Skip to content

Commit

Permalink
misc(build): set correct exit code when build scripts fail (#13459)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Jan 11, 2022
1 parent 28176dd commit ccbe8fc
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 13 deletions.
7 changes: 5 additions & 2 deletions build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,15 @@ async function cli(argv) {
// Take paths relative to cwd and build.
const [entryPath, distPath] = argv.slice(2)
.map(filePath => path.resolve(process.cwd(), filePath));
build(entryPath, distPath);
await build(entryPath, distPath);
}

// Test if called from the CLI or as a module.
if (require.main === module) {
cli(process.argv);
cli(process.argv).catch(err => {
console.error(err);
process.exit(1);
});
} else {
module.exports = {
/** The commit hash for the current HEAD. */
Expand Down
5 changes: 4 additions & 1 deletion build/build-dt-report-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ async function buildReportGenerator() {
await bundle.close();
}

buildReportGenerator();
buildReportGenerator().catch(err => {
console.error(err);
process.exit(1);
});
5 changes: 4 additions & 1 deletion build/build-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,7 @@ async function run() {
await packageExtension();
}

run();
run().catch(err => {
console.error(err);
process.exit(1);
});
5 changes: 4 additions & 1 deletion build/build-lightrider-bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,7 @@ async function run() {
]);
}

run();
run().catch(err => {
console.error(err);
process.exit(1);
});
5 changes: 4 additions & 1 deletion build/build-report-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ async function main() {
}

if (require.main === module) {
main();
main().catch(err => {
console.error(err);
process.exit(1);
});
}

module.exports = {normalizeTextNodeText};
5 changes: 4 additions & 1 deletion build/build-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ async function main() {
}

if (require.main === module) {
main();
main().catch(err => {
console.error(err);
process.exit(1);
});
}

module.exports = {
Expand Down
5 changes: 4 additions & 1 deletion build/build-smokehouse-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ async function build() {
await bundle.close();
}

build();
build().catch(err => {
console.error(err);
process.exit(1);
});
5 changes: 4 additions & 1 deletion build/build-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ async function run() {
}
}

run();
run().catch(err => {
console.error(err);
process.exit(1);
});
1 change: 0 additions & 1 deletion lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ function getShardedDefinitions(testDefns, shardArg) {
return shardDefns;
}


export {
runSmokehouse,
getShardedDefinitions,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"prepack": "yarn build-report --standalone --flow --esm",
"build-all": "npm-run-posix-or-windows build-all:task",
"build-all:task": "yarn build-report && yarn build-cdt-lib && yarn build-devtools && (yarn build-extension & yarn build-lr & yarn build-viewer & yarn build-treemap & yarn build-smokehouse-bundle & wait) && yarn build-pack",
"build-all:task": "yarn build-report && yarn build-cdt-lib && yarn build-devtools && concurrently 'yarn build-extension' 'yarn build-lr' 'yarn build-viewer' 'yarn build-treemap' 'yarn build-smokehouse-bundle' && yarn build-pack",
"build-all:task:windows": "yarn build-report && yarn build-cdt-lib && yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer && yarn build-treemap && yarn build-smokehouse-bundle",
"build-cdt-lib": "node ./build/build-cdt-lib.js",
"build-extension": "yarn build-extension-chrome && yarn build-extension-firefox",
Expand Down Expand Up @@ -137,6 +137,7 @@
"c8": "^7.4.0",
"chalk": "^2.4.1",
"chrome-devtools-frontend": "1.0.922924",
"concurrently": "^6.4.0",
"conventional-changelog-cli": "^2.1.1",
"cpy": "^8.1.2",
"cross-env": "^7.0.2",
Expand Down
45 changes: 43 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,20 @@ [email protected]:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=

concurrently@^6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-6.4.0.tgz#5387ee86be435a0eb51c292ade8a00acf479f170"
integrity sha512-HZ3D0RTQMH3oS4gvtYj1P+NBc6PzE2McEra6yEFcQKrUQ9HvtTGU4Dbne083F034p+LRb7kWU0tPRNvSGs1UCQ==
dependencies:
chalk "^4.1.0"
date-fns "^2.16.1"
lodash "^4.17.21"
rxjs "^6.6.3"
spawn-command "^0.0.2-1"
supports-color "^8.1.0"
tree-kill "^1.2.2"
yargs "^16.2.0"

configstore@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-5.0.1.tgz#d365021b5df4b98cdd187d6a3b0e3f6a7cc5ed96"
Expand Down Expand Up @@ -3082,6 +3096,11 @@ data-urls@^2.0.0:
whatwg-mimetype "^2.3.0"
whatwg-url "^8.0.0"

date-fns@^2.16.1:
version "2.27.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.27.0.tgz#e1ff3c3ddbbab8a2eaadbb6106be2929a5a2d92b"
integrity sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q==

dateformat@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
Expand Down Expand Up @@ -5882,7 +5901,7 @@ lodash.union@^4.6.0:
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
integrity sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=

[email protected], lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.7.0:
[email protected], lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.3, lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -7199,6 +7218,13 @@ run-parallel@^1.1.9:
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.10.tgz#60a51b2ae836636c81377df16cb107351bcd13ef"
integrity sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==

rxjs@^6.6.3:
version "6.6.7"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9"
integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==
dependencies:
tslib "^1.9.0"

safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
Expand Down Expand Up @@ -7446,6 +7472,11 @@ sourcemap-codec@^1.4.4:
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==

spawn-command@^0.0.2-1:
version "0.0.2-1"
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=

spdx-correct@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
Expand Down Expand Up @@ -7672,7 +7703,7 @@ supports-color@^7.0.0, supports-color@^7.1.0:
dependencies:
has-flag "^4.0.0"

supports-color@^8.0.0:
supports-color@^8.0.0, supports-color@^8.1.0:
version "8.1.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
Expand Down Expand Up @@ -7919,6 +7950,11 @@ tr46@^2.0.2:
dependencies:
punycode "^2.1.1"

tree-kill@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==

trim-newlines@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
Expand Down Expand Up @@ -7962,6 +7998,11 @@ tslib@^1.8.1:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==

tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
Expand Down

0 comments on commit ccbe8fc

Please sign in to comment.