From 619d4051eef66603939602da52cf5dd90db0ba88 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 11 Nov 2025 13:26:51 +0000 Subject: [PATCH 1/3] Revert "[LOCAL] Fix prettier" This reverts commit 5efc57afc11c5156aeee56e5d4ab44671c3ef10e. --- scripts/releases-ci/__tests__/publish-npm-test.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/releases-ci/__tests__/publish-npm-test.js b/scripts/releases-ci/__tests__/publish-npm-test.js index de3fe26b25b8..99b014df2853 100644 --- a/scripts/releases-ci/__tests__/publish-npm-test.js +++ b/scripts/releases-ci/__tests__/publish-npm-test.js @@ -176,10 +176,7 @@ describe('publish-npm', () => { expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled(); expect(setVersionMock).not.toBeCalled(); - expect(updateReactNativeArtifactsMock).toBeCalledWith( - version, - 'dry-run', - ); + expect(updateReactNativeArtifactsMock).toBeCalledWith(version, 'dry-run'); // Generate Android artifacts is now delegate to build_android entirely expect(generateAndroidArtifactsMock).not.toHaveBeenCalled(); From 5fa907fa5e3d9ad797907d8611e01fcb33722db3 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 11 Nov 2025 13:27:00 +0000 Subject: [PATCH 2/3] Revert "[LOCAL] Force the right version on Artifacts when testing" This reverts commit 042403fdffe8c03e52353840002c8e7c5ac35d51. --- scripts/releases-ci/__tests__/publish-npm-test.js | 2 +- scripts/releases-ci/publish-npm.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/releases-ci/__tests__/publish-npm-test.js b/scripts/releases-ci/__tests__/publish-npm-test.js index 99b014df2853..f2568c130793 100644 --- a/scripts/releases-ci/__tests__/publish-npm-test.js +++ b/scripts/releases-ci/__tests__/publish-npm-test.js @@ -176,7 +176,7 @@ describe('publish-npm', () => { expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled(); expect(setVersionMock).not.toBeCalled(); - expect(updateReactNativeArtifactsMock).toBeCalledWith(version, 'dry-run'); + expect(updateReactNativeArtifactsMock).not.toBeCalled(); // Generate Android artifacts is now delegate to build_android entirely expect(generateAndroidArtifactsMock).not.toHaveBeenCalled(); diff --git a/scripts/releases-ci/publish-npm.js b/scripts/releases-ci/publish-npm.js index 8d9151ee1204..0986ee21feec 100755 --- a/scripts/releases-ci/publish-npm.js +++ b/scripts/releases-ci/publish-npm.js @@ -117,8 +117,6 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise */ { await updateHermesVersionsToNightly(); } await updateReactNativeArtifacts(version, buildType); - } else { - await updateReactNativeArtifacts(projectInfo.version, buildType); } } From 636e3224d4c2b14c83189b9e9bea3fedf5aa5e07 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 11 Nov 2025 13:30:36 +0000 Subject: [PATCH 3/3] [RN] Fix build for 0.83-RC.1 --- scripts/releases-ci/__tests__/publish-npm-test.js | 6 ++++-- scripts/releases-ci/publish-npm.js | 10 ++++------ scripts/shared/monorepoUtils.js | 13 ++++++++++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/releases-ci/__tests__/publish-npm-test.js b/scripts/releases-ci/__tests__/publish-npm-test.js index f2568c130793..0eeb9a3489b8 100644 --- a/scripts/releases-ci/__tests__/publish-npm-test.js +++ b/scripts/releases-ci/__tests__/publish-npm-test.js @@ -96,7 +96,9 @@ describe('publish-npm', () => { beforeEach(() => { jest.mock('../../shared/monorepoUtils', () => ({ ...jest.requireActual('../../shared/monorepoUtils'), - getWorkspaceRoot: jest.fn().mockResolvedValue({version: '1000.0.0'}), + getReactNativePackage: jest + .fn() + .mockResolvedValue({version: '1000.0.0'}), })); }); @@ -167,7 +169,7 @@ describe('publish-npm', () => { getBranchName.mockReturnValueOnce('0.83-stable'); jest.mock('../../shared/monorepoUtils', () => ({ ...jest.requireActual('../../shared/monorepoUtils'), - getWorkspaceRoot: jest + getReactNativePackage: jest .fn() .mockResolvedValue({version: '0.83.0-rc.0'}), })); diff --git a/scripts/releases-ci/publish-npm.js b/scripts/releases-ci/publish-npm.js index 0986ee21feec..291f50b51117 100755 --- a/scripts/releases-ci/publish-npm.js +++ b/scripts/releases-ci/publish-npm.js @@ -27,9 +27,8 @@ const { publishExternalArtifactsToMaven, } = require('../releases/utils/release-utils'); const {getBranchName} = require('../releases/utils/scm-utils'); -const {REPO_ROOT} = require('../shared/consts'); -const {getPackages, getWorkspaceRoot} = require('../shared/monorepoUtils'); -const path = require('path'); +const {REACT_NATIVE_PACKAGE_DIR} = require('../shared/consts'); +const {getPackages, getReactNativePackage} = require('../shared/monorepoUtils'); const yargs = require('yargs'); /** @@ -109,7 +108,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise */ { // Before updating React Native artifacts versions for dry-run, we check if the version has already been set. // If it has, we don't need to update the artifacts at all (at this will revert them back to 1000.0.0) // If it hasn't, we can update the native artifacts accordingly. - const projectInfo = await getWorkspaceRoot(); + const projectInfo = await getReactNativePackage(); if (projectInfo.version === '1000.0.0') { // Set hermes versions to latest available if not on a stable branch @@ -134,8 +133,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise */ { // NPM publishing is done just after. publishExternalArtifactsToMaven(version, buildType); - const packagePath = path.join(REPO_ROOT, 'packages', 'react-native'); - const result = publishPackage(packagePath, { + const result = publishPackage(REACT_NATIVE_PACKAGE_DIR, { tags: [tag], }); diff --git a/scripts/shared/monorepoUtils.js b/scripts/shared/monorepoUtils.js index 4205ffd8b2f5..f0278a8c8fe3 100644 --- a/scripts/shared/monorepoUtils.js +++ b/scripts/shared/monorepoUtils.js @@ -8,7 +8,7 @@ * @format */ -const {REPO_ROOT} = require('./consts'); +const {REACT_NATIVE_PACKAGE_DIR, REPO_ROOT} = require('./consts'); const {promises: fs} = require('fs'); const glob = require('glob'); const path = require('path'); @@ -89,6 +89,16 @@ async function getWorkspaceRoot() /*: Promise */ { return packageInfo; } +/** + * Get the parsed package metadata for the main react-native package. + */ +async function getReactNativePackage() /*: Promise */ { + const [, packageInfo] = await parsePackageInfo( + path.join(REACT_NATIVE_PACKAGE_DIR, 'package.json'), + ); + return packageInfo; +} + async function parsePackageInfo( packageJsonPath /*: string */, ) /*: Promise<[string, PackageInfo]> */ { @@ -158,4 +168,5 @@ module.exports = { getPackages, getWorkspaceRoot, updatePackageJson, + getReactNativePackage, };