Commit Graph

1276 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 7ce5e56f38 Migrate the Prepare Release workflow (#44833)
Summary:
This change migrates the prepare_release workflow from CCI to GHA

## Changelog:
[Internal] - Migrate from CCI to GHA

Pull Request resolved: https://github.com/facebook/react-native/pull/44833

Test Plan: Test on GHA

Reviewed By: huntie

Differential Revision: D58289050

Pulled By: cipolleschi

fbshipit-source-id: 134fc7ffb66a18eec1187e14500daec2828cae61
2024-06-10 09:49:45 -07:00
Saad Najmi c67dfbbe42 chore(ci): Set retryOnFailure for RNTester iOS Unit and Integration tests (#44642)
Summary:
On React Native macOS (I am not sure with the current state of React Native), the Xcode Unit and Integration tests are a bit flaky. Rather than set "retry on failure up to 3 times" through the pipeline config (in our case, Azure Pipelines), I realized my earlier PR to use Xcode test plans (https://github.com/facebook/react-native/pull/36443) means we can have Xcode retry the test. This should be faster than retrying it on the pipeline, because it retries just the failing test, not the entire "test" step. I did this on React Native macOS, so I'm doing it upstream so we can remove a diff.

## Changelog:

[INTERNAL] [CHANGED] - Set `retryOnFailure` for Xcode Unit and Integration tests

Pull Request resolved: https://github.com/facebook/react-native/pull/44642

Test Plan: CI should pass (faster)

Reviewed By: cortinico

Differential Revision: D57662523

Pulled By: cipolleschi

fbshipit-source-id: 8de2ab0ea15ba4d38c3b5bf96108c0c7ff5e9f32
2024-05-30 07:24:35 -07:00
Tim Yung abb7070a51 RN/Relay: Upgrade to React v18.3.1 (#44397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44397

X-link: https://github.com/facebook/metro/pull/1270

Upgrades `react-native` and `relay` to the newly published `react@18.3.1`.

Changelog:
[General][Changed] - Upgrade to `react@18.3.1`

Reviewed By: jackpope

Differential Revision: D56901818

fbshipit-source-id: 423d35205bb533c6a39c0fed25a1ffea1f0bc12d
2024-05-02 16:18:26 -07:00
Blake Friedman b38f80aeb6 update shared build to strip Babel wrapper (#44339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44339

We require the wrapper code for in repository calls to these packages directly from node (i.e. using CommonJS).  This wrapper code typically sits at the entrypoint of the build packages (i.e. `index.js`).

NOTE: This unblocks an issue preventing me from landing further work on the `helloworld` cli replacing the community template.

## Problem:
The [flow-api-translator](https://www.npmjs.com/package/flow-api-translator) library doesn't allow CommonJS `module.exports` when generating TypeScript Type Defintions.

## Change
1. At the built time, this strips out our wrapper code and sets up the dist/ folder appropriately for npm distribution.
2. Updated the `package.json` files to consistently share Flow types

Changelog: [Internal] refactor build packages output to remove wrapper.

NOTE: Added better error messages when users deviated from the current pattern:
{F1501571608}

Reviewed By: huntie

Differential Revision: D56762162

fbshipit-source-id: f110b31e4ad780998dbc81a2482891ac8d8c6458
2024-05-02 04:00:21 -07:00
Riccardo Cipolleschi 993f500fcf Add support for patch rc versions
Summary:
We might want to publish some new versions of React Native with experimental feature to allow some partners to test whether those versions fixes some reported issues, before creating a proper stable version for the whole ecosystem.

The infra is mostly [setup for this](https://www.internalfb.com/code/fbsource/[496a64d180faab501b8598aa0ec26d47454fb961]/xplat/js/react-native-github/scripts/releases/utils/version-utils.js?lines=149), already. The only detail we need to take care of is not to move the `next` tag.

## Changelog:
[Internal]

Reviewed By: cortinico, huntie

Differential Revision: D56578456

fbshipit-source-id: 8dcc674aab5f85077c1b3e6580c5aeb99226eff8
2024-04-25 15:17:34 -07:00
Blake Friedman 9d1f951ab0 remove from build script (#44233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44233

The package was added to our build scripts, but shouldn't have been.  We're not exporting this package or making it public.

Changelog: [Internal]

This should unblock our OSS CI.

Reviewed By: cipolleschi

Differential Revision: D56513694

fbshipit-source-id: f37c75871253b2570fb933175165d8f0a9593a16
2024-04-24 03:53:34 -07:00
Blake Friedman 995d5b832d Add an internal HelloWorld template
Summary:
This is a copy of the current packages/react-native/template that we exclusively use internally for testing.

Changelog: [Internal]

NOTE: Best contribution would be to scan the file list and ensure there isn't anything that shouldn't be in there.

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D56242484

fbshipit-source-id: 0913ff7acff9b0314b49f48e986674b77dbb908e
2024-04-23 15:07:59 -07:00
Alex Hunt 7c0676db06 Add useLastSuccessfulPipeline to release testing script (#44088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44088

This is a power user option for Release Crew members when testing locally — a flag to bypass being blocked on the latest in-progress CircleCI job and instead fetch build artifacts from the most recent successful pipeline (typically `HEAD~1`).

Example use cases where the latest pushed commit isn't impactful:
- An iOS-only fix, meaning Android can be tested now.
- A trivial fix that applies to CI only (e.g. RNTester Podfile.lock update).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D56138727

fbshipit-source-id: f9884bdb289a92486807e8e033b756466fcec559
2024-04-16 10:34:44 -07:00
Tim Yung e175912e7d RN: Fix Open Source Test Scripts
Summary:
Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D55502889

fbshipit-source-id: aabba96bd816982f7bce9cbd752ba9eee409bbf6
2024-03-29 01:42:24 -07:00
Moti Zilberman b13e9f8f75 Add --create-diff mode to debugger-frontend sync script (#43621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43621

Changelog: [Internal]

TSIA

Reviewed By: huntie

Differential Revision: D55244550

fbshipit-source-id: 5d3f408c51369d44e8dda1dc3768cac1125a21a4
2024-03-22 12:11:48 -07:00
Alex Hunt d03b5dca74 Adjust version parsing in release scripts, fix release dry runs in CI (#43568)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43568

Fixes to restore passing CI checks on main after D55027120.

- Widen validation checks in version utils to accept `0.x.x` (as opposed to `0.[not-'0'].x`).
- Use `tag: test` instead of `tag: latest` for dry run job params.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55123739

fbshipit-source-id: 9f76dced4e7aa3ce87d6680cd7687ae443305331
2024-03-20 08:07:36 -07:00
Alex Hunt 5a80935cf2 Remove bump-all-updated-packages script (#43534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43534

This is no longer used after switching to the new release workflow, which uses the newer and less error-prone `set-version` script.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55027122

fbshipit-source-id: faa8cfd2af9b54fab611b108df162793c5768695
2024-03-19 07:05:03 -07:00
Alex Hunt bb4d13e80c Switch to new release workflow as default (#43533)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43533

Switch to the new unified release workflow by default, now that this has been validated on the `0.74-stable` branch.

- Remove `--use-new-workflow` flag and remove legacy logic.
- Remove legacy `prepare_package_for_release` CI job, and use `run_new_release_workflow` -> `run_release_workflow` as new workflow condition match.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55027120

fbshipit-source-id: 7c05cdff95ac369ce6cd1201ccfc5718798c4da6
2024-03-19 07:05:03 -07:00
Alex Hunt a87fb56ef5 Fix new release workflow script (#43530)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43530

Fixes and changes following D54956345, encountered during the release process for 0.74 RC4 today.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55017872

fbshipit-source-id: 616b387088db00c6f076f4571b4ab1541467361c
2024-03-18 12:18:55 -07:00
Alex Hunt 14a7202983 Add prepare_release_new workflow, configure via flag (#43518)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43518

This is a minimum approach to achieve a **single-command publish flow** for React Native, unifying the previous `yarn bump-all-updated-packages` and `yarn trigger-react-native-release` workflow entry points.

This diff aims to change as little as possible to achieve the above — introducing a new job that merges operations to create the versioning commit. The triggered publish jobs are unchanged. In future, we may follow this change with further simplifications down the workflow tree.

**Key changes**

- Adds a new CircleCI workflow, `prepare_release_new`, which versions **all packages** and writes a single release commit.
- This replaces `yarn bump-all-updated-packages`, now implemented with the newer `set-version` script.
- Wires this up as an experiment within `trigger-react-native-release.js`, conditionally running the new workflow when `--use-new-workflow` is passed.

**Not changed**

- The single release commit written will continue to trigger both of the existing CI workflows on push (`publish_release` and `publish_bumped_packages`), which are unchanged.
    - The commit summary now includes the `#publish-packages-to-npm` marker, in order to trigger `publish_bumped_packages`.
- Usage: Release Crew members will continue to use the existing local script entry point (as [documented in the releases repo](https://github.com/reactwg/react-native-releases/blob/main/docs/guide-release-process.md#step-7-publish-react-native)), with the opt in flag.
    ```
    yarn trigger-react-native-release --use-new-workflow [...args]
    ```

After we're happy with the E2E behaviour of this workflow in the next 0.74 RC, I will follow up by dropping the `--use-new-workflow` flag and removing the old scripts (T182533699).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54956345

fbshipit-source-id: 35fd7af8f3e60a39507b5d978ccd97472bf03ddb
2024-03-18 02:22:46 -07:00
Alex Hunt 6f6aaae73e Fix RNTester Podfile.lock update in release workflow (#43513)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43513

The previous `update_podfile_lock.sh` script would fail as executed from the repo root (could not locate RNTester dir). Delete this and replace with direct calls in `prepare-package-for-release.js`, which will fail script on error.

 {F1469216632}

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D54949214

fbshipit-source-id: 4f032069e803e84f835c279d01332d16787dfafc
2024-03-15 10:32:07 -07:00
Blake Friedman f855de7fed Add @react-native/core-cli-utils to build script
Summary:
Changelog: [Internal]

Use our build script for packages and to generate the TypeScript types.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D54428870

fbshipit-source-id: 2a1666d30ac472300979b2be078a906d390e919a
2024-03-13 11:07:12 -07:00
Alex Hunt 42cab1488c Fix E2E template install in CI jobs (#43323)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43323

This fixes a seemingly pre-existent misconfiguration within our `test_ios_template` E2E test setup in CircleCI.

**Background**

We call `npx react-native-community/cli init` with the `--skip-install` flag, as part of the bootstrapping logic in `scripts/e2e/init-template-e2e.js`. This is necessary because we later want to explicitly call `npm install` with a custom `--registry` for our locally mirrored packages (via Verdaccio).

For some reason, we were observing unexpected differences when this was run under CircleCI:

1. Runs `yarn init`
2. Runs a `yarn add` (unknown pkg)

 {F1464781818}

https://app.circleci.com/pipelines/github/facebook/react-native/42725/workflows/f648468b-e916-4501-887d-ad293aa6fccf/jobs/1398950

This is causing a Yarn-based install ahead of where we want — ignoring the `--skip-install` flag.

*I'm still unsure on the exact LOC cause in CLI* (but most likely, it's around the Yarn v3 move).

**Impact of this fix**

- The above meant that, when we were bootstrapping `test_ios_template` previously, packages weren't being read from Verdaccio, but **instead from npm** — using the `"0.74.0"` versions from the *previous branch cut* .
- After D54006327, this behaviour became breaking 💀 — since for the 0.74 -> 0.75 cut, we no longer physically published `"0.75.0-main"` (new format) packages to npm.

**This change**

I'm passing `--pm npm` to `npx react-native-community/cli init` to skip around any Yarn behaviour. This appears to have removed the erroneous `yarn` invocations .

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: cortinico, cipolleschi

Differential Revision: D54536848

fbshipit-source-id: 473b11924955f5787c82a6c81d4527d77b810aa5
2024-03-05 06:18:37 -08:00
Alex Hunt 6cacc6d5df Relocate and export updatePackageJson script util
Summary: Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D54423651

fbshipit-source-id: e6705b055bf1f1d70d86d2c6978b837bd0807081
2024-03-04 02:54:44 -08:00
Alex Hunt b919ff606a Update set-version script to version private packages and workspace deps
Summary:
Addresses a gap when using the `set-version` script to update all packages on `main` (i.e. post branch cut):
- Package versions were not being set consistently. It is safe to version all workspace packages, including `"private"`.
    - Our publishing workflow is independent from this, and only considers public packages for submission to npm.
- We also need to update the root `package.json`, which includes `devDependencies` referencing workspace dependencies.

Unblocks https://github.com/facebook/react-native/pull/43132.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D54419456

fbshipit-source-id: 93eee669c5cf7c2f16b68a2bf41e9a8ace5521bf
2024-03-04 02:54:44 -08:00
Alex Hunt 79d1706b50 Omit source/build file snapshots from set-version script tests
Summary:
Make the snapshot output of this test terser (since `set-version` is a superset of the fully tested `set-rn-version` script). Notably, this removes any instances of `generated` from the snapshot file, which would hide the diff in PRs.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D54420338

fbshipit-source-id: e4a94b1fda34efaedf1b309496954be35acd5f98
2024-03-04 02:54:44 -08:00
Sam Zhou 2053364e5a Update hermes-parser and related packages in fbsource to 0.20.0
Summary:
Bump hermes-parser and related packages to [0.20.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: alexmckenley

Differential Revision: D54368487

fbshipit-source-id: a5a05f1e499ff5d8bda4649433bd285f7215d3da
2024-02-29 14:19:29 -08:00
Luna Wei fadcf7bf83 set to public access by default
Summary: Changelog: [Internal] - Specify `access` flag in publishing nightlies

Reviewed By: cipolleschi

Differential Revision: D54230208

fbshipit-source-id: 7711eee62e8e01a12d6604831754d36a5cd5dc13
2024-02-27 09:09:50 -08:00
Alex Hunt 30b088d245 Adjust output package.json formatting in scripts (#43133)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43133

I noticed inconsistent handling of terminating newlines in D54006327@V1, and had also been noticing `yarn build` reformatting unrelated sections of `package.json` files.

For now, this logic isn't moved to a shared util, since there will likely be a higher level abstraction for the release scripts in the next batch of improvements.

Changelog: [Internal]

Reviewed By: lunaleaps, cipolleschi

Differential Revision: D54007565

fbshipit-source-id: 74d58362a85be4fae2f9e058b6c6622a026ff0a0
2024-02-23 02:44:10 -08:00
Alex Hunt 8c51cbec94 Fix release testing script (#43130)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43130

Various fixes/tweaks to the `test-e2e-local` script, impacted by recent changes, found during the release process:

- Fix typo in variable name for `circleciToken` arg.
- Relocate erroneously positioned `process.exit` call (a force exit around Verdaccio, which we will remove in future).
- Add notice on exit around Verdaccio server not being killed successfully (to do in T179377112).
- Switch from Yarn to npm for test project installation — Yarn 3 is not respecting `npmRegistryServer`, see https://github.com/yarnpkg/yarn/issues/2508.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53951606

fbshipit-source-id: f6e29ef6c9ab33ebf60124757576fcb54219f339
2024-02-21 07:51:10 -08:00
Alex Hunt d6bf51cad9 Refactor remaining forEachPackage call sites (#43112)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43112

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53942028

fbshipit-source-id: 335bff3c3a31026bae7140fac1d1a6aae23a0f1e
2024-02-20 09:55:46 -08:00
Alex Hunt a4d6be8908 Update set-version to reuse set-rn-version (#43109)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43109

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940616

fbshipit-source-id: 8ce85437ab5164dae81a9956706c517880ee1f74
2024-02-20 05:06:03 -08:00
Alex Hunt cffb69a12b Fix path in trigger-react-native-release (#43107)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43107

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940161

fbshipit-source-id: 0de7887ff117db6f876420c1b609924bfc237847
2024-02-20 04:22:55 -08:00
Alex Hunt 1b504382c1 Fix import in bump-all-updated-packages, add Flow (#43106)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43106

Missed import in untyped, untested script during recent file move.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940160

fbshipit-source-id: ec86c5881a2f34d992538c713f808c8d5634ba16
2024-02-20 04:22:55 -08:00
Luna Wei 8ff05b5a18 Remove release-branch-cutoff from yarn bump-all-updated-packages (#43040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43040

Changelog: [Internal] Remove release-branch-cutoff option as its been replaced by `yarn set-version --skip-react-native-version`

Reviewed By: huntie

Differential Revision: D53742450

fbshipit-source-id: 726479698ec4f4f61d9a1ddde95e246e033f864c
2024-02-16 15:57:37 -08:00
Alex Hunt 98ea5ea29b Refactor set-version to use new getPackages util (#43072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43072

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53851089

fbshipit-source-id: 6305f7404a43a8da8bfe84137921437423be7985
2024-02-16 10:41:04 -08:00
Alex Hunt 80ec096e7c Create shared consts module for scripts
Summary:
Tidy up, removes risk of breakage when relocating inner modules.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53813025

fbshipit-source-id: 43dc4a57191363546d6858cff311e260d416192f
2024-02-16 03:21:25 -08:00
Alex Hunt a80674fc7c Relocate run-ci-e2e-tests script, add Flow (#43053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43053

- Relocate under `scripts/e2e/` (also move util used only by this cript).
- Type as Flow (to catch trivial errors). Some cleanup of `log()` calls as errors.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53813023

fbshipit-source-id: 05caf415ec0bf3739a6f7fec3afd385a195f42e9
2024-02-15 14:51:48 -08:00
Alex Hunt fb446598f9 Rename E2E template init script, relocate Verdaccio config + storage (#43001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43001

More understandable name: ~"React Native init, for E2E testing". Also relocates Verdaccio config and storage location under `scripts/e2e/` (resolving TODO comment).

The intent is for the `scripts/e2e/` dir to also group the existing E2E testing-related scripts — although I will stop here for the current release-related work.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53609332

fbshipit-source-id: fb2f6502a18c4a4ac2368b46af1e3ee42edbadd6
2024-02-15 14:51:48 -08:00
Alex Hunt e4135e9be5 Update test-e2e-local to use source monorepo packages for RNTestProject (#42899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42899

Updates the `test-e2e-local` script to bootstrap `/tmp/RNTestProject/` using the currently checked out repository as the source of truth for all monorepo packages (previously we only did this for the `react-native` package).

This enables release testers to validate a release **before** physically publishing new dependency versions via `yarn bump-all-updated-packages`.

We are able to reuse the `scripts/template/initialize.js` script that is currently used for E2E validation in CI. This sets up a local Verdaccio server during project install.

NOTE: The time taken for `Build packages` + Verdaccio isn't ideal, I may explore a way to reuse the published package state in a future diff. Until then, this extra time (~1 min) will still be much less pain than the `bump-all-updated-packages` + commit process loop.

Changelog:
[Internal] - Update test-e2e-local to use source monorepo packages for RNTestProject

Reviewed By: lunaleaps

Differential Revision: D53484510

fbshipit-source-id: 600a8a3257a4947d7738ab9d908d6549c38545e6
2024-02-15 13:04:00 -08:00
Luna Wei d6a440ee8b Remove process.exit calls from publish-npm and throw errors instead (#43039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43039

Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others.

Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called.

This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script.

I've also updated the tests to better capture what we're actually testing by mocking at a higher level.

Reviewed By: cipolleschi

Differential Revision: D53792754

fbshipit-source-id: 9293bb9a95430c50052db36c0e6f6c1ba348107f
2024-02-15 11:18:05 -08:00
Alex Hunt 24f7bd7445 Remove .npmrc write from setupVerdaccio util (#42941)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42941

I noticed that programatically running `npm set registry <value>` would fail within the repo root dir (intended run location) (`node` version `18.18.2`).

```
npm ERR! This command does not support workspaces.
```

It turns out this is no longer supported from npm 9.x: https://github.com/npm/cli/issues/6099. **Note**: The workaround discussed in this thread is incompatible/nontrivial with `npx`, so I've opted to remove this behaviour.

**Changes**

- Remove `npm set registry http://localhost:4873` call.
    - This is non-breaking due to the [explicit `--registry` arg already present in `run-e2e-ci-tests.js`](https://github.com/facebook/react-native/blob/b366b4b42e0f91eb2b1850c404fadd0f0322fc61/scripts/run-ci-e2e-tests.js#L102). The previous `.npmrc` config value is unnecessary, and probably was being ignored (will be validated for this PR in CircleCI run).
- Add comment against remaining `.npmrc` write, convert to `fs` call.
- Remove unused params on `setupVerdaccio` (moved to constants which will be exported and referenced in the next diff).

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53609308

fbshipit-source-id: 77d3666b42963cd61f6d3fd0be00cdc19bbb1ec8
2024-02-15 09:06:44 -08:00
Alex Hunt afc61ab643 Fix test-e2e-local when building artifacts locally (#43043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43043

Restores behaviour of `yarn test-e2e-local` when we are not using `--circleciToken`. The `npm pack` logic (necessary for the subsequent `updateTemplatePackage` call before initing `RNTestProject`) was deleted in https://github.com/facebook/react-native/pull/41172 / D50651448.

https://github.com/facebook/react-native/commit/4eed12b7df5d9731e556b77d701c87dcf91d3a1f#diff-56f57bf0eac99b0fda1b2938aceb8d9b663db82c07cb405bd53a01c8689710ffL224-L240

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53806191

fbshipit-source-id: 918306d5dea90266292728cda9c0e243e5c37eba
2024-02-15 09:06:44 -08:00
Luna Wei b8ad91732f fix nightlies dont exit early (#43035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43035

Changelog: [Internal] - We early-exited because of poor copy-pasta and the fact that our tests don't properly emulate the behavior of mock `exit`

Will try and clean this up in next diff but want to quickly fix so it unbreaks nightlies

Reviewed By: yungsters

Differential Revision: D53779109

fbshipit-source-id: ff56e498344fcb4851729d98625b6c7010c73795
2024-02-14 14:32:21 -08:00
Alex Hunt a68ae2e2cc Rename and document monorepo publish script (#42989)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42989

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607805

fbshipit-source-id: 8bbf82c02b54b20404de834800ae49d3fa43baee
2024-02-14 02:57:36 -08:00
Luna Wei 23a66444f7 Fix nightly publish
Summary:
Changelog: [Internal] - `get-and-update-packages` was deleted in D53487874 also actually published the monorepo packages.

Update publish-npm to publish the updated nightly monorepo packages

Reviewed By: cipolleschi

Differential Revision: D53697621

fbshipit-source-id: 21facb49739ba64c43b921117356715be3d8868a
2024-02-13 12:21:20 -08:00
Alex Hunt d243cd9ca9 Add Flow and document template init script, simplify args (#42898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42898

- Add Flow, switch from `yargs` to `parseArgs` (built-in to Node.js, Flow-safe).
- Document script via `--help` output (relevant ahead of reusing this script for local release testing).
- Relocate and add Flow to `setup-verdaccio.js` util.

Also:
- Remove `--reactNativeRootPath` arg.
- Tweak other arg names.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53484322

fbshipit-source-id: d828e5606bbff032109ecccca9c8f8e337d78626
2024-02-13 02:32:21 -08:00
Luna Wei 8a94bf0dba Fix CircleCI template tests by excluding dry-run build types
Summary:
Changelog: [Internal] - We still use the `dry-run` build variant in template tests on CircleCI

Previous diff migrated `set-rn-version` to `set-version` for dry-run, prealpha, and nightly build types. I didn't realize that template test flow used `dry-run` builds. I thought it was just for commitlies (which are deprecated).

To properly migrate this site, I need to fix the template test flow to accept monorepo packages at the same version as the dry-run react-native version (1000-<commithash>)

For now, let's just make this change more precise, and only update the nightly flow

See this error: {F1455663616}

Template test flow doesn't fake publish the monorepo packages at this version -- they're still using the versions off of main

Reviewed By: mdvacca

Differential Revision: D53688238

fbshipit-source-id: 6b64baca7eac842f2207fe13a3046b18459228da
2024-02-12 18:42:26 -08:00
Luna Wei 2090fe5cf8 Add support for bumping packages on main after release cut (#42958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42958

Changelog: [Internal] - Add support to `set-version` that we can bump the monorepo packages on main

This should be used after we cut a release branch. The release crew should then run

`yarn set-version 0.next.0-main --skip-react-native-version`

This makes sure we don't update `react-native` on main branch and keep it at 1000.0.0

This essentially replaces:
`yarn bump-all-updated-packages --release-branch-cutoff`
in this step: https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main

The reason for this change is to consolidate all the places where we update the version to one place, set-version.

Currently we do this in many fragmented places
* bump-all-updated-packages
* set-rn-version
* get-and-update-packages (deleted in the prev diff)

In the future, I want to get rid of `skip-react-native-version` but we'll need to remove the `1000.0.0` nomenclature. This unblocks us to just use this script for now.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53648688

fbshipit-source-id: 4f76366f8d340ec5aeaba1d3a26eba8b18a0166c
2024-02-12 12:07:51 -08:00
Luna Wei 34abd79475 Use set-version for nightly publishes (#42903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42903

Changelog: [Internal] - Update publish-npm to use `set-version` for nightly builds

Now that `set-version` basically does what `set-rn-version` does, this diff uses this logic for nightlies only (as dry-run/pre-alpha variants are non-functional right now)

This does not change the flow of build-type `'release'` -- that will still use `set-rn-version` via CircleCI ([job](https://fburl.com/code/6xo3ijwg), [script](https://fburl.com/code/bo8np0tb))  We will eventually replace that too but that will be later.

This allows us to delete `get-and-update-packages.js` which was a helper written specifically for updating monorepo packages for nightlies.

The purpose of this is to eventually conform all version updates to use `set-version` in all types of releases (nightlies, stable)

bypass-github-export-checks

Reviewed By: cipolleschi

Differential Revision: D53487874

fbshipit-source-id: 734b528ef5bd095ac68f86701ae105daa30c7d68
2024-02-12 12:07:51 -08:00
Alex Hunt d190ccafd3 Add retry to monorepo publish script (#42964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42964

We've seen npm publishes fail occasionally in CI as part of this script, most recently in S391653. This change adds a single retry, per package, during the execution of this script, in an attempt to reduce the chance of manual interventions after a broken pipeline.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607808

fbshipit-source-id: 526d9c33d51ec57702efba3c199bad313c1bf2d4
2024-02-12 10:43:48 -08:00
Alex Hunt 273a5177e0 Use npm as source of truth for updated packages (make publish script rerunnable) (#42944)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42944

Updates `find-and-publish-all-bumped-packages` to use the npm registry as the source of truth, similar to tools like Lerna (`lerna publish from-package`). **This enables safe reruns of the publish script**, and replaces the previous Git-diff-detection implementation.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53607807

fbshipit-source-id: 135808b7ce36cf463c9f53a8059500b83f8b6679
2024-02-12 10:43:48 -08:00
Alex Hunt b41a33ede9 Move metro-config package into monorepo build, enable TS generation (#41836)
Summary:
This adds `react-native/metro-config` to the monorepo build tool and emits the missing typescript declarations.

Right now, we do have typescript declarations on `metro-config`, but not `react-native/metro-config`. Which makes everything a bit harder extend from "[the default React Native metro config](https://github.com/facebook/react-native/pull/36502)" in Expo.

> Note, I also added the same `exports` block from `react-native/dev-middleware` for conformity.

One open question here is, why aren't we exporting _all_ helper functions from `metro-config`? To me, its a bit weird that we need both `metro-config` _and_ `react-native/metro-config` as `loadConfig` isn't exported.

## Changelog:

[INTERNAL] [FIXED] - Emit typescript declaration files for `react-native/metro-config`

Pull Request resolved: https://github.com/facebook/react-native/pull/41836

Test Plan:
Run the build tool, and check if the typescript declarations are emitted for `react-native/metro-config`.

```
yarn build metro-config
```

Reviewed By: hoxyq

Differential Revision: D51943453

Pulled By: huntie

fbshipit-source-id: cfaffe5660053fc9a9fcbe3dacf7f6ccc2bde01b
2024-02-12 05:20:38 -08:00
Alex Hunt 49c3c3412a Refactor package discovery in publish script (#42938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42938

Substitutes the `forEachPackage` util with a replacement async `getPackages` function. This will be used further in the next diff.

The new function aims to be more erganomic/versatile than `forEachPackage` by returning a package mapping (see updated test mock). The API aligns roughly with `yarn workspaces list` and [Lerna's `detectProjects`](https://lerna.js.org/docs/api-reference/utilities#detectprojects).

This also aligns with / replaces similar attempts in our existing scripts:
- [`getPackagesToPublish`](https://github.com/facebook/react-native/blob/2ca7bec0c2a7d821ceaaf39840a6cdc5eceb8678/scripts/monorepo/get-and-update-packages.js#L56)
- [`getPublicPackages`](https://github.com/facebook/react-native/blob/2ca7bec0c2a7d821ceaaf39840a6cdc5eceb8678/scripts/releases/set-version/index.js#L19)

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607806

fbshipit-source-id: 00ec34edadab863dc8f2f0c7852f6e835a5dddf5
2024-02-12 04:42:27 -08:00
Alex Hunt 56f483ccad Update exit cases for monorepo publish script (#42937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42937

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607810

fbshipit-source-id: 18e79f23060ee70e96bd8ac6e9995b0a8ba300b3
2024-02-12 04:42:27 -08:00