Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(build): Ensure experimental builds exists on windows #20933

Merged
merged 2 commits into from
Mar 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion scripts/rollup/build-all-release-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (process.env.CIRCLE_NODE_TOTAL) {
// will have already removed conflicting files.
//
// In CI, merging is handled automatically by CircleCI's workspace feature.
spawnSync('rsync', ['-ar', experimentalDir + '/', stableDir + '/']);
mergeDirsSync(experimentalDir + '/', stableDir + '/');

// Now restore the combined directory back to its original name
// TODO: Currently storing artifacts as `./build2` so that it doesn't conflict
Expand Down Expand Up @@ -186,3 +186,23 @@ function updateTheReactVersionThatDevToolsReads(version) {
`export default '${version}';\n`
);
}

/**
* cross-platform alternative to `rsync -ar`
* @param {string} source
* @param {string} destination
*/
function mergeDirsSync(source, destination) {
for (const sourceFileBaseName of fs.readdirSync(source)) {
const sourceFileName = path.join(source, sourceFileBaseName);
const targetFileName = path.join(destination, sourceFileBaseName);

const sourceFile = fs.statSync(sourceFileName);
if (sourceFile.isDirectory()) {
fse.ensureDirSync(targetFileName);
mergeDirsSync(sourceFileName, targetFileName);
} else {
fs.copyFileSync(sourceFileName, targetFileName);
}
}
}