downloadRegressionBuild() — react Function Reference
Architecture documentation for the downloadRegressionBuild() function in download_devtools_regression_build.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 745bf39c_336e_302b_1f6a_ab9b1d96fef7["downloadRegressionBuild()"] e111b43e_c038_4a6e_9038_384d8b141189["download_devtools_regression_build.js"] 745bf39c_336e_302b_1f6a_ab9b1d96fef7 -->|defined in| e111b43e_c038_4a6e_9038_384d8b141189 33138783_7a91_c871_c21f_c71c2f28c07b["main()"] 33138783_7a91_c871_c21f_c71c2f28c07b -->|calls| 745bf39c_336e_302b_1f6a_ab9b1d96fef7 style 745bf39c_336e_302b_1f6a_ab9b1d96fef7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/ci/download_devtools_regression_build.js lines 24–133
async function downloadRegressionBuild() {
const reactVersion = semver.coerce(version).version;
const installPackages = ['react-dom', 'react', 'react-test-renderer'];
if (semver.gte(reactVersion, '16.3.0')) {
installPackages.push('react-is');
}
console.log(chalk.bold.white(`Downloading React v${version}\n`));
// Make build directory for temporary modules we're going to download
// from NPM
console.log(
chalk.white(
`Make Build directory at ${chalk.underline.blue(regressionBuildPath)}\n`
)
);
await exec(`mkdir ${regressionBuildPath}`);
// Install all necessary React packages that have the same version
const downloadPackagesStr = installPackages.reduce(
(str, name) => `${str} ${name}@${version}`,
''
);
await exec(
`npm install --prefix ${REGRESSION_FOLDER} ${downloadPackagesStr}`
);
// If we shouldn't replace the build folder, we can stop here now
// before we modify anything
if (!shouldReplaceBuild) {
return;
}
// Remove all the packages that we downloaded in the original build folder
// so we can move the modules from the regression build over
const removePackagesStr = installPackages.reduce(
(str, name) => `${str} ${join(buildPath, name)}`,
''
);
console.log(
chalk.white(
`Removing ${removePackagesStr
.split(' ')
.map(str => chalk.underline.blue(str) + '\n')
.join(' ')}\n`
)
);
await exec(`rm -rf ${removePackagesStr}`);
// Move all packages that we downloaded to the original build folder
// We need to separately move the scheduler package because it might
// be called schedule
const movePackageString = installPackages.reduce(
(str, name) => `${str} ${join(regressionBuildPath, 'node_modules', name)}`,
''
);
console.log(
chalk.white(
`Moving ${movePackageString
.split(' ')
.map(str => chalk.underline.blue(str) + '\n')
.join(' ')} to ${chalk.underline.blue(buildPath)}\n`
)
);
fs.mkdirSync(buildPath, {recursive: true});
await exec(`mv ${movePackageString} ${buildPath}`);
// For React versions earlier than 18.0.0, we explicitly scheduler v0.20.1, which
// is the first version that has unstable_mock, which DevTools tests need, but also
// has Scheduler.unstable_trace, which, although we don't use in DevTools tests
// is imported by older React versions and will break if it's not there
if (semver.lte(reactVersion, '18.0.0')) {
await exec(`npm install --prefix ${REGRESSION_FOLDER} scheduler@0.20.1`);
}
// In v16.5, scheduler is called schedule. We need to make sure we also move
// this over. Otherwise the code will break.
if (fs.existsSync(join(regressionBuildPath, 'node_modules', 'schedule'))) {
console.log(chalk.white(`Downloading schedule\n`));
await exec(
`mv ${join(regressionBuildPath, 'node_modules', 'schedule')} ${buildPath}`
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does downloadRegressionBuild() do?
downloadRegressionBuild() is a function in the react codebase, defined in scripts/ci/download_devtools_regression_build.js.
Where is downloadRegressionBuild() defined?
downloadRegressionBuild() is defined in scripts/ci/download_devtools_regression_build.js at line 24.
What calls downloadRegressionBuild()?
downloadRegressionBuild() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free