3 <title>npm-version</title>
4 <meta http-equiv="content-type" value="text/html;utf-8">
5 <link rel="stylesheet" type="text/css" href="../../static/style.css">
9 <h1><a href="../cli/npm-version.html">npm-version</a></h1> <p>Bump a package version</p>
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
13 <pre><code>npm version [<newversion> | major | minor | patch | build]</code></pre>
15 <h2 id="DESCRIPTION">DESCRIPTION</h2>
17 <p>Run this in a package directory to bump the version and write the new
18 data back to the package.json file.</p>
20 <p>The <code>newversion</code> argument should be a valid semver string, <em>or</em> a valid
21 second argument to semver.inc (one of "build", "patch", "minor", or
22 "major"). In the second case, the existing version will be incremented
23 by 1 in the specified field.</p>
25 <p>If run in a git repo, it will also create a version commit and tag, and
26 fail if the repo is not clean.</p>
28 <p>If supplied with <code>--message</code> (shorthand: <code>-m</code>) config option, npm will
29 use it as a commit message when creating a version commit. If the
30 <code>message</code> config contains <code>%s</code> then that will be replaced with the
31 resulting version number. For example:</p>
33 <pre><code>npm version patch -m "Upgrade to %s for reasons"</code></pre>
35 <p>If the <code>sign-git-tag</code> config is set, then the tag will be signed using
36 the <code>-s</code> flag to git. Note that you must have a default GPG key set up
37 in your git config for this to work properly. For example:</p>
39 <pre><code>$ npm config set sign-git-tag true
42 You need a passphrase to unlock the secret key for
43 user: "isaacs (http://blog.izs.me/) <i@izs.me>"
44 2048-bit RSA key, ID 6C481CF6, created 2010-08-31
46 Enter passphrase:</code></pre>
48 <h2 id="SEE-ALSO">SEE ALSO</h2>
50 <ul><li><a href="../cli/npm-init.html">npm-init(1)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../misc/semver.html">semver(7)</a></li></ul>
52 <p id="footer">npm-version — npm@1.3.15</p>
55 var wrapper = document.getElementById("wrapper")
56 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
57 .filter(function (el) {
58 return el.parentNode === wrapper
59 && el.tagName.match(/H[1-6]/)
63 , toc = document.createElement("ul")
64 toc.innerHTML = els.map(function (el) {
65 var i = el.tagName.charAt(1)
75 out += "<li><a href='#" + el.id + "'>" +
76 ( el.innerText || el.text || el.innerHTML)
81 document.body.appendChild(toc)