@samitouri / QOS-React-2 / commits / bb1e3d0e19

Fail yarn build if any bundle fails to build (#26207)

## Summary `yarn build` would previously still exit with zero exit code hiding build errors such as https://app.circleci.com/pipelines/github/facebook/react/38609/workflows/62a73635-3bf3-4264-8c48-a61844a27764/jobs/630503/parallel-runs/11?filterBy=ALL&invite=true#step-105-17. These issues are still surfaced due to missing size bot artifacts but the overall PR status would still be green which we don't want. Now we just exit with the same exit has a the process of a single build if it's non-zero. ## How did you test this change? - [x] fails based on the parent of 62e6c4612ec704cf07c99b318bc8f26d3ec3f588: https://app.circleci.com/pipelines/github/facebook/react/38681/workflows/654c68ed-cebc-48d4-a156-bac719772f6f/jobs/632166 - [x] passes based on `main`

Sebastian Silbermann committed Feb 20, 2023 at 21:59 UTC bb1e3d0e19f1e36ecb5b9e58d40bbf59fa220b73
1 file changed +18 -9
scripts/rollup/build-all-release-channels.js
+18 -9
@@ -93,15 +93,24 @@ if (process.env.CIRCLE_NODE_TOTAL) {
93 }
94
95 function buildForChannel(channel, nodeTotal, nodeIndex) {
96 - spawnSync('node', ['./scripts/rollup/build.js', ...process.argv.slice(2)], {
97 - stdio: ['pipe', process.stdout, process.stderr],
98 - env: {
99 - ...process.env,
100 - RELEASE_CHANNEL: channel,
101 - CIRCLE_NODE_TOTAL: nodeTotal,
102 - CIRCLE_NODE_INDEX: nodeIndex,
103 - },
104 - });
96 + const {status} = spawnSync(
97 + 'node',
98 + ['./scripts/rollup/build.js', ...process.argv.slice(2)],
99 + {
100 + stdio: ['pipe', process.stdout, process.stderr],
101 + env: {
102 + ...process.env,
103 + RELEASE_CHANNEL: channel,
104 + CIRCLE_NODE_TOTAL: nodeTotal,
105 + CIRCLE_NODE_INDEX: nodeIndex,
106 + },
107 + }
108 + );
109 +
110 + if (status !== 0) {
111 + // Error of spawned process is already piped to this stderr
112 + process.exit(status);
113 + }
114 }
115
116 function processStable(buildDir) {