0.16.26 • Published 21 days ago

@rnx-kit/cli v0.16.26

Weekly downloads
-
License
MIT
Repository
github
Last release
21 days ago

@rnx-kit/cli

Build npm version

Command-line interface for working with packages in your repo.

Bundle a Package

Bundle a package using Metro. The bundling process uses optional configuration parameters and command-line overrides.

The command react-native rnx-bundle is meant to be a drop-in replacement for react-native bundle. If rnx-bundle ever becomes widely accepted, we will work on upstreaming it to @react-native-community/cli, along with supporting libraries for package configuration and Metro plugins.

Example Commands

yarn react-native rnx-bundle
yarn react-native rnx-bundle       \
    --entry-file src/index.ts      \
    --bundle-output main.jsbundle  \
    --platform ios                 \
    --dev false                    \
    --minify true

Example Configuration (Optional)

{
  "rnx-kit": {
    "bundle": {
      "entryFile": "entry.js",
      "assetsDest": "dist",
      "plugins": [
        "@rnx-kit/metro-plugin-cyclic-dependencies-detector",
        [
          "@rnx-kit/metro-plugin-duplicates-checker",
          { "ignoredModules": ["react-is"] }
        ],
        "@rnx-kit/metro-plugin-typescript"
      ],
      "targets": ["ios", "android", "windows", "macos"],
      "platforms": {
        "android": {
          "assetsDest": "dist/res"
        },
        "macos": {
          "plugins": [
            "@rnx-kit/metro-plugin-cyclic-dependencies-detector",
            [
              "@rnx-kit/metro-plugin-duplicates-checker",
              { "ignoredModules": ["react-is"] }
            ]
          ]
        }
      }
    }
  }
}

Bundle Defaults

When certain parameters aren't specified in configuration or on the command-line, they are explicitly set to default values.

ParameterDefault Value
entryFile"index.js"
bundleOutput"index.<platform>.bundle" (Windows, Android) or "index.<platform>.jsbundle" (iOS, macOS)
hermesfalse
treeShakefalse
plugins["@rnx-kit/metro-plugin-cyclic-dependencies-detector", "@rnx-kit/metro-plugin-duplicates-checker", "@rnx-kit/metro-plugin-typescript"]

Other parameters have implicit defaults, buried deep in Metro or its dependencies.

Command-Line Overrides

OverrideDescription
--id idTarget bundle definition. This is only needed when the rnx-kit configuration has multiple bundle definitions.
--entry-file filePath to the root JavaScript or TypeScript file, either absolute or relative to the package.
--platform ios | android | windows | win32 | macosTarget platform. When not given, all platforms in the rnx-kit configuration are bundled.
--dev booleanIf false, warnings are disabled and the bundle is minified (default: true).
--minify booleanControls whether or not the bundle is minified. Disabling minification is useful for test builds.
--bundle-output pathPath to the output bundle file, either absolute or relative to the package.
--bundle-encoding utf8 | utf16le | asciiCharacter encoding to use when writing the bundle file.
--max-workers numberSpecifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.
--sourcemap-output stringPath where the bundle source map is written, either absolute or relative to the package.
--sourcemap-sources-root stringPath to use when relativizing file entries in the bundle source map.
--assets-dest pathPath where bundle assets like images are written, either absolute or relative to the package. If not given, assets are ignored.
--tree-shake booleanEnable tree shaking to remove unused code and reduce the bundle size.
--reset-cacheReset the Metro cache.
--config stringPath to the Metro configuration file.
-h, --helpShow usage information.

Start a Bundle Server

Start a bundle server for a package using Metro. The bundle server uses optional configuration parameters and command-line overrides.

The command react-native rnx-start is meant to be a drop-in replacement for react-native start. If rnx-start ever becomes widely accepted, we will work on upstreaming it to @react-native-community/cli, along with supporting libraries for package configuration and Metro plugins.

Example Commands

yarn react-native rnx-start
yarn react-native rnx-start --host localhost --port 8812

Example Configuration

{
  "rnx-kit": {
    "server": {
      "projectRoot": "src",
      "plugins": [
        "@rnx-kit/metro-plugin-cyclic-dependencies-detector",
        [
          "@rnx-kit/metro-plugin-duplicates-checker",
          {
            "ignoredModules": ["react-is"],
            "throwOnError": false
          }
        ],
        "@rnx-kit/metro-plugin-typescript"
      ]
    }
  }
}

Server Defaults

If the server configuration is not defined, it is implicitly created at runtime from the bundle configuration (or its defaults).

Command-Line Overrides

OverrideDescription
--port numberHost port to use when listening for incoming server requests.
--host stringHost name or address to bind when listening for incoming server requests. When not given, requests from all addresses are accepted.
--projectRoot pathPath to the root of your react-native project. The bundle server uses this root path to resolve all web requests.
--watchFolders pathsAdditional folders which will be added to the file-watch list. Comma-separated. By default, Metro watches all project files.
--assetPlugins listAdditional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin module names or absolute paths to plugin packages.
--sourceExts listAdditional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.
--max-workers numberSpecifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.
--reset-cacheReset the Metro cache.
--custom-log-reporter-path stringPath to a JavaScript file which exports a Metro TerminalReporter function. This replaces the default reporter, which writes all messages to the Metro console.
--httpsUse a secure (https) web server. When not specified, an insecure (http) web server is used.
--key pathPath to a custom SSL private key file to use for secure (https) communication.
--cert pathPath to a custom SSL certificate file to use for secure (https) communication.
--config stringPath to the Metro configuration file.
--no-interactiveDisables interactive mode.
--idSpecify which bundle configuration to use if server configuration is missing.

Manage Dependencies

Manage dependencies within a repository and across many repositories.

$ yarn react-native rnx-align-deps [options] [/path/to/package.json]

Refer to @rnx-kit/align-deps for details.

Generate a Third-Party Notice for a Package

Generate a 3rd-party notice, which is an aggregation of all the LICENSE files from your package's dependencies.

NOTE: A 3rd-party notice is a legal document. You are solely responsble for its content, even if you use this command to assist you in generating it. You should consult with an attorney to ensure your notice meets all legal requirements.

$ yarn react-native rnx-write-third-party-notices [options]
OptionDescription
--root-path pathThe root of the repo. This is the starting point for finding each module in the source map dependency graph.
--source-map-file fileThe source map file associated with the package's entry file. This source map eventually leads to all package dependencies and their licenses.
--jsonFormat the 3rd-party notice file as JSON instead of text.
--output-file fileThe path to use when writing the 3rd-party notice file.
--ignore-scopes stringComma-separated list of npm scopes to ignore when traversing the source map dependency graph.
--ignore-modules stringComma-separated list of modules to ignore when traversing the source map dependency graph.
--preamble-text stringA string to prepend to the start of the 3rd-party notice.
--additional-text pathA string to append to the end of the 3rd-party notice.

Clean a React Native Project

Deprecated: This command was upstreamed to @react-native-community/cli. As of v8.0, you can use react-native clean instead.

Cleans your project by removing React Native related caches and modules.

$ yarn react-native rnx-clean [options]
OptionDescription
--include stringComma-separated flag of caches to clear e.g npm,yarn . When not specified , only non-platform specific caches are cleared. android,cocoapods,npm,metro,watchman,yarn
--project-root pathRoot path to your React Native project. When not specified, defaults to current working directory
0.16.26

21 days ago

0.16.25

29 days ago

0.16.24

2 months ago

0.16.23

2 months ago

0.16.22

4 months ago

0.16.21

5 months ago

0.16.10

9 months ago

0.16.11

9 months ago

0.16.14

8 months ago

0.16.15

8 months ago

0.16.12

9 months ago

0.16.13

9 months ago

0.16.18

7 months ago

0.16.19

6 months ago

0.16.16

8 months ago

0.16.17

7 months ago

0.16.20

6 months ago

0.16.9

1 year ago

0.16.4

1 year ago

0.16.5

1 year ago

0.16.6

1 year ago

0.16.7

1 year ago

0.16.8

1 year ago

0.16.3

1 year ago

0.15.4

1 year ago

0.15.1

1 year ago

0.15.2

1 year ago

0.15.3

1 year ago

0.16.0

1 year ago

0.16.1

1 year ago

0.16.2

1 year ago

0.14.10

1 year ago

0.14.9

2 years ago

0.15.0

1 year ago

0.14.5

2 years ago

0.14.6

2 years ago

0.14.7

2 years ago

0.14.8

2 years ago

0.14.3

2 years ago

0.14.4

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.14.2

2 years ago

0.12.7

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.4

2 years ago

0.12.5

2 years ago

0.12.6

2 years ago

0.11.2

2 years ago

0.10.0

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.9.56

2 years ago

0.9.57

2 years ago

0.9.58

2 years ago

0.9.52

2 years ago

0.9.53

2 years ago

0.9.54

2 years ago

0.9.55

2 years ago

0.9.50

2 years ago

0.9.51

2 years ago

0.9.46

2 years ago

0.9.47

2 years ago

0.9.48

2 years ago

0.9.49

2 years ago

0.9.45

3 years ago

0.9.41

3 years ago

0.9.42

3 years ago

0.9.43

3 years ago

0.9.44

3 years ago

0.9.40

3 years ago

0.9.35

3 years ago

0.9.36

3 years ago

0.9.37

3 years ago

0.9.38

3 years ago

0.9.39

3 years ago

0.9.34

3 years ago

0.9.32

3 years ago

0.9.33

3 years ago

0.9.30

3 years ago

0.9.31

3 years ago

0.9.27

3 years ago

0.9.28

3 years ago

0.9.29

3 years ago

0.9.26

3 years ago

0.9.25

3 years ago

0.9.23

3 years ago

0.9.24

3 years ago

0.9.21

3 years ago

0.9.22

3 years ago

0.9.12

3 years ago

0.9.13

3 years ago

0.9.14

3 years ago

0.9.15

3 years ago

0.9.10

3 years ago

0.9.11

3 years ago

0.9.16

3 years ago

0.9.17

3 years ago

0.9.18

3 years ago

0.9.19

3 years ago

0.9.20

3 years ago

0.9.9

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.2

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.8.0

3 years ago

0.6.7

3 years ago

0.6.8

3 years ago

0.6.6

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.5.36

3 years ago

0.5.34

3 years ago

0.5.35

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.32

3 years ago

0.5.33

3 years ago

0.5.31

3 years ago

0.5.30

3 years ago

0.5.29

3 years ago

0.5.28

3 years ago

0.5.27

3 years ago

0.5.26

3 years ago

0.5.25

3 years ago

0.5.23

3 years ago

0.5.24

3 years ago

0.5.22

3 years ago

0.5.21

3 years ago

0.5.20

3 years ago

0.5.19

3 years ago

0.5.18

3 years ago

0.5.17

3 years ago

0.5.10

3 years ago

0.5.11

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.5.16

3 years ago

0.5.14

3 years ago

0.5.15

3 years ago

0.5.12

3 years ago

0.5.13

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.4.4

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.3.2

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.5.2

3 years ago

0.4.3

3 years ago

0.5.1

3 years ago

0.4.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago