Skip to content

Commit

Permalink
Cleanup prealpha logic from the JS Publishing Scripts (facebook#48691)
Browse files Browse the repository at this point in the history
Summary:

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] -

Differential Revision: D68206014
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 15, 2025
1 parent e8a64fd commit 8623a0e
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 408 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
env:
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
# By default we only build ARM64 to save time/resources. For release/nightlies, we override this value to build all archs.
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
env:
HERMES_WS_DIR: /tmp/hermes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
env:
TERM: "dumb"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
# By default we only build ARM64 to save time/resources. For release/nightlies, we override this value to build all archs.
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
env:
HERMES_WS_DIR: /tmp/hermes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/scripts/hermes/hermes-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const os = require('os');
const path = require('path');

/*::
type BuildType = 'dry-run' | 'release' | 'nightly' | 'prealpha';
type BuildType = 'dry-run' | 'release' | 'nightly';
*/

const SDKS_DIR = path.normalize(path.join(__dirname, '..', '..', 'sdks'));
Expand Down
12 changes: 0 additions & 12 deletions scripts/__tests__/npm-utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@ describe('npm-utils', () => {
process.env.GITHUB_REF_NAME = '';
});

it('return the expected format for prealpha', () => {
const isoStringSpy = jest.spyOn(Date.prototype, 'toISOString');
isoStringSpy.mockReturnValue('2023-10-04T15:43:55.123Z');
getCurrentCommitMock.mockImplementation(() => 'abcd1234');

const returnedValue = getNpmInfo('prealpha');
expect(returnedValue).toMatchObject({
version: `0.0.0-prealpha-2023100415`,
tag: 'prealpha',
});
});

it('return the expected format for patch-prereleases', () => {
const isoStringSpy = jest.spyOn(Date.prototype, 'toISOString');
isoStringSpy.mockReturnValue('2023-10-04T15:43:55.123Z');
Expand Down
20 changes: 1 addition & 19 deletions scripts/npm-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {exec} = require('shelljs');
/*::
import type { ExecOptsSync, ShellString } from 'shelljs';
type BuildType = 'dry-run' | 'release' | 'nightly' | 'prealpha';
type BuildType = 'dry-run' | 'release' | 'nightly';
type NpmInfo = {
version: string,
tag: ?string,
Expand Down Expand Up @@ -70,24 +70,6 @@ function getNpmInfo(buildType /*: BuildType */) /*: NpmInfo */ {
};
}

if (buildType === 'prealpha') {
const mainVersion = '0.0.0';
// Date in the format of YYYYMMDDHH.
// This is a progressive int that can track subsequent
// releases and it is smaller of 2^32-1.
// It is unlikely that we can trigger two prealpha in less
// than an hour given that nightlies take ~ 1 hr to complete.
const dateIdentifier = new Date()
.toISOString()
.slice(0, -10)
.replace(/[-T:]/g, '');

return {
version: `${mainVersion}-prealpha-${dateIdentifier}`,
tag: 'prealpha',
};
}

if (buildType === 'release') {
let versionTag /*: string*/ = '';
if (process.env.CIRCLE_TAG != null && process.env.CIRCLE_TAG !== '') {
Expand Down
2 changes: 1 addition & 1 deletion scripts/release-testing/utils/testing-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const path = require('path');
const {cp, exec} = require('shelljs');

/*::
type BuildType = 'dry-run' | 'release' | 'nightly' | 'prealpha';
type BuildType = 'dry-run' | 'release' | 'nightly';
*/

/*
Expand Down
22 changes: 0 additions & 22 deletions scripts/releases-ci/__tests__/publish-npm-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const setVersionMock = jest.fn();
const updateReactNativeArtifactsMock = jest.fn();
const publishAndroidArtifactsToMavenMock = jest.fn();
const publishExternalArtifactsToMavenMock = jest.fn();
const removeNewArchFlags = jest.fn();
const env = process.env;
const publishPackageMock = jest.fn();
const getNpmInfoMock = jest.fn();
Expand Down Expand Up @@ -51,9 +50,6 @@ describe('publish-npm', () => {
.mock('../../releases/set-rn-artifacts-version', () => ({
updateReactNativeArtifacts: updateReactNativeArtifactsMock,
}))
.mock('../../releases/remove-new-arch-flags', () => ({
removeNewArchFlags,
}))
.mock('../../npm-utils', () => ({
...jest.requireActual('../../npm-utils'),
publishPackage: publishPackageMock,
Expand Down Expand Up @@ -103,8 +99,6 @@ describe('publish-npm', () => {

await publishNpm('dry-run');

expect(removeNewArchFlags).not.toHaveBeenCalled();

expect(setVersionMock).not.toBeCalled();
expect(updateReactNativeArtifactsMock).toBeCalledWith(version, 'dry-run');

Expand Down Expand Up @@ -159,9 +153,6 @@ describe('publish-npm', () => {

await publishNpm('nightly');

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(setVersionMock).toBeCalledWith(expectedVersion);

// Generate Android artifacts is now delegate to build_android entirely
expect(generateAndroidArtifactsMock).not.toHaveBeenCalled();

Expand Down Expand Up @@ -213,8 +204,6 @@ describe('publish-npm', () => {
await publishNpm('nightly');
}).rejects.toThrow('something went wrong with setVersion');

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(publishPackageMock).not.toBeCalled();
expect(generateAndroidArtifactsMock).not.toHaveBeenCalled();
expect(publishAndroidArtifactsToMavenMock).not.toBeCalled();
expect(publishExternalArtifactsToMavenMock).not.toHaveBeenCalled();
Expand Down Expand Up @@ -259,9 +248,6 @@ describe('publish-npm', () => {
`Failed to publish monorepo/pkg-b@${expectedVersion} to npm. Stopping all nightly publishes`,
);

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(setVersionMock).toBeCalledWith(expectedVersion);

expect(generateAndroidArtifactsMock).not.toHaveBeenCalled();

// Note that we don't call `publishPackage` for react-native, or monorepo/pkg-c
Expand Down Expand Up @@ -301,8 +287,6 @@ describe('publish-npm', () => {

await publishNpm('release');

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(updateReactNativeArtifactsMock).not.toHaveBeenCalled();
expect(setVersionMock).not.toBeCalled();

// Generate Android artifacts is now delegate to build_android entirely
Expand Down Expand Up @@ -343,8 +327,6 @@ describe('publish-npm', () => {

await publishNpm('release');

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(setVersionMock).not.toBeCalled();
expect(updateReactNativeArtifactsMock).not.toBeCalled();

// Generate Android artifacts is now delegate to build_android entirely
Expand Down Expand Up @@ -392,8 +374,6 @@ describe('publish-npm', () => {
`Failed to publish react-native@${expectedVersion} to npm.`,
);

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(setVersionMock).not.toBeCalled();
expect(updateReactNativeArtifactsMock).not.toHaveBeenCalled();

// Generate Android artifacts is now delegate to build_android entirely
Expand Down Expand Up @@ -431,8 +411,6 @@ describe('publish-npm', () => {

await publishNpm('release');

expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(updateReactNativeArtifactsMock).not.toHaveBeenCalled();
expect(setVersionMock).not.toBeCalled();

// Generate Android artifacts is now delegate to build_android entirely
Expand Down
9 changes: 2 additions & 7 deletions scripts/releases-ci/publish-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {BuildType} from '../releases/utils/version-utils';

const {REPO_ROOT} = require('../consts');
const {getNpmInfo, publishPackage} = require('../npm-utils');
const {removeNewArchFlags} = require('../releases/remove-new-arch-flags');
const {
updateReactNativeArtifacts,
} = require('../releases/set-rn-artifacts-version');
Expand Down Expand Up @@ -57,7 +56,7 @@ async function main() {
.option('t', {
alias: 'builtType',
describe: 'The type of build you want to perform.',
choices: ['dry-run', 'nightly', 'release', 'prealpha'],
choices: ['dry-run', 'nightly', 'release'],
default: 'dry-run',
})
.strict().argv;
Expand Down Expand Up @@ -96,12 +95,8 @@ async function publishMonorepoPackages(tag /*: ?string */) {
async function publishNpm(buildType /*: BuildType */) /*: Promise<void> */ {
const {version, tag} = getNpmInfo(buildType);

if (buildType === 'prealpha') {
removeNewArchFlags();
}

// For stable releases, CircleCI job `prepare_package_for_release` handles this
if (['dry-run', 'nightly', 'prealpha'].includes(buildType)) {
if (['dry-run', 'nightly'].includes(buildType)) {
if (buildType === 'nightly') {
// Set same version for all monorepo packages
await setVersion(version);
Expand Down
4 changes: 0 additions & 4 deletions scripts/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ For information on command arguments, run `node <command> --help`.

Creates a release commit to trigger a new release.

### `remove-new-arch-flags`

Updates native build files to disable the New Architecture.

### `set-version`

Bump the version of all packages.
Expand Down
138 changes: 0 additions & 138 deletions scripts/releases/__tests__/remove-new-arch-flags-test.js

This file was deleted.

Loading

0 comments on commit 8623a0e

Please sign in to comment.