Skip to content

Commit bd1a9f4

Browse files
committed
modified download_devtools_regression_build
1 parent 05c34de commit bd1a9f4

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ jobs:
238238
- run:
239239
name: Install nested packages from Yarn cache
240240
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
241-
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >>
241+
- run: ./scripts/circleci/download_devtools_regression_build.js << parameters.version >> --replaceBuild
242242
- run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion << parameters.version >> --ci
243243

244244
yarn_lint_build:

scripts/circleci/download_devtools_regression_build.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const {exec} = require('child-process-promise');
66
const chalk = require('chalk');
77
const {join} = require('path');
88
const semver = require('semver');
9+
const yargs = require('yargs');
910
const fs = require('fs');
1011

1112
const INSTALL_PACKAGES = ['react-dom', 'react', 'react-test-renderer'];
@@ -16,7 +17,10 @@ const ROOT_PATH = join(__dirname, '..', '..');
1617
const buildPath = join(ROOT_PATH, `build`, 'oss-experimental');
1718
const regressionBuildPath = join(ROOT_PATH, REGRESSION_FOLDER);
1819

20+
const argv = yargs(process.argv.slice(2)).argv;
21+
1922
const version = process.argv[2];
23+
const shouldReplaceBuild = !!argv.replaceBuild;
2024

2125
async function downloadRegressionBuild() {
2226
console.log(chalk.bold.white(`Downloading React v${version}\n`));
@@ -39,6 +43,12 @@ async function downloadRegressionBuild() {
3943
`npm install --prefix ${REGRESSION_FOLDER} ${downloadPackagesStr}`
4044
);
4145

46+
// If we shouldn't replace the build folder, we can stop here now
47+
// before we modify anything
48+
if (!shouldReplaceBuild) {
49+
return;
50+
}
51+
4252
// Remove all the packages that we downloaded in the original build folder
4353
// so we can move the modules from the regression build over
4454
const removePackagesStr = INSTALL_PACKAGES.reduce(
@@ -102,12 +112,20 @@ async function downloadRegressionBuild() {
102112

103113
async function main() {
104114
try {
115+
if (!version) {
116+
console.log(chalk.red('Must specify React version to download'));
117+
return;
118+
}
105119
await downloadRegressionBuild();
106120
} catch (e) {
107121
console.log(chalk.red(e));
108122
} finally {
109-
console.log(chalk.bold.white(`Removing regression build`));
110-
await exec(`rm -r ${regressionBuildPath}`);
123+
// We shouldn't remove the regression-build folder unless we're using
124+
// it to replace the build folder
125+
if (shouldReplaceBuild) {
126+
console.log(chalk.bold.white(`Removing regression build`));
127+
await exec(`rm -r ${regressionBuildPath}`);
128+
}
111129
}
112130
}
113131

0 commit comments

Comments
 (0)