updateVersionsForNext() — react Function Reference
Architecture documentation for the updateVersionsForNext() function in utils.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 48d03b2a_6a28_7bde_c90f_16235ba5b6e0["updateVersionsForNext()"] 9ef9efb0_edfe_575a_20d0_9f1277d0f69a["utils.js"] 48d03b2a_6a28_7bde_c90f_16235ba5b6e0 -->|defined in| 9ef9efb0_edfe_575a_20d0_9f1277d0f69a ec6c56c1_6dd5_95fc_9524_0690c804875e["getBuildInfo()"] ec6c56c1_6dd5_95fc_9524_0690c804875e -->|calls| 48d03b2a_6a28_7bde_c90f_16235ba5b6e0 a621eb34_e4d3_7bf6_e1c7_dd88f80ecc99["getPublicPackages()"] 48d03b2a_6a28_7bde_c90f_16235ba5b6e0 -->|calls| a621eb34_e4d3_7bf6_e1c7_dd88f80ecc99 style 48d03b2a_6a28_7bde_c90f_16235ba5b6e0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/release/utils.js lines 207–256
const updateVersionsForNext = async (cwd, reactVersion, version) => {
const isExperimental = reactVersion.includes('experimental');
const packages = getPublicPackages(isExperimental);
const packagesDir = join(cwd, 'packages');
// Update the shared React version source file.
// This is bundled into built renderers.
// The promote script will replace this with a final version later.
const sourceReactVersionPath = join(cwd, 'packages/shared/ReactVersion.js');
const sourceReactVersion = readFileSync(
sourceReactVersionPath,
'utf8'
).replace(/export default '[^']+';/, `export default '${reactVersion}';`);
writeFileSync(sourceReactVersionPath, sourceReactVersion);
// Update the root package.json.
// This is required to pass a later version check script.
{
const packageJSONPath = join(cwd, 'package.json');
const packageJSON = await readJson(packageJSONPath);
packageJSON.version = version;
await writeJson(packageJSONPath, packageJSON, {spaces: 2});
}
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
const packagePath = join(packagesDir, packageName);
// Update version numbers in package JSONs
const packageJSONPath = join(packagePath, 'package.json');
const packageJSON = await readJson(packageJSONPath);
packageJSON.version = version;
// Also update inter-package dependencies.
// Next releases always have exact version matches.
// The promote script may later relax these (e.g. "^x.x.x") based on source package JSONs.
const {dependencies, peerDependencies} = packageJSON;
for (let j = 0; j < packages.length; j++) {
const dependencyName = packages[j];
if (dependencies && dependencies[dependencyName]) {
dependencies[dependencyName] = version;
}
if (peerDependencies && peerDependencies[dependencyName]) {
peerDependencies[dependencyName] = version;
}
}
await writeJson(packageJSONPath, packageJSON, {spaces: 2});
}
};
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does updateVersionsForNext() do?
updateVersionsForNext() is a function in the react codebase, defined in scripts/release/utils.js.
Where is updateVersionsForNext() defined?
updateVersionsForNext() is defined in scripts/release/utils.js at line 207.
What does updateVersionsForNext() call?
updateVersionsForNext() calls 1 function(s): getPublicPackages.
What calls updateVersionsForNext()?
updateVersionsForNext() is called by 1 function(s): getBuildInfo.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free