Docs
CLI
Prepublish

Pre Publish

Update package.json and copy addons into per platform packages

Usage

# CLI
napi pre-publish [--options]
// Programmatically
import { NapiCli } from '@napi-rs/cli'
 
new NapiCli().prePublish({
  // options
})

Options

OptionsCLI Optionstyperequireddefaultdescription
--help,-hget help
cwd--cwdstringfalseprocess.cwd()The working directory of where napi command will be executed in, all other paths options are relative to this path
configPath--config-path,-cstringfalsePath to napi config json file
packageJsonPath--package-json-pathstringfalsepackage.jsonPath to package.json
npmDir--npm-dir,-pstringfalsenpmPath to the folder where the npm packages put
tagStyle--tag-style,--tagstyle,-tnpm | lernafalselernagit tag style, npm or lerna
ghRelease--gh-releasebooleanfalsetrueWhether create GitHub release
ghReleaseName--gh-release-namestringfalseGitHub release name
ghReleaseId--gh-release-idstringfalseExisting GitHub release id
dryRun--dry-runbooleanfalsefalseDry run without touching file system
💡

This command is usually used in prepublishOnly lifecycle scripts in package.json.

package.json
"scripts": {
  "prepublishOnly": "napi prepublish -t npm"
}