@@ -11,7 +11,7 @@ <h2 id="synopsis">SYNOPSIS</h2>
limit the results to only the paths to the packages named. Note that
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm&#39;s source tree will show:</p>
<pre><code>npm@2.6.1 /path/to/npm
<pre><code>npm@2.7.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre><p>It will print out extraneous, missing, and invalid packages.</p>
@@ -50,6 +50,18 @@ <h3 id="depth">depth</h3>
<li>Type: Int</li>
</ul>
<p>Max display depth of the dependency tree.</p>
<h3 id="prod-production">prod / production</h3>
<ul>
<li>Type: Boolean</li>
<li>Default: false</li>
</ul>
<p>Display only the dependency tree for packages in <code>dependencies</code>.</p>
<h3 id="dev">dev</h3>
<ul>
<li>Type: Boolean</li>
<li>Default: false</li>
</ul>
<p>Display only the dependency tree for packages in <code>devDependencies</code>.</p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../cli/npm-config.html">npm-config(1)</a></li>
@@ -3,22 +3,22 @@ <h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm run-script [command] [-- &lt;args&gt;]
npm run [command] [-- &lt;args&gt;]
</code></pre><h2 id="description">DESCRIPTION</h2>
<p>This runs an arbitrary command from a package&#39;s <code>&quot;scripts&quot;</code> object.
If no package name is provided, it will search for a <code>package.json</code>
in the current folder and use its <code>&quot;scripts&quot;</code> object. If no <code>&quot;command&quot;</code>
is provided, it will list the available top level scripts. The <code>env</code> command
can be used to list environment variables that will be available to the script
at runtime. If an &quot;env&quot; command is defined in your package it will have
precedence instead.</p>
<p><code>run[-script]</code> is used by the test, start, restart, and stop commands, but can
be called directly, as well.</p>
<p>This runs an arbitrary command from a package&#39;s <code>&quot;scripts&quot;</code> object. If no
<code>&quot;command&quot;</code> is provided, it will list the available scripts. <code>run[-script]</code> is
used by the test, start, restart, and stop commands, but can be called
directly, as well. When the scripts in the package are printed out, they&#39;re
separated into lifecycle (test, start, restart) and directly-run scripts.</p>
<p>As of <a href="http://blog.npmjs.org/post/98131109725/npm-2-0-0"><code>npm@2.0.0</code></a>, you can
use custom arguments when executing scripts. The special option <code>--</code> is used by
<a href="http://goo.gl/KxMmtG">getopt</a> to delimit the end of the options. npm will pass
all the arguments after the <code>--</code> directly to your script:</p>
<pre><code>npm run test -- --grep=&quot;pattern&quot;
</code></pre><p>The arguments will only be passed to the script specified after <code>npm run</code>
and not to any pre or post script.</p>
<p>The <code>env</code> script is a special built-in command that can be used to list
environment variables that will be available to the script at runtime. If an
&quot;env&quot; command is defined in your package it will take precedence over the
built-in.</p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../misc/npm-scripts.html">npm-scripts(7)</a></li>
@@ -3,18 +3,95 @@ <h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm update [-g] [&lt;name&gt; [&lt;name&gt; ...]]
</code></pre><h2 id="description">DESCRIPTION</h2>
<p>This command will update all the packages listed to the latest version
(specified by the <code>tag</code> config).</p>
(specified by the <code>tag</code> config), respecting semver.</p>
<p>It will also install missing packages. As with all commands that install
packages, the <code>--dev</code> flag will cause <code>devDependencies</code> to be processed
as well.</p>
<p>If the <code>-g</code> flag is specified, this command will update globally installed
packages.</p>
<p>If no package name is specified, all packages in the specified location (global
or local) will be updated.</p>
<p>As of <code>npm@2.6.1</code>, the <code>npm update</code> will only inspect top-level packages.
Prior versions of <code>npm</code> would also recursively inspect all dependencies.
To get the old behavior, use <code>npm --depth 9999 update</code>, but be warned that
simultaneous asynchronous update of all packages, including <code>npm</code> itself
and packages that <code>npm</code> depends on, often causes problems up to and including
the uninstallation of <code>npm</code> itself.</p>
<p>To restore a missing <code>npm</code>, use the command:</p>
<pre><code>curl -L https://npmjs.com/install.sh | sh
</code></pre><h2 id="examples">EXAMPLES</h2>
<p>IMPORTANT VERSION NOTE: these examples assume <code>npm@2.6.1</code> or later. For
older versions of <code>npm</code>, you must specify <code>--depth 0</code> to get the behavior
described below.</p>
<p>For the examples below, assume that the current package is <code>app</code> and it depends
on dependencies, <code>dep1</code> (<code>dep2</code>, .. etc.). The published versions of <code>dep1</code> are:</p>
<pre><code>{
dist-tags: { latest: &quot;1.2.2&quot; },
versions: { &quot;1.2.2&quot;,
&quot;1.2.1&quot;,
&quot;1.2.0&quot;,
&quot;1.1.2&quot;,
&quot;1.1.1&quot;,
&quot;1.0.0&quot;,
&quot;0.4.1&quot;,
&quot;0.4.0&quot;,
&quot;0.2.0&quot;
}
}
</code></pre><h3 id="caret-dependencies">Caret Dependencies</h3>
<p>If <code>app</code>&#39;s <code>package.json</code> contains:</p>
<pre><code>dependencies: {
dep1: &quot;^1.1.1&quot;
}
</code></pre><p>Then <code>npm update</code> will install <code>dep1@1.2.2</code>, because <code>1.2.2</code> is <code>latest</code> and
<code>1.2.2</code> satisfies <code>^1.1.1</code>.</p>
<h3 id="tilde-dependencies">Tilde Dependencies</h3>
<p>However, if <code>app</code>&#39;s <code>package.json</code> contains:</p>
<pre><code>dependencies: {
dep1: &quot;~1.1.1&quot;
}
</code></pre><p>In this case, running <code>npm update</code> will install <code>dep1@1.1.2</code>. Even though the <code>latest</code>
tag points to <code>1.2.2</code>, this version does not satisfy <code>~1.1.1</code>, which is equivalent
to <code>&gt;=1.1.1 &lt;1.2.0</code>. So the highest-sorting version that satisfies <code>~1.1.1</code> is used,
which is <code>1.1.2</code>.</p>
<h3 id="caret-dependencies-below-1-0-0">Caret Dependencies below 1.0.0</h3>
<p>Suppose <code>app</code> has a caret dependency on a version below <code>1.0.0</code>, for example:</p>
<pre><code>dependencies: {
dep1: &quot;^0.2.0&quot;
}
</code></pre><p><code>npm update</code> will install <code>dep1@0.2.0</code>, because there are no other
versions which satisfy <code>^0.2.0</code>.</p>
<p>If the dependence were on <code>^0.4.0</code>:</p>
<pre><code>dependencies: {
dep1: &quot;^0.4.0&quot;
}
</code></pre><p>Then <code>npm update</code> will install <code>dep1@0.4.1</code>, because that is the highest-sorting
version that satisfies <code>^0.4.0</code> (<code>&gt;= 0.4.0 &lt;0.5.0</code>)</p>
<h3 id="recording-updates-with-save-">Recording Updates with <code>--save</code></h3>
<p>When you want to update a package and save the new version as
the minimum required dependency in <code>package.json</code>, you can use
<code>npm update --save</code>. For example if <code>package.json</code> contains</p>
<pre><code>dependencies: {
dep1: &quot;^1.1.1&quot;
}
</code></pre><p>Then <code>npm update --save</code> will install <code>dep1@1.2.2</code> (i.e., <code>latest</code>),
and <code>package.json</code> will be modified:</p>
<pre><code>dependencies: {
dep1: &quot;^1.2.2&quot;
}
</code></pre><p>Note that <code>npm</code> will only write an updated version to <code>package.json</code>
if it installs a new package.</p>
<h3 id="updating-globally-installed-packages">Updating Globally-Installed Packages</h3>
<p><code>npm update -g</code> will apply the <code>update</code> action to each globally- installed
package that is <code>outdated</code> -- that is, has a version that is different from
<code>latest</code>.</p>
<p>NOTE: If a package has been upgraded to a version newer than <code>latest</code>, it will
be <em>downgraded</em>.</p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../cli/npm-install.html">npm-install(1)</a></li>
<li><a href="../cli/npm-outdated.html">npm-outdated(1)</a></li>
<li><a href="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></li>
<li><a href="../misc/npm-registry.html">npm-registry(7)</a></li>
<li><a href="../files/npm-folders.html">npm-folders(5)</a></li>
<li><a href="../cli/npm-ls.html">npm-ls(1)</a></li>
@@ -8,8 +8,10 @@ <h2 id="synopsis">SYNOPSIS</h2>
valid second argument to semver.inc (one of &quot;patch&quot;, &quot;minor&quot;, &quot;major&quot;,
&quot;prepatch&quot;, &quot;preminor&quot;, &quot;premajor&quot;, &quot;prerelease&quot;). In the second case,
the existing version will be incremented by 1 in the specified field.</p>
<p>If run in a git repo, it will also create a version commit and tag, and
fail if the repo is not clean.</p>
<p>If run in a git repo, it will also create a version commit and tag, and fail if
the repo is not clean. This behavior is controlled by <code>git-tag-version</code> (see
below), and can be disabled on the command line by running <code>npm
--no-git-tag-version version</code></p>
<p>If supplied with <code>--message</code> (shorthand: <code>-m</code>) config option, npm will
use it as a commit message when creating a version commit. If the
<code>message</code> config contains <code>%s</code> then that will be replaced with the
@@ -26,10 +28,18 @@ <h2 id="synopsis">SYNOPSIS</h2>
2048-bit RSA key, ID 6C481CF6, created 2010-08-31

Enter passphrase:
</code></pre><h2 id="see-also">SEE ALSO</h2>
</code></pre><h2 id="configuration">CONFIGURATION</h2>
<h3 id="git-tag-version">git-tag-version</h3>
<ul>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
<p>Commit and tag the version change.</p>
<h2 id="see-also">SEE ALSO</h2>
<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>
<li><a href="../misc/config.html">config(7)</a></li>
</ul>

@@ -2,7 +2,7 @@ <h1><a href="../cli/npm.html">npm</a></h1> <p>javascript package manager</p>
<h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm &lt;command&gt; [args]
</code></pre><h2 id="version">VERSION</h2>
<p>2.6.1</p>
<p>2.7.0</p>
<h2 id="description">DESCRIPTION</h2>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
@@ -99,15 +99,15 @@ <h2 id="contributions">CONTRIBUTIONS</h2>
the issues list or ask on the mailing list.</p>
<ul>
<li><a href="http://github.com/npm/npm/issues">http://github.com/npm/npm/issues</a></li>
<li><a href="&#x6d;&#97;&#x69;&#108;&#116;&#111;&#x3a;&#110;&#112;&#x6d;&#x2d;&#x40;&#103;&#x6f;&#111;&#103;&#108;&#x65;&#103;&#114;&#x6f;&#117;&#x70;&#x73;&#x2e;&#x63;&#x6f;&#x6d;">&#110;&#112;&#x6d;&#x2d;&#x40;&#103;&#x6f;&#111;&#103;&#108;&#x65;&#103;&#114;&#x6f;&#117;&#x70;&#x73;&#x2e;&#x63;&#x6f;&#x6d;</a></li>
<li><a href="&#109;&#97;&#105;&#x6c;&#116;&#x6f;&#58;&#110;&#x70;&#109;&#45;&#64;&#x67;&#x6f;&#111;&#x67;&#x6c;&#101;&#x67;&#114;&#111;&#117;&#112;&#115;&#46;&#99;&#111;&#x6d;">&#110;&#x70;&#109;&#45;&#64;&#x67;&#x6f;&#111;&#x67;&#x6c;&#101;&#x67;&#114;&#111;&#117;&#112;&#115;&#46;&#99;&#111;&#x6d;</a></li>
</ul>
<h2 id="bugs">BUGS</h2>
<p>When you find issues, please report them:</p>
<ul>
<li>web:
<a href="http://github.com/npm/npm/issues">http://github.com/npm/npm/issues</a></li>
<li>email:
<a href="&#x6d;&#97;&#x69;&#108;&#x74;&#111;&#58;&#x6e;&#x70;&#x6d;&#x2d;&#64;&#103;&#111;&#x6f;&#103;&#x6c;&#x65;&#103;&#x72;&#111;&#x75;&#112;&#115;&#46;&#99;&#x6f;&#109;">&#x6e;&#x70;&#x6d;&#x2d;&#64;&#103;&#111;&#x6f;&#103;&#x6c;&#x65;&#103;&#x72;&#111;&#x75;&#112;&#115;&#46;&#99;&#x6f;&#109;</a></li>
<a href="&#x6d;&#x61;&#105;&#x6c;&#x74;&#111;&#x3a;&#x6e;&#112;&#x6d;&#45;&#64;&#x67;&#111;&#x6f;&#103;&#x6c;&#x65;&#x67;&#114;&#111;&#x75;&#112;&#115;&#x2e;&#x63;&#x6f;&#109;">&#x6e;&#112;&#x6d;&#45;&#64;&#x67;&#111;&#x6f;&#103;&#x6c;&#x65;&#x67;&#114;&#111;&#x75;&#112;&#115;&#x2e;&#x63;&#x6f;&#109;</a></li>
</ul>
<p>Be sure to include <em>all</em> of the output from the npm command that didn&#39;t work
as expected. The <code>npm-debug.log</code> file is also helpful to provide.</p>
@@ -117,7 +117,7 @@ <h2 id="author">AUTHOR</h2>
<p><a href="http://blog.izs.me/">Isaac Z. Schlueter</a> ::
<a href="https://github.com/isaacs/">isaacs</a> ::
<a href="http://twitter.com/izs">@izs</a> ::
<a href="&#x6d;&#x61;&#105;&#108;&#116;&#111;&#58;&#x69;&#64;&#105;&#x7a;&#115;&#x2e;&#x6d;&#x65;">&#x69;&#64;&#105;&#x7a;&#115;&#x2e;&#x6d;&#x65;</a></p>
<a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#111;&#58;&#x69;&#x40;&#x69;&#122;&#115;&#x2e;&#x6d;&#101;">&#x69;&#x40;&#x69;&#122;&#115;&#x2e;&#x6d;&#101;</a></p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../cli/npm-help.html">npm-help(1)</a></li>
@@ -195,7 +195,7 @@ <h3 id="depth">depth</h3>
<li>Default: Infinity</li>
<li>Type: Number</li>
</ul>
<p>The depth to go when recursing directories for <code>npm ls</code>,
<p>The depth to go when recursing directories for <code>npm ls</code>,
<code>npm cache ls</code>, and <code>npm outdated</code>.</p>
<p>For <code>npm outdated</code>, a setting of <code>Infinity</code> will be treated as <code>0</code>
since that gives more useful information. To show the outdated status
@@ -325,6 +325,16 @@ <h3 id="https-proxy">https-proxy</h3>
<p>A proxy to use for outgoing https requests. If the <code>HTTPS_PROXY</code> or
<code>https_proxy</code> or <code>HTTP_PROXY</code> or <code>http_proxy</code> environment variables are set,
proxy settings will be honored by the underlying <code>request</code> library.</p>
<h3 id="if-present">if-present</h3>
<ul>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
<p>If true, npm will not exit with an error code when <code>run-script</code> is invoked for
a script that isn&#39;t defined in the <code>scripts</code> section of <code>package.json</code>. This
option can be used when it&#39;s desirable to optionally run a script when it&#39;s
present and fail if the script fails. This is useful, for example, when running
scripts that may only apply for some builds in an otherwise generic CI setup.</p>
<h3 id="ignore-scripts">ignore-scripts</h3>
<ul>
<li>Default: false</li>
@@ -2,7 +2,7 @@ <h1><a href="../misc/npm-disputes.html">npm-disputes</a></h1> <p>Handling Module
<h2 id="synopsis">SYNOPSIS</h2>
<ol>
<li>Get the author email with <code>npm owner ls &lt;pkgname&gt;</code></li>
<li>Email the author, CC <a href="&#x6d;&#x61;&#105;&#x6c;&#x74;&#x6f;&#x3a;&#x73;&#117;&#x70;&#x70;&#x6f;&#x72;&#x74;&#64;&#x6e;&#112;&#x6d;&#106;&#115;&#x2e;&#x63;&#111;&#x6d;">&#x73;&#117;&#x70;&#x70;&#x6f;&#x72;&#x74;&#64;&#x6e;&#112;&#x6d;&#106;&#115;&#x2e;&#x63;&#111;&#x6d;</a></li>
<li>Email the author, CC <a href="&#x6d;&#97;&#x69;&#108;&#116;&#x6f;&#x3a;&#x73;&#x75;&#x70;&#x70;&#x6f;&#114;&#x74;&#64;&#110;&#x70;&#109;&#106;&#115;&#x2e;&#99;&#111;&#x6d;">&#x73;&#x75;&#x70;&#x70;&#x6f;&#114;&#x74;&#64;&#110;&#x70;&#109;&#106;&#115;&#x2e;&#99;&#111;&#x6d;</a></li>
<li>After a few weeks, if there&#39;s no resolution, we&#39;ll sort it out.</li>
</ol>
<p>Don&#39;t squat on package names. Publish code or move out of the way.</p>
@@ -40,12 +40,12 @@ <h2 id="description">DESCRIPTION</h2>
owner (Bob).</li>
<li>Joe emails Bob, explaining the situation <strong>as respectfully as
possible</strong>, and what he would like to do with the module name. He
adds the npm support staff <a href="&#109;&#97;&#105;&#108;&#x74;&#x6f;&#58;&#115;&#x75;&#x70;&#x70;&#111;&#x72;&#116;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#x2e;&#x63;&#x6f;&#x6d;">&#115;&#x75;&#x70;&#x70;&#111;&#x72;&#116;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#x2e;&#x63;&#x6f;&#x6d;</a> to the CC list of
adds the npm support staff <a href="&#109;&#x61;&#x69;&#x6c;&#116;&#111;&#58;&#115;&#117;&#x70;&#112;&#111;&#114;&#x74;&#x40;&#x6e;&#112;&#109;&#106;&#115;&#46;&#99;&#111;&#x6d;">&#115;&#117;&#x70;&#112;&#111;&#114;&#x74;&#x40;&#x6e;&#112;&#109;&#106;&#115;&#46;&#99;&#111;&#x6d;</a> to the CC list of
the email. Mention in the email that Bob can run <code>npm owner add
joe foo</code> to add Joe as an owner of the <code>foo</code> package.</li>
<li>After a reasonable amount of time, if Bob has not responded, or if
Bob and Joe can&#39;t come to any sort of resolution, email support
<a href="&#x6d;&#97;&#x69;&#x6c;&#x74;&#111;&#x3a;&#x73;&#x75;&#x70;&#x70;&#x6f;&#x72;&#x74;&#64;&#110;&#112;&#x6d;&#106;&#x73;&#x2e;&#99;&#111;&#x6d;">&#x73;&#x75;&#x70;&#x70;&#x6f;&#x72;&#x74;&#64;&#110;&#112;&#x6d;&#106;&#x73;&#x2e;&#99;&#111;&#x6d;</a> and we&#39;ll sort it out. (&quot;Reasonable&quot; is
<a href="&#109;&#x61;&#x69;&#108;&#116;&#111;&#58;&#x73;&#117;&#112;&#x70;&#111;&#114;&#116;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#x2e;&#x63;&#111;&#x6d;">&#x73;&#117;&#112;&#x70;&#111;&#114;&#116;&#x40;&#x6e;&#x70;&#x6d;&#x6a;&#x73;&#x2e;&#x63;&#111;&#x6d;</a> and we&#39;ll sort it out. (&quot;Reasonable&quot; is
usually at least 4 weeks, but extra time is allowed around common
holidays.)</li>
</ol>
@@ -225,7 +225,7 @@ <h2 id="i-get-econnrefused-a-lot-what-s-up-">I get ECONNREFUSED a lot. What&#39
<p>To check if the registry is down, open up
<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a> in a web browser. This will also tell
you if you are just unable to access the internet for some reason.</p>
<p>If the registry IS down, let us know by emailing <a href="&#109;&#x61;&#105;&#x6c;&#x74;&#111;&#58;&#x73;&#x75;&#x70;&#x70;&#111;&#x72;&#x74;&#64;&#x6e;&#x70;&#109;&#106;&#x73;&#46;&#x63;&#x6f;&#x6d;">&#x73;&#x75;&#x70;&#x70;&#111;&#x72;&#x74;&#64;&#x6e;&#x70;&#109;&#106;&#x73;&#46;&#x63;&#x6f;&#x6d;</a>
<p>If the registry IS down, let us know by emailing <a href="&#109;&#x61;&#x69;&#x6c;&#116;&#x6f;&#x3a;&#115;&#x75;&#112;&#x70;&#x6f;&#114;&#116;&#x40;&#110;&#x70;&#109;&#106;&#x73;&#x2e;&#99;&#x6f;&#109;">&#115;&#x75;&#112;&#x70;&#x6f;&#114;&#116;&#x40;&#110;&#x70;&#109;&#106;&#x73;&#x2e;&#99;&#x6f;&#109;</a>
or posting an issue at <a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a>. If it&#39;s
down for the world (and not just on your local network) then we&#39;re
probably already being pinged about it.</p>
@@ -30,41 +30,23 @@ <h2 id="description">DESCRIPTION</h2>
run-script &lt;pkg&gt; &lt;stage&gt;</code>. <em>Pre</em> and <em>post</em> commands with matching
names will be run for those as well (e.g. <code>premyscript</code>, <code>myscript</code>,
<code>postmyscript</code>).</p>
<h2 id="note-install-scripts-are-an-antipattern">NOTE: INSTALL SCRIPTS ARE AN ANTIPATTERN</h2>
<p><strong>tl;dr</strong> Don&#39;t use <code>install</code>. Use a <code>.gyp</code> file for compilation, and
<code>prepublish</code> for anything else.</p>
<p>You should almost never have to explicitly set a <code>preinstall</code> or
<code>install</code> script. If you are doing this, please consider if there is
another option.</p>
<p>The only valid use of <code>install</code> or <code>preinstall</code> scripts is for
compilation which must be done on the target architecture. In early
versions of node, this was often done using the <code>node-waf</code> scripts, or
a standalone <code>Makefile</code>, and early versions of npm required that it be
explicitly set in package.json. This was not portable, and harder to
do properly.</p>
<p>In the current version of node, the standard way to do this is using a
<code>.gyp</code> file. If you have a file with a <code>.gyp</code> extension in the root
of your package, then npm will run the appropriate <code>node-gyp</code> commands
automatically at install time. This is the only officially supported
method for compiling binary addons, and does not require that you add
anything to your package.json file.</p>
<p>If you have to do other things before your package is used, in a way
<h2 id="common-uses">COMMON USES</h2>
<p>If you need to perform operations on your package before it is used, in a way
that is not dependent on the operating system or architecture of the
target system, then use a <code>prepublish</code> script instead. This includes
target system, use a <code>prepublish</code> script. This includes
tasks such as:</p>
<ul>
<li>Compile CoffeeScript source code into JavaScript.</li>
<li>Create minified versions of JavaScript source code.</li>
<li>Compiling CoffeeScript source code into JavaScript.</li>
<li>Creating minified versions of JavaScript source code.</li>
<li>Fetching remote resources that your package will use.</li>
</ul>
<p>The advantage of doing these things at <code>prepublish</code> time instead of
<code>preinstall</code> or <code>install</code> time is that they can be done once, in a
single place, and thus greatly reduce complexity and variability.
<p>The advantage of doing these things at <code>prepublish</code> time is that they can be done once, in a
single place, thus reducing complexity and variability.
Additionally, this means that:</p>
<ul>
<li>You can depend on <code>coffee-script</code> as a <code>devDependency</code>, and thus
your users don&#39;t need to have it installed.</li>
<li>You don&#39;t need to include the minifiers in your package, reducing
<li>You don&#39;t need to include minifiers in your package, reducing
the size for your users.</li>
<li>You don&#39;t need to rely on your users having <code>curl</code> or <code>wget</code> or
other system tools on the target machines.</li>
@@ -185,6 +167,11 @@ <h2 id="best-practices">BEST PRACTICES</h2>
<li>Don&#39;t prefix your script commands with &quot;sudo&quot;. If root permissions
are required for some reason, then it&#39;ll fail with that error, and
the user will sudo the npm command in question.</li>
<li>Don&#39;t use <code>install</code>. Use a <code>.gyp</code> file for compilation, and <code>prepublish</code>
for anything else. You should almost never have to explicitly set a
preinstall or install script. If you are doing this, please consider if
there is another option. The only valid use of <code>install</code> or <code>preinstall</code>
scripts is for compilation which must be done on the target architecture.</li>
</ul>
<h2 id="see-also">SEE ALSO</h2>
<ul>
@@ -13,14 +13,9 @@ var npm = require("./npm.js")
, mapToRegistry = require("./utils/map-to-registry.js")

bugs.completion = function (opts, cb) {
if (opts.conf.argv.remain.length > 2) return cb()
mapToRegistry("-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

npm.registry.get(uri, { timeout : 60000, auth : auth }, function (er, list) {
return cb(null, list || [])
})
})
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}

function bugs (args, cb) {
@@ -188,7 +188,9 @@ function resolveHead (p, u, co, origUrl, cb) {
parsed.hash = stdout
var resolved = url.format(parsed)

if (parsed.protocol !== "git:") resolved = "git+" + resolved
if (!/^git[+:]/.test(parsed.protocol)) {
resolved = "git+" + resolved
}

// https://github.com/npm/npm/issues/3224
// node incorrectly sticks a / at the start of the path We know that the
@@ -11,7 +11,7 @@ module.exports = function maybeGithub (p, cb) {

return addRemoteGit(u, true, function (er, data) {
if (er) {
var upriv = "git+ssh://git@github.com:" + p
var upriv = "ssh://git@github.com:" + p
log.info("maybeGithub", "Attempting %s from %s", p, upriv)

return addRemoteGit(upriv, false, function (er, data) {
@@ -160,6 +160,7 @@ Object.defineProperty(exports, "defaults", {get: function () {
, group : process.platform === "win32" ? 0
: process.env.SUDO_GID || (process.getgid && process.getgid())
, heading: "npm"
, "if-present": false
, "ignore-scripts": false
, "init-module": path.resolve(home, ".npm-init.js")
, "init-author-name" : ""
@@ -262,6 +263,7 @@ exports.types =
, "https-proxy" : [null, url]
, "user-agent" : String
, "heading": String
, "if-present": Boolean
, "ignore-scripts": Boolean
, "init-module": path
, "init-author-name" : String
@@ -11,13 +11,9 @@ var npm = require("./npm.js")
, mapToRegistry = require("./utils/map-to-registry.js")

docs.completion = function (opts, cb) {
mapToRegistry("/-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

npm.registry.get(uri, { timeout : 60000, auth : auth }, function (er, list) {
return cb(null, list || [])
})
})
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}

function url (json) {
@@ -59,19 +59,23 @@ function help (args, cb) {
var manroot = path.resolve(__dirname, "..", "man")

// legacy
if (section === "global")
section = "folders"
else if (section === "json")
section = "package.json"
if (section === "global") section = "folders"
else if (section === "json") section = "package.json"

// find either /section.n or /npm-section.n
var f = "+(npm-" + section + "|" + section + ").[0-9]"
var compext = "\\.+(gz|bz2|lzma|[FYzZ]|xz)$"
var f = "+(npm-" + section + "|" + section + ").[0-9]?(" + compext + ")"
return glob(manroot + "/*/" + f, function (er, mans) {
if (er)
return cb(er)
if (er) return cb(er)

if (!mans.length) return npm.commands["help-search"](args, cb)

if (!mans.length)
return npm.commands["help-search"](args, cb)
mans = mans.map(function (man) {
var ext = path.extname(man)
if (man.match(new RegExp(compext))) man = path.basename(man, ext)

return man
})

viewMan(pickMan(mans, pref), cb)
})
@@ -32,38 +32,58 @@ install.completion = function (opts, cb) {
// install can complete to a folder with a package.json, or any package.
// if it has a slash, then it's gotta be a folder
// if it starts with https?://, then just give up, because it's a url
// for now, not yet implemented.
mapToRegistry("-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

var options = { auth : auth }
npm.registry.get(uri, options, function (er, pkgs) {
if (er) return cb()
if (!opts.partialWord) return cb(null, pkgs)
if (/^https?:\/\//.test(opts.partialWord)) {
// do not complete to URLs
return cb(null, [])
}

var name = npa(opts.partialWord).name
pkgs = pkgs.filter(function (p) {
return p.indexOf(name) === 0
if (/\//.test(opts.partialWord)) {
// Complete fully to folder if there is exactly one match and it
// is a folder containing a package.json file. If that is not the
// case we return 0 matches, which will trigger the default bash
// complete.
var lastSlashIdx = opts.partialWord.lastIndexOf("/")
var partialName = opts.partialWord.slice(lastSlashIdx + 1)
var partialPath = opts.partialWord.slice(0, lastSlashIdx)
if (partialPath === "") partialPath = "/"

function annotatePackageDirMatch (sibling, cb) {
var fullPath = path.join(partialPath, sibling)
if (sibling.slice(0, partialName.length) !== partialName) {
return cb(null, null) // not name match
}
fs.readdir(fullPath, function (err, contents) {
if (err) return cb(null, { isPackage: false })

cb(
null,
{
fullPath: fullPath,
isPackage: contents.indexOf("package.json") !== -1
}
)
})
}

if (pkgs.length !== 1 && opts.partialWord === name) {
return cb(null, pkgs)
}
return fs.readdir(partialPath, function (err, siblings) {
if (err) return cb(null, []) // invalid dir: no matching

mapToRegistry(pkgs[0], npm.config, function (er, uri) {
if (er) return cb(er)
asyncMap(siblings, annotatePackageDirMatch, function (err, matches) {
if (err) return cb(err)

npm.registry.get(uri, options, function (er, d) {
if (er) return cb()
return cb(null, Object.keys(d["dist-tags"] || {})
.concat(Object.keys(d.versions || {}))
.map(function (t) {
return pkgs[0] + "@" + t
}))
})
var cleaned = matches.filter(function (x) { return x !== null })
if (cleaned.length !== 1) return cb(null, [])
if (!cleaned[0].isPackage) return cb(null, [])

// Success - only one match and it is a package dir
return cb(null, [cleaned[0].fullPath])
})
})
})
}

// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}

var npm = require("./npm.js")
@@ -40,6 +40,7 @@ function ls (args, silent, cb) {
var opt = { depth: depth, log: log.warn, dev: true }
readInstalled(dir, opt, function (er, data) {
pruneNestedExtraneous(data)
filterByEnv(data)
var bfs = bfsify(data, args)
, lite = getLite(bfs)

@@ -88,6 +89,21 @@ function pruneNestedExtraneous (data, visited) {
}
}

function filterByEnv (data) {
var dev = npm.config.get("dev")
var production = npm.config.get("production")
if (dev === production) return
var dependencies = {}
var devDependencies = data.devDependencies || []
Object.keys(data.dependencies).forEach(function (name) {
var keys = Object.keys(devDependencies)
if (production && keys.indexOf(name) !== -1) return
if (dev && keys.indexOf(name) === -1) return
dependencies[name] = data.dependencies[name]
})
data.dependencies = dependencies
}

function alphasort (a, b) {
a = a.toLowerCase()
b = b.toLowerCase()
@@ -224,7 +224,7 @@ Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) {
})

return commandCache[a]
}, enumerable: fullList.indexOf(c) !== -1 })
}, enumerable: fullList.indexOf(c) !== -1, configurable: true })

// make css-case commands callable via camelCase as well
if (c.match(/\-([a-z])/)) {
@@ -26,12 +26,9 @@ owner.completion = function (opts, cb) {
var byUser, theUser
switch (argv[2]) {
case "ls":
if (argv.length > 3) return cb()
return mapToRegistry("-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

npm.registry.get(uri, { auth : auth }, cb)
})
// FIXME: there used to be registry completion here, but it stopped
// making sense somewhere around 50,000 packages on the registry
return cb()

case "rm":
if (argv.length > 3) {
@@ -15,14 +15,9 @@ var npm = require("./npm.js")
, npa = require("npm-package-arg")

repo.completion = function (opts, cb) {
if (opts.conf.argv.remain.length > 2) return cb()
mapToRegistry("/-/short", npm.config, function (er, uri) {
if (er) return cb(er)

npm.registry.get(uri, { timeout : 60000 }, function (er, list) {
return cb(null, list || [])
})
})
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}

function repo (args, cb) {
@@ -84,39 +84,64 @@ function runScript (args, cb) {

function list(cb) {
var json = path.join(npm.localPrefix, "package.json")
var cmdList = [ "publish", "install", "uninstall"
, "test", "stop", "start", "restart"
].reduce(function (l, p) {
return l.concat(["pre" + p, p, "post" + p])
}, [])
return readJson(json, function(er, d) {
if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er)
if (er) d = {}
var scripts = Object.keys(d.scripts || {})
var allScripts = Object.keys(d.scripts || {})
var scripts = []
var runScripts = []
allScripts.forEach(function (script) {
if (cmdList.indexOf(script) !== -1) scripts.push(script)
else runScripts.push(script)
})

if (log.level === "silent") {
return cb(null, scripts)
return cb(null, allScripts)
}

if (npm.config.get("json")) {
console.log(JSON.stringify(d.scripts || {}, null, 2))
return cb(null, scripts)
return cb(null, allScripts)
}

if (npm.config.get("parseable")) {
allScripts.forEach(function(script) {
console.log(script + ":" + d.scripts[script])
})
return cb(null, allScripts)
}

var s = ":"
var prefix = ""
if (!npm.config.get("parseable")) {
s = "\n "
prefix = " "
console.log("Available scripts in the %s package:", d.name)
var s = "\n "
var prefix = " "
if (scripts.length) {
console.log("Lifecycle scripts included in %s:", d.name)
}
scripts.forEach(function(script) {
console.log(prefix + script + s + d.scripts[script])
})
return cb(null, scripts)
if (!scripts.length && runScripts.length) {
console.log("Scripts available in %s via `npm run-script`:", d.name)
}
else if (runScripts.length) {
console.log("\navailable via `npm run-script`:")
}
runScripts.forEach(function(script) {
console.log(prefix + script + s + d.scripts[script])
})
return cb(null, allScripts)
})
}

function run (pkg, wd, cmd, args, cb) {
if (!pkg.scripts) pkg.scripts = {}

var cmds
if (cmd === "restart") {
if (cmd === "restart" && !pkg.scripts.restart) {
cmds = [
"prestop", "stop", "poststop",
"restart",
@@ -134,6 +159,8 @@ function run (pkg, wd, cmd, args, cb) {
log.verbose("run-script using default platform env: env (Unix)")
pkg.scripts[cmd] = "env"
}
} else if (npm.config.get("if-present")) {
return cb(null);
} else {
return cb(new Error("missing script: " + cmd))
}
@@ -10,17 +10,9 @@ star.usage = "npm star <package> [pkg, pkg, ...]\n"
+ "npm unstar <package> [pkg, pkg, ...]"

star.completion = function (opts, cb) {
mapToRegistry("-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

var params = {
timeout : 60000,
auth : auth
}
npm.registry.get(uri, params, function (er, list) {
return cb(null, list || [])
})
})
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}

function star (args, cb) {
@@ -28,12 +28,11 @@ function uninstall (args, cb) {
if (args.length) return uninstall_(args, nm, cb)

// remove this package from the global space, if it's installed there
if (npm.config.get("global")) return cb(uninstall.usage)
readJson(path.resolve(npm.prefix, "package.json"), function (er, pkg) {
readJson(path.resolve(npm.localPrefix, "package.json"), function (er, pkg) {
if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er)
if (er) return cb(uninstall.usage)
uninstall_( [pkg.name]
, npm.dir
, npm.globalDir
, cb )
})

@@ -21,10 +21,10 @@ if type complete &>/dev/null; then
2>/dev/null)) || return $?
IFS="$si"
}
complete -F _npm_completion npm
complete -o default -F _npm_completion npm
elif type compdef &>/dev/null; then
_npm_completion() {
si=$IFS
local si=$IFS
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
COMP_LINE=$BUFFER \
COMP_POINT=0 \
@@ -304,11 +304,15 @@ function errorHandler (er) {
break

case "ETARGET":
log.error("notarget", [er.message
var msg = [er.message
,"This is most likely not a problem with npm itself."
,"In most cases you or one of your dependencies are requesting"
,"a package version that doesn't exist."
].join("\n"))
]
if (er.parent) {
msg.push("\nIt was specified as a dependency of '"+er.parent+"'\n")
}
log.error("notarget", msg.join("\n"))
break

case "ENOTSUP":
@@ -18,8 +18,13 @@ function prefixGitArgs () {
}

function execGit (args, options, cb) {
log.info("git", args)
return exec(git, prefixGitArgs().concat(args || []), options, cb)
log.info('git', args)
var fullArgs = prefixGitArgs().concat(args || [])
return exec(git, fullArgs, options, function (err) {
if (err) log.error('git', fullArgs.join(' '))

cb.apply(null, arguments)
})
}

function spawnGit (args, options) {
@@ -14,11 +14,9 @@ var npm = require("./npm.js")

view.completion = function (opts, cb) {
if (opts.conf.argv.remain.length <= 2) {
return mapToRegistry("-/short", npm.config, function (er, uri, auth) {
if (er) return cb(er)

npm.registry.get(uri, { auth : auth }, cb)
})
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
return cb()
}
// have the package, get the fields.
var tag = npm.config.get("tag")
@@ -1,4 +1,4 @@
.TH "NPM" "1" "February 2015" "" ""
.TH "NPM" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm\fR \- a JavaScript package manager
.P
@@ -1,4 +1,4 @@
.TH "NPM\-ACCESS" "1" "February 2015" "" ""
.TH "NPM\-ACCESS" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-access\fR \- Set access level on published packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-ADDUSER" "1" "February 2015" "" ""
.TH "NPM\-ADDUSER" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-adduser\fR \- Add a registry user account
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-BIN" "1" "February 2015" "" ""
.TH "NPM\-BIN" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-bin\fR \- Display npm bin folder
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-BUGS" "1" "February 2015" "" ""
.TH "NPM\-BUGS" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-bugs\fR \- Bugs for a package in a web browser maybe
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-BUILD" "1" "February 2015" "" ""
.TH "NPM\-BUILD" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-build\fR \- Build a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-BUNDLE" "1" "February 2015" "" ""
.TH "NPM\-BUNDLE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-bundle\fR \- REMOVED
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-CACHE" "1" "February 2015" "" ""
.TH "NPM\-CACHE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-cache\fR \- Manipulates packages cache
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-COMPLETION" "1" "February 2015" "" ""
.TH "NPM\-COMPLETION" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-completion\fR \- Tab Completion for npm
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-CONFIG" "1" "February 2015" "" ""
.TH "NPM\-CONFIG" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-config\fR \- Manage the npm configuration files
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DEDUPE" "1" "February 2015" "" ""
.TH "NPM\-DEDUPE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-dedupe\fR \- Reduce duplication
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DEPRECATE" "1" "February 2015" "" ""
.TH "NPM\-DEPRECATE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-deprecate\fR \- Deprecate a version of a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DIST\-TAG" "1" "February 2015" "" ""
.TH "NPM\-DIST\-TAG" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-dist-tag\fR \- Modify package distribution tags
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DOCS" "1" "February 2015" "" ""
.TH "NPM\-DOCS" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-docs\fR \- Docs for a package in a web browser maybe
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-EDIT" "1" "February 2015" "" ""
.TH "NPM\-EDIT" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-edit\fR \- Edit an installed package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-EXPLORE" "1" "February 2015" "" ""
.TH "NPM\-EXPLORE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-explore\fR \- Browse an installed package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-HELP\-SEARCH" "1" "February 2015" "" ""
.TH "NPM\-HELP\-SEARCH" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-help-search\fR \- Search npm help documentation
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-HELP" "1" "February 2015" "" ""
.TH "NPM\-HELP" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-help\fR \- Get help on npm
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-INIT" "1" "February 2015" "" ""
.TH "NPM\-INIT" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-init\fR \- Interactively create a package\.json file
.SH SYNOPSIS
@@ -23,6 +23,17 @@ without a really good reason to do so\.
.P
If you invoke it with \fB\-f\fR, \fB\-\-force\fR, \fB\-y\fR, or \fB\-\-yes\fR, it will use only
defaults and not prompt you for any options\.
.SH CONFIGURATION
.SS scope
.RS 0
.IP \(bu 2
Default: none
.IP \(bu 2
Type: String

.RE
.P
The scope under which the new module should be created\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
@@ -31,6 +42,8 @@ https://github\.com/isaacs/init\-package\-json
npm help 5 package\.json
.IP \(bu 2
npm help version
.IP \(bu 2
npm help 7 scope

.RE

@@ -1,4 +1,4 @@
.TH "NPM\-INSTALL" "1" "February 2015" "" ""
.TH "NPM\-INSTALL" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-install\fR \- Install a package
.SH SYNOPSIS
@@ -52,9 +52,10 @@ after packing it up into a tarball (b)\.
In global mode (ie, with \fB\-g\fR or \fB\-\-global\fR appended to the command),
it installs the current package context (ie, the current working
directory) as a global package\.
By default, \fBnpm install\fR will install all modules listed as
dependencies\. With the \fB\-\-production\fR flag,
npm will not install modules listed in \fBdevDependencies\fR\|\.
By default, \fBnpm install\fR will install all modules listed as dependencies\.
With the \fB\-\-production\fR flag (or when the \fBNODE_ENV\fR environment variable
is set to \fBproduction\fR), npm will not install modules listed in
\fBdevDependencies\fR\|\.
.IP \(bu 2
\fBnpm install <folder>\fR:
Install a package that is sitting in a folder on the filesystem\.
@@ -1,4 +1,4 @@
.TH "NPM\-LINK" "1" "February 2015" "" ""
.TH "NPM\-LINK" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-link\fR \- Symlink a package folder
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-LOGOUT" "1" "February 2015" "" ""
.TH "NPM\-LOGOUT" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-logout\fR \- Log out of the registry
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-LS" "1" "February 2015" "" ""
.TH "NPM\-LS" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-ls\fR \- List installed packages
.SH SYNOPSIS
@@ -23,7 +23,7 @@ For example, running \fBnpm ls promzard\fR in npm's source tree will show:
.P
.RS 2
.nf
npm@2.6.1 /path/to/npm
npm@2.7.0 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
@@ -86,6 +86,26 @@ Type: Int
.RE
.P
Max display depth of the dependency tree\.
.SS prod / production
.RS 0
.IP \(bu 2
Type: Boolean
.IP \(bu 2
Default: false

.RE
.P
Display only the dependency tree for packages in \fBdependencies\fR\|\.
.SS dev
.RS 0
.IP \(bu 2
Type: Boolean
.IP \(bu 2
Default: false

.RE
.P
Display only the dependency tree for packages in \fBdevDependencies\fR\|\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
@@ -1,4 +1,4 @@
.TH "NPM\-OUTDATED" "1" "February 2015" "" ""
.TH "NPM\-OUTDATED" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-outdated\fR \- Check for outdated packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-OWNER" "1" "February 2015" "" ""
.TH "NPM\-OWNER" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-owner\fR \- Manage package owners
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PACK" "1" "February 2015" "" ""
.TH "NPM\-PACK" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-pack\fR \- Create a tarball from a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PREFIX" "1" "February 2015" "" ""
.TH "NPM\-PREFIX" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-prefix\fR \- Display prefix
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PRUNE" "1" "February 2015" "" ""
.TH "NPM\-PRUNE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-prune\fR \- Remove extraneous packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PUBLISH" "1" "February 2015" "" ""
.TH "NPM\-PUBLISH" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-publish\fR \- Publish a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-REBUILD" "1" "February 2015" "" ""
.TH "NPM\-REBUILD" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-rebuild\fR \- Rebuild a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-REPO" "1" "February 2015" "" ""
.TH "NPM\-REPO" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-repo\fR \- Open package repository page in the browser
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RESTART" "1" "February 2015" "" ""
.TH "NPM\-RESTART" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-restart\fR \- Restart a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RM" "1" "February 2015" "" ""
.TH "NPM\-RM" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-rm\fR \- Remove a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-ROOT" "1" "February 2015" "" ""
.TH "NPM\-ROOT" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-root\fR \- Display npm root
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RUN\-SCRIPT" "1" "February 2015" "" ""
.TH "NPM\-RUN\-SCRIPT" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-run-script\fR \- Run arbitrary package scripts
.SH SYNOPSIS
@@ -11,16 +11,11 @@ npm run [command] [\-\- <args>]
.RE
.SH DESCRIPTION
.P
This runs an arbitrary command from a package's \fB"scripts"\fR object\.
If no package name is provided, it will search for a \fBpackage\.json\fR
in the current folder and use its \fB"scripts"\fR object\. If no \fB"command"\fR
is provided, it will list the available top level scripts\. The \fBenv\fR command
can be used to list environment variables that will be available to the script
at runtime\. If an "env" command is defined in your package it will have
precedence instead\.
.P
\fBrun[\-script]\fR is used by the test, start, restart, and stop commands, but can
be called directly, as well\.
This runs an arbitrary command from a package's \fB"scripts"\fR object\. If no
\fB"command"\fR is provided, it will list the available scripts\. \fBrun[\-script]\fR is
used by the test, start, restart, and stop commands, but can be called
directly, as well\. When the scripts in the package are printed out, they're
separated into lifecycle (test, start, restart) and directly\-run scripts\.
.P
As of \fBnpm@2\.0\.0\fR \fIhttp://blog\.npmjs\.org/post/98131109725/npm\-2\-0\-0\fR, you can
use custom arguments when executing scripts\. The special option \fB\-\-\fR is used by
@@ -35,6 +30,11 @@ npm run test \-\- \-\-grep="pattern"
.P
The arguments will only be passed to the script specified after \fBnpm run\fR
and not to any pre or post script\.
.P
The \fBenv\fR script is a special built\-in command that can be used to list
environment variables that will be available to the script at runtime\. If an
"env" command is defined in your package it will take precedence over the
built\-in\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
@@ -1,4 +1,4 @@
.TH "NPM\-SEARCH" "1" "February 2015" "" ""
.TH "NPM\-SEARCH" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-search\fR \- Search for packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-SHRINKWRAP" "1" "February 2015" "" ""
.TH "NPM\-SHRINKWRAP" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-shrinkwrap\fR \- Lock down dependency versions
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-STAR" "1" "February 2015" "" ""
.TH "NPM\-STAR" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-star\fR \- Mark your favorite packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-STARS" "1" "February 2015" "" ""
.TH "NPM\-STARS" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-stars\fR \- View packages marked as favorites
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-START" "1" "February 2015" "" ""
.TH "NPM\-START" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-start\fR \- Start a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-STOP" "1" "February 2015" "" ""
.TH "NPM\-STOP" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-stop\fR \- Stop a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-TAG" "1" "February 2015" "" ""
.TH "NPM\-TAG" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-tag\fR \- Tag a published version
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-TEST" "1" "February 2015" "" ""
.TH "NPM\-TEST" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-test\fR \- Test a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RM" "1" "February 2015" "" ""
.TH "NPM\-RM" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-rm\fR \- Remove a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-UNPUBLISH" "1" "February 2015" "" ""
.TH "NPM\-UNPUBLISH" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-unpublish\fR \- Remove a package from the registry
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-UPDATE" "1" "February 2015" "" ""
.TH "NPM\-UPDATE" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-update\fR \- Update a package
.SH SYNOPSIS
@@ -11,7 +11,7 @@ npm update [\-g] [<name> [<name> \.\.\.]]
.SH DESCRIPTION
.P
This command will update all the packages listed to the latest version
(specified by the \fBtag\fR config)\.
(specified by the \fBtag\fR config), respecting semver\.
.P
It will also install missing packages\. As with all commands that install
packages, the \fB\-\-dev\fR flag will cause \fBdevDependencies\fR to be processed
@@ -22,13 +22,148 @@ packages\.
.P
If no package name is specified, all packages in the specified location (global
or local) will be updated\.
.P
As of \fBnpm@2\.6\.1\fR, the \fBnpm update\fR will only inspect top\-level packages\.
Prior versions of \fBnpm\fR would also recursively inspect all dependencies\.
To get the old behavior, use \fBnpm \-\-depth 9999 update\fR, but be warned that
simultaneous asynchronous update of all packages, including \fBnpm\fR itself
and packages that \fBnpm\fR depends on, often causes problems up to and including
the uninstallation of \fBnpm\fR itself\.
.P
To restore a missing \fBnpm\fR, use the command:
.P
.RS 2
.nf
curl \-L https://npmjs\.com/install\.sh | sh
.fi
.RE
.SH EXAMPLES
.P
IMPORTANT VERSION NOTE: these examples assume \fBnpm@2\.6\.1\fR or later\. For
older versions of \fBnpm\fR, you must specify \fB\-\-depth 0\fR to get the behavior
described below\.
.P
For the examples below, assume that the current package is \fBapp\fR and it depends
on dependencies, \fBdep1\fR (\fBdep2\fR, \.\. etc\.)\. The published versions of \fBdep1\fR are:
.P
.RS 2
.nf
{
dist\-tags: { latest: "1\.2\.2" },
versions: { "1\.2\.2",
"1\.2\.1",
"1\.2\.0",
"1\.1\.2",
"1\.1\.1",
"1\.0\.0",
"0\.4\.1",
"0\.4\.0",
"0\.2\.0"
}
}
.fi
.RE
.SS Caret Dependencies
.P
If \fBapp\fR\|'s \fBpackage\.json\fR contains:
.P
.RS 2
.nf
dependencies: {
dep1: "^1\.1\.1"
}
.fi
.RE
.P
Then \fBnpm update\fR will install \fBdep1@1\.2\.2\fR, because \fB1\.2\.2\fR is \fBlatest\fR and
\fB1\.2\.2\fR satisfies \fB^1\.1\.1\fR\|\.
.SS Tilde Dependencies
.P
However, if \fBapp\fR\|'s \fBpackage\.json\fR contains:
.P
.RS 2
.nf
dependencies: {
dep1: "~1\.1\.1"
}
.fi
.RE
.P
In this case, running \fBnpm update\fR will install \fBdep1@1\.1\.2\fR\|\. Even though the \fBlatest\fR
tag points to \fB1\.2\.2\fR, this version does not satisfy \fB~1\.1\.1\fR, which is equivalent
to \fB>=1\.1\.1 <1\.2\.0\fR\|\. So the highest\-sorting version that satisfies \fB~1\.1\.1\fR is used,
which is \fB1\.1\.2\fR\|\.
.SS Caret Dependencies below 1\.0\.0
.P
Suppose \fBapp\fR has a caret dependency on a version below \fB1\.0\.0\fR, for example:
.P
.RS 2
.nf
dependencies: {
dep1: "^0\.2\.0"
}
.fi
.RE
.P
\fBnpm update\fR will install \fBdep1@0\.2\.0\fR, because there are no other
versions which satisfy \fB^0\.2\.0\fR\|\.
.P
If the dependence were on \fB^0\.4\.0\fR:
.P
.RS 2
.nf
dependencies: {
dep1: "^0\.4\.0"
}
.fi
.RE
.P
Then \fBnpm update\fR will install \fBdep1@0\.4\.1\fR, because that is the highest\-sorting
version that satisfies \fB^0\.4\.0\fR (\fB>= 0\.4\.0 <0\.5\.0\fR)
.SS Recording Updates with \fB\-\-save\fR
.P
When you want to update a package and save the new version as
the minimum required dependency in \fBpackage\.json\fR, you can use
\fBnpm update \-\-save\fR\|\. For example if \fBpackage\.json\fR contains
.P
.RS 2
.nf
dependencies: {
dep1: "^1\.1\.1"
}
.fi
.RE
.P
Then \fBnpm update \-\-save\fR will install \fBdep1@1\.2\.2\fR (i\.e\., \fBlatest\fR),
and \fBpackage\.json\fR will be modified:
.P
.RS 2
.nf
dependencies: {
dep1: "^1\.2\.2"
}
.fi
.RE
.P
Note that \fBnpm\fR will only write an updated version to \fBpackage\.json\fR
if it installs a new package\.
.SS Updating Globally\-Installed Packages
.P
\fBnpm update \-g\fR will apply the \fBupdate\fR action to each globally\- installed
package that is \fBoutdated\fR \-\- that is, has a version that is different from
\fBlatest\fR\|\.
.P
NOTE: If a package has been upgraded to a version newer than \fBlatest\fR, it will
be \fIdowngraded\fR\|\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
npm help install
.IP \(bu 2
npm help outdated
.IP \(bu 2
npm help shrinkwrap
.IP \(bu 2
npm help 7 registry
.IP \(bu 2
npm help 5 folders
@@ -1,4 +1,4 @@
.TH "NPM\-VERSION" "1" "February 2015" "" ""
.TH "NPM\-VERSION" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-version\fR \- Bump a package version
.SH SYNOPSIS
@@ -18,8 +18,10 @@ valid second argument to semver\.inc (one of "patch", "minor", "major",
"prepatch", "preminor", "premajor", "prerelease")\. In the second case,
the existing version will be incremented by 1 in the specified field\.
.P
If run in a git repo, it will also create a version commit and tag, and
fail if the repo is not clean\.
If run in a git repo, it will also create a version commit and tag, and fail if
the repo is not clean\. This behavior is controlled by \fBgit\-tag\-version\fR (see
below), and can be disabled on the command line by running \fBnpm
\-\-no\-git\-tag\-version version\fR
.P
If supplied with \fB\-\-message\fR (shorthand: \fB\-m\fR) config option, npm will
use it as a commit message when creating a version commit\. If the
@@ -48,6 +50,17 @@ user: "isaacs (http://blog\.izs\.me/) <i@izs\.me>"
Enter passphrase:
.fi
.RE
.SH CONFIGURATION
.SS git\-tag\-version
.RS 0
.IP \(bu 2
Default: true
.IP \(bu 2
Type: Boolean

.RE
.P
Commit and tag the version change\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
@@ -56,6 +69,8 @@ npm help init
npm help 5 package\.json
.IP \(bu 2
npm help 7 semver
.IP \(bu 2
npm help 7 config

.RE

@@ -1,4 +1,4 @@
.TH "NPM\-VIEW" "1" "February 2015" "" ""
.TH "NPM\-VIEW" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-view\fR \- View registry info
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-WHOAMI" "1" "February 2015" "" ""
.TH "NPM\-WHOAMI" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-whoami\fR \- Display npm username
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM" "1" "February 2015" "" ""
.TH "NPM" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm\fR \- javascript package manager
.SH SYNOPSIS
@@ -10,7 +10,7 @@ npm <command> [args]
.RE
.SH VERSION
.P
2.6.1
2.7.0
.SH DESCRIPTION
.P
npm is the package manager for the Node JavaScript platform\. It puts
@@ -1,4 +1,4 @@
.TH "NPM\-BIN" "3" "February 2015" "" ""
.TH "NPM\-BIN" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-bin\fR \- Display npm bin folder
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-BUGS" "3" "February 2015" "" ""
.TH "NPM\-BUGS" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-bugs\fR \- Bugs for a package in a web browser maybe
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-CACHE" "3" "February 2015" "" ""
.TH "NPM\-CACHE" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-cache\fR \- manage the npm cache programmatically
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-COMMANDS" "3" "February 2015" "" ""
.TH "NPM\-COMMANDS" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-commands\fR \- npm commands
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-CONFIG" "3" "February 2015" "" ""
.TH "NPM\-CONFIG" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-config\fR \- Manage the npm configuration files
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DEPRECATE" "3" "February 2015" "" ""
.TH "NPM\-DEPRECATE" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-deprecate\fR \- Deprecate a version of a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-DOCS" "3" "February 2015" "" ""
.TH "NPM\-DOCS" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-docs\fR \- Docs for a package in a web browser maybe
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-EDIT" "3" "February 2015" "" ""
.TH "NPM\-EDIT" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-edit\fR \- Edit an installed package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-EXPLORE" "3" "February 2015" "" ""
.TH "NPM\-EXPLORE" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-explore\fR \- Browse an installed package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-HELP\-SEARCH" "3" "February 2015" "" ""
.TH "NPM\-HELP\-SEARCH" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-help-search\fR \- Search the help pages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM" "" "February 2015" "" ""
.TH "NPM" "" "March 2015" "" ""
.SH "NAME"
\fBnpm\fR
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-INSTALL" "3" "February 2015" "" ""
.TH "NPM\-INSTALL" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-install\fR \- install a package programmatically
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-LINK" "3" "February 2015" "" ""
.TH "NPM\-LINK" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-link\fR \- Symlink a package folder
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-LOAD" "3" "February 2015" "" ""
.TH "NPM\-LOAD" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-load\fR \- Load config settings
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-LS" "3" "February 2015" "" ""
.TH "NPM\-LS" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-ls\fR \- List installed packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-OUTDATED" "3" "February 2015" "" ""
.TH "NPM\-OUTDATED" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-outdated\fR \- Check for outdated packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-OWNER" "3" "February 2015" "" ""
.TH "NPM\-OWNER" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-owner\fR \- Manage package owners
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PACK" "3" "February 2015" "" ""
.TH "NPM\-PACK" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-pack\fR \- Create a tarball from a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PREFIX" "3" "February 2015" "" ""
.TH "NPM\-PREFIX" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-prefix\fR \- Display prefix
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PRUNE" "3" "February 2015" "" ""
.TH "NPM\-PRUNE" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-prune\fR \- Remove extraneous packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-PUBLISH" "3" "February 2015" "" ""
.TH "NPM\-PUBLISH" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-publish\fR \- Publish a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-REBUILD" "3" "February 2015" "" ""
.TH "NPM\-REBUILD" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-rebuild\fR \- Rebuild a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-REPO" "3" "February 2015" "" ""
.TH "NPM\-REPO" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-repo\fR \- Open package repository page in the browser
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RESTART" "3" "February 2015" "" ""
.TH "NPM\-RESTART" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-restart\fR \- Restart a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-ROOT" "3" "February 2015" "" ""
.TH "NPM\-ROOT" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-root\fR \- Display npm root
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-RUN\-SCRIPT" "3" "February 2015" "" ""
.TH "NPM\-RUN\-SCRIPT" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-run-script\fR \- Run arbitrary package scripts
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-SEARCH" "3" "February 2015" "" ""
.TH "NPM\-SEARCH" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-search\fR \- Search for packages
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-SHRINKWRAP" "3" "February 2015" "" ""
.TH "NPM\-SHRINKWRAP" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-shrinkwrap\fR \- programmatically generate package shrinkwrap file
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-START" "3" "February 2015" "" ""
.TH "NPM\-START" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-start\fR \- Start a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-STOP" "3" "February 2015" "" ""
.TH "NPM\-STOP" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-stop\fR \- Stop a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-TAG" "3" "February 2015" "" ""
.TH "NPM\-TAG" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-tag\fR \- Tag a published version
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-TEST" "3" "February 2015" "" ""
.TH "NPM\-TEST" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-test\fR \- Test a package
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-UNINSTALL" "3" "February 2015" "" ""
.TH "NPM\-UNINSTALL" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-uninstall\fR \- uninstall a package programmatically
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-UNPUBLISH" "3" "February 2015" "" ""
.TH "NPM\-UNPUBLISH" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-unpublish\fR \- Remove a package from the registry
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-UPDATE" "3" "February 2015" "" ""
.TH "NPM\-UPDATE" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-update\fR \- Update a package
.SH SYNOPSIS
@@ -8,11 +8,19 @@
npm\.commands\.update(packages, callback)
.fi
.RE
.TH "DESCRIPTION" "" "February 2015" "" ""
.TH "DESCRIPTION" "" "March 2015" "" ""
.SH "NAME"
\fBDESCRIPTION\fR
.P
Updates a package, upgrading it to the latest version\. It also installs any missing packages\.
Updates a package, upgrading it to the latest version\. It also installs any
missing packages\.
.P
The 'packages' argument is an array of packages to update\. The 'callback' parameter will be called when done or when an error occurs\.
The \fBpackages\fR argument is an array of packages to update\. The \fBcallback\fR
parameter will be called when done or when an error occurs\.
.SH SEE ALSO
.RS 0
.IP \(bu 2
npm help update

.RE

@@ -1,4 +1,4 @@
.TH "NPM\-VERSION" "3" "February 2015" "" ""
.TH "NPM\-VERSION" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-version\fR \- Bump a package version
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-VIEW" "3" "February 2015" "" ""
.TH "NPM\-VIEW" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-view\fR \- View registry info
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-WHOAMI" "3" "February 2015" "" ""
.TH "NPM\-WHOAMI" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm-whoami\fR \- Display npm username
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM" "3" "February 2015" "" ""
.TH "NPM" "3" "March 2015" "" ""
.SH "NAME"
\fBnpm\fR \- javascript package manager
.SH SYNOPSIS
@@ -20,7 +20,7 @@ npm\.load([configObject, ]function (er, npm) {
.RE
.SH VERSION
.P
2.6.1
2.7.0
.SH DESCRIPTION
.P
This is the API documentation for npm\.
@@ -1,4 +1,4 @@
.TH "NPM\-FOLDERS" "5" "February 2015" "" ""
.TH "NPM\-FOLDERS" "5" "March 2015" "" ""
.SH "NAME"
\fBnpm-folders\fR \- Folder Structures Used by npm
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-FOLDERS" "5" "February 2015" "" ""
.TH "NPM\-FOLDERS" "5" "March 2015" "" ""
.SH "NAME"
\fBnpm-folders\fR \- Folder Structures Used by npm
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "PACKAGE\.JSON" "5" "February 2015" "" ""
.TH "PACKAGE\.JSON" "5" "March 2015" "" ""
.SH "NAME"
\fBpackage.json\fR \- Specifics of npm's package\.json handling
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPMRC" "5" "February 2015" "" ""
.TH "NPMRC" "5" "March 2015" "" ""
.SH "NAME"
\fBnpmrc\fR \- The npm config files
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "PACKAGE\.JSON" "5" "February 2015" "" ""
.TH "PACKAGE\.JSON" "5" "March 2015" "" ""
.SH "NAME"
\fBpackage.json\fR \- Specifics of npm's package\.json handling
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-CODING\-STYLE" "7" "February 2015" "" ""
.TH "NPM\-CODING\-STYLE" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-coding-style\fR \- npm's "funny" coding style
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-CONFIG" "7" "February 2015" "" ""
.TH "NPM\-CONFIG" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-config\fR \- More than you probably want to know about npm configuration
.SH DESCRIPTION
@@ -340,7 +340,7 @@ Type: Number

.RE
.P
The depth to go when recursing directories for \fBnpm ls\fR,
The depth to go when recursing directories for \fBnpm ls\fR,
\fBnpm cache ls\fR, and \fBnpm outdated\fR\|\.
.P
For \fBnpm outdated\fR, a setting of \fBInfinity\fR will be treated as \fB0\fR
@@ -545,6 +545,20 @@ Type: url
A proxy to use for outgoing https requests\. If the \fBHTTPS_PROXY\fR or
\fBhttps_proxy\fR or \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variables are set,
proxy settings will be honored by the underlying \fBrequest\fR library\.
.SS if\-present
.RS 0
.IP \(bu 2
Default: false
.IP \(bu 2
Type: Boolean

.RE
.P
If true, npm will not exit with an error code when \fBrun\-script\fR is invoked for
a script that isn't defined in the \fBscripts\fR section of \fBpackage\.json\fR\|\. This
option can be used when it's desirable to optionally run a script when it's
present and fail if the script fails\. This is useful, for example, when running
scripts that may only apply for some builds in an otherwise generic CI setup\.
.SS ignore\-scripts
.RS 0
.IP \(bu 2
@@ -1,4 +1,4 @@
.TH "NPM\-DEVELOPERS" "7" "February 2015" "" ""
.TH "NPM\-DEVELOPERS" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-developers\fR \- Developer Guide
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-DISPUTES" "7" "February 2015" "" ""
.TH "NPM\-DISPUTES" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-disputes\fR \- Handling Module Name Disputes
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "NPM\-FAQ" "7" "February 2015" "" ""
.TH "NPM\-FAQ" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-faq\fR \- Frequently Asked Questions
.SH Where can I find these docs in HTML?
@@ -1,4 +1,4 @@
.TH "NPM\-INDEX" "7" "February 2015" "" ""
.TH "NPM\-INDEX" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-index\fR \- Index of all npm documentation
.SS npm help README
@@ -1,4 +1,4 @@
.TH "NPM\-REGISTRY" "7" "February 2015" "" ""
.TH "NPM\-REGISTRY" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-registry\fR \- The JavaScript Package Registry
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-SCOPE" "7" "February 2015" "" ""
.TH "NPM\-SCOPE" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-scope\fR \- Scoped packages
.SH DESCRIPTION
@@ -1,4 +1,4 @@
.TH "NPM\-SCRIPTS" "7" "February 2015" "" ""
.TH "NPM\-SCRIPTS" "7" "March 2015" "" ""
.SH "NAME"
\fBnpm-scripts\fR \- How npm handles the "scripts" field
.SH DESCRIPTION
@@ -45,53 +45,31 @@ Additionally, arbitrary scripts can be executed by running \fBnpm
run\-script <pkg> <stage>\fR\|\. \fIPre\fR and \fIpost\fR commands with matching
names will be run for those as well (e\.g\. \fBpremyscript\fR, \fBmyscript\fR,
\fBpostmyscript\fR)\.
.SH NOTE: INSTALL SCRIPTS ARE AN ANTIPATTERN
.P
\fBtl;dr\fR Don't use \fBinstall\fR\|\. Use a \fB\|\.gyp\fR file for compilation, and
\fBprepublish\fR for anything else\.
.P
You should almost never have to explicitly set a \fBpreinstall\fR or
\fBinstall\fR script\. If you are doing this, please consider if there is
another option\.
.P
The only valid use of \fBinstall\fR or \fBpreinstall\fR scripts is for
compilation which must be done on the target architecture\. In early
versions of node, this was often done using the \fBnode\-waf\fR scripts, or
a standalone \fBMakefile\fR, and early versions of npm required that it be
explicitly set in package\.json\. This was not portable, and harder to
do properly\.
.P
In the current version of node, the standard way to do this is using a
\fB\|\.gyp\fR file\. If you have a file with a \fB\|\.gyp\fR extension in the root
of your package, then npm will run the appropriate \fBnode\-gyp\fR commands
automatically at install time\. This is the only officially supported
method for compiling binary addons, and does not require that you add
anything to your package\.json file\.
.P
If you have to do other things before your package is used, in a way
.SH COMMON USES
.P
If you need to perform operations on your package before it is used, in a way
that is not dependent on the operating system or architecture of the
target system, then use a \fBprepublish\fR script instead\. This includes
target system, use a \fBprepublish\fR script\. This includes
tasks such as:
.RS 0
.IP \(bu 2
Compile CoffeeScript source code into JavaScript\.
Compiling CoffeeScript source code into JavaScript\.
.IP \(bu 2
Create minified versions of JavaScript source code\.
Creating minified versions of JavaScript source code\.
.IP \(bu 2
Fetching remote resources that your package will use\.

.RE
.P
The advantage of doing these things at \fBprepublish\fR time instead of
\fBpreinstall\fR or \fBinstall\fR time is that they can be done once, in a
single place, and thus greatly reduce complexity and variability\.
The advantage of doing these things at \fBprepublish\fR time is that they can be done once, in a
single place, thus reducing complexity and variability\.
Additionally, this means that:
.RS 0
.IP \(bu 2
You can depend on \fBcoffee\-script\fR as a \fBdevDependency\fR, and thus
your users don't need to have it installed\.
.IP \(bu 2
You don't need to include the minifiers in your package, reducing
You don't need to include minifiers in your package, reducing
the size for your users\.
.IP \(bu 2
You don't need to rely on your users having \fBcurl\fR or \fBwget\fR or
@@ -275,6 +253,12 @@ probably set it up that way for a reason\.
Don't prefix your script commands with "sudo"\. If root permissions
are required for some reason, then it'll fail with that error, and
the user will sudo the npm command in question\.
.IP \(bu 2
Don't use \fBinstall\fR\|\. Use a \fB\|\.gyp\fR file for compilation, and \fBprepublish\fR
for anything else\. You should almost never have to explicitly set a
preinstall or install script\. If you are doing this, please consider if
there is another option\. The only valid use of \fBinstall\fR or \fBpreinstall\fR
scripts is for compilation which must be done on the target architecture\.

.RE
.SH SEE ALSO
@@ -1,4 +1,4 @@
.TH "NPM\-REMOVAL" "1" "February 2015" "" ""
.TH "NPM\-REMOVAL" "1" "March 2015" "" ""
.SH "NAME"
\fBnpm-removal\fR \- Cleaning the Slate
.SH SYNOPSIS
@@ -1,4 +1,4 @@
.TH "SEMVER" "7" "February 2015" "" ""
.TH "SEMVER" "7" "March 2015" "" ""
.SH "NAME"
\fBsemver\fR \- The semantic versioner for npm
.SH Usage

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,5 +1,5 @@
{
"version": "2.6.1",
"version": "2.7.0",
"name": "npm",
"description": "a package manager for JavaScript",
"keywords": [
@@ -53,12 +53,12 @@
"fstream-npm": "~1.0.1",
"github-url-from-git": "~1.4.0",
"github-url-from-username-repo": "~1.0.2",
"glob": "~4.4.0",
"glob": "~4.4.1",
"graceful-fs": "~3.0.5",
"inflight": "~1.0.4",
"inherits": "~2.0.1",
"ini": "~1.3.3",
"init-package-json": "~1.2.0",
"init-package-json": "~1.3.0",
"lockfile": "~1.0.0",
"lru-cache": "~2.5.0",
"minimatch": "~2.0.1",
@@ -85,15 +85,15 @@
"request": "~2.53.0",
"retry": "~0.6.1",
"rimraf": "~2.2.8",
"semver": "~4.3.0",
"semver": "~4.3.1",
"sha": "~1.3.0",
"slide": "~1.1.6",
"sorted-object": "~1.0.0",
"tar": "~1.0.3",
"text-table": "~0.2.0",
"uid-number": "0.0.6",
"umask": "~1.1.0",
"which": "~1.0.8",
"which": "~1.0.9",
"wrappy": "~1.0.1",
"write-file-atomic": "~1.1.0"
},
@@ -172,7 +172,7 @@
"npm-registry-mock": "~1.0.0",
"require-inject": "~1.1.0",
"sprintf-js": "~1.0.2",
"tap": "~0.6.0"
"tap": "~0.7.1"
},
"scripts": {
"test-legacy": "node ./test/run.js",
@@ -8,6 +8,7 @@ process.env.npm_config_loglevel = "error"
var npm_config_cache = path.resolve(__dirname, "npm_cache")
process.env.npm_config_cache = exports.npm_config_cache = npm_config_cache
process.env.npm_config_userconfig = exports.npm_config_userconfig = path.join(__dirname, "fixtures", "config", "userconfig")
process.env.npm_config_globalconfig = exports.npm_config_globalconfig = path.join(__dirname, "fixtures", "config", "globalconfig")
process.env.random_env_var = "foo"

var bin = exports.bin = require.resolve("../bin/npm-cli.js")

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,91 @@
var fs = require('fs')
var resolve = require('path').resolve
var url = require('url')

var chain = require('slide').chain
var osenv = require('osenv')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test

var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')

var pkg = resolve(__dirname, 'add-remote-git-file')
var repo = resolve(__dirname, 'add-remote-git-file-repo')

var git
var cloneURL = 'git+file://' + resolve(pkg, 'child.git')

test('setup', function (t) {
bootstrap()
setup(function (er, r) {
t.ifError(er, 'git started up successfully')

t.end()
})
})

test('cache from repo', function (t) {
process.chdir(pkg)
var addRemoteGit = require('../../lib/cache/add-remote-git.js')
addRemoteGit(cloneURL, false, function (er, data) {
t.ifError(er, 'cached via git')
t.equal(
url.parse(data._resolved).protocol,
'git+file:',
'npm didn\'t go crazy adding git+git+git+git'
)

t.end()
})
})

test('clean', function (t) {
cleanup()
t.end()
})

var pjChild = JSON.stringify({
name: 'child',
version: '1.0.3'
}, null, 2) + '\n'

function bootstrap () {
cleanup()
mkdirp.sync(pkg)
}

function setup (cb) {
mkdirp.sync(repo)
fs.writeFileSync(resolve(repo, 'package.json'), pjChild)
npm.load({ registry: common.registry, loglevel: 'silent' }, function () {
git = require('../../lib/utils/git.js')

var opts = {
cwd: repo,
env: process.env
}

chain(
[
git.chainableExec(['init'], opts),
git.chainableExec(['config', 'user.name', 'PhantomFaker'], opts),
git.chainableExec(['config', 'user.email', 'nope@not.real'], opts),
git.chainableExec(['add', 'package.json'], opts),
git.chainableExec(['commit', '-m', 'stub package'], opts),
git.chainableExec(
['clone', '--bare', repo, 'child.git'],
{ cwd: pkg, env: process.env }
)
],
cb
)
})
}

function cleanup () {
process.chdir(osenv.tmpdir())
rimraf.sync(repo)
rimraf.sync(pkg)
}
@@ -10,7 +10,7 @@ var requireInject = require("require-inject")

var npm = require("../../lib/npm.js")

var PKG_DIR = path.resolve(__dirname, "build-alread-built")
var PKG_DIR = path.resolve(__dirname, "build-already-built")
var fakePkg = "foo"

test("setup", function (t) {
@@ -0,0 +1,118 @@
var fs = require('fs')
var resolve = require('path').resolve

var osenv = require('osenv')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test

var common = require('../common-tap.js')

var pkg = resolve(__dirname, 'graceful-restart')

test('setup', function (t) {
bootstrap()
t.end()
})

test('graceless restart', function (t) {
fs.writeFileSync(resolve(pkg, 'package.json'), pjGraceless)
createChild(['run-script', 'restart'], function (err, code, out) {
t.ifError(err, 'restart finished successfully')
t.equal(code, 0, 'npm run-script exited with code')
t.equal(out, outGraceless, 'expected all scripts to run')
t.end()
})
})

test('graceful restart', function (t) {
fs.writeFileSync(resolve(pkg, 'package.json'), pjGraceful)
createChild(['run-script', 'restart'], function (err, code, out) {
t.ifError(err, 'restart finished successfully')
t.equal(code, 0, 'npm run-script exited with code')
t.equal(out, outGraceful, 'expected only *restart scripts to run')
t.end()
})
})

test('clean', function (t) {
cleanup()
t.end()
})

var outGraceless = [
'prerestart',
'prestop',
'stop',
'poststop',
'prestart',
'start',
'poststart',
'postrestart',
''
].join('\n')

var outGraceful = [
'prerestart',
'restart',
'postrestart',
''
].join('\n')

var pjGraceless = JSON.stringify({
name: 'graceless',
version: '1.2.3',
scripts: {
'prestop': 'echo prestop',
'stop': 'echo stop',
'poststop': 'echo poststop',
'prerestart': 'echo prerestart',
'postrestart': 'echo postrestart',
'prestart': 'echo prestart',
'start': 'echo start',
'poststart': 'echo poststart'
}
}, null, 2) + '\n'

var pjGraceful = JSON.stringify({
name: 'graceful',
version: '1.2.3',
scripts: {
'prestop': 'echo prestop',
'stop': 'echo stop',
'poststop': 'echo poststop',
'prerestart': 'echo prerestart',
'restart': 'echo restart',
'postrestart': 'echo postrestart',
'prestart': 'echo prestart',
'start': 'echo start',
'poststart': 'echo poststart'
}
}, null, 2) + '\n'

function bootstrap () {
mkdirp.sync(pkg)
}

function cleanup () {
process.chdir(osenv.tmpdir())
rimraf.sync(pkg)
}

function createChild (args, cb) {
var env = {
HOME: process.env.HOME,
Path: process.env.PATH,
PATH: process.env.PATH,
'npm_config_loglevel': 'silent'
}

if (process.platform === 'win32')
env.npm_config_cache = '%APPDATA%\\npm-cache'

return common.npm(args, {
cwd: pkg,
stdio: ['ignore', 'pipe', 'ignore'],
env: env
}, cb)
}
@@ -13,13 +13,6 @@ test("lifecycle signal abort", function (t) {
cwd: pkg
})
child.on("close", function (code, signal) {
// GNU shell returns a code, no signal
if (process.platform === "linux") {
t.equal(code, 1)
t.equal(signal, null)
return t.end()
}

t.equal(code, null)
t.equal(signal, "SIGSEGV")
t.end()
@@ -0,0 +1,77 @@
var common = require('../common-tap')
var test = require('tap').test
var path = require('path')
var rimraf = require('rimraf')
var osenv = require('osenv')
var mkdirp = require('mkdirp')
var pkg = path.resolve(__dirname, 'ls-depth')
var mr = require('npm-registry-mock')
var opts = {cwd: pkg}

function cleanup () {
process.chdir(osenv.tmpdir())
rimraf.sync(pkg + '/cache')
rimraf.sync(pkg + '/tmp')
rimraf.sync(pkg + '/node_modules')
}

test('setup', function (t) {
cleanup()
mkdirp.sync(pkg + '/cache')
mkdirp.sync(pkg + '/tmp')
mr({port: common.port}, function (er, s) {
common.npm(
[
'install',
'--registry', common.registry
],
opts,
function (er, c) {
t.ifError(er, 'install ran without issue')
t.equal(c, 0)
s.close()
t.end()
}
)
})
})

test('npm ls --dev', function (t) {
common.npm(['ls', '--dev'], opts, function (er, code, stdout) {
t.ifError(er, 'ls --dev ran without issue')
t.equal(code, 0)
t.has(stdout, /(empty)/, 'output contains (empty)')
t.end()
})
})

test('npm ls --production', function (t) {
common.npm(['ls', '--production'], opts, function (er, code, stdout) {
t.ifError(er, 'ls --production ran without issue')
t.notOk(code, 'npm exited ok')
t.has(
stdout,
/test-package-with-one-dep@0\.0\.0/,
'output contains test-package-with-one-dep@0.0.0'
)
t.end()
})
})

test('npm ls --prod', function (t) {
common.npm(['ls', '--prod'], opts, function (er, code, stdout) {
t.ifError(er, 'ls --prod ran without issue')
t.notOk(code, 'npm exited ok')
t.has(
stdout,
/test-package-with-one-dep@0\.0\.0/,
'output contains test-package-with-one-dep@0.0.0'
)
t.end()
})
})

test('cleanup', function (t) {
cleanup()
t.end()
})
@@ -3,28 +3,53 @@ var common = require('../common-tap')
, rimraf = require('rimraf')
, npm = require('../../')
, mr = require('npm-registry-mock')
, pkg = __dirname + '/outdated-depth'
, pkg = __dirname + '/outdated-depth-integer'

var osenv = require("osenv")
var mkdirp = require("mkdirp")
var fs = require("fs")

var pj = JSON.stringify({
"name": "whatever",
"description": "yeah idk",
"version": "1.2.3",
"main": "index.js",
"dependencies": {
"underscore": "1.3.1"
},
"repository": "git://github.com/luk-/whatever"
}, null, 2);

function cleanup () {
rimraf.sync(pkg + '/node_modules')
rimraf.sync(pkg + '/cache')
process.chdir(osenv.tmpdir())
rimraf.sync(pkg)
}

function setup () {
mkdirp.sync(pkg)
process.chdir(pkg)
fs.writeFileSync("package.json", pj)
}

test("setup", function (t) {
cleanup()
setup()
t.end()
})

test('outdated depth integer', function (t) {
// todo: update with test-package-with-one-dep once the new
// npm-registry-mock is published
var expected = [
var expected = [[
pkg,
'underscore',
'1.3.1',
'1.3.1',
'1.5.1',
undefined, // no version installed
'1.3.1', // wanted
'1.5.1', // latest
'1.3.1'
]

process.chdir(pkg)
]]

mr({port : common.port}, function (s) {
mr({port : common.port}, function (er, s) {
npm.load({
cache: pkg + '/cache'
, loglevel: 'silent'
@@ -36,7 +61,7 @@ test('outdated depth integer', function (t) {
if (er) throw new Error(er)
npm.outdated(function (err, d) {
if (err) throw new Error(err)
t.deepEqual(d[0], expected)
t.deepEqual(d, expected)
s.close()
t.end()
})