napi-rs/cli
2021-09-15 00:13:08 +08:00
..
src fix(cli): cargo config path and ci template in new command 2021-09-15 00:13:08 +08:00
.npmignore
CHANGELOG.md chore: publish 2021-09-02 23:35:56 +08:00
LICENSE
package.json Merge pull request #741 from napi-rs/dependabot/npm_and_yarn/types/inquirer-8.1.1 2021-09-14 16:57:07 +08:00
README.md

@napi-rs/cli

Download Install size chat

Cli tools for napi-rs

Commands

Debug mode

DEBUG="napi:*" napi [command]

napi build

Build command. Build rust codes and copy the dynamic lib binary file to the dist dir.

--platform

default false

Append platform-arch-[abi] name to dist file. eg: index.darwin-x64.node.

--release

default false

Is release build. This flag will be passed to Cargo directly.

--features

default ''

Cargo features, passthrough to cargo build command.

--config,-c

default package.json

napi-rs config file name. napi-rs config example :

{
  "name": "@native-binding/fib",
  "version": "0.1.0",
  "napi": {
    "name": "fib", // binary name
    "triples": {
      "defaults": true, // default true, if this value is true, will build `x86_64-pc-windows-msvc`, `x86_64-apple-darwin` and `x86_64-unknown-linux-gnu`
      "addition": [
        "x86_64-unknown-linux-musl",
        "x86_64-unknown-freebsd",
        "aarch64-unknown-linux-gnu"
      ]
    }
  }
}

--cargo-name

default undefined

If not set, cli will read the package.name field in Cargo.toml under process.cwd(). The - in the name will be replaced with _.

--target

default undefined

You can also define this value using the RUST_TARGET environment variable.

This value will be passed to Cargo build command directly. eg: napi build --target x86_64-unknown-linux-musl

--cargo-flags

default undefined

Other flags you want pass to Cargo build.

--cargo-cwd

default undefined

This flag can be used to build binaries that are not in the current directory. The path that is passed to this flag should be relative to the current directory.

napi artifacts

Copy artifact files in Github actions.