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
This commit is contained in:
Riccardo Cipolleschi authored and meta-codesync[bot] committed 2026-05-11 12:55:12 -07:00
1 parent 99988aba7b
commit 041b6d5f9e
4 files changed
+17 -16

No files matched your search

@@ -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([
[
+3 -3
View File
@@ -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<void> */ {
// 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<void> */ {
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);
+3 -3
View File
@@ -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) {
+5 -4
View File
@@ -32,7 +32,8 @@ const GRADLE_PROPERTIES_PATH = path.join(
'gradle.properties',
);
async function getLatestHermesNightlyVersion() /*: Promise<string> */ {
// TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm
async function getLatestHermesVersion() /*: Promise<string> */ {
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,
};