James Halliday <mail@substack.net>
Jeremy Cantrell <jmcantrell@gmail.com>
Ribettes <patlogan29@gmail.com>
+Einar Otto Stangvik <einaros@gmail.com>
Don Park <donpark@docuverse.com>
Kei Son <heyacct@gmail.com>
Nicolas Morel <marsup@gmail.com>
Mark Dube <markisdee@gmail.com>
+Nathan Rajlich <nathan@tootallnate.net>
Maxim Bogushevich <boga1@mail.ru>
Justin Beckwith <justbe@microsoft.com>
Meaglin <Meaglin.wasabi@gmail.com>
+Ben Evans <ben@bensbit.co.uk>
+Nathan Zadoks <nathan@nathan7.eu>
+Brian White <mscdex@gmail.com>
+Jed Schmidt <tr@nslator.jp>
+Ian Livingstone <ianl@cs.dal.ca>
+Patrick Pfeiffer <patrick@buzzle.at>
+Paul Miller <paul@paulmillr.com>
+seebees <seebees@gmail.com>
<p>This function should not be used programmatically. Instead, just refer
to the <code>npm.bin</code> member.</p>
</div>
-<p id="footer">bin — npm@1.2.0</p>
+<p id="footer">bin — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">bugs — npm@1.2.0</p>
+<p id="footer">bugs — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer">commands — npm@1.2.0</p>
+<p id="footer">commands — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">config — npm@1.2.0</p>
+<p id="footer">config — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../api/unpublish.html">unpublish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">deprecate — npm@1.2.0</p>
+<p id="footer">deprecate — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This command will launch a browser, so this command may not be the most
friendly for programmatic use.</p>
</div>
-<p id="footer">docs — npm@1.2.0</p>
+<p id="footer">docs — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Since this command opens an editor in a new process, be careful about where
and how this is used.</p>
</div>
-<p id="footer">edit — npm@1.2.0</p>
+<p id="footer">edit — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The first element in the 'args' parameter must be a package name. After that is the optional command, which can be any number of strings. All of the strings will be combined into one, space-delimited command.</p>
</div>
-<p id="footer">explore — npm@1.2.0</p>
+<p id="footer">explore — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The silent parameter is not neccessary not used, but it may in the future.</p>
</div>
-<p id="footer">help-search — npm@1.2.0</p>
+<p id="footer">help-search — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p><a href="../doc/json.html">json(1)</a></p>
</div>
-<p id="footer">init — npm@1.2.0</p>
+<p id="footer">init — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when all packages have been
installed or when an error has been encountered.</p>
</div>
-<p id="footer">install — npm@1.2.0</p>
+<p id="footer">install — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Now, any changes to the redis package will be reflected in
the package in the current working directory</p>
</div>
-<p id="footer">link — npm@1.2.0</p>
+<p id="footer">link — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>For a list of all the available command-line configs, see <code>npm help config</code></p>
</div>
-<p id="footer">load — npm@1.2.0</p>
+<p id="footer">load — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
This means that if a submodule a same dependency as a parent module, then the
dependency will only be output once.</p>
</div>
-<p id="footer">ls — npm@1.2.0</p>
+<p id="footer">ls — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.2.0</p>
+<p>1.2.2</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<pre><code>var cmd = npm.deref("unp") // cmd === "unpublish"</code></pre>
</div>
-<p id="footer">npm — npm@1.2.0</p>
+<p id="footer">npm — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If the 'packages' parameter is left out, npm will check all packages.</p>
</div>
-<p id="footer">outdated — npm@1.2.0</p>
+<p id="footer">outdated — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/publish.html">publish(3)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">owner — npm@1.2.0</p>
+<p id="footer">owner — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If no arguments are supplied, then npm packs the current package folder.</p>
</div>
-<p id="footer">pack — npm@1.2.0</p>
+<p id="footer">pack — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">prefix — npm@1.2.0</p>
+<p id="footer">prefix — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Extraneous packages are packages that are not listed on the parent
package's dependencies list.</p>
</div>
-<p id="footer">prune — npm@1.2.0</p>
+<p id="footer">prune — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../api/owner.html">owner(3)</a></li></ul>
</div>
-<p id="footer">publish — npm@1.2.0</p>
+<p id="footer">publish — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>See <code>npm help build</code></p>
</div>
-<p id="footer">rebuild — npm@1.2.0</p>
+<p id="footer">rebuild — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul>
</div>
-<p id="footer">restart — npm@1.2.0</p>
+<p id="footer">restart — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically.</p>
</div>
-<p id="footer">root — npm@1.2.0</p>
+<p id="footer">root — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../api/test.html">test(3)</a></li><li><a href="../api/start.html">start(3)</a></li><li><a href="../api/restart.html">restart(3)</a></li><li><a href="../api/stop.html">stop(3)</a></li></ul>
</div>
-<p id="footer">run-script — npm@1.2.0</p>
+<p id="footer">run-script — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
and doesn't try to read your mind (it doesn't do any verb tense matching or the
like).</p>
</div>
-<p id="footer">search — npm@1.2.0</p>
+<p id="footer">search — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when the shrinkwrap has
been saved.</p>
</div>
-<p id="footer">shrinkwrap — npm@1.2.0</p>
+<p id="footer">shrinkwrap — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">start — npm@1.2.0</p>
+<p id="footer">start — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run stop on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">stop — npm@1.2.0</p>
+<p id="footer">stop — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li>npm help json</li><li>git help submodule</li></ul>
</div>
-<p id="footer">submodule — npm@1.2.0</p>
+<p id="footer">submodule — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
used. For more information about how to set this config, check
<code>man 3 npm-config</code> for programmatic usage or <code>man npm-config</code> for cli usage.</p>
</div>
-<p id="footer">tag — npm@1.2.0</p>
+<p id="footer">tag — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>npm can run tests on multiple packages. Just specify multiple packages
in the <code>packages</code> parameter.</p>
</div>
-<p id="footer">test — npm@1.2.0</p>
+<p id="footer">test — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>Finally, 'callback' is a function that will be called when all packages have been
uninstalled or when an error has been encountered.</p>
</div>
-<p id="footer">uninstall — npm@1.2.0</p>
+<p id="footer">uninstall — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>If no version is specified, or if all versions are removed then
the root package entry is removed from the registry entirely.</p>
</div>
-<p id="footer">unpublish — npm@1.2.0</p>
+<p id="footer">unpublish — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.</p>
</div>
-<p id="footer">update — npm@1.2.0</p>
+<p id="footer">update — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
parameter. The difference, however, is this function will fail if it does
not have exactly one element. The only element should be a version number.</p>
</div>
-<p id="footer">version — npm@1.2.0</p>
+<p id="footer">version — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>corresponding to the list of fields selected.</p>
</div>
-<p id="footer">view — npm@1.2.0</p>
+<p id="footer">view — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">whoami — npm@1.2.0</p>
+<p id="footer">whoami — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer"><a href="../doc/README.html">README</a> — npm@1.2.0</p>
+<p id="footer"><a href="../doc/README.html">README</a> — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li></ul>
</div>
-<p id="footer">adduser — npm@1.2.0</p>
+<p id="footer">adduser — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">bin — npm@1.2.0</p>
+<p id="footer">bin — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/docs.html">docs(1)</a></li><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">bugs — npm@1.2.0</p>
+<p id="footer">bugs — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">build — npm@1.2.0</p>
+<p id="footer">build — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">bundle — npm@1.2.0</p>
+<p id="footer">bundle — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li></ul>
</div>
-<p id="footer">cache — npm@1.2.0</p>
+<p id="footer">cache — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li></ul>
</div>
-<p id="footer">changelog — npm@1.2.0</p>
+<p id="footer">changelog — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">coding-style — npm@1.2.0</p>
+<p id="footer">coding-style — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">completion — npm@1.2.0</p>
+<p id="footer">completion — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li></ul>
</div>
-<p id="footer">config — npm@1.2.0</p>
+<p id="footer">config — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/ls.html">ls(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">dedupe — npm@1.2.0</p>
+<p id="footer">dedupe — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">deprecate — npm@1.2.0</p>
+<p id="footer">deprecate — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li></ul>
</div>
-<p id="footer">developers — npm@1.2.0</p>
+<p id="footer">developers — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul>
</div>
-<p id="footer">disputes — npm@1.2.0</p>
+<p id="footer">disputes — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">docs — npm@1.2.0</p>
+<p id="footer">docs — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/explore.html">explore(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">edit — npm@1.2.0</p>
+<p id="footer">edit — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/submodule.html">submodule(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/edit.html">edit(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">explore — npm@1.2.0</p>
+<p id="footer">explore — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul>
</div>
-<p id="footer">faq — npm@1.2.0</p>
+<p id="footer">faq — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/pack.html">pack(1)</a></li><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li></ul>
</div>
-<p id="footer">folders — npm@1.2.0</p>
+<p id="footer">folders — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/help.html">help(1)</a></li></ul>
</div>
-<p id="footer">help-search — npm@1.2.0</p>
+<p id="footer">help-search — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/npm.html">npm(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/help-search.html">help-search(1)</a></li><li><a href="../doc/index.html">index(1)</a></li></ul>
</div>
-<p id="footer">help — npm@1.2.0</p>
+<p id="footer">help — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p> Display npm username</p>
</div>
-<p id="footer">index — npm@1.2.0</p>
+<p id="footer">index — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="https://github.com/isaacs/init-package-json">https://github.com/isaacs/init-package-json</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/version.html">version(1)</a></li></ul>
</div>
-<p id="footer">init — npm@1.2.0</p>
+<p id="footer">init — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/rebuild.html">rebuild(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/shrinkwrap.html">shrinkwrap(1)</a></li></ul>
</div>
-<p id="footer">install — npm@1.2.0</p>
+<p id="footer">install — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/semver.html">semver(1)</a></li><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/version.html">version(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/rm.html">rm(1)</a></li></ul>
</div>
-<p id="footer">json — npm@1.2.0</p>
+<p id="footer">json — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">link — npm@1.2.0</p>
+<p id="footer">link — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
-<pre><code>npm@1.2.0 /path/to/npm
+<pre><code>npm@1.2.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5</code></pre>
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/link.html">link(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/update.html">update(1)</a></li></ul>
</div>
-<p id="footer">ls — npm@1.2.0</p>
+<p id="footer">ls — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.2.0</p>
+<p>1.2.2</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<ul><li><a href="../doc/help.html">help(1)</a></li><li><a href="../doc/faq.html">faq(1)</a></li><li><a href="../doc/README.html">README</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/index.html">index(1)</a></li><li><a href="../api/npm.html">npm(3)</a></li></ul>
</div>
-<p id="footer">npm — npm@1.2.0</p>
+<p id="footer">npm — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/update.html">update(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li></ul>
</div>
-<p id="footer">outdated — npm@1.2.0</p>
+<p id="footer">outdated — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul>
</div>
-<p id="footer">owner — npm@1.2.0</p>
+<p id="footer">owner — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/cache.html">cache(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">pack — npm@1.2.0</p>
+<p id="footer">pack — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/root.html">root(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">prefix — npm@1.2.0</p>
+<p id="footer">prefix — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">prune — npm@1.2.0</p>
+<p id="footer">prune — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/tag.html">tag(1)</a></li></ul>
</div>
-<p id="footer">publish — npm@1.2.0</p>
+<p id="footer">publish — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/build.html">build(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">rebuild — npm@1.2.0</p>
+<p id="footer">rebuild — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/disputes.html">disputes(1)</a></li></ul>
</div>
-<p id="footer">registry — npm@1.2.0</p>
+<p id="footer">registry — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/README.html">README</a></li><li><a href="../doc/rm.html">rm(1)</a></li><li><a href="../doc/prune.html">prune(1)</a></li></ul>
</div>
-<p id="footer">removing-npm — npm@1.2.0</p>
+<p id="footer">removing-npm — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">restart — npm@1.2.0</p>
+<p id="footer">restart — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/prefix.html">prefix(1)</a></li><li><a href="../doc/bin.html">bin(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">root — npm@1.2.0</p>
+<p id="footer">root — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">run-script — npm@1.2.0</p>
+<p id="footer">run-script — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/developers.html">developers(1)</a></li><li><a href="../doc/install.html">install(1)</a></li></ul>
</div>
-<p id="footer">scripts — npm@1.2.0</p>
+<p id="footer">scripts — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/view.html">view(1)</a></li></ul>
</div>
-<p id="footer">search — npm@1.2.0</p>
+<p id="footer">search — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/json.html">json(1)</a></li></ul>
</div>
-<p id="footer">semver — npm@1.2.0</p>
+<p id="footer">semver — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">shrinkwrap — npm@1.2.0</p>
+<p id="footer">shrinkwrap — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/view.html">view(1)</a></li><li><a href="../doc/whoami.html">whoami(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul>
</div>
-<p id="footer">star — npm@1.2.0</p>
+<p id="footer">star — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">start — npm@1.2.0</p>
+<p id="footer">start — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/test.html">test(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li></ul>
</div>
-<p id="footer">stop — npm@1.2.0</p>
+<p id="footer">stop — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/json.html">json(1)</a></li><li>git help submodule</li></ul>
</div>
-<p id="footer">submodule — npm@1.2.0</p>
+<p id="footer">submodule — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">tag — npm@1.2.0</p>
+<p id="footer">tag — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/run-script.html">run-script(1)</a></li><li><a href="../doc/scripts.html">scripts(1)</a></li><li><a href="../doc/start.html">start(1)</a></li><li><a href="../doc/restart.html">restart(1)</a></li><li><a href="../doc/stop.html">stop(1)</a></li></ul>
</div>
-<p id="footer">test — npm@1.2.0</p>
+<p id="footer">test — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/prune.html">prune(1)</a></li><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/config.html">config(1)</a></li></ul>
</div>
-<p id="footer">uninstall — npm@1.2.0</p>
+<p id="footer">uninstall — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/deprecate.html">deprecate(1)</a></li><li><a href="../doc/publish.html">publish(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li><li><a href="../doc/owner.html">owner(1)</a></li></ul>
</div>
-<p id="footer">unpublish — npm@1.2.0</p>
+<p id="footer">unpublish — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/install.html">install(1)</a></li><li><a href="../doc/outdated.html">outdated(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/folders.html">folders(1)</a></li><li><a href="../doc/list.html">list(1)</a></li></ul>
</div>
-<p id="footer">update — npm@1.2.0</p>
+<p id="footer">update — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/init.html">init(1)</a></li><li><a href="../doc/json.html">json(1)</a></li><li><a href="../doc/semver.html">semver(1)</a></li></ul>
</div>
-<p id="footer">version — npm@1.2.0</p>
+<p id="footer">version — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/search.html">search(1)</a></li><li><a href="../doc/registry.html">registry(1)</a></li><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/docs.html">docs(1)</a></li></ul>
</div>
-<p id="footer">view — npm@1.2.0</p>
+<p id="footer">view — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<ul><li><a href="../doc/config.html">config(1)</a></li><li><a href="../doc/adduser.html">adduser(1)</a></li></ul>
</div>
-<p id="footer">whoami — npm@1.2.0</p>
+<p id="footer">whoami — npm@1.2.2</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
*/
exports = module.exports = cache
-exports.read = read
-exports.clean = clean
-exports.unpack = unpack
-exports.lock = lock
-exports.unlock = unlock
+cache.read = read
+cache.clean = clean
+cache.unpack = unpack
+cache.lock = lock
+cache.unlock = unlock
var mkdir = require("mkdirp")
, exec = require("./utils/exec.js")
+ , spawn = require("child_process").spawn
+ , once = require("once")
, fetch = require("./utils/fetch.js")
, npm = require("./npm.js")
, fs = require("graceful-fs")
, lockFile = require("lockfile")
, crypto = require("crypto")
, retry = require("retry")
+ , zlib = require("zlib")
cache.usage = "npm cache add <tarball file>"
+ "\nnpm cache add <folder>"
if (0 === prefix.indexOf(process.env.HOME)) {
prefix = "~" + prefix.substr(process.env.HOME.length)
}
- ls_(args, npm.config.get("depth"), function(er, files) {
+ ls_(args, npm.config.get("depth"), function (er, files) {
console.log(files.map(function (f) {
return path.join(prefix, f)
}).join("\n").trim())
// npm cache add <pkg> <ver>
// npm cache add <tarball>
// npm cache add <folder>
-exports.add = function (pkg, ver, scrub, cb) {
+cache.add = function (pkg, ver, scrub, cb) {
if (typeof cb !== "function") cb = scrub, scrub = false
if (typeof cb !== "function") cb = ver, ver = null
if (scrub) {
spec = args[0]
}
- log.silly("cache add", "name=%j spec=%j args=%j", name, spec, args)
+ log.verbose("cache add", "name=%j spec=%j args=%j", name, spec, args)
if (!name && !spec) return cb(usage)
if (iF.length > 1) return
function cb (er, data) {
+ if (data) {
+ data._from = u
+ data._resolved = u
+ }
unlock(u, function () {
var c
while (c = iF.shift()) c(er, data)
})
}
+ var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), "tmp.tgz")
+
lock(u, function (er) {
if (er) return cb(er)
log.verbose("addRemoteTarball", [u, shasum])
- var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), "tmp.tgz")
mkdir(path.dirname(tmp), function (er) {
if (er) return cb(er)
- // Tuned to spread 3 attempts over about a minute.
- // See formula at <https://github.com/tim-kos/node-retry>.
- var operation = retry.operation
- ( { retries: npm.config.get("fetch-retries")
- , factor: npm.config.get("fetch-retry-factor")
- , minTimeout: npm.config.get("fetch-retry-mintimeout")
- , maxTimeout: npm.config.get("fetch-retry-maxtimeout") })
-
- operation.attempt(function (currentAttempt) {
- log.info("retry", "fetch attempt " + currentAttempt
- + " at " + (new Date()).toLocaleTimeString())
- fetchAndShaCheck(u, tmp, shasum, function (er, response) {
- // Only retry on 408, 5xx or no `response`.
- var statusCode = response && response.statusCode
- var statusRetry = !statusCode || (statusCode === 408 || statusCode >= 500)
- if (er && statusRetry && operation.retry(er)) {
- log.info("retry", "will retry, error on last attempt: " + er)
- return
- }
- done(er)
- })
- })
+ addRemoteTarball_(u, tmp, shasum, done)
+ })
+ })
+
+ function done (er) {
+ if (er) return cb(er)
+ addLocalTarball(tmp, name, cb)
+ }
+}
+
+function addRemoteTarball_(u, tmp, shasum, cb) {
+ // Tuned to spread 3 attempts over about a minute.
+ // See formula at <https://github.com/tim-kos/node-retry>.
+ var operation = retry.operation
+ ( { retries: npm.config.get("fetch-retries")
+ , factor: npm.config.get("fetch-retry-factor")
+ , minTimeout: npm.config.get("fetch-retry-mintimeout")
+ , maxTimeout: npm.config.get("fetch-retry-maxtimeout") })
+
+ operation.attempt(function (currentAttempt) {
+ log.info("retry", "fetch attempt " + currentAttempt
+ + " at " + (new Date()).toLocaleTimeString())
+ fetchAndShaCheck(u, tmp, shasum, function (er, response) {
+ // Only retry on 408, 5xx or no `response`.
+ var sc = response && response.statusCode
+ var statusRetry = !sc || (sc === 408 || sc >= 500)
+ if (er && statusRetry && operation.retry(er)) {
+ log.info("retry", "will retry, error on last attempt: " + er)
+ return
+ }
+ cb(er)
})
- function done (er) {
- if (er) return cb(er)
- addLocalTarball(tmp, name, cb)
- }
})
}
-// For now, this is kind of dumb. Just basically treat git as
-// yet another "fetch and scrub" kind of thing.
-// Clone to temp folder, then proceed with the addLocal stuff.
+// 1. cacheDir = path.join(cache,'_git-remotes',sha1(u))
+// 2. checkGitDir(cacheDir) ? 4. : 3. (rm cacheDir if necessary)
+// 3. git clone --mirror u cacheDir
+// 4. cd cacheDir && git fetch -a origin
+// 5. git archive /tmp/random.tgz
+// 6. addLocalTarball(/tmp/random.tgz) <gitref> --format=tar --prefix=package/
function addRemoteGit (u, parsed, name, cb_) {
if (typeof cb_ !== "function") cb_ = name, name = null
})
}
+ var p, co // cachePath, git-ref we want to check out
+
lock(u, function (er) {
if (er) return cb(er)
u = u.replace(/^ssh:\/\//, "")
}
+ var v = crypto.createHash("sha1").update(u).digest("hex").slice(0, 8)
+ v = u.replace(/[^a-zA-Z0-9]+/g, '-') + '-' + v
+
log.verbose("addRemoteGit", [u, co])
- var tmp = path.join(npm.tmp, Date.now()+"-"+Math.random())
- mkdir(path.dirname(tmp), function (er) {
+ p = path.join(npm.config.get("cache"), "_git-remotes", v)
+
+ checkGitDir(p, u, co, cb)
+ })
+}
+
+function checkGitDir (p, u, co, cb) {
+ fs.stat(p, function (er, s) {
+ if (er) return cloneGitRemote(p, u, co, cb)
+ if (!s.isDirectory()) return rm(p, function (er){
if (er) return cb(er)
- exec( npm.config.get("git"), ["clone", u, tmp], gitEnv(), false
- , function (er, code, stdout, stderr) {
- stdout = (stdout + "\n" + stderr).trim()
- if (er) {
- log.error("git clone " + u, stdout)
- return cb(er)
- }
- log.verbose("git clone "+u, stdout)
- exec( npm.config.get("git"), ["checkout", co], gitEnv(), false, tmp
- , function (er, code, stdout, stderr) {
- stdout = (stdout + "\n" + stderr).trim()
- if (er) {
- log.error("git checkout " + co, stdout)
- return cb(er)
- }
- log.verbose("git checkout " + co, stdout)
- addLocalDirectory(tmp, cb)
+ cloneGitRemote(p, u, co, cb)
+ })
+
+ var git = npm.config.get("git")
+ var args = ["config", "--get", "remote.origin.url"]
+ var env = gitEnv()
+
+ exec(git, args, env, false, p, function (er, code, stdout, stderr) {
+ stdoutTrimmed = (stdout + "\n" + stderr).trim()
+ if (er || u !== stdout.trim()) {
+ log.warn( "`git config --get remote.origin.url` returned "
+ + "wrong result ("+u+")", stdoutTrimmed )
+ return rm(p, function (er){
+ if (er) return cb(er)
+ cloneGitRemote(p, u, co, cb)
})
- })
+ }
+ log.verbose("git remote.origin.url", stdoutTrimmed)
+ archiveGitRemote(p, u, co, cb)
+ })
+ })
+}
+
+function cloneGitRemote (p, u, co, cb) {
+ mkdir(p, function (er) {
+ if (er) return cb(er)
+ exec( npm.config.get("git"), ["clone", "--mirror", u, p], gitEnv(), false
+ , function (er, code, stdout, stderr) {
+ stdout = (stdout + "\n" + stderr).trim()
+ if (er) {
+ log.error("git clone " + u, stdout)
+ return cb(er)
+ }
+ log.verbose("git clone " + u, stdout)
+ archiveGitRemote(p, u, co, cb)
})
})
}
+function archiveGitRemote (p, u, co, cb) {
+ var git = npm.config.get("git")
+ var archive = ["fetch", "-a", "origin"]
+ var resolve = ["rev-list", "-n1", co]
+ var env = gitEnv()
+
+ var errState = null
+ var n = 0
+ var resolved = null
+ var tmp
+
+ exec(git, archive, env, false, p, function (er, code, stdout, stderr) {
+ stdout = (stdout + "\n" + stderr).trim()
+ if (er) {
+ log.error("git fetch -a origin ("+u+")", stdout)
+ return next(er)
+ }
+ log.verbose("git fetch -a origin ("+u+")", stdout)
+ tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), "tmp.tgz")
+ next()
+ })
+
+ exec(git, resolve, env, false, p, function (er, code, stdout, stderr) {
+ stdout = (stdout + "\n" + stderr).trim()
+ if (er) {
+ log.error("Failed resolving git HEAD (" + u + ")", stderr)
+ return next(er)
+ }
+ log.verbose("git rev-list -n1 " + co, stdout)
+ var parsed = url.parse(u)
+ parsed.hash = stdout
+ resolved = url.format(parsed)
+ next()
+ })
+
+ function next (er) {
+ if (errState) return
+ if (er) return cb(errState = er)
+
+ if (++n < 2) return
+
+ mkdir(path.dirname(tmp), function (er) {
+ if (er) return cb(er)
+ var gzip = zlib.createGzip({ level: 9 })
+ var git = npm.config.get("git")
+ var args = ["archive", co, "--format=tar", "--prefix=package/"]
+ var out = fs.createWriteStream(tmp)
+ var env = gitEnv()
+ cb = once(cb)
+ var cp = spawn(git, args, { env: env, cwd: p })
+ cp.on("error", cb)
+ cp.stderr.on("data", function(chunk) {
+ log.silly(chunk.toString(), "git archive")
+ })
+
+ cp.stdout.pipe(gzip).pipe(out).on("close", function() {
+ addLocalTarball(tmp, function(er, data) {
+ if (data) data._resolved = resolved
+ cb(er, data)
+ })
+ })
+ })
+ }
+}
var gitEnv_
function gitEnv () {
if (iF.length > 1) return
function cb (er, data) {
+ if (data && !data._fromGithub) data._from = k
unlock(k, function () {
var c
while (c = iF.shift()) c(er, data)
log.error("addLocal", "Could not install %s", p)
return cb_(er)
}
+ if (data && !data._fromGithub) data._from = p
return cb_(er, data)
})
}
}
function maybeGithub (p, name, er, cb) {
- var u = "https://github.com/" + p
+ var u = "git://github.com/" + p
, up = url.parse(u)
- if (up.hash && up.hash[0] === "#")
- up.hash = up.hash.slice(1)
-
- var ref = encodeURIComponent(up.hash || "master")
- up.pathname = path.join(up.pathname, "tarball", ref).replace(/\\/g, "/")
- u = url.format(up)
log.info("maybeGithub", "Attempting to fetch %s from %s", p, u)
- return addRemoteTarball(u, null, name, function (er2, data) {
+
+ return addRemoteGit(u, up, name, function (er2, data) {
if (er2) return cb(er)
+ data._from = u
+ data._fromGithub = true
return cb(null, data)
})
}
-function addLocalTarball (p, name, cb) {
- if (typeof cb !== "function") cb = name, name = ""
+function addLocalTarball (p, name, cb_) {
+ if (typeof cb_ !== "function") cb_ = name, name = ""
// if it's a tar, and not in place,
// then unzip to .tmp, add the tmp folder, and clean up tmp
- if (p.indexOf(npm.tmp) === 0) return addTmpTarball(p, name, cb)
+ if (p.indexOf(npm.tmp) === 0) return addTmpTarball(p, name, cb_)
if (p.indexOf(npm.cache) === 0) {
- if (path.basename(p) !== "package.tgz") return cb(new Error(
+ if (path.basename(p) !== "package.tgz") return cb_(new Error(
"Not a valid cache tarball name: "+p))
- return addPlacedTarball(p, name, cb)
+ return addPlacedTarball(p, name, cb_)
+ }
+
+ function cb (er, data) {
+ if (data) data._resolved = p
+ return cb_(er, data)
}
// just copy it over and then add the temp tarball file.
rv.dependencies = {}
Object.keys(wrap).forEach(function (key) {
log.verbose("from wrap", [key, wrap[key]])
- var w = wrap[key]
- rv.dependencies[key] = w.from || w.version
+ rv.dependencies[key] = readWrap(wrap[key])
})
log.verbose("readDependencies returned deps", rv.dependencies)
return cb(null, rv, wrap)
})
rv.dependencies = {}
Object.keys(newwrap.dependencies || {}).forEach(function (key) {
- var w = newwrap.dependencies[key]
- rv.dependencies[key] = w.from || w.version
+ rv.dependencies[key] = readWrap(newwrap.dependencies[key])
})
log.verbose("readDependencies returned deps", rv.dependencies)
return cb(null, rv, newwrap.dependencies)
})
}
+function readWrap (w) {
+ return (w.resolved) ? w.resolved
+ : (w.from && url.parse(w.from).protocol) ? w.from
+ : w.version
+}
+
// if the -S|--save option is specified, then write installed packages
// as dependencies to a package.json file.
// This is experimental.
data.bundleDependencies = bundle
}
+ log.verbose('saving', things)
data[deps] = data[deps] || {}
Object.keys(things).forEach(function (t) {
data[deps][t] = things[t]
if (wrap) {
name = what.split(/@/).shift()
if (wrap[name]) {
- var wrapTarget = wrap[name].from || wrap[name].version
- log.verbose("shrinkwrap", "resolving %s to %s", wrapTarget, what)
+ var wrapTarget = readWrap(wrap[name])
what = name + "@" + wrapTarget
} else {
log.verbose("shrinkwrap", "skipping %s (not in shrinkwrap)", what)
return cb(null, [])
}
- if (data) data._from = what
+ if (data && !data._from) data._from = what
return cb(er, data)
})
+ " " + (data.path || "") )
}
- if (data._from) {
- var from = data._from
- if (from.indexOf(data.name + "@") === 0) {
- from = from.substr(data.name.length + 1)
- }
- var u = url.parse(from)
- if (u.protocol) lite.from = from
- }
+ if (data._from)
+ lite.from = data._from
+
+ if (data._resolved)
+ lite.resolved = data._resolved
if (data.invalid) {
lite.invalid = true
, "se" : "search"
, "author" : "owner"
, "home" : "docs"
+ , "issues": "bugs"
, "unstar": "star" // same function
, "apihelp" : "help"
, "login": "adduser"
})
}
-function cacheAddPublish (arg, didPre, isRetry, cb) {
- npm.commands.cache.add(arg, function (er, data) {
+// didPre in this case means that we already ran the prepublish script,
+// and that the "dir" is an actual directory, and not something silly
+// like a tarball or name@version thing.
+// That means that we can run publish/postpublish in the dir, rather than
+// in the cache dir.
+function cacheAddPublish (dir, didPre, isRetry, cb) {
+ npm.commands.cache.add(dir, function (er, data) {
if (er) return cb(er)
log.silly("publish", data)
var cachedir = path.resolve( npm.cache
, "package" )
chain
( [ !didPre && [lifecycle, data, "prepublish", cachedir]
- , [publish_, arg, data, isRetry, cachedir]
- , [lifecycle, data, "publish", cachedir]
- , [lifecycle, data, "postpublish", cachedir] ]
+ , [publish_, dir, data, isRetry, cachedir]
+ , [lifecycle, data, "publish", didPre ? dir : cachedir]
+ , [lifecycle, data, "postpublish", didPre ? dir : cachedir] ]
, cb )
})
}
cp.stderr && cp.stderr.on("data", function (chunk) {
if (chunk) stderr += chunk
})
- cp.on("exit", function (code) {
+ cp.on("close", function (code) {
var er = null
if (code) er = new Error("`"+cmd
+(args.length ? " "
var pathArr = []
, p = wd.split("node_modules")
, acc = path.resolve(p.shift())
+
+ // first add the directory containing the `node` executable currently
+ // running, so that any lifecycle script that invoke "node" will execute
+ // this same one.
+ pathArr.unshift(path.dirname(process.execPath))
+
p.forEach(function (pp) {
pathArr.unshift(path.join(acc, "node_modules", ".bin"))
acc = path.join(acc, "node_modules", pp)
// the bundled one will be used for installing things.
pathArr.unshift(path.join(__dirname, "..", "..", "bin", "node-gyp-bin"))
- // add the directory containing the `node` executable currently running, so
- // that any lifecycle script that invoke "node" will execute this same one.
- pathArr.unshift(path.dirname(process.execPath))
-
if (env[PATH]) pathArr.push(env[PATH])
env[PATH] = pathArr.join(process.platform === "win32" ? ";" : ":")
if (dfc) {
// do fancy crap
- return lifecycle(pkg, 'prepublish', folder, function (er) {
+ return lifecycle(pkg, "prepublish", folder, function (er) {
if (er) return cb(er)
pack_(targetTarball, folder, pkg, cb)
})
if (this.type.match(/^.*Link$/)) {
log.warn( "excluding symbolic link"
, this.path.substr(target.length + 1)
- + ' -> ' + this.linkpath )
+ + " -> " + this.linkpath )
return false
}
return true
.IP "" 4
.
.nf
-npm@1.2.0 /path/to/npm
+npm@1.2.2 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.
.fi
.
.SH "VERSION"
-1.2.0
+1.2.2
.
.SH "DESCRIPTION"
npm is the package manager for the Node JavaScript platform\. It puts
.fi
.
.SH "VERSION"
-1.2.0
+1.2.2
.
.SH "DESCRIPTION"
This is the API documentation for npm\.
abbrev.monkeyPatch = monkeyPatch
function monkeyPatch () {
- Array.prototype.abbrev = function () { return abbrev(this) }
- Object.prototype.abbrev = function () { return abbrev(Object.keys(this)) }
+ Object.defineProperty(Array.prototype, 'abbrev', {
+ value: function () { return abbrev(this) },
+ enumerable: false, configurable: true, writable: true
+ })
+
+ Object.defineProperty(Object.prototype, 'abbrev', {
+ value: function () { return abbrev(Object.keys(this)) },
+ enumerable: false, configurable: true, writable: true
+ })
}
function abbrev (list) {
var curChar = current.charAt(j)
nextMatches = nextMatches && curChar === next.charAt(j)
prevMatches = prevMatches && curChar === prev.charAt(j)
- if (nextMatches || prevMatches) continue
- else {
+ if (!nextMatches && !prevMatches) {
j ++
break
}
if (module === require.main) {
var assert = require("assert")
- , sys
-sys = require("util")
+var util = require("util")
console.log("running tests")
function test (list, expect) {
var actual = abbrev(list)
assert.deepEqual(actual, expect,
- "abbrev("+sys.inspect(list)+") === " + sys.inspect(expect) + "\n"+
- "actual: "+sys.inspect(actual))
+ "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
+ "actual: "+util.inspect(actual))
actual = abbrev.apply(exports, list)
assert.deepEqual(abbrev.apply(exports, list), expect,
- "abbrev("+list.map(JSON.stringify).join(",")+") === " + sys.inspect(expect) + "\n"+
- "actual: "+sys.inspect(actual))
+ "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
+ "actual: "+util.inspect(actual))
}
test([ "ruby", "ruby", "rules", "rules", "rules" ],
-{ "name" : "abbrev"
-, "version" : "1.0.3"
-, "description" : "Like ruby's abbrev module, but in js"
-, "author" : "Isaac Z. Schlueter <i@izs.me>"
-, "main" : "./lib/abbrev.js"
-, "scripts" : { "test" : "node lib/abbrev.js" }
-, "repository" : "http://github.com/isaacs/abbrev-js"
-, "license" :
- { "type" : "MIT"
- , "url" : "https://github.com/isaacs/abbrev-js/raw/master/LICENSE" }
+{
+ "name": "abbrev",
+ "version": "1.0.4",
+ "description": "Like ruby's abbrev module, but in js",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me"
+ },
+ "main": "./lib/abbrev.js",
+ "scripts": {
+ "test": "node lib/abbrev.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/isaacs/abbrev-js"
+ },
+ "license": {
+ "type": "MIT",
+ "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE"
+ },
+ "readme": "# abbrev-js\n\nJust like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).\n\nUsage:\n\n var abbrev = require(\"abbrev\");\n abbrev(\"foo\", \"fool\", \"folding\", \"flop\");\n \n // returns:\n { fl: 'flop'\n , flo: 'flop'\n , flop: 'flop'\n , fol: 'folding'\n , fold: 'folding'\n , foldi: 'folding'\n , foldin: 'folding'\n , folding: 'folding'\n , foo: 'foo'\n , fool: 'fool'\n }\n\nThis is handy for command-line scripts, or other cases where you want to be able to accept shorthands.\n",
+ "readmeFilename": "README.md",
+ "_id": "abbrev@1.0.4",
+ "_from": "abbrev@latest"
}
--- /dev/null
+Copyright (c) Isaac Z. Schlueter ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
},
"name": "fstream-ignore",
"description": "A thing for ignoring files based on globs",
- "version": "0.0.5",
+ "version": "0.0.6",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream-ignore.git"
"rimraf": "",
"mkdirp": ""
},
+ "license": "BSD",
"readme": "# fstream-ignore\n\nA fstream DirReader that filters out files that match globs in `.ignore`\nfiles throughout the tree, like how git ignores files based on a\n`.gitignore` file.\n\nHere's an example:\n\n```javascript\nvar Ignore = require(\"fstream-ignore\")\nIgnore({ path: __dirname\n , ignoreFiles: [\".ignore\", \".gitignore\"]\n })\n .on(\"child\", function (c) {\n console.error(c.path.substr(c.root.path.length + 1))\n })\n .pipe(tar.Pack())\n .pipe(fs.createWriteStream(\"foo.tar\"))\n```\n\nThis will tar up the files in __dirname into `foo.tar`, ignoring\nanything matched by the globs in any .iginore or .gitignore file.\n",
"readmeFilename": "README.md",
- "_id": "fstream-ignore@0.0.5",
+ "_id": "fstream-ignore@0.0.6",
"_from": "fstream-ignore@~0.0.5"
}
"readme": "# fstream-npm\n\nThis is an fstream DirReader class that will read a directory and filter\nthings according to the semantics of what goes in an npm package.\n\nFor example:\n\n```javascript\n// This will print out all the files that would be included\n// by 'npm publish' or 'npm install' of this directory.\n\nvar FN = require(\"fstream-npm\")\nFN({ path: \"./\" })\n .on(\"child\", function (e) {\n console.error(e.path.substr(e.root.path.length + 1))\n })\n```\n\n",
"readmeFilename": "README.md",
"_id": "fstream-npm@0.1.3",
- "_from": "fstream-npm@latest"
+ "_from": "fstream-npm@~0.1.3"
}
, "num-list": [Number, Array]
, "str-list": [String, Array]
, "bool-list": [Boolean, Array]
- , str: String }
+ , str: String
+ , clear: Boolean
+ , config: Boolean
+ , length: Number
+ }
, shorthands = { s: [ "--str", "astring" ]
, b: [ "--bool" ]
, nb: [ "--no-bool" ]
, "?": ["--help"]
, h: ["--help"]
, H: ["--help"]
- , n: [ "--num", "125" ] }
+ , n: [ "--num", "125" ]
+ , c: ["--config"]
+ , l: ["--length"]
+ }
, parsed = nopt( types
, shorthands
, process.argv
function clean (data, types, typeDefs) {
typeDefs = typeDefs || exports.typeDefs
var remove = {}
- , typeDefault = [false, true, null, String, Number]
+ , typeDefault = [false, true, null, String, Number, Array]
Object.keys(data).forEach(function (k) {
if (k === "argv") return
v = v.join("=")
args.splice.apply(args, [i, 1].concat([arg, v]))
}
+
// see if it's a shorthand
// if so, splice and back up to re-parse it.
var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
var isArray = types[arg] === Array ||
Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
+ // allow unknown things to be arrays if specified multiple times.
+ if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) {
+ if (!Array.isArray(data[arg]))
+ data[arg] = [data[arg]]
+ isArray = true
+ }
+
var val
, la = args[i + 1]
// all of the chars are single-char shorthands, and it's
// not a match to some other abbrev.
arg = arg.replace(/^-+/, '')
- if (abbrevs[arg] && !shorthands[arg]) {
+
+ // if it's an exact known option, then don't go any further
+ if (abbrevs[arg] === arg)
return null
+
+ // if it's an exact known shortopt, same deal
+ if (shorthands[arg]) {
+ // make it an array, if it's a list of words
+ if (shorthands[arg] && !Array.isArray(shorthands[arg]))
+ shorthands[arg] = shorthands[arg].split(/\s+/)
+
+ return shorthands[arg]
}
- if (shortAbbr[arg]) {
- arg = shortAbbr[arg]
- } else {
- var singles = shorthands.___singles
- if (!singles) {
- singles = Object.keys(shorthands).filter(function (s) {
- return s.length === 1
- }).reduce(function (l,r) { l[r] = true ; return l }, {})
- shorthands.___singles = singles
- }
- var chrs = arg.split("").filter(function (c) {
- return singles[c]
- })
- if (chrs.join("") === arg) return chrs.map(function (c) {
- return shorthands[c]
- }).reduce(function (l, r) {
- return l.concat(r)
- }, [])
+
+ // first check to see if this arg is a set of single-char shorthands
+ var singles = shorthands.___singles
+ if (!singles) {
+ singles = Object.keys(shorthands).filter(function (s) {
+ return s.length === 1
+ }).reduce(function (l,r) {
+ l[r] = true
+ return l
+ }, {})
+ shorthands.___singles = singles
+ debug('shorthand singles', singles)
}
- if (shorthands[arg] && !Array.isArray(shorthands[arg])) {
+ var chrs = arg.split("").filter(function (c) {
+ return singles[c]
+ })
+
+ if (chrs.join("") === arg) return chrs.map(function (c) {
+ return shorthands[c]
+ }).reduce(function (l, r) {
+ return l.concat(r)
+ }, [])
+
+
+ // if it's an arg abbrev, and not a literal shorthand, then prefer the arg
+ if (abbrevs[arg] && !shorthands[arg])
+ return null
+
+ // if it's an abbr for a shorthand, then use that
+ if (shortAbbr[arg])
+ arg = shortAbbr[arg]
+
+ // make it an array, if it's a list of words
+ if (shorthands[arg] && !Array.isArray(shorthands[arg]))
shorthands[arg] = shorthands[arg].split(/\s+/)
- }
+
return shorthands[arg]
}
,["--date 2011-01-25"
,{date: new Date("2011-01-25")}
,[]]
+ ,["-cl 1"
+ ,{config: true, length: 1}
+ ,[]
+ ,{config: Boolean, length: Number, clear: Boolean}
+ ,{c: "--config", l: "--length"}]
+ ,["--acount bla"
+ ,{"acount":true}
+ ,["bla"]
+ ,{account: Boolean, credentials: Boolean, options: String}
+ ,{a:"--account", c:"--credentials",o:"--options"}]
+ ,["--clear"
+ ,{clear:true}
+ ,[]
+ ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
+ ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
].forEach(function (test) {
var argv = test[0].split(/\s+/)
, opts = test[1]
, rem = test[2]
- , actual = nopt(types, shorthands, argv, 0)
+ , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
, parsed = actual.argv
delete actual.argv
console.log(util.inspect(actual, false, 2, true), parsed.remain)
{
"name": "nopt",
- "version": "2.0.0",
+ "version": "2.1.1",
"description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
"author": {
"name": "Isaac Z. Schlueter",
"abbrev": "1"
},
"readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it. The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser. We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you go half-insane just trying to manage them all, and put\nit off with duct-tape solutions until you see exactly to the core of the\nproblem, and finally snap and write an awesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system. You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n // my-program.js\n var nopt = require(\"nopt\")\n , Stream = require(\"stream\").Stream\n , path = require(\"path\")\n , knownOpts = { \"foo\" : [String, null]\n , \"bar\" : [Stream, Number]\n , \"baz\" : path\n , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n , \"flag\" : Boolean\n , \"pick\" : Boolean\n , \"many\" : [String, Array]\n }\n , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n , \"b7\" : [\"--bar\", \"7\"]\n , \"m\" : [\"--bloo\", \"medium\"]\n , \"p\" : [\"--pick\"]\n , \"f\" : [\"--flag\"]\n }\n // everything is optional.\n // knownOpts and shorthands default to {}\n // arg list defaults to process.argv\n // slice defaults to 2\n , parsed = nopt(knownOpts, shortHands, process.argv, 2)\n console.log(parsed)\n\nThis would give you support for any of the following:\n\n```bash\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk 1000 -fp # unknown opts are ok.\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --blatzk true -fp # but they need a value\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array. The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many 1 --many null --many foo\n{ many: [\"1\", \"null\", \"foo\"] }\n\n$ node my-program.js --many foo\n{ many: [\"foo\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string. No parsing is done.\n* path: A file system path. Gets resolved against cwd if not absolute.\n* url: A url. If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`. If an option is a boolean,\n then it does not need a value, and its presence will imply `true` as\n the value. To negate boolean flags, do `--no-whatever` or `--whatever\n false`\n* NaN: Means that the option is strictly not allowed. Any value will\n fail.\n* Stream: An object matching the \"Stream\" class in node. Valuable\n for use when validating programmatically. (npm uses this to let you\n supply any WriteStream on the `outfd` and `logfd` config options.)\n* Array: If `Array` is specified as one of the types, then the value\n will be parsed as a list of options. This means that multiple values\n can be specified, and that the value will always be an array.\n\nIf a type is an array of values not on this list, then those are\nconsidered valid values. For instance, in the example above, the\n`--bloo` option can only be one of `\"big\"`, `\"medium\"`, or `\"small\"`,\nand any other value will be rejected.\n\nWhen parsing unknown fields, `\"true\"`, `\"false\"`, and `\"null\"` will be\ninterpreted as their JavaScript equivalents, and numeric values will be\ninterpreted as a number.\n\nYou can also mix types and values, or multiple types, in a list. For\ninstance `{ blah: [Number, null] }` would allow a value to be set to\neither a Number or null. When types are ordered, this implies a\npreference, and the first type that can be used to properly interpret\nthe value will be used.\n\nTo define a new type, add it to `nopt.typeDefs`. Each item in that\nhash is an object with a `type` member and a `validate` method. The\n`type` member is an object that matches what goes in the type list. The\n`validate` method is a function that gets called with `validate(data,\nkey, val)`. Validate methods should assign `data[key]` to the valid\nvalue of `val` if it can be handled properly, or return boolean\n`false` if it cannot.\n\nYou can also call `nopt.clean(data, types, typeDefs)` to clean up a\nconfig object and remove its invalid properties.\n\n## Error Handling\n\nBy default, nopt outputs a warning to standard error when invalid\noptions are found. You can change this behavior by assigning a method\nto `nopt.invalidHandler`. This method will be called with\nthe offending `nopt.invalidHandler(key, val, types)`.\n\nIf no `nopt.invalidHandler` is assigned, then it will console.error\nits whining. If it is assigned to boolean `false` then the warning is\nsuppressed.\n\n## Abbreviations\n\nYes, they are supported. If you define options like this:\n\n```javascript\n{ \"foolhardyelephants\" : Boolean\n, \"pileofmonkeys\" : Boolean }\n```\n\nThen this will work:\n\n```bash\nnode program.js --foolhar --pil\nnode program.js --no-f --pileofmon\n# etc.\n```\n\n## Shorthands\n\nShorthands are a hash of shorter option names to a snippet of args that\nthey expand to.\n\nIf multiple one-character shorthands are all combined, and the\ncombination does not unambiguously match any other option or shorthand,\nthen they will be broken up into their constituent parts. For example:\n\n```json\n{ \"s\" : [\"--loglevel\", \"silent\"]\n, \"g\" : \"--global\"\n, \"f\" : \"--force\"\n, \"p\" : \"--parseable\"\n, \"l\" : \"--long\"\n}\n```\n\n```bash\nnpm ls -sgflp\n# just like doing this:\nnpm ls --loglevel silent --global --force --long --parseable\n```\n\n## The Rest of the args\n\nThe config object returned by nopt is given a special member called\n`argv`, which is an object with the following fields:\n\n* `remain`: The remaining args after all the parsing has occurred.\n* `original`: The args as they originally appeared.\n* `cooked`: The args after flags and shorthands are expanded.\n\n## Slicing\n\nNode programs are called with more or less the exact argv as it appears\nin C land, after the v8 and node-specific options have been plucked off.\nAs such, `argv[0]` is always `node` and `argv[1]` is always the\nJavaScript program being run.\n\nThat's usually not very useful to you. So they're sliced off by\ndefault. If you want them, then you can pass in `0` as the last\nargument, or any other number that you'd like to slice off the start of\nthe list.\n",
- "_id": "nopt@2.0.0",
+ "readmeFilename": "README.md",
+ "_id": "nopt@2.1.1",
"_from": "nopt@latest"
}
{
"name": "npmconf",
- "version": "0.0.16",
+ "version": "0.0.17",
"description": "The config thing npm uses",
"main": "npmconf.js",
"directories": {
"once": "~1.1.1",
"mkdirp": "~0.3.3",
"osenv": "0.0.3",
- "nopt": "~2.0.0"
+ "nopt": "2"
},
"devDependencies": {},
"scripts": {
"license": "BSD",
"readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n",
"readmeFilename": "README.md",
- "_id": "npmconf@0.0.16",
- "_from": "npmconf@0"
+ "_id": "npmconf@0.0.17",
+ "_from": "npmconf@latest"
}
{
- "version": "1.2.0",
+ "version": "1.2.2",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
"semver": "~1.1.2",
"ini": "~1.0.5",
"slide": "1",
- "abbrev": "1",
+ "abbrev": "~1.0.4",
"graceful-fs": "~1.1.1",
"minimatch": "~0.2.8",
- "nopt": "~2.0",
+ "nopt": "~2.1.1",
"rimraf": "2",
"request": "~2.9",
"which": "1",
{
- "name": "npm-test-peer-deps-invalid",
- "version": "0.0.0",
- "dependencies": {
- "npm-test-peer-deps-file": {
- "version": "1.2.3",
- "from": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
- "dependencies": {
- "opener": {
- "version": "1.3.0"
- }
+ "npm-test-peer-deps-file": {
+ "version": "1.2.3",
+ "from": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
+ "resolved": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
+ "dependencies": {
+ "opener": {
+ "version": "1.3.0",
+ "from": "opener@1.3.0"
}
- },
- "npm-test-peer-deps-file-invalid": {
- "version": "1.2.3",
- "from": "https://gist.github.com/raw/4303335/861f8d3213061826ab31591840c3cb0ac737f4fc/index.js"
- },
- "dict": {
- "peerInvalid": true
}
+ },
+ "npm-test-peer-deps-file-invalid": {
+ "version": "1.2.3",
+ "from": "https://gist.github.com/raw/4303335/861f8d3213061826ab31591840c3cb0ac737f4fc/index.js",
+ "resolved": "https://gist.github.com/raw/4303335/861f8d3213061826ab31591840c3cb0ac737f4fc/index.js"
+ },
+ "dict": {
+ "peerInvalid": true
}
}
function (err, stdout, stderr) {
var actual = JSON.parse(stdout).dependencies
- var expected = require("./npm-ls.json").dependencies
+ var expected = require("./npm-ls.json")
// Delete the "problems" entry because it contains system-specific path info,
// so we can't compare it accurately and thus have deleted it from
// this will be either version 1.1.0 or version 1.0.0
var dictVer = actual.dict.version
delete actual.dict.version
+ delete actual.dict.from
+ delete actual.dict.resolved
assert(dictVer === "1.1.0" || dictVer === "1.0.0")
+ console.error(JSON.stringify(actual, null, 2))
assert.deepEqual(actual, expected)
assert.ok(err)
{
- "name": "npm-test-peer-deps",
- "version": "0.0.0",
- "dependencies": {
- "npm-test-peer-deps-file": {
- "version": "1.2.3",
- "from": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
- "dependencies": {
- "opener": {
- "version": "1.3.0"
- }
+ "npm-test-peer-deps-file": {
+ "version": "1.2.3",
+ "from": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
+ "resolved": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
+ "dependencies": {
+ "opener": {
+ "version": "1.3.0",
+ "from": "opener@1.3.0"
}
- },
- "dict": {
- "version": "1.1.0"
}
+ },
+ "dict": {
+ "version": "1.1.0",
+ "from": "dict@1.1.0"
}
}
if (err) throw err
var actual = JSON.parse(stdout).dependencies
- var expected = require("./npm-ls.json").dependencies
+ var expected = require("./npm-ls.json")
+ console.error(JSON.stringify(actual, null, 2))
+ console.error(JSON.stringify(expected, null, 2))
assert.deepEqual(actual, expected)
})
"dependencies": {
"npm-test-single-file": {
"version": "1.2.3",
- "from": "https://raw.github.com/gist/1837112/index.js"
+ "from": "https://raw.github.com/gist/1837112/index.js",
+ "resolved": "https://raw.github.com/gist/1837112/index.js"
},
"glob": {
"version": "3.1.5",
- "from": "git://github.com/isaacs/node-glob.git#npm-test",
+ "from": "glob@git://github.com/isaacs/node-glob.git#npm-test",
+ "resolved": "git://github.com/isaacs/node-glob.git#67bda227fd7a559cca5620307c7d30a6732a792f",
"dependencies": {
"minimatch": {
"version": "0.2.1",
"dependencies": {
"lru-cache": {
- "version": "1.0.5"
+ "version": "1.0.5",
+ "from": "lru-cache@~1.0.5"
}
}
},
"graceful-fs": {
"version": "1.1.5",
+ "from": "graceful-fs@1.1.5",
"dependencies": {
"fast-list": {
- "version": "1.0.2"
+ "version": "1.0.2",
+ "from": "fast-list@1.0.2"
}
}
},
"inherits": {
- "version": "1.0.0"
+ "version": "1.0.0",
+ "from": "inherits@1.0.0"
}
}
},
"minimatch": {
"version": "0.1.5",
+ "from": "minimatch@0.1.5",
"dependencies": {
"lru-cache": {
- "version": "1.0.5"
+ "version": "1.0.5",
+ "from": "lru-cache@1.0.5"
}
}
}
delete process.env.npm_config_global
delete process.env.npm_config_depth
-var npm = process.platform === "win32"
- ? path.resolve(process.env.npm_config_prefix, "../../npm")
- : path.resolve(process.env.npm_config_prefix, "../../../bin/npm")
+var npm = process.env.npm_execpath
require("child_process").exec(npm + " ls --json", {
stdio: "pipe", env: process.env, cwd: process.cwd() },
function (err, stdout, stderr) {
if (err) throw err
- var actual = JSON.parse(stdout).dependencies
- var expected = require("./npm-shrinkwrap.json").dependencies
+ var actual = JSON.parse(stdout)
+ var expected = require("./npm-shrinkwrap.json")
+ rmFrom(actual)
+ actual = actual.dependencies
+ rmFrom(expected)
+ expected = expected.dependencies
+ console.error(JSON.stringify(actual, null, 2))
+ console.error(JSON.stringify(expected, null, 2))
assert.deepEqual(actual, expected)
})
+
+function rmFrom (obj) {
+ for (var i in obj) {
+ if (i === "from")
+ delete obj[i]
+ else if (i === "dependencies")
+ for (var j in obj[i])
+ rmFrom(obj[i][j])
+ }
+}
{ "name":"npm-test-url-dep"
, "version" : "1.2.3"
, "dependencies" :
- { "dnode" : "https://github.com/substack/jsonify/tarball/master"
+ { "jsonify" : "https://github.com/substack/jsonify/tarball/master"
, "sax": "isaacs/sax-js"
, "canonical-host": "git://github.com/isaacs/canonical-host"
} }