run() — react Function Reference
Architecture documentation for the run() function in update-stable-version-numbers.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 1ece39de_3cde_ab4d_4c44_21598b74db57["run()"] 1f735809_166e_4fe1_20f1_117a6dd24e62["update-stable-version-numbers.js"] 1ece39de_3cde_ab4d_4c44_21598b74db57 -->|defined in| 1f735809_166e_4fe1_20f1_117a6dd24e62 style 1ece39de_3cde_ab4d_4c44_21598b74db57 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/release/publish-commands/update-stable-version-numbers.js lines 9–50
const run = async ({cwd, packages, skipPackages, tags}) => {
if (!tags.includes('latest')) {
// Don't update version numbers for alphas.
return;
}
const nodeModulesPath = join(cwd, 'build/node_modules');
const packagesPath = join(cwd, 'packages');
// Update package versions and dependencies (in source) to mirror what was published to NPM.
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
const publishedPackageJSON = await readJson(
join(nodeModulesPath, packageName, 'package.json')
);
const sourcePackageJSONPath = join(
packagesPath,
packageName,
'package.json'
);
const sourcePackageJSON = await readJson(sourcePackageJSONPath);
sourcePackageJSON.version = publishedPackageJSON.version;
sourcePackageJSON.dependencies = publishedPackageJSON.dependencies;
sourcePackageJSON.peerDependencies = publishedPackageJSON.peerDependencies;
await writeJson(sourcePackageJSONPath, sourcePackageJSON, {spaces: 2});
}
// Update the shared React version source file.
// (Unless this release does not include an update to React)
if (!skipPackages.includes('react')) {
const sourceReactVersionPath = join(cwd, 'packages/shared/ReactVersion.js');
const {version} = await readJson(
join(nodeModulesPath, 'react', 'package.json')
);
const sourceReactVersion = readFileSync(
sourceReactVersionPath,
'utf8'
).replace(/export default '[^']+';/, `export default '${version}';`);
writeFileSync(sourceReactVersionPath, sourceReactVersion);
}
};
Domain
Subdomains
Source
Frequently Asked Questions
What does run() do?
run() is a function in the react codebase, defined in scripts/release/publish-commands/update-stable-version-numbers.js.
Where is run() defined?
run() is defined in scripts/release/publish-commands/update-stable-version-numbers.js at line 9.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free