Skip to content

Latest commit

 

History

History
82 lines (57 loc) · 2.68 KB

npm.md

File metadata and controls

82 lines (57 loc) · 2.68 KB

Publish to npm

With a package.json in the current directory, release-it will let npm bump the version in package.json (and package-lock.json if present), and publish to the npm registry.

Skip publish

To bump the version in package.json with the release, but not publish to the registry:

{
  "npm": {
    "publish": false
  }
}

In case there is a package.json, but no npm-related tasks should be executed, use "npm": false (or --no-npm).

Ignore version

To ignore the version from package.json, (and use the latest Git tag instead):

{
  "npm": {
    "ignoreVersion": true
  }
}

Or --npm.ignoreVersion from the command line.

Tags

Use e.g. --npm.tag=beta to tag the package in the npm repository. With the --preRelease=beta shorthand, the npm dist-tag will have the same value (unless --npm.tag is used to override this). The default tag is "latest".

For a pre-release, the default tag is "next". The tag will be derived from the pre-release version (e.g. version 2.0.0-alpha.3 will result in tag "alpha"), unless overridden by setting npm.tag.

Public scoped packages

A scoped package (e.g. @user/package) is either public or private. To publish scoped packages, make sure this is in package.json:

{
  "publishConfig": {
    "access": "public"
  }
}

By default, npm publish will publish a scoped package as private (requires paid account).

Two-factor authentication

In case two-factor authentication (2FA) is enabled for the package, release-it will ask for the one-time password (OTP).

The OTP can be provided from the command line (--npm.otp=123456). However, providing the OTP without a prompt basically defeats the purpose of 2FA (also, the OTP expires after a short period).

Publish path

Use npm.publishPath to publish only a specific folder. For example, set npm.publishPath to "dist". The default value is the current (root) folder (".").

Monorepos

Monorepos do not require extra configuration, but release-it handles only one package at a time. Also see how Git steps can be skipped. This is useful if, for instance, tagging the Git repo should be skipped.

Miscellaneous