Skip to content
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
11 changes: 8 additions & 3 deletions scripts/rollup/build-all-release-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable no-for-of-loops/no-for-of-loops */

const fs = require('fs');
const fse = require('fs-extra');
const {spawnSync} = require('child_process');
const path = require('path');
const tmp = require('tmp');
Expand Down Expand Up @@ -50,13 +51,13 @@ if (process.env.CIRCLE_NODE_TOTAL) {
const stableVersion = '0.0.0-' + sha;
buildForChannel('stable', '', '');
const stableDir = tmp.dirSync().name;
fs.renameSync('./build', stableDir);
crossDeviceRenameSync('./build', stableDir);
processStable(stableDir, stableVersion);

const experimentalVersion = '0.0.0-experimental-' + sha;
buildForChannel('experimental', '', '');
const experimentalDir = tmp.dirSync().name;
fs.renameSync('./build', experimentalDir);
crossDeviceRenameSync('./build', experimentalDir);
processExperimental(experimentalDir, experimentalVersion);

// Then merge the experimental folder into the stable one. processExperimental
Expand All @@ -68,7 +69,7 @@ if (process.env.CIRCLE_NODE_TOTAL) {
// Now restore the combined directory back to its original name
// TODO: Currently storing artifacts as `./build2` so that it doesn't conflict
// with old build job. Remove once we migrate rest of build/test pipeline.
fs.renameSync(stableDir, './build2');
crossDeviceRenameSync(stableDir, './build2');
}

function buildForChannel(channel, nodeTotal, nodeIndex) {
Expand Down Expand Up @@ -139,6 +140,10 @@ function processExperimental(buildDir, version) {
}
}

function crossDeviceRenameSync(source, destination) {
return fse.moveSync(source, destination, {overwrite: true});
}

function updatePackageVersions(modulesDir, version) {
const allReactModuleNames = fs.readdirSync('packages');
for (const moduleName of fs.readdirSync(modulesDir)) {
Expand Down