Граф коммитов

958 Коммитов

Автор SHA1 Сообщение Дата
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`](b366b4b42e/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.

4eed12b7df (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`](2ca7bec0c2/scripts/monorepo/get-and-update-packages.js (L56))
- [`getPublicPackages`](2ca7bec0c2/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
Alex Hunt b25be6687e Add Flow, add positive test case for monorepo publish step (#42936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42936

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53607809

fbshipit-source-id: 990826fda5538af9a13e3f24978295a2f3b0c8c3
2024-02-12 04:42:27 -08:00
Luna Wei 68e6a94538 Fix`set-version` to also update `packages/react-native` source (#42897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42897

Changelog: [Internal] - Update nightly flow to use set-version

This change fixes `set-version` to update the `packages/react-native` native source and build files (as `set-rn-version` does) -- this was an oversight but not an issue as `set-version` isn't actually used anywhere right now.

Reviewed By: huntie

Differential Revision: D53463414

fbshipit-source-id: d0d9e4bbe246cccb8643a6ebf9794122bc343433
2024-02-09 21:35:18 -08:00
Alex Hunt f0d1d9214d Relocate RNTester E2E wrapper script under package (#42906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42906

Makes way to relocate repo E2E testing + Verdaccio logic under `scripts/e2e/`. The contents of this script are minimal and are better located with `rn-tester-e2e`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53516117

fbshipit-source-id: e7e50af0383788f2219da190bf921ea93a6455eb
2024-02-07 08:31:29 -08:00
Alex Hunt 009542f4ee Move release testing scripts into subdirectory (#42900)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42900

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D53471278

fbshipit-source-id: 56b16c20b85c88577e5d899b0e85d078ab8aa51f
2024-02-07 05:40:26 -08:00
Riccardo Cipolleschi 7c5e4262d4 Fix publishing of React Native with the right version (#42783)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42783

This change will fix the publishing of Nightlies for React Native with the right version

## Changelog:
[Internal] - Update the package.json of react native correctly.

Reviewed By: cortinico, huntie

Differential Revision: D53309082

fbshipit-source-id: 2fa4d4fdf4f984603c6b3d3690fa3c464ee6d030
2024-02-01 07:40:11 -08:00
Alex Hunt 76598de621 Reorganise and document release script entry points (#42774)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42774

Reorganise release scripts so that command entry points are grouped based on execution context, which also reflects dependencies between scripts.

Also:

- Document the current behaviours of these scripts.
- Relocate utils out of the root contents.
- Replace `exec` call to `set-rn-version` script with function import.

NOTE: `yarn trigger-react-native-release` (documented command in release process) is unchanged, since this is aliased from `package.json`.

```
├── releases
│   ├── templates/
│   ├── utils/
│   ├── remove-new-arch-flags.js
│   ├── set-rn-version.js
│   └── update-template-package.js
├── releases-ci
│   ├── prepare-package-for-release.js
│   └── publish-npm.js
└── releases-local
    └── trigger-react-native-release.js
```

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53274341

fbshipit-source-id: eec2befc43e7a47fd821b2e2bcc818ddffbb6cf7
2024-02-01 06:02:17 -08:00
Luna Wei ebc2831d5b set unified version (#42776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42776

Changelog: [Internal] set all monorepo packages (including react-native) to one version and update all inter-dependencies (including the template)

Reviewed By: huntie

Differential Revision: D53251917

fbshipit-source-id: 95330ca66dcb7234a3f09752ecc3ed9087ced4bf
2024-01-31 19:32:08 -08:00
Alex Hunt b7b55854fe Enable Flow on misc release scripts (#42736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42736

- Minimally enable Flow in these scripts. This would have caught outdated imports in D53001971 and D53228096.
- Update `publish-npm` script with async `main()` function.
- Also delete leftover `ReactNativeVersion.js.template` file.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53225162

fbshipit-source-id: 9521291b7c84728e3e05af510ebf3244a9a189e5
2024-01-31 03:36:02 -08:00
Alex Hunt 2f818b464f Fix import in publish-npm script (#42740)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42740

Follow-up to a CircleCI breakage introduced by D53001971.

This was missed by both the typechecker (no Flow in file) and CI (no PR-time jobs covering this script).

Changelog: [Internal]

Reviewed By: cortinico, GijsWeterings, cipolleschi

Differential Revision: D53228096

fbshipit-source-id: fbbe1538ee52b8452399d86489239434d3a068be
2024-01-30 10:59:02 -08:00
Alex Hunt e97ba475aa Relocate and refactor set-rn-version script (#42730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42730

Reviewing and modernising this script as part of simplifying our release publish workflow.

- Drop unused `--dependency-versions` arg from CLI entry point
- Simplify templating approach
- Type as Flow
- Drop dependencies on `shelljs` and `yargs`
- Relocate under `scripts/releases/`
- Rewrite tests as snapshot tests

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D53001971

fbshipit-source-id: e55a71a0bb37e3e18ba1e582a5c46ddd58823d81
2024-01-30 06:46:50 -08:00
Rob Hogan 41b256a776 Babel-ignore `node_modules` on Windows consistently with others (#42681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42681

CI failures in Windows JS tests recently (https://github.com/facebook/react-native/pull/41463) were caused by the triggering of Babel registration during tests, due to an import of `packages/dev-middleware` (index), breaking subsequent transformation of other tests.

## Root cause
Example of a problematic import:
a5d8ea4579/packages/dev-middleware/src/__tests__/ServerUtils.js (L15)

..which triggers a Babel registration:
a5d8ea4579/packages/dev-middleware/src/index.js (L16-L18)

That registration behaves differently on Windows due to the `ignore: [/\/node_modules\/\]`, which doesn't match against Windows path separators - Babel matches against system separators.

In particular, this changed whether `node_modules/flow-parser` was transformed when loading the RN Babel transformer. Transforming this file causes a `console.warn` from Babel due to its size:
> [BABEL] Note: The code generator has deoptimised the styling of /Users/robhogan/workspace/react-native/node_modules/flow-parser/flow_parser.js as it exceeds the max of 500KB.

This throws due to our setup:
a5d8ea4579/packages/react-native/jest/local-setup.js (L27)

This all manifests as the first test following a Babel registration (within the same Jest worker) that requires the RN Babel transformer throwing during script transformation.

## This change
This is the minimally disruptive change that makes Babel registration behaviour consistent between Windows and other platforms. The more durable solution here would be *not* to rely on any Babel registration for Jest, which has its own `ScriptTransformer` mechanism for running code from source. Given the fragile way our internal+OSS Babel set up hangs together that's a higher-risk change, so I'll follow up separately.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D53124578

fbshipit-source-id: 074a8e139e506a5dceec13f07d412599fb292d92
2024-01-27 06:49:15 -08:00
Rubén Norte 5e66f41697 Implement new feature flag system (re-land) (#42678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42678

Changelog: [internal]

This is a re-application of https://github.com/facebook/react-native/pull/42430, which had to be reverted because of crashes in optimized builds on Android:

```
Abort Reason: terminating due to uncaught exception of type facebook::jni::JniException: java.lang.ClassNotFoundException: com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsProvider
```

The root cause of that was that that class was removed because it wasn't statically referenced from Kotlin/Java, but it was dynamically referenced from C++ (in `ReactNativeFeatureFlagsProviderHolder.cpp`).

This applies the same changes + adds `DoNotStrip` annotations for the affected class and all its methods.

Reviewed By: huntie

Differential Revision: D53122992

fbshipit-source-id: efc4d5636a3f2d39b86e9c098bff408b6688b80b
2024-01-26 09:55:27 -08:00
David Vacca ffaeaba213 Back out "Implement new feature flag system"
Summary:
Original commit changeset: 0ba95803f61e

Original Phabricator Diff: D52806730

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D53113947

fbshipit-source-id: ace1222a861a739fcd3f4b0e12c135db47a93344
2024-01-25 21:52:59 -08:00
Rubén Norte 705c675d51 Implement new feature flag system (#42430)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42430

This PR creates a new internal feature flags system for React Native. This is only meant to be used internally within the framework, but we might expose it externally in some form in the future to allow customizing specific feature flags in frameworks and applications.

Features:
* 2 types of flags:
  * Common: can be overridden from native and are accessible from all layers of the stack (Objective-C/Swift, Java/Kotlin, C++ and JavaScript).
  * JS-only: flags that can only be defined and accessed from JS (to allow things like hot reloading without a native build).
* 1 source of truth for each flag.
* Feature flags are application/process scoped (using C++ singletons).

See the `README.md` file in this PR for additional information.

This also adds modifies `run-ci-javascript-tests` to run a new check to make sure that the generate files are in sync with the JSON file that contains the definitions.

Changelog: [internal]

Reviewed By: huntie

Differential Revision: D52806730

fbshipit-source-id: 0ba95803f61ec2f05266ee535921321bf6d3dc6a
2024-01-25 13:55:11 -08:00
szymonrybczak 78967b33c0 Bump CLI to 13.5.1 (#42183)
Summary:
Updates CLI to v13.5.1.

## Changelog:

[GENERAL] [CHANGED] - Bump CLI to 13.5.1

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

Test Plan: CI

Reviewed By: christophpurrer

Differential Revision: D52600707

Pulled By: huntie

fbshipit-source-id: f314a405d8d7e9200595b42b62d354e61f0a2964
2024-01-25 02:32:45 -08:00
Alex Hunt 02e7244b3d Improve types, fix translator compatibility for version-related modules (#42638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42638

Enables these modules to be covered by `public-api-test`.

- Standardise as CommonJS modules, fixing compatibility with [`flow-api-translator`](https://www.npmjs.com/package/flow-api-translator).
- Use explicit object type in generated file template.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52963967

fbshipit-source-id: c9f3e35f70859c1b99b7297228ee2498f91d9041
2024-01-25 02:32:00 -08:00
Luna Wei f322dc7a84 Typing scripts used for test-e2e-local (#42610)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42610

Changelog: [Internal] Adding more typing to internal scripts used by test-e2e-local

Reviewed By: NickGerleman

Differential Revision: D52988733

fbshipit-source-id: 6e187b7c9560b30def014e8932ab82ed07cf8488
2024-01-24 15:39:06 -08:00
Luna Wei 3d097d46e3 Type circle-ci-artifacts-util (#42608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42608

Changelog: [Internal] - Type circle-ci-artifacts-util and migrate it to node-fetch

Reviewed By: NickGerleman

Differential Revision: D52932555

fbshipit-source-id: 50e874e23fe8131a9376845006dab3116aed8a04
2024-01-24 15:39:06 -08:00