From 041b6d5f9e67675d402583529d6f0199435f1d34 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 11 May 2026 12:55:12 -0700 Subject: [PATCH] Rename 'nightly' functions to 'prebuilt' in release scripts (#56753) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56753 The functions getLatestHermesNightlyVersion() and updateHermesVersionsToNightly() were misleadingly named: they actually fetch from the 'latest-v1' npm dist-tag, not a 'nightly' tag. Rename them to better reflect what they do: - getLatestHermesNightlyVersion -> getLatestHermesVersion - updateHermesVersionsToNightly -> updateHermesVersionsToPrebuilt Update all call sites in publish-npm.js and publish-npm-test.js. ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D104649629 fbshipit-source-id: b1d60b9bb48ef51946e99877a73d5760db585a4c --- scripts/releases-ci/__tests__/publish-npm-test.js | 12 ++++++------ scripts/releases-ci/publish-npm.js | 6 +++--- scripts/releases/use-hermes-nightly.js | 6 +++--- scripts/releases/utils/hermes-utils.js | 9 +++++---- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/releases-ci/__tests__/publish-npm-test.js b/scripts/releases-ci/__tests__/publish-npm-test.js index 0eeb9a3489b..c06a96e0fba 100644 --- a/scripts/releases-ci/__tests__/publish-npm-test.js +++ b/scripts/releases-ci/__tests__/publish-npm-test.js @@ -20,7 +20,7 @@ const publishPackageMock = jest.fn(); const getNpmInfoMock = jest.fn(); const generateAndroidArtifactsMock = jest.fn(); const getPackagesMock = jest.fn(); -const updateHermesVersionsToNightlyMock = jest.fn(); +const updateHermesVersionsToPrebuiltMock = jest.fn(); const getBranchName = jest.fn(); const {REPO_ROOT} = require('../../shared/consts'); @@ -58,7 +58,7 @@ describe('publish-npm', () => { getNpmInfo: getNpmInfoMock, })) .mock('../../releases/utils/hermes-utils', () => ({ - updateHermesVersionsToNightly: updateHermesVersionsToNightlyMock, + updateHermesVersionsToPrebuilt: updateHermesVersionsToPrebuiltMock, })); }); @@ -112,7 +112,7 @@ describe('publish-npm', () => { await publishNpm('dry-run'); - expect(updateHermesVersionsToNightlyMock).toHaveBeenCalled(); + expect(updateHermesVersionsToPrebuiltMock).toHaveBeenCalled(); expect(setVersionMock).not.toBeCalled(); expect(updateReactNativeArtifactsMock).toBeCalledWith(version, 'dry-run'); @@ -140,7 +140,7 @@ describe('publish-npm', () => { await publishNpm('dry-run'); - expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled(); + expect(updateHermesVersionsToPrebuiltMock).not.toHaveBeenCalled(); expect(setVersionMock).not.toBeCalled(); expect(updateReactNativeArtifactsMock).toBeCalledWith( version, @@ -176,7 +176,7 @@ describe('publish-npm', () => { await publishNpm('dry-run'); - expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled(); + expect(updateHermesVersionsToPrebuiltMock).not.toHaveBeenCalled(); expect(setVersionMock).not.toBeCalled(); expect(updateReactNativeArtifactsMock).not.toBeCalled(); @@ -235,7 +235,7 @@ describe('publish-npm', () => { // Generate Android artifacts is now delegate to build_android entirely expect(generateAndroidArtifactsMock).not.toHaveBeenCalled(); - expect(updateHermesVersionsToNightlyMock).toHaveBeenCalled(); + expect(updateHermesVersionsToPrebuiltMock).toHaveBeenCalled(); expect(publishPackageMock.mock.calls).toEqual([ [ diff --git a/scripts/releases-ci/publish-npm.js b/scripts/releases-ci/publish-npm.js index 93cc4d17826..d8fb7ecd700 100755 --- a/scripts/releases-ci/publish-npm.js +++ b/scripts/releases-ci/publish-npm.js @@ -19,7 +19,7 @@ const { } = require('../releases/set-rn-artifacts-version'); const {setVersion} = require('../releases/set-version'); const { - updateHermesVersionsToNightly, + updateHermesVersionsToPrebuilt, } = require('../releases/utils/hermes-utils'); const {getNpmInfo, publishPackage} = require('../releases/utils/npm-utils'); const { @@ -99,7 +99,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise */ { // For stable releases, ci job `prepare_package_for_release` handles this if (buildType === 'nightly') { // Set hermes versions to latest available - await updateHermesVersionsToNightly(); + await updateHermesVersionsToPrebuilt(); // Set same version for all monorepo packages await setVersion(version); @@ -113,7 +113,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise */ { if (projectInfo.version === '1000.0.0') { // Set hermes versions to latest available if not on a stable branch if (!/.*-stable/.test(getBranchName())) { - await updateHermesVersionsToNightly(); + await updateHermesVersionsToPrebuilt(); } await updateReactNativeArtifacts(version, buildType); diff --git a/scripts/releases/use-hermes-nightly.js b/scripts/releases/use-hermes-nightly.js index 24cad539552..be08ebbed14 100644 --- a/scripts/releases/use-hermes-nightly.js +++ b/scripts/releases/use-hermes-nightly.js @@ -11,7 +11,7 @@ 'use strict'; const {getReactNativePackage} = require('../shared/monorepoUtils'); -const {updateHermesVersionsToNightly} = require('./utils/hermes-utils'); +const {updateHermesVersionsToPrebuilt} = require('./utils/hermes-utils'); async function main() { const {packageJson} = await getReactNativePackage(); @@ -19,12 +19,12 @@ async function main() { if (hermesCompilerVersion != null && hermesCompilerVersion !== '0.0.0') { console.log( - `Skipping hermes nightly update: hermes-compiler is pinned to ${hermesCompilerVersion}`, + `Skipping hermes prebuilt update: hermes-compiler is pinned to ${hermesCompilerVersion}`, ); return; } - await updateHermesVersionsToNightly(); + await updateHermesVersionsToPrebuilt(); } if (require.main === module) { diff --git a/scripts/releases/utils/hermes-utils.js b/scripts/releases/utils/hermes-utils.js index 384e02e7f20..614a17362e1 100644 --- a/scripts/releases/utils/hermes-utils.js +++ b/scripts/releases/utils/hermes-utils.js @@ -32,7 +32,8 @@ const GRADLE_PROPERTIES_PATH = path.join( 'gradle.properties', ); -async function getLatestHermesNightlyVersion() /*: Promise */ { +// TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm +async function getLatestHermesVersion() /*: Promise */ { return getPackageVersionStrByTag('hermes-compiler', 'latest-v1'); } @@ -86,15 +87,15 @@ async function updateHermesRuntimeDependenciesVersions( await fs.writeFile(MAVEN_VERSIONS_FILE_PATH, newVersionsFile.trim() + '\n'); } -async function updateHermesVersionsToNightly() { - const hermesVersion = await getLatestHermesNightlyVersion(); +async function updateHermesVersionsToPrebuilt() { + const hermesVersion = await getLatestHermesVersion(); await updateHermesCompilerVersionInDependencies(hermesVersion); await updateHermesRuntimeDependenciesVersions(hermesVersion); } module.exports = { setStableHermesForReleaseBranch, - updateHermesVersionsToNightly, + updateHermesVersionsToPrebuilt, updateHermesCompilerVersionInDependencies, updateHermesRuntimeDependenciesVersions, };