update-stable-version-numbers.js — react Source File
Architecture documentation for update-stable-version-numbers.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
#!/usr/bin/env node
'use strict';
const {readFileSync, writeFileSync} = require('fs');
const {readJson, writeJson} = require('fs-extra');
const {join} = require('path');
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);
}
};
module.exports = run;
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does update-stable-version-numbers.js do?
update-stable-version-numbers.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in update-stable-version-numbers.js?
update-stable-version-numbers.js defines 1 function(s): run.
Where is update-stable-version-numbers.js in the architecture?
update-stable-version-numbers.js is located at scripts/release/publish-commands/update-stable-version-numbers.js (domain: BabelCompiler, subdomain: Entrypoint, directory: scripts/release/publish-commands).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free