|
2 | 2 |
|
3 | 3 | Calling Gradle or manually calling a script might be hard to remember and it requires a lot of cerimony. |
4 | 4 |
|
5 | | -To simplify it, we created a CLI tool that can help you running those tasks: the **Codegen** cli. |
6 | | - |
7 | | -```shell |
8 | | -npx react-native codegen [--path path] [--platform string] [--outputPath path] |
| 5 | +To simplify it, we created a CLI tool that can help you running those tasks: the **Codegen** cli. This command runs [react-native-codegen](https://www.npmjs.com/package/react-native-codegen) for your project. The following options are available: |
| 6 | + |
| 7 | +```sh |
| 8 | +npx @react-native-community/cli codegen --help |
| 9 | +Usage: rnc-cli codegen [options] |
| 10 | + |
| 11 | +Options: |
| 12 | + --verbose Increase logging verbosity |
| 13 | + --path <path> Path to the React Native project root. (default: "/Users/MyUsername/projects/my-app") |
| 14 | + --platform <string> Target platform. Supported values: "android", "ios", "all". (default: "all") |
| 15 | + --outputPath <path> Path where generated artifacts will be output to. |
| 16 | + -h, --help display help for command |
9 | 17 | ``` |
10 | 18 |
|
11 | | -This command runs [react-native-codegen](https://www.npmjs.com/package/react-native-codegen) for your project. The following options are available: |
12 | | - |
13 | | -- `--path` - Path to `package.json`. The default path is the current working directory. |
14 | | -- `--platform` - Target platform. Supported values: `android`, `ios`, `all`. The default value is `all`. |
15 | | -- `--outputPath` - Output path. The default value is the value defined in `codegenConfig.outputDir`. |
16 | | - |
17 | 19 | ## Examples |
18 | 20 |
|
19 | 21 | - Read `package.json` from the current working directory, generate code based on its codegenConfig. |
20 | 22 |
|
21 | 23 | ```shell |
22 | | -npx react-native codegen |
| 24 | +npx @react-native-codegen/cli codegen |
23 | 25 | ``` |
24 | 26 |
|
25 | 27 | - Read `package.json` from the current working directory, generate iOS code in the location defined in the codegenConfig. |
26 | 28 |
|
27 | 29 | ```shell |
28 | | -npx react-native codegen --platform ios |
| 30 | +npx @react-native-codegen/cli codegen --platform ios |
29 | 31 | ``` |
30 | 32 |
|
31 | 33 | - Read `package.json` from `third-party/some-library`, generate Android code in `third-party/some-library/android/generated`. |
32 | 34 |
|
33 | 35 | ```shell |
34 | | -npx react-native codegen \ |
| 36 | +npx @react-native-codegen/cli codegen \ |
35 | 37 | --path third-party/some-library \ |
36 | 38 | --platform android \ |
37 | 39 | --outputPath third-party/some-library/android/generated |
|
0 commit comments