run() — react Function Reference
Architecture documentation for the run() function in check-out-packages.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 5756d784_127f_a112_7ef1_78fb912e8890["run()"] a600f235_55ce_0b33_509a_90ea5dd19250["check-out-packages.js"] 5756d784_127f_a112_7ef1_78fb912e8890 -->|defined in| a600f235_55ce_0b33_509a_90ea5dd19250 67142e19_e1ae_3640_63e9_064644a27261["module()"] 67142e19_e1ae_3640_63e9_064644a27261 -->|calls| 5756d784_127f_a112_7ef1_78fb912e8890 style 5756d784_127f_a112_7ef1_78fb912e8890 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/release/prepare-release-from-npm-commands/check-out-packages.js lines 11–53
const run = async ({cwd, local, packages, version}) => {
if (local) {
// Sanity test
if (!existsSync(join(cwd, 'build', 'node_modules', 'react'))) {
console.error(theme.error`No local build exists.`);
process.exit(1);
}
return;
}
if (!existsSync(join(cwd, 'build'))) {
await exec(`mkdir ./build`, {cwd});
}
// Cleanup from previous builds
await exec(`rm -rf ./build/node_modules*`, {cwd});
await exec(`mkdir ./build/node_modules`, {cwd});
const nodeModulesPath = join(cwd, 'build/node_modules');
// Checkout "next" release from NPM for all local packages
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
// We previously used `npm install` for this,
// but in addition to checking out a lot of transient dependencies that we don't care about–
// the NPM client also added a lot of registry metadata to the package JSONs,
// which we had to remove as a separate step before re-publishing.
// It's easier for us to just download and extract the tarball.
const url = await execRead(
`npm view ${packageName}@${version} dist.tarball`
);
const filePath = join(nodeModulesPath, `${packageName}.tgz`);
const packagePath = join(nodeModulesPath, `${packageName}`);
const tempPackagePath = join(nodeModulesPath, 'package');
// Download packages from NPM and extract them to the expected build locations.
await exec(`curl -L ${url} > ${filePath}`, {cwd});
await exec(`tar -xvzf ${filePath} -C ${nodeModulesPath}`, {cwd});
await exec(`mv ${tempPackagePath} ${packagePath}`, {cwd});
await exec(`rm ${filePath}`, {cwd});
}
};
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does run() do?
run() is a function in the react codebase, defined in scripts/release/prepare-release-from-npm-commands/check-out-packages.js.
Where is run() defined?
run() is defined in scripts/release/prepare-release-from-npm-commands/check-out-packages.js at line 11.
What calls run()?
run() is called by 1 function(s): module.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free