1. @napi-rs/cli
Cli tools for napi-rs
@napi-rs/cli
Package: @napi-rs/cli
Created by: napi-rs
Last modified: Mon, 06 May 2024 10:47:39 GMT
Version: 2.18.3
License: MIT
Downloads: 175,645
Repository: https://github.com/napi-rs/napi-rs

Install

npm install @napi-rs/cli
yarn add @napi-rs/cli

@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`
      "additional": [
        "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

Note you should have rustup installed if omit the --target flag. The @napi-rs/cli will try to find the default target on your system via rustup if no --target specified.

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.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code