Docs
CLI
New

New

Create a new project with pre-configured boilerplate

💡

The napi new command requires git to be installed, and it will clone the repository from the GitHub, be sure you can access the GitHub.

Usage

# CLI
napi new <path> [--options]
// Programmatically
import { NapiCli } from '@napi-rs/cli'
 
new NapiCli().new({
  // options
})

Options

OptionsCLI Optionstyperequireddefaultdescription
--help,-hget help
path<path>falsestringThe path where the NAPI-RS project will be created.
name--name,-nstringfalseThe name of the project, default to the name of the directory if not provided
minNodeApiVersion--min-node-api,-vnumberfalse4The minimum Node-API version to support
packageManager--package-managerstringfalseyarnThe package manager to use. Only support yarn 4.x for now.
license--license,-lstringfalseMITLicense for open-sourced project
targets--targets,-tstring[]false[]All targets the crate will be compiled for.
enableDefaultTargets--enable-default-targetsbooleanfalsetrueWhether enable default targets
enableAllTargets--enable-all-targetsbooleanfalsefalseWhether enable all targets
enableTypeDef--enable-type-defbooleanfalsetrueWhether enable the type-def feature for typescript definitions auto-generation
enableGithubActions--enable-github-actionsbooleanfalsetrueWhether generate preconfigured GitHub Actions workflow
testFramework--test-frameworkstringfalseavaThe JavaScript test framework to use, only support ava for now
dryRun--dry-runbooleanfalsefalseWhether to run the command in dry-run mode