Skip to content

Commit 80c84d0

Browse files
authored
breaking: Delete source for cli-plugin-metro, remove from builtin commands (#2055)
1 parent 2204d35 commit 80c84d0

36 files changed

+176
-1832
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ _Note: you must use the `--watchFolders` flag with the `start` command when test
2121

2222
Because of a modular design of the CLI, we recommend developing using symbolic links to its packages. This way you can use it seamlessly in the tested project, as you'd use the locally installed CLI. Here's what you need to run in the terminal:
2323

24+
> [!NOTE]
25+
> `@react-native-community/cli-plugin-metro` has been relocated as [`@react-native/community-cli-plugin`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin). To make new contributions to this package, please open a PR in the [React Native repo](https://github.com/facebook/react-native) ([contributing guide](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#contributing)).
26+
2427
#### yarn v1
2528

2629
```sh
@@ -32,7 +35,7 @@ And then:
3235

3336
```sh
3437
cd /my/new/react-native/project/
35-
yarn link "@react-native-community/cli-platform-ios" "@react-native-community/cli-platform-android" "@react-native-community/cli" "@react-native-community/cli-server-api" "@react-native-community/cli-types" "@react-native-community/cli-tools" "@react-native-community/cli-debugger-ui" "@react-native-community/cli-hermes" "@react-native-community/cli-plugin-metro" "@react-native-community/cli-clean" "@react-native-community/cli-doctor" "@react-native-community/cli-config"
38+
yarn link "@react-native-community/cli-platform-ios" "@react-native-community/cli-platform-android" "@react-native-community/cli" "@react-native-community/cli-server-api" "@react-native-community/cli-types" "@react-native-community/cli-tools" "@react-native-community/cli-debugger-ui" "@react-native-community/cli-hermes" "@react-native-community/cli-clean" "@react-native-community/cli-doctor" "@react-native-community/cli-config"
3639
```
3740

3841
Once you're done with testing and you'd like to get back to regular setup, run `yarn unlink` instead of `yarn link` from above command. Then `yarn install --force`.

docs/commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
React Native CLI comes with following commands:
44

5-
- [`bundle`](/packages/cli-plugin-metro/README.md#bundle)
5+
- [`bundle`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#bundle)
66
- [`clean`](/packages/cli-clean/README.md#clean)
77
- [`config`](/packages/cli-config/README.md#config)
88
- [`doctor`](/packages/cli-doctor/README.md#doctor)
99
- [`init`](#init)
1010
- [`info`](/packages/cli-doctor/README.md#info)
1111
- [`log-android`](/packages/cli-platform-android/README.md#log-android)
1212
- [`log-ios`](/packages/cli-platform-ios/README.md#log-ios)
13-
- [`ram-bundle`](/packages/cli-plugin-metro/README.md#ram-bundle)
13+
- [`ram-bundle`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#ram-bundle)
1414
- [`run-android`](/packages/cli-platform-android/README.md#run-android)
1515
- [`build-android`](/packages/cli-platform-android/README.md#build-android)
1616
- [`run-ios`](/packages/cli-platform-ios/README.md#run-ios)
1717
- [`build-ios`](/packages/cli-platform-ios/README.md#build-ios)
18-
- [`start`](/packages/cli-plugin-metro/README.md#start)
18+
- [`start`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#start)
1919
- [`upgrade`](#upgrade)
2020
- [`profile-hermes`](/packages/cli-hermes/README.md#profile-hermes)
2121

packages/cli-doctor/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@
1010
{"path": "../cli-config"},
1111
{"path": "../cli-platform-android"},
1212
{"path": "../cli-platform-ios"},
13-
{"path": "../cli-plugin-metro"},
1413
]
1514
}

packages/cli-platform-android/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
"references": [
88
{"path": "../cli-tools"},
99
{"path": "../cli-types"},
10-
{"path": "../cli-plugin-metro"}
1110
]
1211
}

packages/cli-plugin-metro/CHANGELOG.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/cli-plugin-metro/README.md

Lines changed: 5 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -1,206 +1,7 @@
11
# @react-native-community/cli-plugin-metro
22

3-
This package is part of the [React Native CLI](../../README.md).
4-
It contains commands for managing the Metro bundler.
5-
6-
## Installation
7-
8-
```sh
9-
yarn add @react-native-community/cli-plugin-metro
10-
```
11-
12-
## Commands
13-
14-
### `start`
15-
16-
Usage:
17-
18-
```sh
19-
npx react-native start [option]
20-
```
21-
22-
Starts the server that communicates with connected devices
23-
24-
#### Options
25-
26-
#### `--port <number>`
27-
28-
Specify port to listen on
29-
30-
#### `--projectRoot <path>`
31-
32-
Path to a custom project root
33-
34-
#### `--watchFolders <list>`
35-
36-
Specify any additional folders to be added to the watch list
37-
38-
#### `--assetPlugins <list>`
39-
40-
Specify any additional asset plugins to be used by the packager by full filepath
41-
42-
#### `--sourceExts <list>`
43-
44-
Specify any additional source extensions to be used by the packager
45-
46-
#### `--max-workers <number>`
47-
48-
Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine
49-
50-
#### `--transformer <string>`
51-
52-
Specify a custom transformer to be used
53-
54-
#### `--reset-cache, --resetCache`
55-
56-
Removes cached files
57-
58-
#### `--custom-log-reporter-path, --customLogReporterPath <string>`
59-
60-
Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter
61-
62-
#### `--https`
63-
64-
Enables https connections to the server
65-
66-
#### `--key <path>`
67-
68-
Path to custom SSL key
69-
70-
#### `--cert <path>`
71-
72-
Path to custom SSL cert
73-
74-
#### `--config <string>`
75-
76-
Path to the CLI configuration file
77-
78-
#### `--no-interactive`
79-
80-
Disables interactive mode
81-
82-
### `bundle`
83-
84-
Usage:
85-
86-
```sh
87-
npx react-native bundle <flag>
88-
```
89-
90-
Builds the JavaScript bundle for offline use.
91-
92-
#### `--entry-file <path>`
93-
94-
Path to the root JS file, either absolute or relative to JS root.
95-
96-
#### `--platform <string>`
97-
98-
> default: ios
99-
100-
Either "ios" or "android".
101-
102-
#### `--transformer <string>`
103-
104-
Specify a custom transformer to be used.
105-
106-
#### `--dev [boolean]`
107-
108-
> default: true
109-
110-
If false, warnings are disabled and the bundle is minified.
111-
112-
#### `--minify [boolean]`
113-
114-
Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.
115-
116-
#### `--bundle-output <string>`
117-
118-
File name where to store the resulting bundle, ex. `/tmp/groups.bundle`.
119-
120-
If you are planning on building a debug APK, that will run without the packager, by invoking `./gradlew assembleDebug` you can simply set `bundleInDebug: true` in your app/build.gradle file, inside the `project.ext.react` map.
121-
122-
<details>
123-
Alternatively if you want to run <code>npx react-native bundle</code> manually and then create the APK with <code>./gradlew assembleDebug</code> you have to make sure to put the bundle into the right directory and give it the right name, so that gradle can find it.
124-
125-
For react-native versions 0.57 and above the bundle output path should be:
126-
<code>android/app/build/generated/assets/react/debug/index.android.js</code>
127-
128-
To find out the correct path for previous react-native versions, take a look at the <code>react.gradle</code> file here: <https://github.com/facebook/react-native/blob/0.57-stable/react.gradle> or inside your <code>node_modules/react-native</code> directory.
129-
130-
The expected path for the js bundle can be found on the line that starts with <code>jsBundleDir = </code>.
131-
132-
</details>
133-
134-
#### `--bundle-encoding <string>`
135-
136-
> default: utf8
137-
138-
Encoding the bundle should be written in (<https://nodejs.org/api/buffer.html#buffer_buffer>).
139-
140-
#### `--max-workers <number>`
141-
142-
Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.
143-
144-
#### `--sourcemap-output <string>`
145-
146-
File name where to store the sourcemap file for resulting bundle, ex. `/tmp/groups.map`.
147-
148-
#### `--sourcemap-sources-root <string>`
149-
150-
Path to make sourcemap sources entries relative to, ex. `/root/dir`.
151-
152-
#### `--sourcemap-use-absolute-path`
153-
154-
> default: false
155-
156-
Report SourceMapURL using its full path.
157-
158-
#### `--assets-dest <string>`
159-
160-
Directory name where to store assets referenced in the bundle.
161-
162-
If you are planning on building a debug APK that will run without the packager, see ([--bundle-output](https://github.com/react-native-community/cli/blob/main/packages/cli-plugin-metro/README.md#--bundle-output-string))
163-
164-
<details>
165-
Alternatively if you want to run <code>npx react-native bundle</code> manually and then create the APK with <code>./gradlew assembleDebug</code> you have to make sure to put the assets into the right directory, so that gradle can find them.
166-
167-
For react-native versions 0.57 and above the <code>--assets-dest</code> path should be:
168-
<code>android/app/build/generated/res/react/debug</code>
169-
170-
The expected path for the assets can be found in the react.gradle file on the line that starts with <code>resourcesDir =</code>
171-
172-
</details>
173-
174-
#### `--reset-cache`
175-
176-
> default: false
177-
178-
Removes cached files.
179-
180-
#### `--read-global-cache`
181-
182-
> default: false
183-
184-
Try to fetch transformed JS code from the global cache, if configured.
185-
186-
#### `--config <string>`
187-
188-
Path to the CLI configuration file.
189-
190-
### `ram-bundle`
191-
192-
Usage:
193-
194-
```sh
195-
npx react-native ram-bundle [options]
196-
```
197-
198-
Builds JavaScript as a "Random Access Module" bundle for offline use.
199-
200-
#### Options
201-
202-
Accepts all of [bundle commands](#bundle) and following:
203-
204-
#### `--indexed-ram-bundle`
205-
206-
Force the "Indexed RAM" bundle file format, even when building for Android.
3+
> **[Removed]**
4+
>
5+
> This package is now relocated as [`@react-native/community-cli-plugin`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin).
6+
>
7+
> To make new contributions to this package, please open a PR in the [React Native repo](https://github.com/facebook/react-native) ([contributing guide](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#contributing)).

packages/cli-plugin-metro/package.json

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
11
{
22
"name": "@react-native-community/cli-plugin-metro",
33
"version": "12.0.0-alpha.11",
4+
"description": "[Removed since 12.0.0-alpha.12]",
45
"license": "MIT",
5-
"main": "build/index.js",
66
"publishConfig": {
77
"access": "public"
88
},
9-
"dependencies": {
10-
"@react-native-community/cli-server-api": "12.0.0-alpha.11",
11-
"@react-native-community/cli-tools": "12.0.0-alpha.11",
12-
"chalk": "^4.1.2",
13-
"execa": "^5.0.0",
14-
"metro": "0.78.0",
15-
"metro-config": "0.78.0",
16-
"metro-core": "0.78.0",
17-
"readline": "^1.3.0"
18-
},
19-
"devDependencies": {
20-
"@react-native-community/cli-types": "12.0.0-alpha.11",
21-
"metro-resolver": "0.78.0"
22-
},
23-
"files": [
24-
"build",
25-
"!*.map"
26-
],
9+
"dependencies": {},
2710
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro",
2811
"repository": {
2912
"type": "git",

packages/cli-plugin-metro/src/commands/bundle/__mocks__/sign.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/cli-plugin-metro/src/commands/bundle/__tests__/filterPlatformAssetScales-test.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)