@samitouri / QOS-React-2 / commits / 1825990c56

[release] Don't lookup build-info.json when updating version numbers (#32778)

From what we can see, `build-info.json` is a vestigal file that we were previously including in builds but are no longer since 2022 (see https://github.com/facebook/react/pull/23257, which removes `build-info.json` which would have broken scripts/release/build-release-locally-commands/add-build-info-json.js). Since this file is no longer built, instead of looking it up we default to the `version` that was passed in as an argument to scripts/release/prepare-release-from-npm.js. Since `version` is what is pulled from npm, there should only be 1 consistent version for all the packages that are pulled. Therefore, only 1 version (eg canary) needs to be replaced to the new stable version. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32778). * __->__ #32778 * #32777

lauren committed Mar 28, 2025 at 14:35 UTC 1825990c5608f0ab0c1475b4292218a508a171c9
1 file changed -18
scripts/release/prepare-release-from-npm-commands/update-stable-version-numbers.js
-18
@@ -114,20 +114,6 @@ const run = async ({cwd, packages, version, ci}, versionsMap) => {
114 clear();
115
116 if (packages.includes('react')) {
117 - // A separate "React version" is used for the embedded renderer version to support DevTools,
118 - // since it needs to distinguish between different version ranges of React.
119 - // We need to replace it as well as the "next" version number.
120 - const buildInfoPath = join(nodeModulesPath, 'react', 'build-info.json');
121 - const {reactVersion} = await readJson(buildInfoPath);
122 -
123 - if (!reactVersion) {
124 - console.error(
125 - theme`{error Unsupported or invalid build metadata in} {path build/node_modules/react/build-info.json}` +
126 - theme`{error . This could indicate that you have specified an outdated "next" version.}`
127 - );
128 - process.exit(1);
129 - }
130 -
117 // We print the diff to the console for review,
118 // but it can be large so let's also write it to disk.
119 const diffPath = join(cwd, 'build', 'temp.diff');
@@ -152,10 +138,6 @@ const run = async ({cwd, packages, version, ci}, versionsMap) => {
138 while (afterContents.indexOf(version) >= 0) {
139 afterContents = afterContents.replace(version, newStableVersion);
140 }
155 - // Replace inline renderer version numbers (e.g. shared/ReactVersion).
156 - while (afterContents.indexOf(reactVersion) >= 0) {
157 - afterContents = afterContents.replace(reactVersion, newStableVersion);
158 - }
141 if (beforeContents !== afterContents) {
142 numFilesModified++;
143 // Using a relative path for diff helps with the snapshot test