Skip to content

Commit d8ac75a

Browse files
cipolleschimeta-codesync[bot]
authored andcommitted
Rename 'nightly' functions to 'prebuilt' in release scripts (#56753)
Summary: Pull Request resolved: #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
1 parent 8b57768 commit d8ac75a

4 files changed

Lines changed: 17 additions & 16 deletions

File tree

scripts/releases-ci/__tests__/publish-npm-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const publishPackageMock = jest.fn();
2020
const getNpmInfoMock = jest.fn();
2121
const generateAndroidArtifactsMock = jest.fn();
2222
const getPackagesMock = jest.fn();
23-
const updateHermesVersionsToNightlyMock = jest.fn();
23+
const updateHermesVersionsToPrebuiltMock = jest.fn();
2424
const getBranchName = jest.fn();
2525

2626
const {REPO_ROOT} = require('../../shared/consts');
@@ -58,7 +58,7 @@ describe('publish-npm', () => {
5858
getNpmInfo: getNpmInfoMock,
5959
}))
6060
.mock('../../releases/utils/hermes-utils', () => ({
61-
updateHermesVersionsToNightly: updateHermesVersionsToNightlyMock,
61+
updateHermesVersionsToPrebuilt: updateHermesVersionsToPrebuiltMock,
6262
}));
6363
});
6464

@@ -112,7 +112,7 @@ describe('publish-npm', () => {
112112

113113
await publishNpm('dry-run');
114114

115-
expect(updateHermesVersionsToNightlyMock).toHaveBeenCalled();
115+
expect(updateHermesVersionsToPrebuiltMock).toHaveBeenCalled();
116116
expect(setVersionMock).not.toBeCalled();
117117
expect(updateReactNativeArtifactsMock).toBeCalledWith(version, 'dry-run');
118118

@@ -140,7 +140,7 @@ describe('publish-npm', () => {
140140

141141
await publishNpm('dry-run');
142142

143-
expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled();
143+
expect(updateHermesVersionsToPrebuiltMock).not.toHaveBeenCalled();
144144
expect(setVersionMock).not.toBeCalled();
145145
expect(updateReactNativeArtifactsMock).toBeCalledWith(
146146
version,
@@ -176,7 +176,7 @@ describe('publish-npm', () => {
176176

177177
await publishNpm('dry-run');
178178

179-
expect(updateHermesVersionsToNightlyMock).not.toHaveBeenCalled();
179+
expect(updateHermesVersionsToPrebuiltMock).not.toHaveBeenCalled();
180180
expect(setVersionMock).not.toBeCalled();
181181
expect(updateReactNativeArtifactsMock).not.toBeCalled();
182182

@@ -235,7 +235,7 @@ describe('publish-npm', () => {
235235
// Generate Android artifacts is now delegate to build_android entirely
236236
expect(generateAndroidArtifactsMock).not.toHaveBeenCalled();
237237

238-
expect(updateHermesVersionsToNightlyMock).toHaveBeenCalled();
238+
expect(updateHermesVersionsToPrebuiltMock).toHaveBeenCalled();
239239

240240
expect(publishPackageMock.mock.calls).toEqual([
241241
[

scripts/releases-ci/publish-npm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919
} = require('../releases/set-rn-artifacts-version');
2020
const {setVersion} = require('../releases/set-version');
2121
const {
22-
updateHermesVersionsToNightly,
22+
updateHermesVersionsToPrebuilt,
2323
} = require('../releases/utils/hermes-utils');
2424
const {getNpmInfo, publishPackage} = require('../releases/utils/npm-utils');
2525
const {
@@ -99,7 +99,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise<void> */ {
9999
// For stable releases, ci job `prepare_package_for_release` handles this
100100
if (buildType === 'nightly') {
101101
// Set hermes versions to latest available
102-
await updateHermesVersionsToNightly();
102+
await updateHermesVersionsToPrebuilt();
103103

104104
// Set same version for all monorepo packages
105105
await setVersion(version);
@@ -113,7 +113,7 @@ async function publishNpm(buildType /*: BuildType */) /*: Promise<void> */ {
113113
if (projectInfo.version === '1000.0.0') {
114114
// Set hermes versions to latest available if not on a stable branch
115115
if (!/.*-stable/.test(getBranchName())) {
116-
await updateHermesVersionsToNightly();
116+
await updateHermesVersionsToPrebuilt();
117117
}
118118

119119
await updateReactNativeArtifacts(version, buildType);

scripts/releases/use-hermes-nightly.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
'use strict';
1212

1313
const {getReactNativePackage} = require('../shared/monorepoUtils');
14-
const {updateHermesVersionsToNightly} = require('./utils/hermes-utils');
14+
const {updateHermesVersionsToPrebuilt} = require('./utils/hermes-utils');
1515

1616
async function main() {
1717
const {packageJson} = await getReactNativePackage();
1818
const hermesCompilerVersion = packageJson.dependencies?.['hermes-compiler'];
1919

2020
if (hermesCompilerVersion != null && hermesCompilerVersion !== '0.0.0') {
2121
console.log(
22-
`Skipping hermes nightly update: hermes-compiler is pinned to ${hermesCompilerVersion}`,
22+
`Skipping hermes prebuilt update: hermes-compiler is pinned to ${hermesCompilerVersion}`,
2323
);
2424
return;
2525
}
2626

27-
await updateHermesVersionsToNightly();
27+
await updateHermesVersionsToPrebuilt();
2828
}
2929

3030
if (require.main === module) {

scripts/releases/utils/hermes-utils.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const GRADLE_PROPERTIES_PATH = path.join(
3232
'gradle.properties',
3333
);
3434

35-
async function getLatestHermesNightlyVersion() /*: Promise<string> */ {
35+
// TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm
36+
async function getLatestHermesVersion() /*: Promise<string> */ {
3637
return getPackageVersionStrByTag('hermes-compiler', 'latest-v1');
3738
}
3839

@@ -86,15 +87,15 @@ async function updateHermesRuntimeDependenciesVersions(
8687
await fs.writeFile(MAVEN_VERSIONS_FILE_PATH, newVersionsFile.trim() + '\n');
8788
}
8889

89-
async function updateHermesVersionsToNightly() {
90-
const hermesVersion = await getLatestHermesNightlyVersion();
90+
async function updateHermesVersionsToPrebuilt() {
91+
const hermesVersion = await getLatestHermesVersion();
9192
await updateHermesCompilerVersionInDependencies(hermesVersion);
9293
await updateHermesRuntimeDependenciesVersions(hermesVersion);
9394
}
9495

9596
module.exports = {
9697
setStableHermesForReleaseBranch,
97-
updateHermesVersionsToNightly,
98+
updateHermesVersionsToPrebuilt,
9899
updateHermesCompilerVersionInDependencies,
99100
updateHermesRuntimeDependenciesVersions,
100101
};

0 commit comments

Comments
 (0)