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="../api/npm-version.html">npm-version</a></h1> <p>Bump a package version</p>
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
13 <pre><code>npm.commands.version(newversion, callback)</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>If run in a git repo, it will also create a version commit and tag, and
21 fail if the repo is not clean.</p>
23 <p>Like all other commands, this function takes a string array as its first
24 parameter. The difference, however, is this function will fail if it does
25 not have exactly one element. The only element should be a version number.</p>
27 <p id="footer">npm-version — npm@1.3.17</p>
30 var wrapper = document.getElementById("wrapper")
31 var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
32 .filter(function (el) {
33 return el.parentNode === wrapper
34 && el.tagName.match(/H[1-6]/)
38 , toc = document.createElement("ul")
39 toc.innerHTML = els.map(function (el) {
40 var i = el.tagName.charAt(1)
50 out += "<li><a href='#" + el.id + "'>" +
51 ( el.innerText || el.text || el.innerHTML)
56 document.body.appendChild(toc)