11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head> 21cb0ef41Sopenharmony_ci<meta charset="utf-8"> 31cb0ef41Sopenharmony_ci<title>npm-version</title> 41cb0ef41Sopenharmony_ci<style> 51cb0ef41Sopenharmony_cibody { 61cb0ef41Sopenharmony_ci background-color: #ffffff; 71cb0ef41Sopenharmony_ci color: #24292e; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci margin: 0; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci line-height: 1.5; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; 141cb0ef41Sopenharmony_ci} 151cb0ef41Sopenharmony_ci#rainbar { 161cb0ef41Sopenharmony_ci height: 10px; 171cb0ef41Sopenharmony_ci background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff); 181cb0ef41Sopenharmony_ci} 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cia { 211cb0ef41Sopenharmony_ci text-decoration: none; 221cb0ef41Sopenharmony_ci color: #0366d6; 231cb0ef41Sopenharmony_ci} 241cb0ef41Sopenharmony_cia:hover { 251cb0ef41Sopenharmony_ci text-decoration: underline; 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_cipre { 291cb0ef41Sopenharmony_ci margin: 1em 0px; 301cb0ef41Sopenharmony_ci padding: 1em; 311cb0ef41Sopenharmony_ci border: solid 1px #e1e4e8; 321cb0ef41Sopenharmony_ci border-radius: 6px; 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci display: block; 351cb0ef41Sopenharmony_ci overflow: auto; 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci white-space: pre; 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci background-color: #f6f8fa; 401cb0ef41Sopenharmony_ci color: #393a34; 411cb0ef41Sopenharmony_ci} 421cb0ef41Sopenharmony_cicode { 431cb0ef41Sopenharmony_ci font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; 441cb0ef41Sopenharmony_ci font-size: 85%; 451cb0ef41Sopenharmony_ci padding: 0.2em 0.4em; 461cb0ef41Sopenharmony_ci background-color: #f6f8fa; 471cb0ef41Sopenharmony_ci color: #393a34; 481cb0ef41Sopenharmony_ci} 491cb0ef41Sopenharmony_cipre > code { 501cb0ef41Sopenharmony_ci padding: 0; 511cb0ef41Sopenharmony_ci background-color: inherit; 521cb0ef41Sopenharmony_ci color: inherit; 531cb0ef41Sopenharmony_ci} 541cb0ef41Sopenharmony_cih1, h2, h3 { 551cb0ef41Sopenharmony_ci font-weight: 600; 561cb0ef41Sopenharmony_ci} 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ci#logobar { 591cb0ef41Sopenharmony_ci background-color: #333333; 601cb0ef41Sopenharmony_ci margin: 0 auto; 611cb0ef41Sopenharmony_ci padding: 1em 4em; 621cb0ef41Sopenharmony_ci} 631cb0ef41Sopenharmony_ci#logobar .logo { 641cb0ef41Sopenharmony_ci float: left; 651cb0ef41Sopenharmony_ci} 661cb0ef41Sopenharmony_ci#logobar .title { 671cb0ef41Sopenharmony_ci font-weight: 600; 681cb0ef41Sopenharmony_ci color: #dddddd; 691cb0ef41Sopenharmony_ci float: left; 701cb0ef41Sopenharmony_ci margin: 5px 0 0 1em; 711cb0ef41Sopenharmony_ci} 721cb0ef41Sopenharmony_ci#logobar:after { 731cb0ef41Sopenharmony_ci content: ""; 741cb0ef41Sopenharmony_ci display: block; 751cb0ef41Sopenharmony_ci clear: both; 761cb0ef41Sopenharmony_ci} 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci#content { 791cb0ef41Sopenharmony_ci margin: 0 auto; 801cb0ef41Sopenharmony_ci padding: 0 4em; 811cb0ef41Sopenharmony_ci} 821cb0ef41Sopenharmony_ci 831cb0ef41Sopenharmony_ci#table_of_contents > h2 { 841cb0ef41Sopenharmony_ci font-size: 1.17em; 851cb0ef41Sopenharmony_ci} 861cb0ef41Sopenharmony_ci#table_of_contents ul:first-child { 871cb0ef41Sopenharmony_ci border: solid 1px #e1e4e8; 881cb0ef41Sopenharmony_ci border-radius: 6px; 891cb0ef41Sopenharmony_ci padding: 1em; 901cb0ef41Sopenharmony_ci background-color: #f6f8fa; 911cb0ef41Sopenharmony_ci color: #393a34; 921cb0ef41Sopenharmony_ci} 931cb0ef41Sopenharmony_ci#table_of_contents ul { 941cb0ef41Sopenharmony_ci list-style-type: none; 951cb0ef41Sopenharmony_ci padding-left: 1.5em; 961cb0ef41Sopenharmony_ci} 971cb0ef41Sopenharmony_ci#table_of_contents li { 981cb0ef41Sopenharmony_ci font-size: 0.9em; 991cb0ef41Sopenharmony_ci} 1001cb0ef41Sopenharmony_ci#table_of_contents li a { 1011cb0ef41Sopenharmony_ci color: #000000; 1021cb0ef41Sopenharmony_ci} 1031cb0ef41Sopenharmony_ci 1041cb0ef41Sopenharmony_ciheader.title { 1051cb0ef41Sopenharmony_ci border-bottom: solid 1px #e1e4e8; 1061cb0ef41Sopenharmony_ci} 1071cb0ef41Sopenharmony_ciheader.title > h1 { 1081cb0ef41Sopenharmony_ci margin-bottom: 0.25em; 1091cb0ef41Sopenharmony_ci} 1101cb0ef41Sopenharmony_ciheader.title > .description { 1111cb0ef41Sopenharmony_ci display: block; 1121cb0ef41Sopenharmony_ci margin-bottom: 0.5em; 1131cb0ef41Sopenharmony_ci line-height: 1; 1141cb0ef41Sopenharmony_ci} 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_cifooter#edit { 1171cb0ef41Sopenharmony_ci border-top: solid 1px #e1e4e8; 1181cb0ef41Sopenharmony_ci margin: 3em 0 4em 0; 1191cb0ef41Sopenharmony_ci padding-top: 2em; 1201cb0ef41Sopenharmony_ci} 1211cb0ef41Sopenharmony_ci</style> 1221cb0ef41Sopenharmony_ci</head> 1231cb0ef41Sopenharmony_ci<body> 1241cb0ef41Sopenharmony_ci<div id="banner"> 1251cb0ef41Sopenharmony_ci<div id="rainbar"></div> 1261cb0ef41Sopenharmony_ci<div id="logobar"> 1271cb0ef41Sopenharmony_ci<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700"> 1281cb0ef41Sopenharmony_ci<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon> 1291cb0ef41Sopenharmony_ci<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon> 1301cb0ef41Sopenharmony_ci</svg> 1311cb0ef41Sopenharmony_ci<div class="title"> 1321cb0ef41Sopenharmony_cinpm command-line interface 1331cb0ef41Sopenharmony_ci</div> 1341cb0ef41Sopenharmony_ci</div> 1351cb0ef41Sopenharmony_ci</div> 1361cb0ef41Sopenharmony_ci 1371cb0ef41Sopenharmony_ci<section id="content"> 1381cb0ef41Sopenharmony_ci<header class="title"> 1391cb0ef41Sopenharmony_ci<h1 id="npm-version">npm-version</h1> 1401cb0ef41Sopenharmony_ci<span class="description">Bump a package version</span> 1411cb0ef41Sopenharmony_ci</header> 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci<section id="table_of_contents"> 1441cb0ef41Sopenharmony_ci<h2 id="table-of-contents">Table of contents</h2> 1451cb0ef41Sopenharmony_ci<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#workspaces-update"><code>workspaces-update</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li></ul><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div> 1461cb0ef41Sopenharmony_ci</section> 1471cb0ef41Sopenharmony_ci 1481cb0ef41Sopenharmony_ci<div id="_content"><h3 id="synopsis">Synopsis</h3> 1491cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] 1501cb0ef41Sopenharmony_ci 1511cb0ef41Sopenharmony_cialias: verison 1521cb0ef41Sopenharmony_ci</code></pre> 1531cb0ef41Sopenharmony_ci<h3 id="configuration">Configuration</h3> 1541cb0ef41Sopenharmony_ci<h4 id="allow-same-version"><code>allow-same-version</code></h4> 1551cb0ef41Sopenharmony_ci<ul> 1561cb0ef41Sopenharmony_ci<li>Default: false</li> 1571cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 1581cb0ef41Sopenharmony_ci</ul> 1591cb0ef41Sopenharmony_ci<p>Prevents throwing an error when <code>npm version</code> is used to set the new version 1601cb0ef41Sopenharmony_cito the same value as the current version.</p> 1611cb0ef41Sopenharmony_ci<h4 id="commit-hooks"><code>commit-hooks</code></h4> 1621cb0ef41Sopenharmony_ci<ul> 1631cb0ef41Sopenharmony_ci<li>Default: true</li> 1641cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 1651cb0ef41Sopenharmony_ci</ul> 1661cb0ef41Sopenharmony_ci<p>Run git commit hooks when using the <code>npm version</code> command.</p> 1671cb0ef41Sopenharmony_ci<h4 id="git-tag-version"><code>git-tag-version</code></h4> 1681cb0ef41Sopenharmony_ci<ul> 1691cb0ef41Sopenharmony_ci<li>Default: true</li> 1701cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 1711cb0ef41Sopenharmony_ci</ul> 1721cb0ef41Sopenharmony_ci<p>Tag the commit when using the <code>npm version</code> command. Setting this to false 1731cb0ef41Sopenharmony_ciresults in no commit being made at all.</p> 1741cb0ef41Sopenharmony_ci<h4 id="json"><code>json</code></h4> 1751cb0ef41Sopenharmony_ci<ul> 1761cb0ef41Sopenharmony_ci<li>Default: false</li> 1771cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 1781cb0ef41Sopenharmony_ci</ul> 1791cb0ef41Sopenharmony_ci<p>Whether or not to output JSON data, rather than the normal output.</p> 1801cb0ef41Sopenharmony_ci<ul> 1811cb0ef41Sopenharmony_ci<li>In <code>npm pkg set</code> it enables parsing set values with JSON.parse() before 1821cb0ef41Sopenharmony_cisaving them to your <code>package.json</code>.</li> 1831cb0ef41Sopenharmony_ci</ul> 1841cb0ef41Sopenharmony_ci<p>Not supported by all npm commands.</p> 1851cb0ef41Sopenharmony_ci<h4 id="preid"><code>preid</code></h4> 1861cb0ef41Sopenharmony_ci<ul> 1871cb0ef41Sopenharmony_ci<li>Default: ""</li> 1881cb0ef41Sopenharmony_ci<li>Type: String</li> 1891cb0ef41Sopenharmony_ci</ul> 1901cb0ef41Sopenharmony_ci<p>The "prerelease identifier" to use as a prefix for the "prerelease" part of 1911cb0ef41Sopenharmony_cia semver. Like the <code>rc</code> in <code>1.2.0-rc.8</code>.</p> 1921cb0ef41Sopenharmony_ci<h4 id="sign-git-tag"><code>sign-git-tag</code></h4> 1931cb0ef41Sopenharmony_ci<ul> 1941cb0ef41Sopenharmony_ci<li>Default: false</li> 1951cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 1961cb0ef41Sopenharmony_ci</ul> 1971cb0ef41Sopenharmony_ci<p>If set to true, then the <code>npm version</code> command will tag the version using 1981cb0ef41Sopenharmony_ci<code>-s</code> to add a signature.</p> 1991cb0ef41Sopenharmony_ci<p>Note that git requires you to have set up GPG keys in your git configs for 2001cb0ef41Sopenharmony_cithis to work properly.</p> 2011cb0ef41Sopenharmony_ci<h4 id="workspace"><code>workspace</code></h4> 2021cb0ef41Sopenharmony_ci<ul> 2031cb0ef41Sopenharmony_ci<li>Default:</li> 2041cb0ef41Sopenharmony_ci<li>Type: String (can be set multiple times)</li> 2051cb0ef41Sopenharmony_ci</ul> 2061cb0ef41Sopenharmony_ci<p>Enable running a command in the context of the configured workspaces of the 2071cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by 2081cb0ef41Sopenharmony_cithis configuration option.</p> 2091cb0ef41Sopenharmony_ci<p>Valid values for the <code>workspace</code> config are either:</p> 2101cb0ef41Sopenharmony_ci<ul> 2111cb0ef41Sopenharmony_ci<li>Workspace names</li> 2121cb0ef41Sopenharmony_ci<li>Path to a workspace directory</li> 2131cb0ef41Sopenharmony_ci<li>Path to a parent workspace directory (will result in selecting all 2141cb0ef41Sopenharmony_ciworkspaces within that folder)</li> 2151cb0ef41Sopenharmony_ci</ul> 2161cb0ef41Sopenharmony_ci<p>When set for the <code>npm init</code> command, this may be set to the folder of a 2171cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a 2181cb0ef41Sopenharmony_cibrand new workspace within the project.</p> 2191cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 2201cb0ef41Sopenharmony_ci<h4 id="workspaces"><code>workspaces</code></h4> 2211cb0ef41Sopenharmony_ci<ul> 2221cb0ef41Sopenharmony_ci<li>Default: null</li> 2231cb0ef41Sopenharmony_ci<li>Type: null or Boolean</li> 2241cb0ef41Sopenharmony_ci</ul> 2251cb0ef41Sopenharmony_ci<p>Set to true to run the command in the context of <strong>all</strong> configured 2261cb0ef41Sopenharmony_ciworkspaces.</p> 2271cb0ef41Sopenharmony_ci<p>Explicitly setting this to false will cause commands like <code>install</code> to 2281cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:</p> 2291cb0ef41Sopenharmony_ci<ul> 2301cb0ef41Sopenharmony_ci<li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.) 2311cb0ef41Sopenharmony_ciwill link workspaces into the <code>node_modules</code> folder. - Commands that do 2321cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project, 2331cb0ef41Sopenharmony_ci<em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li> 2341cb0ef41Sopenharmony_ci</ul> 2351cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 2361cb0ef41Sopenharmony_ci<h4 id="workspaces-update"><code>workspaces-update</code></h4> 2371cb0ef41Sopenharmony_ci<ul> 2381cb0ef41Sopenharmony_ci<li>Default: true</li> 2391cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2401cb0ef41Sopenharmony_ci</ul> 2411cb0ef41Sopenharmony_ci<p>If set to true, the npm cli will run an update after operations that may 2421cb0ef41Sopenharmony_cipossibly change the workspaces installed to the <code>node_modules</code> folder.</p> 2431cb0ef41Sopenharmony_ci<h4 id="include-workspace-root"><code>include-workspace-root</code></h4> 2441cb0ef41Sopenharmony_ci<ul> 2451cb0ef41Sopenharmony_ci<li>Default: false</li> 2461cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2471cb0ef41Sopenharmony_ci</ul> 2481cb0ef41Sopenharmony_ci<p>Include the workspace root when workspaces are enabled for a command.</p> 2491cb0ef41Sopenharmony_ci<p>When false, specifying individual workspaces via the <code>workspace</code> config, or 2501cb0ef41Sopenharmony_ciall workspaces via the <code>workspaces</code> flag, will cause npm to operate only on 2511cb0ef41Sopenharmony_cithe specified workspaces, and not on the root project.</p> 2521cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 2531cb0ef41Sopenharmony_ci<h3 id="description">Description</h3> 2541cb0ef41Sopenharmony_ci<p>Run this in a package directory to bump the version and write the new data 2551cb0ef41Sopenharmony_ciback to <code>package.json</code>, <code>package-lock.json</code>, and, if present, 2561cb0ef41Sopenharmony_ci<code>npm-shrinkwrap.json</code>.</p> 2571cb0ef41Sopenharmony_ci<p>The <code>newversion</code> argument should be a valid semver string, a valid second 2581cb0ef41Sopenharmony_ciargument to <a href="https://github.com/npm/node-semver#functions">semver.inc</a> (one 2591cb0ef41Sopenharmony_ciof <code>patch</code>, <code>minor</code>, <code>major</code>, <code>prepatch</code>, <code>preminor</code>, <code>premajor</code>, 2601cb0ef41Sopenharmony_ci<code>prerelease</code>), or <code>from-git</code>. In the second case, the existing version will 2611cb0ef41Sopenharmony_cibe incremented by 1 in the specified field. <code>from-git</code> will try to read 2621cb0ef41Sopenharmony_cithe latest git tag, and use that as the new npm version.</p> 2631cb0ef41Sopenharmony_ci<p>If run in a git repo, it will also create a version commit and tag. This 2641cb0ef41Sopenharmony_cibehavior is controlled by <code>git-tag-version</code> (see below), and can be 2651cb0ef41Sopenharmony_cidisabled on the command line by running <code>npm --no-git-tag-version version</code>. 2661cb0ef41Sopenharmony_ciIt will fail if the working directory is not clean, unless the <code>-f</code> or 2671cb0ef41Sopenharmony_ci<code>--force</code> flag is set.</p> 2681cb0ef41Sopenharmony_ci<p>If supplied with <code>-m</code> or <a href="../using-npm/config#message.html"><code>--message</code> config</a> option, 2691cb0ef41Sopenharmony_cinpm will use it as a commit message when creating a version commit. If the 2701cb0ef41Sopenharmony_ci<code>message</code> config contains <code>%s</code> then that will be replaced with the resulting 2711cb0ef41Sopenharmony_civersion number. For example:</p> 2721cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm version patch -m "Upgrade to %s for reasons" 2731cb0ef41Sopenharmony_ci</code></pre> 2741cb0ef41Sopenharmony_ci<p>If the <a href="../using-npm/config#sign-git-tag.html"><code>sign-git-tag</code> config</a> is set, then the 2751cb0ef41Sopenharmony_citag will be signed using the <code>-s</code> flag to git. Note that you must have a default 2761cb0ef41Sopenharmony_ciGPG key set up in your git config for this to work properly. For example:</p> 2771cb0ef41Sopenharmony_ci<pre><code class="language-bash">$ npm config set sign-git-tag true 2781cb0ef41Sopenharmony_ci$ npm version patch 2791cb0ef41Sopenharmony_ci 2801cb0ef41Sopenharmony_ciYou need a passphrase to unlock the secret key for 2811cb0ef41Sopenharmony_ciuser: "isaacs (http://blog.izs.me/) <i@izs.me>" 2821cb0ef41Sopenharmony_ci2048-bit RSA key, ID 6C481CF6, created 2010-08-31 2831cb0ef41Sopenharmony_ci 2841cb0ef41Sopenharmony_ciEnter passphrase: 2851cb0ef41Sopenharmony_ci</code></pre> 2861cb0ef41Sopenharmony_ci<p>If <code>preversion</code>, <code>version</code>, or <code>postversion</code> are in the <code>scripts</code> property 2871cb0ef41Sopenharmony_ciof the package.json, they will be executed as part of running <code>npm version</code>.</p> 2881cb0ef41Sopenharmony_ci<p>The exact order of execution is as follows:</p> 2891cb0ef41Sopenharmony_ci<ol> 2901cb0ef41Sopenharmony_ci<li>Check to make sure the git working directory is clean before we get 2911cb0ef41Sopenharmony_cistarted. Your scripts may add files to the commit in future steps. 2921cb0ef41Sopenharmony_ciThis step is skipped if the <code>--force</code> flag is set.</li> 2931cb0ef41Sopenharmony_ci<li>Run the <code>preversion</code> script. These scripts have access to the old 2941cb0ef41Sopenharmony_ci<code>version</code> in package.json. A typical use would be running your full 2951cb0ef41Sopenharmony_citest suite before deploying. Any files you want added to the commit 2961cb0ef41Sopenharmony_cishould be explicitly added using <code>git add</code>.</li> 2971cb0ef41Sopenharmony_ci<li>Bump <code>version</code> in <code>package.json</code> as requested (<code>patch</code>, <code>minor</code>, 2981cb0ef41Sopenharmony_ci<code>major</code>, etc).</li> 2991cb0ef41Sopenharmony_ci<li>Run the <code>version</code> script. These scripts have access to the new <code>version</code> 3001cb0ef41Sopenharmony_ciin package.json (so they can incorporate it into file headers in 3011cb0ef41Sopenharmony_cigenerated files for example). Again, scripts should explicitly add 3021cb0ef41Sopenharmony_cigenerated files to the commit using <code>git add</code>.</li> 3031cb0ef41Sopenharmony_ci<li>Commit and tag.</li> 3041cb0ef41Sopenharmony_ci<li>Run the <code>postversion</code> script. Use it to clean up the file system or 3051cb0ef41Sopenharmony_ciautomatically push the commit and/or tag.</li> 3061cb0ef41Sopenharmony_ci</ol> 3071cb0ef41Sopenharmony_ci<p>Take the following example:</p> 3081cb0ef41Sopenharmony_ci<pre><code class="language-json">{ 3091cb0ef41Sopenharmony_ci "scripts": { 3101cb0ef41Sopenharmony_ci "preversion": "npm test", 3111cb0ef41Sopenharmony_ci "version": "npm run build && git add -A dist", 3121cb0ef41Sopenharmony_ci "postversion": "git push && git push --tags && rm -rf build/temp" 3131cb0ef41Sopenharmony_ci } 3141cb0ef41Sopenharmony_ci} 3151cb0ef41Sopenharmony_ci</code></pre> 3161cb0ef41Sopenharmony_ci<p>This runs all your tests and proceeds only if they pass. Then runs your 3171cb0ef41Sopenharmony_ci<code>build</code> script, and adds everything in the <code>dist</code> directory to the commit. 3181cb0ef41Sopenharmony_ciAfter the commit, it pushes the new commit and tag up to the server, and 3191cb0ef41Sopenharmony_cideletes the <code>build/temp</code> directory.</p> 3201cb0ef41Sopenharmony_ci<h3 id="see-also">See Also</h3> 3211cb0ef41Sopenharmony_ci<ul> 3221cb0ef41Sopenharmony_ci<li><a href="../commands/npm-init.html">npm init</a></li> 3231cb0ef41Sopenharmony_ci<li><a href="../commands/npm-run-script.html">npm run-script</a></li> 3241cb0ef41Sopenharmony_ci<li><a href="../using-npm/scripts.html">npm scripts</a></li> 3251cb0ef41Sopenharmony_ci<li><a href="../configuring-npm/package-json.html">package.json</a></li> 3261cb0ef41Sopenharmony_ci<li><a href="../using-npm/config.html">config</a></li> 3271cb0ef41Sopenharmony_ci</ul></div> 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_ci<footer id="edit"> 3301cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm-version.md"> 3311cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;"> 3321cb0ef41Sopenharmony_ci<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path> 3331cb0ef41Sopenharmony_ci</svg> 3341cb0ef41Sopenharmony_ciEdit this page on GitHub 3351cb0ef41Sopenharmony_ci</a> 3361cb0ef41Sopenharmony_ci</footer> 3371cb0ef41Sopenharmony_ci</section> 3381cb0ef41Sopenharmony_ci 3391cb0ef41Sopenharmony_ci 3401cb0ef41Sopenharmony_ci 3411cb0ef41Sopenharmony_ci</body></html>