From 8ddf0bb828bb00abf4ae0ac729d80fb8ae3e2679 Mon Sep 17 00:00:00 2001 From: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Date: Thu, 9 May 2024 16:33:40 +0100 Subject: [PATCH] build:package-types: Run silently to reduce user confusion (#61530) Follows up on #61501. The original PR, #61501, modified the `build:package-types` script to log a help message to developers if the `tsc --build` call failed. This message suggested a fix (to run `npm run clean:package-types`). This works, but due to the way that NPM logs the execution of successive NPM scripts, the code that conditionally outputs the help message is, itself, always output. This is not only noisy, but could mislead developers into following the help message's instruction unnecessarily. This commit fixes the problem by wrapping the original NPM script in a new script, which is then called with NPM's `--silent` flag. The console output now looks like this: > gutenberg@18.3.0 build:packages > npm run build:package-types && node ./bin/packages/build.js > gutenberg@18.3.0 build:package-types > npm run --silent build:package-types:verbose --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c7dc70cfee56d..36fbcbec290320 100644 --- a/package.json +++ b/package.json @@ -270,7 +270,7 @@ "build:analyze-bundles": "npm run build -- --webpack-bundle-analyzer", "build:package-types": "node ./bin/packages/validate-typescript-version.js && ( tsc --build || ( echo 'tsc failed. Try cleaning up first: `npm run clean:package-types`'; exit 1 ) ) && node ./bin/packages/check-build-type-declaration-files.js", "prebuild:packages": "npm run clean:packages && lerna run build", - "build:packages": "npm run build:package-types && node ./bin/packages/build.js", + "build:packages": "npm run --silent build:package-types && node ./bin/packages/build.js", "build:plugin-zip": "bash ./bin/build-plugin-zip.sh", "clean:package-types": "tsc --build --clean", "clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",