Skip to content

Commit 36df5e8

Browse files
authored
[release] Allow building single release channel with processed versions (#35270)
1 parent 09f0569 commit 36df5e8

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"scripts": {
124124
"prebuild": "./scripts/react-compiler/link-compiler.sh",
125125
"build": "node ./scripts/rollup/build-all-release-channels.js",
126-
"build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react/compiler-runtime,react-dom/index,react-dom/client,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE",
126+
"build-for-devtools": "cross-env yarn build react/index,react/jsx,react/compiler-runtime,react-dom/index,react-dom/client,react-dom/unstable_testing,react-dom/test-utils,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE --release-channel=experimental",
127127
"build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV",
128128
"build-for-devtools-prod": "yarn build-for-devtools --type=NODE_PROD",
129129
"build-for-flight-dev": "cross-env RELEASE_CHANNEL=experimental node ./scripts/rollup/build.js react/index,react/jsx,react.react-server,react-dom/index,react-dom/client,react-dom/server,react-dom.react-server,react-dom-server.node,react-dom-server-legacy.node,scheduler,react-server-dom-webpack/ --type=NODE_DEV,ESM_PROD,NODE_ES2015 && mv ./build/node_modules ./build/oss-experimental",

scripts/rollup/build-all-release-channels.js

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,34 @@ async function main() {
124124
throw new Error(`Unknown release channel ${argv.releaseChannel}`);
125125
}
126126
} else {
127-
// Running locally, no concurrency. Move each channel's build artifacts into
128-
// a temporary directory so that they don't conflict.
129-
buildForChannel('stable', '', '');
130-
const stableDir = tmp.dirSync().name;
131-
crossDeviceRenameSync('./build', stableDir);
132-
processStable(stableDir);
133-
buildForChannel('experimental', '', '');
134-
const experimentalDir = tmp.dirSync().name;
135-
crossDeviceRenameSync('./build', experimentalDir);
136-
processExperimental(experimentalDir);
137-
138-
// Then merge the experimental folder into the stable one. processExperimental
139-
// will have already removed conflicting files.
140-
//
141-
// In CI, merging is handled by the GitHub Download Artifacts plugin.
142-
mergeDirsSync(experimentalDir + '/', stableDir + '/');
143-
144-
// Now restore the combined directory back to its original name
145-
crossDeviceRenameSync(stableDir, './build');
127+
const releaseChannel = argv.releaseChannel;
128+
if (releaseChannel === 'stable') {
129+
buildForChannel('stable', '', '');
130+
processStable('./build');
131+
} else if (releaseChannel === 'experimental') {
132+
buildForChannel('experimental', '', '');
133+
processExperimental('./build');
134+
} else {
135+
// Running locally, no concurrency. Move each channel's build artifacts into
136+
// a temporary directory so that they don't conflict.
137+
buildForChannel('stable', '', '');
138+
const stableDir = tmp.dirSync().name;
139+
crossDeviceRenameSync('./build', stableDir);
140+
processStable(stableDir);
141+
buildForChannel('experimental', '', '');
142+
const experimentalDir = tmp.dirSync().name;
143+
crossDeviceRenameSync('./build', experimentalDir);
144+
processExperimental(experimentalDir);
145+
146+
// Then merge the experimental folder into the stable one. processExperimental
147+
// will have already removed conflicting files.
148+
//
149+
// In CI, merging is handled by the GitHub Download Artifacts plugin.
150+
mergeDirsSync(experimentalDir + '/', stableDir + '/');
151+
152+
// Now restore the combined directory back to its original name
153+
crossDeviceRenameSync(stableDir, './build');
154+
}
146155
}
147156
}
148157

0 commit comments

Comments
 (0)