11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head> 21cb0ef41Sopenharmony_ci<meta charset="utf-8"> 31cb0ef41Sopenharmony_ci<title>npm-diff</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-diff">npm-diff</h1> 1401cb0ef41Sopenharmony_ci<span class="description">The registry diff command</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="#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 diff [...<paths>] 1501cb0ef41Sopenharmony_ci</code></pre> 1511cb0ef41Sopenharmony_ci<h3 id="description">Description</h3> 1521cb0ef41Sopenharmony_ci<p>Similar to its <code>git diff</code> counterpart, this command will print diff patches 1531cb0ef41Sopenharmony_ciof files for packages published to the npm registry.</p> 1541cb0ef41Sopenharmony_ci<ul> 1551cb0ef41Sopenharmony_ci<li> 1561cb0ef41Sopenharmony_ci<p><code>npm diff --diff=<spec-a> --diff=<spec-b></code></p> 1571cb0ef41Sopenharmony_ci<p>Compares two package versions using their registry specifiers, e.g: 1581cb0ef41Sopenharmony_ci<code>npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0</code>. It's also possible to 1591cb0ef41Sopenharmony_cicompare across forks of any package, 1601cb0ef41Sopenharmony_cie.g: <code>npm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0</code>.</p> 1611cb0ef41Sopenharmony_ci<p>Any valid spec can be used, so that it's also possible to compare 1621cb0ef41Sopenharmony_cidirectories or git repositories, 1631cb0ef41Sopenharmony_cie.g: <code>npm diff --diff=pkg@latest --diff=./packages/pkg</code></p> 1641cb0ef41Sopenharmony_ci<p>Here's an example comparing two different versions of a package named 1651cb0ef41Sopenharmony_ci<code>abbrev</code> from the registry:</p> 1661cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1 1671cb0ef41Sopenharmony_ci</code></pre> 1681cb0ef41Sopenharmony_ci<p>On success, output looks like:</p> 1691cb0ef41Sopenharmony_ci<pre><code class="language-bash">diff --git a/package.json b/package.json 1701cb0ef41Sopenharmony_ciindex v1.1.0..v1.1.1 100644 1711cb0ef41Sopenharmony_ci--- a/package.json 1721cb0ef41Sopenharmony_ci+++ b/package.json 1731cb0ef41Sopenharmony_ci@@ -1,6 +1,6 @@ 1741cb0ef41Sopenharmony_ci { 1751cb0ef41Sopenharmony_ci "name": "abbrev", 1761cb0ef41Sopenharmony_ci- "version": "1.1.0", 1771cb0ef41Sopenharmony_ci+ "version": "1.1.1", 1781cb0ef41Sopenharmony_ci "description": "Like ruby's abbrev module, but in js", 1791cb0ef41Sopenharmony_ci "author": "Isaac Z. Schlueter <i@izs.me>", 1801cb0ef41Sopenharmony_ci "main": "abbrev.js", 1811cb0ef41Sopenharmony_ci</code></pre> 1821cb0ef41Sopenharmony_ci<p>Given the flexible nature of npm specs, you can also target local 1831cb0ef41Sopenharmony_cidirectories or git repos just like when using <code>npm install</code>:</p> 1841cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=https://github.com/npm/libnpmdiff --diff=./local-path 1851cb0ef41Sopenharmony_ci</code></pre> 1861cb0ef41Sopenharmony_ci<p>In the example above we can compare the contents from the package installed 1871cb0ef41Sopenharmony_cifrom the git repo at <code>github.com/npm/libnpmdiff</code> with the contents of the 1881cb0ef41Sopenharmony_ci<code>./local-path</code> that contains a valid package, such as a modified copy of 1891cb0ef41Sopenharmony_cithe original.</p> 1901cb0ef41Sopenharmony_ci</li> 1911cb0ef41Sopenharmony_ci<li> 1921cb0ef41Sopenharmony_ci<p><code>npm diff</code> (in a package directory, no arguments):</p> 1931cb0ef41Sopenharmony_ci<p>If the package is published to the registry, <code>npm diff</code> will fetch the 1941cb0ef41Sopenharmony_citarball version tagged as <code>latest</code> (this value can be configured using the 1951cb0ef41Sopenharmony_ci<code>tag</code> option) and proceed to compare the contents of files present in that 1961cb0ef41Sopenharmony_citarball, with the current files in your local file system.</p> 1971cb0ef41Sopenharmony_ci<p>This workflow provides a handy way for package authors to see what 1981cb0ef41Sopenharmony_cipackage-tracked files have been changed in comparison with the latest 1991cb0ef41Sopenharmony_cipublished version of that package.</p> 2001cb0ef41Sopenharmony_ci</li> 2011cb0ef41Sopenharmony_ci<li> 2021cb0ef41Sopenharmony_ci<p><code>npm diff --diff=<pkg-name></code> (in a package directory):</p> 2031cb0ef41Sopenharmony_ci<p>When using a single package name (with no version or tag specifier) as an 2041cb0ef41Sopenharmony_ciargument, <code>npm diff</code> will work in a similar way to 2051cb0ef41Sopenharmony_ci<a href="npm-outdated"><code>npm-outdated</code></a> and reach for the registry to figure out 2061cb0ef41Sopenharmony_ciwhat current published version of the package named <code><pkg-name></code> 2071cb0ef41Sopenharmony_ciwill satisfy its dependent declared semver-range. Once that specific 2081cb0ef41Sopenharmony_civersion is known <code>npm diff</code> will print diff patches comparing the 2091cb0ef41Sopenharmony_cicurrent version of <code><pkg-name></code> found in the local file system with 2101cb0ef41Sopenharmony_cithat specific version returned by the registry.</p> 2111cb0ef41Sopenharmony_ci<p>Given a package named <code>abbrev</code> that is currently installed:</p> 2121cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=abbrev 2131cb0ef41Sopenharmony_ci</code></pre> 2141cb0ef41Sopenharmony_ci<p>That will request from the registry its most up to date version and 2151cb0ef41Sopenharmony_ciwill print a diff output comparing the currently installed version to this 2161cb0ef41Sopenharmony_cinewer one if the version numbers are not the same.</p> 2171cb0ef41Sopenharmony_ci</li> 2181cb0ef41Sopenharmony_ci<li> 2191cb0ef41Sopenharmony_ci<p><code>npm diff --diff=<spec-a></code> (in a package directory):</p> 2201cb0ef41Sopenharmony_ci<p>Similar to using only a single package name, it's also possible to declare 2211cb0ef41Sopenharmony_cia full registry specifier version if you wish to compare the local version 2221cb0ef41Sopenharmony_ciof an installed package with the specific version/tag/semver-range provided 2231cb0ef41Sopenharmony_ciin <code><spec-a></code>.</p> 2241cb0ef41Sopenharmony_ci<p>An example: assuming <code>pkg@1.0.0</code> is installed in the current <code>node_modules</code> 2251cb0ef41Sopenharmony_cifolder, running:</p> 2261cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=pkg@2.0.0 2271cb0ef41Sopenharmony_ci</code></pre> 2281cb0ef41Sopenharmony_ci<p>It will effectively be an alias to 2291cb0ef41Sopenharmony_ci<code>npm diff --diff=pkg@1.0.0 --diff=pkg@2.0.0</code>.</p> 2301cb0ef41Sopenharmony_ci</li> 2311cb0ef41Sopenharmony_ci<li> 2321cb0ef41Sopenharmony_ci<p><code>npm diff --diff=<semver-a> [--diff=<semver-b>]</code> (in a package directory):</p> 2331cb0ef41Sopenharmony_ci<p>Using <code>npm diff</code> along with semver-valid version numbers is a shorthand 2341cb0ef41Sopenharmony_cito compare different versions of the current package.</p> 2351cb0ef41Sopenharmony_ci<p>It needs to be run from a package directory, such that for a package named 2361cb0ef41Sopenharmony_ci<code>pkg</code> running <code>npm diff --diff=1.0.0 --diff=1.0.1</code> is the same as running 2371cb0ef41Sopenharmony_ci<code>npm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1</code>.</p> 2381cb0ef41Sopenharmony_ci<p>If only a single argument <code><version-a></code> is provided, then the current local 2391cb0ef41Sopenharmony_cifile system is going to be compared against that version.</p> 2401cb0ef41Sopenharmony_ci<p>Here's an example comparing two specific versions (published to the 2411cb0ef41Sopenharmony_ciconfigured registry) of the current project directory:</p> 2421cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=1.0.0 --diff=1.1.0 2431cb0ef41Sopenharmony_ci</code></pre> 2441cb0ef41Sopenharmony_ci</li> 2451cb0ef41Sopenharmony_ci</ul> 2461cb0ef41Sopenharmony_ci<p>Note that tag names are not valid <code>--diff</code> argument values, if you wish to 2471cb0ef41Sopenharmony_cicompare to a published tag, you must use the <code>pkg@tagname</code> syntax.</p> 2481cb0ef41Sopenharmony_ci<h4 id="filtering-files">Filtering files</h4> 2491cb0ef41Sopenharmony_ci<p>It's possible to also specify positional arguments using file names or globs 2501cb0ef41Sopenharmony_cipattern matching in order to limit the result of diff patches to only a subset 2511cb0ef41Sopenharmony_ciof files for a given package, e.g:</p> 2521cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm diff --diff=pkg@2 ./lib/ CHANGELOG.md 2531cb0ef41Sopenharmony_ci</code></pre> 2541cb0ef41Sopenharmony_ci<p>In the example above the diff output is only going to print contents of files 2551cb0ef41Sopenharmony_cilocated within the folder <code>./lib/</code> and changed lines of code within the 2561cb0ef41Sopenharmony_ci<code>CHANGELOG.md</code> file.</p> 2571cb0ef41Sopenharmony_ci<h3 id="configuration">Configuration</h3> 2581cb0ef41Sopenharmony_ci<h4 id="diff"><code>diff</code></h4> 2591cb0ef41Sopenharmony_ci<ul> 2601cb0ef41Sopenharmony_ci<li>Default:</li> 2611cb0ef41Sopenharmony_ci<li>Type: String (can be set multiple times)</li> 2621cb0ef41Sopenharmony_ci</ul> 2631cb0ef41Sopenharmony_ci<p>Define arguments to compare in <code>npm diff</code>.</p> 2641cb0ef41Sopenharmony_ci<h4 id="diff-name-only"><code>diff-name-only</code></h4> 2651cb0ef41Sopenharmony_ci<ul> 2661cb0ef41Sopenharmony_ci<li>Default: false</li> 2671cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2681cb0ef41Sopenharmony_ci</ul> 2691cb0ef41Sopenharmony_ci<p>Prints only filenames when using <code>npm diff</code>.</p> 2701cb0ef41Sopenharmony_ci<h4 id="diff-unified"><code>diff-unified</code></h4> 2711cb0ef41Sopenharmony_ci<ul> 2721cb0ef41Sopenharmony_ci<li>Default: 3</li> 2731cb0ef41Sopenharmony_ci<li>Type: Number</li> 2741cb0ef41Sopenharmony_ci</ul> 2751cb0ef41Sopenharmony_ci<p>The number of lines of context to print in <code>npm diff</code>.</p> 2761cb0ef41Sopenharmony_ci<h4 id="diff-ignore-all-space"><code>diff-ignore-all-space</code></h4> 2771cb0ef41Sopenharmony_ci<ul> 2781cb0ef41Sopenharmony_ci<li>Default: false</li> 2791cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2801cb0ef41Sopenharmony_ci</ul> 2811cb0ef41Sopenharmony_ci<p>Ignore whitespace when comparing lines in <code>npm diff</code>.</p> 2821cb0ef41Sopenharmony_ci<h4 id="diff-no-prefix"><code>diff-no-prefix</code></h4> 2831cb0ef41Sopenharmony_ci<ul> 2841cb0ef41Sopenharmony_ci<li>Default: false</li> 2851cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 2861cb0ef41Sopenharmony_ci</ul> 2871cb0ef41Sopenharmony_ci<p>Do not show any source or destination prefix in <code>npm diff</code> output.</p> 2881cb0ef41Sopenharmony_ci<p>Note: this causes <code>npm diff</code> to ignore the <code>--diff-src-prefix</code> and 2891cb0ef41Sopenharmony_ci<code>--diff-dst-prefix</code> configs.</p> 2901cb0ef41Sopenharmony_ci<h4 id="diff-src-prefix"><code>diff-src-prefix</code></h4> 2911cb0ef41Sopenharmony_ci<ul> 2921cb0ef41Sopenharmony_ci<li>Default: "a/"</li> 2931cb0ef41Sopenharmony_ci<li>Type: String</li> 2941cb0ef41Sopenharmony_ci</ul> 2951cb0ef41Sopenharmony_ci<p>Source prefix to be used in <code>npm diff</code> output.</p> 2961cb0ef41Sopenharmony_ci<h4 id="diff-dst-prefix"><code>diff-dst-prefix</code></h4> 2971cb0ef41Sopenharmony_ci<ul> 2981cb0ef41Sopenharmony_ci<li>Default: "b/"</li> 2991cb0ef41Sopenharmony_ci<li>Type: String</li> 3001cb0ef41Sopenharmony_ci</ul> 3011cb0ef41Sopenharmony_ci<p>Destination prefix to be used in <code>npm diff</code> output.</p> 3021cb0ef41Sopenharmony_ci<h4 id="diff-text"><code>diff-text</code></h4> 3031cb0ef41Sopenharmony_ci<ul> 3041cb0ef41Sopenharmony_ci<li>Default: false</li> 3051cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 3061cb0ef41Sopenharmony_ci</ul> 3071cb0ef41Sopenharmony_ci<p>Treat all files as text in <code>npm diff</code>.</p> 3081cb0ef41Sopenharmony_ci<h4 id="global"><code>global</code></h4> 3091cb0ef41Sopenharmony_ci<ul> 3101cb0ef41Sopenharmony_ci<li>Default: false</li> 3111cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 3121cb0ef41Sopenharmony_ci</ul> 3131cb0ef41Sopenharmony_ci<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code> 3141cb0ef41Sopenharmony_cifolder instead of the current working directory. See 3151cb0ef41Sopenharmony_ci<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p> 3161cb0ef41Sopenharmony_ci<ul> 3171cb0ef41Sopenharmony_ci<li>packages are installed into the <code>{prefix}/lib/node_modules</code> folder, instead 3181cb0ef41Sopenharmony_ciof the current working directory.</li> 3191cb0ef41Sopenharmony_ci<li>bin files are linked to <code>{prefix}/bin</code></li> 3201cb0ef41Sopenharmony_ci<li>man pages are linked to <code>{prefix}/share/man</code></li> 3211cb0ef41Sopenharmony_ci</ul> 3221cb0ef41Sopenharmony_ci<h4 id="tag"><code>tag</code></h4> 3231cb0ef41Sopenharmony_ci<ul> 3241cb0ef41Sopenharmony_ci<li>Default: "latest"</li> 3251cb0ef41Sopenharmony_ci<li>Type: String</li> 3261cb0ef41Sopenharmony_ci</ul> 3271cb0ef41Sopenharmony_ci<p>If you ask npm to install a package and don't tell it a specific version, 3281cb0ef41Sopenharmony_cithen it will install the specified tag.</p> 3291cb0ef41Sopenharmony_ci<p>Also the tag that is added to the package@version specified by the <code>npm tag</code> 3301cb0ef41Sopenharmony_cicommand, if no explicit tag is given.</p> 3311cb0ef41Sopenharmony_ci<p>When used by the <code>npm diff</code> command, this is the tag used to fetch the 3321cb0ef41Sopenharmony_citarball that will be compared with the local files by default.</p> 3331cb0ef41Sopenharmony_ci<h4 id="workspace"><code>workspace</code></h4> 3341cb0ef41Sopenharmony_ci<ul> 3351cb0ef41Sopenharmony_ci<li>Default:</li> 3361cb0ef41Sopenharmony_ci<li>Type: String (can be set multiple times)</li> 3371cb0ef41Sopenharmony_ci</ul> 3381cb0ef41Sopenharmony_ci<p>Enable running a command in the context of the configured workspaces of the 3391cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by 3401cb0ef41Sopenharmony_cithis configuration option.</p> 3411cb0ef41Sopenharmony_ci<p>Valid values for the <code>workspace</code> config are either:</p> 3421cb0ef41Sopenharmony_ci<ul> 3431cb0ef41Sopenharmony_ci<li>Workspace names</li> 3441cb0ef41Sopenharmony_ci<li>Path to a workspace directory</li> 3451cb0ef41Sopenharmony_ci<li>Path to a parent workspace directory (will result in selecting all 3461cb0ef41Sopenharmony_ciworkspaces within that folder)</li> 3471cb0ef41Sopenharmony_ci</ul> 3481cb0ef41Sopenharmony_ci<p>When set for the <code>npm init</code> command, this may be set to the folder of a 3491cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a 3501cb0ef41Sopenharmony_cibrand new workspace within the project.</p> 3511cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 3521cb0ef41Sopenharmony_ci<h4 id="workspaces"><code>workspaces</code></h4> 3531cb0ef41Sopenharmony_ci<ul> 3541cb0ef41Sopenharmony_ci<li>Default: null</li> 3551cb0ef41Sopenharmony_ci<li>Type: null or Boolean</li> 3561cb0ef41Sopenharmony_ci</ul> 3571cb0ef41Sopenharmony_ci<p>Set to true to run the command in the context of <strong>all</strong> configured 3581cb0ef41Sopenharmony_ciworkspaces.</p> 3591cb0ef41Sopenharmony_ci<p>Explicitly setting this to false will cause commands like <code>install</code> to 3601cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:</p> 3611cb0ef41Sopenharmony_ci<ul> 3621cb0ef41Sopenharmony_ci<li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.) 3631cb0ef41Sopenharmony_ciwill link workspaces into the <code>node_modules</code> folder. - Commands that do 3641cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project, 3651cb0ef41Sopenharmony_ci<em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li> 3661cb0ef41Sopenharmony_ci</ul> 3671cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 3681cb0ef41Sopenharmony_ci<h4 id="include-workspace-root"><code>include-workspace-root</code></h4> 3691cb0ef41Sopenharmony_ci<ul> 3701cb0ef41Sopenharmony_ci<li>Default: false</li> 3711cb0ef41Sopenharmony_ci<li>Type: Boolean</li> 3721cb0ef41Sopenharmony_ci</ul> 3731cb0ef41Sopenharmony_ci<p>Include the workspace root when workspaces are enabled for a command.</p> 3741cb0ef41Sopenharmony_ci<p>When false, specifying individual workspaces via the <code>workspace</code> config, or 3751cb0ef41Sopenharmony_ciall workspaces via the <code>workspaces</code> flag, will cause npm to operate only on 3761cb0ef41Sopenharmony_cithe specified workspaces, and not on the root project.</p> 3771cb0ef41Sopenharmony_ci<p>This value is not exported to the environment for child processes.</p> 3781cb0ef41Sopenharmony_ci<h2 id="see-also">See Also</h2> 3791cb0ef41Sopenharmony_ci<ul> 3801cb0ef41Sopenharmony_ci<li><a href="../commands/npm-outdated.html">npm outdated</a></li> 3811cb0ef41Sopenharmony_ci<li><a href="../commands/npm-install.html">npm install</a></li> 3821cb0ef41Sopenharmony_ci<li><a href="../commands/npm-config.html">npm config</a></li> 3831cb0ef41Sopenharmony_ci<li><a href="../using-npm/registry.html">npm registry</a></li> 3841cb0ef41Sopenharmony_ci</ul></div> 3851cb0ef41Sopenharmony_ci 3861cb0ef41Sopenharmony_ci<footer id="edit"> 3871cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm-diff.md"> 3881cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;"> 3891cb0ef41Sopenharmony_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> 3901cb0ef41Sopenharmony_ci</svg> 3911cb0ef41Sopenharmony_ciEdit this page on GitHub 3921cb0ef41Sopenharmony_ci</a> 3931cb0ef41Sopenharmony_ci</footer> 3941cb0ef41Sopenharmony_ci</section> 3951cb0ef41Sopenharmony_ci 3961cb0ef41Sopenharmony_ci 3971cb0ef41Sopenharmony_ci 3981cb0ef41Sopenharmony_ci</body></html>