2015-02-20 04:10:52 +00:00
|
|
|
{
|
2023-03-17 12:03:25 +00:00
|
|
|
"name": "@react-native/monorepo",
|
2020-08-18 19:07:57 +00:00
|
|
|
"private": true,
|
2016-03-29 19:32:57 +00:00
|
|
|
"version": "1000.0.0",
|
2018-02-17 02:25:02 +00:00
|
|
|
"license": "MIT",
|
2024-10-17 14:55:07 +00:00
|
|
|
"packageManager": "yarn@1.22.22",
|
2015-02-20 04:10:52 +00:00
|
|
|
"scripts": {
|
2023-05-11 07:03:00 +00:00
|
|
|
"android": "cd packages/rn-tester && npm run android",
|
2023-08-09 18:56:44 +00:00
|
|
|
"build-android": "./gradlew :packages:react-native:ReactAndroid:build",
|
2023-08-09 18:56:44 +00:00
|
|
|
"build": "node ./scripts/build/build.js",
|
|
|
|
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"clean": "node ./scripts/build/clean.js",
|
2023-08-26 17:00:22 +00:00
|
|
|
"flow-check": "flow check",
|
2023-08-09 18:56:44 +00:00
|
|
|
"flow": "flow",
|
|
|
|
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
|
|
|
|
"format": "npm run prettier && npm run clang-format",
|
2024-10-29 15:02:54 +00:00
|
|
|
"featureflags": "cd packages/react-native && yarn featureflags",
|
2019-05-22 02:35:40 +00:00
|
|
|
"lint-ci": "./scripts/circleci/analyze_code.sh && yarn shellcheck",
|
2020-12-07 11:10:46 +00:00
|
|
|
"lint-java": "node ./scripts/lint-java.js",
|
2023-08-09 18:56:44 +00:00
|
|
|
"lint": "eslint .",
|
2022-09-19 19:26:00 +00:00
|
|
|
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
|
2024-01-02 19:46:03 +00:00
|
|
|
"print-packages": "node ./scripts/monorepo/print",
|
2023-08-09 18:56:44 +00:00
|
|
|
"shellcheck": "./scripts/circleci/analyze_scripts.sh",
|
|
|
|
"start": "cd packages/rn-tester && npm run start",
|
2024-06-26 14:59:49 +00:00
|
|
|
"set-version": "node ./scripts/releases/set-version.js",
|
2023-08-09 18:56:44 +00:00
|
|
|
"test-android": "./gradlew :packages:react-native:ReactAndroid:test",
|
2023-08-09 18:56:44 +00:00
|
|
|
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
|
2024-02-07 13:40:26 +00:00
|
|
|
"test-e2e-local-clean": "node ./scripts/release-testing/test-e2e-local-clean.js",
|
|
|
|
"test-e2e-local": "node ./scripts/release-testing/test-e2e-local.js",
|
2022-09-19 19:26:00 +00:00
|
|
|
"test-ios": "./scripts/objc-test.sh test",
|
2023-03-17 12:03:25 +00:00
|
|
|
"test-typescript-offline": "dtslint --localTs node_modules/typescript/lib packages/react-native/types",
|
2023-08-09 18:56:44 +00:00
|
|
|
"test-typescript": "dtslint packages/react-native/types",
|
|
|
|
"test": "jest",
|
2024-02-01 14:02:17 +00:00
|
|
|
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
|
2024-09-16 16:14:54 +00:00
|
|
|
"update-lock": "npx yarn-deduplicate"
|
2015-02-20 04:10:52 +00:00
|
|
|
},
|
2020-08-18 19:07:57 +00:00
|
|
|
"workspaces": [
|
2023-08-18 14:48:56 +00:00
|
|
|
"packages/*",
|
2024-07-19 15:55:19 +00:00
|
|
|
"tools/*",
|
|
|
|
"!packages/helloworld"
|
2020-08-18 19:07:57 +00:00
|
|
|
],
|
2020-08-21 21:56:29 +00:00
|
|
|
"devDependencies": {
|
2024-09-05 14:11:17 +00:00
|
|
|
"@babel/core": "^7.25.2",
|
|
|
|
"@babel/eslint-parser": "^7.25.1",
|
|
|
|
"@babel/generator": "^7.25.0",
|
|
|
|
"@babel/plugin-transform-regenerator": "^7.24.7",
|
|
|
|
"@babel/preset-env": "^7.25.3",
|
|
|
|
"@babel/preset-flow": "^7.24.7",
|
2023-03-17 12:03:25 +00:00
|
|
|
"@definitelytyped/dtslint": "^0.0.127",
|
2023-08-21 23:33:35 +00:00
|
|
|
"@jest/create-cache-key-function": "^29.6.3",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"@pkgjs/parseargs": "^0.11.0",
|
2024-09-12 16:23:23 +00:00
|
|
|
"@react-native/metro-babel-transformer": "0.77.0-main",
|
|
|
|
"@react-native/metro-config": "0.77.0-main",
|
2023-08-14 19:12:10 +00:00
|
|
|
"@tsconfig/node18": "1.0.1",
|
2024-03-25 19:23:16 +00:00
|
|
|
"@types/react": "^18.2.6",
|
2024-03-18 14:46:35 +00:00
|
|
|
"@typescript-eslint/parser": "^7.1.1",
|
2023-08-31 15:34:33 +00:00
|
|
|
"ansi-styles": "^4.2.1",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
2024-10-03 15:20:16 +00:00
|
|
|
"babel-plugin-syntax-hermes-parser": "0.24.0",
|
2024-09-05 14:11:17 +00:00
|
|
|
"babel-plugin-transform-define": "^2.1.4",
|
2023-03-24 23:17:05 +00:00
|
|
|
"babel-plugin-transform-flow-enums": "^0.0.2",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"chalk": "^4.0.0",
|
2023-03-17 12:03:25 +00:00
|
|
|
"clang-format": "^1.8.0",
|
|
|
|
"connect": "^3.6.5",
|
2024-03-15 17:33:20 +00:00
|
|
|
"eslint": "^8.57.0",
|
2023-03-17 12:03:25 +00:00
|
|
|
"eslint-config-prettier": "^8.5.0",
|
|
|
|
"eslint-plugin-babel": "^5.3.1",
|
|
|
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
|
|
"eslint-plugin-ft-flow": "^2.0.1",
|
2024-03-18 14:46:35 +00:00
|
|
|
"eslint-plugin-jest": "^27.9.0",
|
2023-03-17 12:03:25 +00:00
|
|
|
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
|
|
"eslint-plugin-lint": "^1.0.0",
|
|
|
|
"eslint-plugin-prettier": "^4.2.1",
|
|
|
|
"eslint-plugin-react": "^7.30.1",
|
|
|
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
|
|
"eslint-plugin-react-native": "^4.0.0",
|
|
|
|
"eslint-plugin-redundant-undefined": "^0.4.0",
|
|
|
|
"eslint-plugin-relay": "^1.8.3",
|
2024-10-03 15:20:16 +00:00
|
|
|
"flow-api-translator": "0.24.0",
|
2024-11-14 22:05:17 +00:00
|
|
|
"flow-bin": "^0.253.0",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"glob": "^7.1.1",
|
2024-10-03 15:20:16 +00:00
|
|
|
"hermes-eslint": "0.24.0",
|
|
|
|
"hermes-transform": "0.24.0",
|
2023-03-17 12:03:25 +00:00
|
|
|
"inquirer": "^7.1.0",
|
2023-08-21 23:33:35 +00:00
|
|
|
"jest": "^29.6.3",
|
2023-03-17 12:03:25 +00:00
|
|
|
"jest-junit": "^10.0.0",
|
|
|
|
"jscodeshift": "^0.14.0",
|
2024-10-14 17:08:36 +00:00
|
|
|
"metro-babel-register": "^0.81.0",
|
|
|
|
"metro-memory-fs": "^0.81.0",
|
|
|
|
"metro-transform-plugins": "^0.81.0",
|
Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718
> NOTE: Replaces https://github.com/facebook/react-native/pull/38240
## Context
RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641
## Changes
To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.
The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:
- `yarn build` — Builds all configured packages. Functionally, this:
- Outputs a `dist/` directory with built files.
- Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)
Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.
```
const buildConfig /*: BuildConfig */ = {
// The packages to include for build and their build options
packages: {
'dev-middleware': {target: 'node'},
},
};
```
For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.
{F1043312771}
**Differences from the Metro setup**
- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.
## Current integration points
- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.
**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).
### Alternative designs
**Per-package config file**
Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).
```
"buildConfig": {
"type": "node"
},
```
This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.
**Rollup**
More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).
**Lerna and Nx**
- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D47760330
fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 11:42:30 +00:00
|
|
|
"micromatch": "^4.0.4",
|
2024-01-24 23:39:06 +00:00
|
|
|
"node-fetch": "^2.2.0",
|
2023-08-07 16:17:43 +00:00
|
|
|
"nullthrows": "^1.1.1",
|
2023-06-07 03:06:25 +00:00
|
|
|
"prettier": "2.8.8",
|
2024-10-03 15:20:16 +00:00
|
|
|
"prettier-plugin-hermes-parser": "0.24.0",
|
2024-11-08 16:27:37 +00:00
|
|
|
"react": "18.3.1",
|
|
|
|
"react-test-renderer": "18.3.1",
|
2023-08-31 15:34:33 +00:00
|
|
|
"rimraf": "^3.0.2",
|
2023-03-17 12:03:25 +00:00
|
|
|
"shelljs": "^0.8.5",
|
|
|
|
"signedsource": "^1.0.0",
|
2023-08-31 15:34:33 +00:00
|
|
|
"supports-color": "^7.1.0",
|
2023-05-10 09:55:42 +00:00
|
|
|
"typescript": "5.0.4",
|
2024-06-26 00:30:10 +00:00
|
|
|
"ws": "^6.2.3"
|
2024-06-17 09:59:55 +00:00
|
|
|
},
|
|
|
|
"resolutions": {
|
2024-11-08 16:27:37 +00:00
|
|
|
"react-is": "18.3.1"
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
2018-01-12 17:09:04 +00:00
|
|
|
}
|