18aaf74700330bdc92a30347b04c8ea7f0079949
[platform/upstream/nodejs.git] / deps / npm / doc / cli / npm-version.md
1 npm-version(1) -- Bump a package version
2 ========================================
3
4 ## SYNOPSIS
5
6     npm version [<newversion> | major | minor | patch | build]
7
8 ## DESCRIPTION
9
10 Run this in a package directory to bump the version and write the new
11 data back to the package.json file.
12
13 The `newversion` argument should be a valid semver string, *or* a valid
14 second argument to semver.inc (one of "build", "patch", "minor", or
15 "major"). In the second case, the existing version will be incremented
16 by 1 in the specified field.
17
18 If run in a git repo, it will also create a version commit and tag, and
19 fail if the repo is not clean.
20
21 If supplied with `--message` (shorthand: `-m`) config option, npm will
22 use it as a commit message when creating a version commit.  If the
23 `message` config contains `%s` then that will be replaced with the
24 resulting version number.  For example:
25
26     npm version patch -m "Upgrade to %s for reasons"
27
28 If the `sign-git-tag` config is set, then the tag will be signed using
29 the `-s` flag to git.  Note that you must have a default GPG key set up
30 in your git config for this to work properly.  For example:
31
32     $ npm config set sign-git-tag true
33     $ npm version patch
34
35     You need a passphrase to unlock the secret key for
36     user: "isaacs (http://blog.izs.me/) <i@izs.me>"
37     2048-bit RSA key, ID 6C481CF6, created 2010-08-31
38
39     Enter passphrase:
40
41 ## SEE ALSO
42
43 * npm-init(1)
44 * package.json(5)
45 * semver(7)