Skip to content

Commit

Permalink
build:package-types: Run silently to reduce user confusion (#61530)
Browse files Browse the repository at this point in the history
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:

> [email protected] build:packages
> npm run build:package-types && node ./bin/packages/build.js

> [email protected] build:package-types
> npm run --silent build:package-types:verbose
  • Loading branch information
mcsf authored May 9, 2024
1 parent 78e53bb commit 8ddf0bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)\"",
Expand Down

0 comments on commit 8ddf0bb

Please sign in to comment.