Dalmais Maxence <github@maxired.fr>
Marcus Ekwall <marcus.ekwall@gmail.com>
Aaron Stacy <aaron.r.stacy@gmail.com>
+Phillip Howell <phowell@cothm.org>
+Domenic Denicola <domenic@domenicdenicola.com>
#!/bin/sh
-if [ -x "`dirname "$0"`/node.exe" ]; then
- "`dirname "$0"`/node.exe" "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"
+
+basedir=`dirname "$0"`
+
+case `uname` in
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+if [ -x "$basedir/node.exe" ]; then
+ "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
else
- node "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"
+ node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
fi
* `-S`: `--save`
* `-D`: `--save-dev`
* `-O`: `--save-optional`
+* `-B`: `--save-bundle`
* `-y`: `--yes`
* `-n`: `--yes false`
* `ll` and `la` commands: `ls --long`
Force npm to always require authentication when accessing the registry,
even for `GET` requests.
-### bin-publish
-
-* Default: false
-* Type: Boolean
-
-If set to true, then binary packages will be created on publish.
-
-This is the way to opt into the "bindist" behavior described below.
-
-### bindist
-
-* Default: Unstable node versions, `null`, otherwise
- `"<node version>-<platform>-<os release>"`
-* Type: String or `null`
-
-Experimental: on stable versions of node, binary distributions will be
-created with this tag. If a user then installs that package, and their
-`bindist` tag is found in the list of binary distributions, they will
-get that prebuilt version.
-
-Pre-build node packages have their preinstall, install, and postinstall
-scripts stripped (since they are run prior to publishing), and do not
-have their `build` directories automatically ignored.
-
-It's yet to be seen if this is a good idea.
-
### browser
* Default: OS X: `"open"`, others: `"google-chrome"`
Any logs of a higher level than the setting are shown.
The default is "http", which shows http, warn, and error output.
+### logstream
+
+* Default: process.stderr
+* Type: Stream
+
+This is the stream that is passed to the
+[npmlog](https://github.com/isaacs/npmlog) module at run time.
+
+It cannot be set from the command line, but if you are using npm
+programmatically, you may wish to send logs to somewhere other than
+stderr.
+
### long
* Default: false
Save installed packages to a package.json file as dependencies.
+When used with the `npm rm` command, it removes it from the dependencies
+hash.
+
Only works if there is already a package.json file present.
+### save-bundle
+
+* Default: false
+* Type: Boolean
+
+If a package would be saved at install time by the use of `--save`,
+`--save-dev`, or `--save-optional`, then also put it in the
+`bundleDependencies` list.
+
+When used with the `npm rm` command, it removes it from the
+bundledDependencies list.
+
### save-dev
* Default: false
Save installed packages to a package.json file as devDependencies.
+When used with the `npm rm` command, it removes it from the devDependencies
+hash.
+
Only works if there is already a package.json file present.
### save-optional
Save installed packages to a package.json file as optionalDependencies.
+When used with the `npm rm` command, it removes it from the devDependencies
+hash.
+
Only works if there is already a package.json file present.
### searchopts
<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.1.27</p>
+<p id="footer">bin — npm@1.1.29</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.1.27</p>
+<p id="footer">bugs — npm@1.1.29</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.1.27</p>
+<p id="footer">commands — npm@1.1.29</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.1.27</p>
+<p id="footer">config — npm@1.1.29</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.1.27</p>
+<p id="footer">deprecate — npm@1.1.29</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.1.27</p>
+<p id="footer">docs — npm@1.1.29</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.1.27</p>
+<p id="footer">edit — npm@1.1.29</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.1.27</p>
+<p id="footer">explore — npm@1.1.29</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.1.27</p>
+<p id="footer">help-search — npm@1.1.29</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.1.27</p>
+<p id="footer">init — npm@1.1.29</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.1.27</p>
+<p id="footer">install — npm@1.1.29</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.1.27</p>
+<p id="footer">link — npm@1.1.29</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.1.27</p>
+<p id="footer">load — npm@1.1.29</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.1.27</p>
+<p id="footer">ls — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.1.27</p>
+<p>1.1.29</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<pre><code>var cmd = npm.deref("unp") // cmd === "unpublish"</code></pre>
</div>
-<p id="footer">npm — npm@1.1.27</p>
+<p id="footer">npm — npm@1.1.29</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.1.27</p>
+<p id="footer">outdated — npm@1.1.29</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.1.27</p>
+<p id="footer">owner — npm@1.1.29</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.1.27</p>
+<p id="footer">pack — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">prefix — npm@1.1.27</p>
+<p id="footer">prefix — npm@1.1.29</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.1.27</p>
+<p id="footer">prune — npm@1.1.29</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.1.27</p>
+<p id="footer">publish — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>See <code>npm help build</code></p>
</div>
-<p id="footer">rebuild — npm@1.1.27</p>
+<p id="footer">rebuild — npm@1.1.29</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.1.27</p>
+<p id="footer">restart — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically.</p>
</div>
-<p id="footer">root — npm@1.1.27</p>
+<p id="footer">root — npm@1.1.29</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.1.27</p>
+<p id="footer">run-script — npm@1.1.29</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.1.27</p>
+<p id="footer">search — npm@1.1.29</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.1.27</p>
+<p id="footer">shrinkwrap — npm@1.1.29</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.1.27</p>
+<p id="footer">start — npm@1.1.29</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.1.27</p>
+<p id="footer">stop — npm@1.1.29</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.1.27</p>
+<p id="footer">submodule — npm@1.1.29</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.1.27</p>
+<p id="footer">tag — npm@1.1.29</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.1.27</p>
+<p id="footer">test — npm@1.1.29</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.1.27</p>
+<p id="footer">uninstall — npm@1.1.29</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.1.27</p>
+<p id="footer">unpublish — npm@1.1.29</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.1.27</p>
+<p id="footer">update — npm@1.1.29</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.1.27</p>
+<p id="footer">version — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>corresponding to the list of fields selected.</p>
</div>
-<p id="footer">view — npm@1.1.27</p>
+<p id="footer">view — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>This function is not useful programmatically</p>
</div>
-<p id="footer">whoami — npm@1.1.27</p>
+<p id="footer">whoami — npm@1.1.29</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.1.27</p>
+<p id="footer"><a href="../doc/README.html">README</a> — npm@1.1.29</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.1.27</p>
+<p id="footer">adduser — npm@1.1.29</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.1.27</p>
+<p id="footer">bin — npm@1.1.29</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.1.27</p>
+<p id="footer">bugs — npm@1.1.29</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.1.27</p>
+<p id="footer">build — npm@1.1.29</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.1.27</p>
+<p id="footer">bundle — npm@1.1.29</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.1.27</p>
+<p id="footer">cache — npm@1.1.29</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.1.27</p>
+<p id="footer">changelog — npm@1.1.29</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.1.27</p>
+<p id="footer">coding-style — npm@1.1.29</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.1.27</p>
+<p id="footer">completion — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p>The following shorthands are parsed on the command-line:</p>
-<ul><li><code>-v</code>: <code>--version</code></li><li><code>-h</code>, <code>-?</code>, <code>--help</code>, <code>-H</code>: <code>--usage</code></li><li><code>-s</code>, <code>--silent</code>: <code>--loglevel silent</code></li><li><code>-q</code>, <code>--quiet</code>: <code>--loglevel warn</code></li><li><code>-d</code>: <code>--loglevel info</code></li><li><code>-dd</code>, <code>--verbose</code>: <code>--loglevel verbose</code></li><li><code>-ddd</code>: <code>--loglevel silly</code></li><li><code>-g</code>: <code>--global</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-m</code>: <code>--message</code></li><li><code>-p</code>, <code>--porcelain</code>: <code>--parseable</code></li><li><code>-reg</code>: <code>--registry</code></li><li><code>-v</code>: <code>--version</code></li><li><code>-f</code>: <code>--force</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-desc</code>: <code>--description</code></li><li><code>-S</code>: <code>--save</code></li><li><code>-D</code>: <code>--save-dev</code></li><li><code>-O</code>: <code>--save-optional</code></li><li><code>-y</code>: <code>--yes</code></li><li><code>-n</code>: <code>--yes false</code></li><li><code>ll</code> and <code>la</code> commands: <code>ls --long</code></li></ul>
+<ul><li><code>-v</code>: <code>--version</code></li><li><code>-h</code>, <code>-?</code>, <code>--help</code>, <code>-H</code>: <code>--usage</code></li><li><code>-s</code>, <code>--silent</code>: <code>--loglevel silent</code></li><li><code>-q</code>, <code>--quiet</code>: <code>--loglevel warn</code></li><li><code>-d</code>: <code>--loglevel info</code></li><li><code>-dd</code>, <code>--verbose</code>: <code>--loglevel verbose</code></li><li><code>-ddd</code>: <code>--loglevel silly</code></li><li><code>-g</code>: <code>--global</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-m</code>: <code>--message</code></li><li><code>-p</code>, <code>--porcelain</code>: <code>--parseable</code></li><li><code>-reg</code>: <code>--registry</code></li><li><code>-v</code>: <code>--version</code></li><li><code>-f</code>: <code>--force</code></li><li><code>-l</code>: <code>--long</code></li><li><code>-desc</code>: <code>--description</code></li><li><code>-S</code>: <code>--save</code></li><li><code>-D</code>: <code>--save-dev</code></li><li><code>-O</code>: <code>--save-optional</code></li><li><code>-B</code>: <code>--save-bundle</code></li><li><code>-y</code>: <code>--yes</code></li><li><code>-n</code>: <code>--yes false</code></li><li><code>ll</code> and <code>la</code> commands: <code>ls --long</code></li></ul>
<p>If the specified configuration param resolves unambiguously to a known
configuration parameter, then it is expanded to that configuration
<p>Force npm to always require authentication when accessing the registry,
even for <code>GET</code> requests.</p>
-<h3 id="bin-publish">bin-publish</h3>
-
-<ul><li>Default: false</li><li>Type: Boolean</li></ul>
-
-<p>If set to true, then binary packages will be created on publish.</p>
-
-<p>This is the way to opt into the "bindist" behavior described below.</p>
-
-<h3 id="bindist">bindist</h3>
-
-<ul><li>Default: Unstable node versions, <code>null</code>, otherwise
-<code>"<node version>-<platform>-<os release>"</code></li><li>Type: String or <code>null</code></li></ul>
-
-<p>Experimental: on stable versions of node, binary distributions will be
-created with this tag. If a user then installs that package, and their
-<code>bindist</code> tag is found in the list of binary distributions, they will
-get that prebuilt version.</p>
-
-<p>Pre-build node packages have their preinstall, install, and postinstall
-scripts stripped (since they are run prior to publishing), and do not
-have their <code>build</code> directories automatically ignored.</p>
-
-<p>It's yet to be seen if this is a good idea.</p>
-
<h3 id="browser">browser</h3>
<ul><li>Default: OS X: <code>"open"</code>, others: <code>"google-chrome"</code></li><li>Type: String</li></ul>
<p>Any logs of a higher level than the setting are shown.
The default is "http", which shows http, warn, and error output.</p>
+<h3 id="logstream">logstream</h3>
+
+<ul><li>Default: process.stderr</li><li>Type: Stream</li></ul>
+
+<p>This is the stream that is passed to the
+<a href="https://github.com/isaacs/npmlog">npmlog</a> module at run time.</p>
+
+<p>It cannot be set from the command line, but if you are using npm
+programmatically, you may wish to send logs to somewhere other than
+stderr.</p>
+
<h3 id="long">long</h3>
<ul><li>Default: false</li><li>Type: Boolean</li></ul>
<p>Save installed packages to a package.json file as dependencies.</p>
+<p>When used with the <code>npm rm</code> command, it removes it from the dependencies
+hash.</p>
+
<p>Only works if there is already a package.json file present.</p>
+<h3 id="save-bundle">save-bundle</h3>
+
+<ul><li>Default: false</li><li>Type: Boolean</li></ul>
+
+<p>If a package would be saved at install time by the use of <code>--save</code>,
+<code>--save-dev</code>, or <code>--save-optional</code>, then also put it in the
+<code>bundleDependencies</code> list.</p>
+
+<p>When used with the <code>npm rm</code> command, it removes it from the
+bundledDependencies list.</p>
+
<h3 id="save-dev">save-dev</h3>
<ul><li>Default: false</li><li>Type: Boolean</li></ul>
<p>Save installed packages to a package.json file as devDependencies.</p>
+<p>When used with the <code>npm rm</code> command, it removes it from the devDependencies
+hash.</p>
+
<p>Only works if there is already a package.json file present.</p>
<h3 id="save-optional">save-optional</h3>
<p>Save installed packages to a package.json file as optionalDependencies.</p>
+<p>When used with the <code>npm rm</code> command, it removes it from the devDependencies
+hash.</p>
+
<p>Only works if there is already a package.json file present.</p>
<h3 id="searchopts">searchopts</h3>
<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.1.27</p>
+<p id="footer">config — npm@1.1.29</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.1.27</p>
+<p id="footer">deprecate — npm@1.1.29</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.1.27</p>
+<p id="footer">developers — npm@1.1.29</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.1.27</p>
+<p id="footer">disputes — npm@1.1.29</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.1.27</p>
+<p id="footer">docs — npm@1.1.29</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.1.27</p>
+<p id="footer">edit — npm@1.1.29</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.1.27</p>
+<p id="footer">explore — npm@1.1.29</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.1.27</p>
+<p id="footer">faq — npm@1.1.29</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.1.27</p>
+<p id="footer">folders — npm@1.1.29</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.1.27</p>
+<p id="footer">help-search — npm@1.1.29</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.1.27</p>
+<p id="footer">help — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<p> Display npm username</p>
</div>
-<p id="footer">index — npm@1.1.27</p>
+<p id="footer">index — npm@1.1.29</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.1.27</p>
+<p id="footer">init — npm@1.1.29</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.1.27</p>
+<p id="footer">install — npm@1.1.29</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.1.27</p>
+<p id="footer">json — npm@1.1.29</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.1.27</p>
+<p id="footer">link — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<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">list — npm@1.1.27</p>
+<p id="footer">list — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
<h2 id="VERSION">VERSION</h2>
-<p>1.1.27</p>
+<p>1.1.29</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.1.27</p>
+<p id="footer">npm — npm@1.1.29</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.1.27</p>
+<p id="footer">outdated — npm@1.1.29</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.1.27</p>
+<p id="footer">owner — npm@1.1.29</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.1.27</p>
+<p id="footer">pack — npm@1.1.29</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.1.27</p>
+<p id="footer">prefix — npm@1.1.29</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.1.27</p>
+<p id="footer">prune — npm@1.1.29</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.1.27</p>
+<p id="footer">publish — npm@1.1.29</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.1.27</p>
+<p id="footer">rebuild — npm@1.1.29</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.1.27</p>
+<p id="footer">registry — npm@1.1.29</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.1.27</p>
+<p id="footer">removing-npm — npm@1.1.29</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.1.27</p>
+<p id="footer">restart — npm@1.1.29</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.1.27</p>
+<p id="footer">root — npm@1.1.29</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.1.27</p>
+<p id="footer">run-script — npm@1.1.29</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.1.27</p>
+<p id="footer">scripts — npm@1.1.29</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.1.27</p>
+<p id="footer">search — npm@1.1.29</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.1.27</p>
+<p id="footer">semver — npm@1.1.29</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.1.27</p>
+<p id="footer">shrinkwrap — npm@1.1.29</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.1.27</p>
+<p id="footer">star — npm@1.1.29</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.1.27</p>
+<p id="footer">start — npm@1.1.29</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.1.27</p>
+<p id="footer">stop — npm@1.1.29</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.1.27</p>
+<p id="footer">submodule — npm@1.1.29</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.1.27</p>
+<p id="footer">tag — npm@1.1.29</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.1.27</p>
+<p id="footer">test — npm@1.1.29</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.1.27</p>
+<p id="footer">uninstall — npm@1.1.29</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.1.27</p>
+<p id="footer">unpublish — npm@1.1.29</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.1.27</p>
+<p id="footer">update — npm@1.1.29</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.1.27</p>
+<p id="footer">version — npm@1.1.29</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.1.27</p>
+<p id="footer">view — npm@1.1.29</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.1.27</p>
+<p id="footer">whoami — npm@1.1.29</p>
<script>
;(function () {
var wrapper = document.getElementById("wrapper")
if (!dist) return cb(new Error("No dist in "+data._id+" package"))
- var bd = npm.config.get("bindist")
- , b = dist.bin && bd && dist.bin[bd]
- log.verbose("bin dist", [bd, dist])
- if (b && b.tarball && b.shasum) {
- log.info("prebuilt", data._id)
- log.verbose("prebuilt", data._id, b)
- dist = b
- }
-
if (!dist.tarball) return cb(new Error(
"No dist.tarball in " + data._id + " package"))
return cb(null, installed, tree, pretty)
}
+ var saveBundle = npm.config.get('save-bundle')
+
// each item in the tree is a top-level thing that should be saved
// to the package.json file.
// The relevant tree shape is { <folder>: {what:<pkg>} }
: npm.config.get("save-dev") ? "devDependencies"
: "dependencies"
+ if (saveBundle) {
+ var bundle = data.bundleDependencies || data.bundledDependencies
+ delete data.bundledDependencies
+ if (!Array.isArray(bundle)) bundle = []
+ data.bundleDependencies = bundle
+ }
+
data[deps] = data[deps] || {}
Object.keys(things).forEach(function (t) {
data[deps][t] = things[t]
+ if (saveBundle) {
+ var i = bundle.indexOf(t)
+ if (i === -1) bundle.push(t)
+ }
})
+
data = JSON.stringify(data, null, 2) + "\n"
fs.writeFile(saveTarget, data, function (er) {
cb(er, installed, tree, pretty)
ini.resolveConfigs(conf, function (er) {
log.level = npm.config.get("loglevel")
log.heading = "npm"
+ log.stream = npm.config.get("logstream")
switch (npm.config.get("color")) {
case "always": log.enableColor(); break
case false: log.disableColor(); break
}
function uninstall_ (args, nm, cb) {
+ // if we've been asked to --save or --save-dev or --save-optional,
+ // then also remove it from the associated dependencies hash.
+ var s = npm.config.get('save')
+ , d = npm.config.get('save-dev')
+ , o = npm.config.get('save-optional')
+ if (s || d || o) {
+ cb = saver(args, nm, cb)
+ }
+
asyncMap(args, function (arg, cb) {
// uninstall .. should not delete /usr/local/lib/node_modules/..
var p = path.join(path.resolve(nm), path.join("/", arg))
asyncMap(folders, npm.commands.unbuild, cb)
})
}
+
+function saver (args, nm, cb_) {
+ return cb
+ function cb (er, data) {
+ var s = npm.config.get('save')
+ , d = npm.config.get('save-dev')
+ , o = npm.config.get('save-optional')
+ if (er || !(s || d || o)) return cb_(er, data)
+ var pj = path.resolve(nm, '..', 'package.json')
+ // don't use readJson here, because we don't want all the defaults
+ // filled in, for mans and other bs.
+ fs.readFile(pj, 'utf8', function (er, json) {
+ try {
+ var pkg = JSON.parse(json)
+ } catch (_) {}
+ if (!pkg) return cb_(null, data)
+
+ var bundle
+ if (npm.config.get('save-bundle')) {
+ var bundle = pkg.bundleDependencies || pkg.bundledDependencies
+ if (!Array.isArray(bundle)) bundle = undefined
+ }
+
+ var changed = false
+ args.forEach(function (a) {
+ ; [ [s, 'dependencies']
+ , [o, 'optionalDependencies']
+ , [d, 'devDependencies'] ].forEach(function (f) {
+ var flag = f[0]
+ , field = f[1]
+ if (!flag || !pkg[field] || !pkg[field].hasOwnProperty(a)) return
+ changed = true
+
+ if (bundle) {
+ var i = bundle.indexOf(a)
+ if (i !== -1) bundle.splice(i, 1)
+ }
+
+ delete pkg[field][a]
+ })
+ })
+ if (!changed) return cb_(null, data)
+
+ if (bundle) {
+ delete pkg.bundledDependencies
+ if (bundle.length) {
+ pkg.bundleDependencies = bundle
+ } else {
+ delete pkg.bundleDependencies
+ }
+ }
+
+ fs.writeFile(pj, JSON.stringify(pkg, null, 2) + "\n", function (er) {
+ return cb_(er, data)
+ })
+ })
+ }
+}
args = args || ""
if (!prog) {
prog = "\"%~dp0\\" + target + "\""
- shProg = "\"`dirname \"$0\"`/" + shTarget + "\""
+ shProg = "\"$basedir/" + shTarget + "\""
args = ""
target = ""
shTarget = ""
} else {
longProg = "\"%~dp0\\" + prog + ".exe\""
- shLongProg = "\"`dirname \"$0\"`/" + prog + "\""
+ shLongProg = "\"$basedir/" + prog + "\""
target = "\"%~dp0\\" + target + "\""
- shTarget = "\"`dirname \"$0\"`/" + shTarget + "\""
+ shTarget = "\"$basedir/" + shTarget + "\""
}
// @IF EXIST "%~dp0\node.exe" (
cmd = ":: Created by npm, please don't edit manually.\r\n" + cmd
// #!/bin/sh
- // if [ -x "`dirname "$0"`/node.exe" ]; then
- // "`dirname "$0"`/node.exe" "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"
+ // basedir=`dirname "$0"`
+ //
+ // case `uname` in
+ // *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+ // esac
+ //
+ // if [ -x "$basedir/node.exe" ]; then
+ // "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
+ // ret=$?
// else
- // node "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"
+ // node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
+ // ret=$?
// fi
+ // exit $ret
+
var sh = "#!/bin/sh\n"
if (shLongProg) {
sh = sh
+ + "basedir=`dirname \"$0\"`\n"
+ + "\n"
+ + "case `uname` in\n"
+ + " *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;\n"
+ + "esac\n"
+ + "\n"
+
+ sh = sh
+ "if [ -x "+shLongProg+" ]; then\n"
+ " " + shLongProg + " " + args + " " + shTarget + " \"$@\"\n"
+ " ret=$?\n"
, Stream = require("stream").Stream
, semver = require("semver")
, stableFamily = semver.parse(process.version)
- , os = require("os")
, nopt = require("nopt")
, log = require("npmlog")
, npm = require("../npm.js")
+ , osenv = require("osenv")
function Octal () {}
function validateOctal (data, k, val) {
data[k] = semver.valid(val)
}
+function validateStream (data, k, val) {
+ if (!(val instanceof Stream)) return false
+ data[k] = val
+}
+
nopt.typeDefs.semver = { type: semver, validate: validateSemver }
nopt.typeDefs.Octal = { type: Octal, validate: validateOctal }
+nopt.typeDefs.Stream = { type: Stream, validate: validateStream }
nopt.invalidHandler = function (k, val, type, data) {
log.warn("invalid config", k + "=" + JSON.stringify(val))
case Number:
log.warn("invalid config", "Must be a numeric value")
break
+ case Stream:
+ log.warn("invalid config", "Must be an instance of the Stream class")
+ break
}
}
var defaults
-var temp = process.env.TMPDIR
- || process.env.TMP
- || process.env.TEMP
- || ( process.platform === "win32"
- ? "c:\\windows\\temp"
- : "/tmp" )
-
-var home = ( process.platform === "win32"
- ? process.env.USERPROFILE
- : process.env.HOME )
+var temp = osenv.tmpdir()
+var home = osenv.home()
if (home) process.env.HOME = home
else home = temp
globalPrefix = process.env.PREFIX
} else if (process.platform === "win32") {
// c:\node\node.exe --> prefix=c:\node\
- globalPrefix = path.join(process.execPath, "..")
+ globalPrefix = path.dirname(process.execPath)
} else {
// /usr/local/bin/node --> prefix=/usr/local
- globalPrefix = path.join(process.execPath, "..", "..")
+ globalPrefix = path.dirname(path.dirname(process.execPath))
// destdir only is respected on Unix
if (process.env.DESTDIR) {
- globalPrefix = process.env.DESTDIR + "/" + globalPrefix
+ globalPrefix = path.join(process.env.DESTDIR, globalPrefix)
}
}
return defaults =
{ "always-auth" : false
- // Disable bindist publishing for now. Too problematic.
- // Revisit when we have a less crappy approach, or just make
- // bindist be a thing that only dedicated build-farms will enable.
- , "bin-publish" : false
-
- , bindist : stableFamily
- && ( stableFamily + "-"
- + "ares" + process.versions.ares + "-"
- + "ev" + process.versions.ev + "-"
- + "openssl" + process.versions.openssl + "-"
- + "v8" + process.versions.v8 + "-"
- + process.platform + "-"
- + (process.arch ? process.arch + "-" : "")
- + os.release() )
-
// are there others?
, browser : process.platform === "darwin" ? "open"
: process.platform === "win32" ? "start"
, depth: Infinity
, description : true
, dev : false
- , editor : process.env.EDITOR ||
- ( process.platform === "win32" ? "notepad" : "vi" )
+ , editor : osenv.editor()
, force : false
, git: "git"
, json: false
, link: false
, loglevel : "http"
+ , logstream : process.stderr
, long : false
, message : "%s"
, "node-version" : process.version
, registry : "https://registry.npmjs.org/"
, rollback : true
, save : false
+ , "save-bundle": false
, "save-dev" : false
, "save-optional" : false
, searchopts: ""
, searchexclude: null
, searchsort: "name"
- , shell : process.platform === "win32"
- ? process.env.ComSpec || "cmd"
- : process.env.SHELL || "bash"
+ , shell : osenv.shell()
, "strict-ssl": true
, tag : "latest"
, tmp : temp
exports.types =
{ "always-auth" : Boolean
- , "bin-publish" : Boolean
- , bindist : [null, String]
, browser : String
, ca: [null, String]
, cache : path
, json: Boolean
, link: Boolean
, loglevel : ["silent","win","error","warn","http","info","verbose","silly"]
+ , logstream : Stream
, long : Boolean
, message: String
, "node-version" : [null, semver]
, registry : [null, url]
, rollback : Boolean
, save : Boolean
+ , "save-bundle": Boolean
, "save-dev" : Boolean
, "save-optional" : Boolean
, searchopts : String
, O : ["--save-optional"]
, y : ["--yes"]
, n : ["--no-yes"]
+ , B : ["--save-bundle"]
}
, chain = require("slide").chain
, constants = require("constants")
, output = require("./output.js")
+ , Stream = require("stream").Stream
, PATH = "PATH"
// windows calls it's path "Path" usually, but this is not guaranteed.
return
}
var value = ini.get(i)
+ if (value instanceof Stream) return
if (!value) value = ""
else if (typeof value !== "string") value = JSON.stringify(value)
\fB\-O\fR: \fB\-\-save\-optional\fR
.
.IP "\(bu" 4
+\fB\-B\fR: \fB\-\-save\-bundle\fR
+.
+.IP "\(bu" 4
\fB\-y\fR: \fB\-\-yes\fR
.
.IP "\(bu" 4
Force npm to always require authentication when accessing the registry,
even for \fBGET\fR requests\.
.
-.SS "bin\-publish"
-.
-.IP "\(bu" 4
-Default: false
-.
-.IP "\(bu" 4
-Type: Boolean
-.
-.IP "" 0
-.
-.P
-If set to true, then binary packages will be created on publish\.
-.
-.P
-This is the way to opt into the "bindist" behavior described below\.
-.
-.SS "bindist"
-.
-.IP "\(bu" 4
-Default: Unstable node versions, \fBnull\fR, otherwise \fB"<node version>\-<platform>\-<os release>"\fR
-.
-.IP "\(bu" 4
-Type: String or \fBnull\fR
-.
-.IP "" 0
-.
-.P
-Experimental: on stable versions of node, binary distributions will be
-created with this tag\. If a user then installs that package, and their \fBbindist\fR tag is found in the list of binary distributions, they will
-get that prebuilt version\.
-.
-.P
-Pre\-build node packages have their preinstall, install, and postinstall
-scripts stripped (since they are run prior to publishing), and do not
-have their \fBbuild\fR directories automatically ignored\.
-.
-.P
-It\'s yet to be seen if this is a good idea\.
-.
.SS "browser"
.
.IP "\(bu" 4
Any logs of a higher level than the setting are shown\.
The default is "http", which shows http, warn, and error output\.
.
+.SS "logstream"
+.
+.IP "\(bu" 4
+Default: process\.stderr
+.
+.IP "\(bu" 4
+Type: Stream
+.
+.IP "" 0
+.
+.P
+This is the stream that is passed to the npmlog \fIhttps://github\.com/isaacs/npmlog\fR module at run time\.
+.
+.P
+It cannot be set from the command line, but if you are using npm
+programmatically, you may wish to send logs to somewhere other than
+stderr\.
+.
.SS "long"
.
.IP "\(bu" 4
Save installed packages to a package\.json file as dependencies\.
.
.P
+When used with the \fBnpm rm\fR command, it removes it from the dependencies
+hash\.
+.
+.P
Only works if there is already a package\.json file present\.
.
+.SS "save\-bundle"
+.
+.IP "\(bu" 4
+Default: false
+.
+.IP "\(bu" 4
+Type: Boolean
+.
+.IP "" 0
+.
+.P
+If a package would be saved at install time by the use of \fB\-\-save\fR, \fB\-\-save\-dev\fR, or \fB\-\-save\-optional\fR, then also put it in the \fBbundleDependencies\fR list\.
+.
+.P
+When used with the \fBnpm rm\fR command, it removes it from the
+bundledDependencies list\.
+.
.SS "save\-dev"
.
.IP "\(bu" 4
Save installed packages to a package\.json file as devDependencies\.
.
.P
+When used with the \fBnpm rm\fR command, it removes it from the devDependencies
+hash\.
+.
+.P
Only works if there is already a package\.json file present\.
.
.SS "save\-optional"
Save installed packages to a package\.json file as optionalDependencies\.
.
.P
+When used with the \fBnpm rm\fR command, it removes it from the devDependencies
+hash\.
+.
+.P
Only works if there is already a package\.json file present\.
.
.SS "searchopts"
.fi
.
.SH "VERSION"
-1.1.27
+1.1.29
.
.SH "DESCRIPTION"
npm is the package manager for the Node JavaScript platform\. It puts
.fi
.
.SH "VERSION"
-1.1.27
+1.1.29
.
.SH "DESCRIPTION"
This is the API documentation for npm\.
exports.name = prompt('name', package.name || basename)
exports.version = prompt('version', package.version || '0.0.0')
+if (!package.description) {
+ exports.description = prompt('description')
+}
if (!package.main) {
exports.main = function (cb) {
"url": "http://blog.izs.me/"
},
"name": "promzard",
- "description": "A reimplementation of @SubStack's",
+ "description": "A reimplementation of @SubStack's [prompter](https://github.com/substack/node-prompter), which does not use AST traversal.",
"version": "0.1.5",
"repository": {
"url": "git://github.com/isaacs/promzard"
{
"name": "init-package-json",
- "version": "0.0.2",
+ "version": "0.0.4",
"main": "init-package-json.js",
"scripts": {
"test": "tap test/*.js"
"url": "http://blog.izs.me/"
},
"license": "BSD",
- "description": "A node module to get your node module started",
+ "description": "A node module to get your node module started.",
"dependencies": {
"promzard": "~0.1.5",
"read": "~0.1.0",
- "read-package-json": "0.0.6",
+ "read-package-json": "0",
"semver": "~1.0.14"
},
"devDependencies": {
"start"
],
"readme": "# init-package-json\n\nA node module to get your node module started.\n\n## Usage\n\n```javascript\nvar init = require('init-package-json')\nvar path = require('path')\n\n// a path to a promzard module. In the event that this file is\n// not found, one will be provided for you.\nvar initFile = path.resolve(process.env.HOME, '.npm-init')\n\n// the dir where we're doin stuff.\nvar dir = process.cwd()\n\n// extra stuff that gets put into the PromZard module's context.\n// In npm, this is the resolved config object. Exposed as 'config'\n// Optional.\nvar configData = { some: 'extra stuff' }\n\n// Any existing stuff from the package.json file is also exposed in the\n// PromZard module as the `package` object. There will also be free\n// vars for:\n// * `filename` path to the package.json file\n// * `basename` the tip of the package dir\n// * `dirname` the parent of the package dir\n\ninit(dir, initFile, configData, function (er, data) {\n // the data's already been written to {dir}/package.json\n // now you can do stuff with it\n})\n```\n\nOr from the command line:\n\n```\n$ npm-init\n```\n\nSee [PromZard](https://github.com/isaacs/promzard) for details about\nwhat can go in the config file.\n",
- "_id": "init-package-json@0.0.2",
+ "_id": "init-package-json@0.0.4",
"_from": "init-package-json@0"
}
}
}
- this.request('GET', uri, etag, nofollow, function (er, remoteData, raw, response) {
+ this.request('GET', uri, null, etag, nofollow, function (er, remoteData, raw, response) {
// if we get an error talking to the registry, but we have it
// from the cache, then just pretend we got it.
if (er && cache && data && !data.error) {
},
"name": "npm-registry-client",
"description": "The code that npm uses to talk to the registry",
- "version": "0.0.6",
+ "version": "0.0.7",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
"node": "*"
},
"readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(options)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Options\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `alwaysAuth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strictSSL` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
- "_id": "npm-registry-client@0.0.6",
- "_from": "npm-registry-client@0"
+ "_id": "npm-registry-client@0.0.7",
+ "_from": "npm-registry-client@latest"
}
--- /dev/null
+Copyright (c) Isaac Z. Schlueter
+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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
--- /dev/null
+# osenv
+
+Look up environment settings specific to different operating systems.
+
+## Usage
+
+```javascript
+var osenv = require('osenv')
+var path = osenv.path()
+var user = osenv.user()
+// etc.
+
+// Some things are not reliably in the env, and have a fallback command:
+var h = osenv.hostname(function (er, hostname) {
+ h = hostname
+})
+// This will still cause it to be memoized, so calling osenv.hostname()
+// is now an immediate operation.
+
+// You can always send a cb, which will get called in the nextTick
+// if it's been memoized, or wait for the fallback data if it wasn't
+// found in the environment.
+osenv.hostname(function (er, hostname) {
+ if (er) console.error('error looking up hostname')
+ else console.log('this machine calls itself %s', hostname)
+})
+```
+
+## osenv.hostname()
+
+The machine name. Calls `hostname` if not found.
+
+## osenv.user()
+
+The currently logged-in user. Calls `whoami` if not found.
+
+## osenv.prompt()
+
+Either PS1 on unix, or PROMPT on Windows.
+
+## osenv.tmpdir()
+
+The place where temporary files should be created.
+
+## osenv.home()
+
+No place like it.
+
+## osenv.path()
+
+An array of the places that the operating system will search for
+executables.
+
+## osenv.editor()
+
+Return the executable name of the editor program. This uses the EDITOR
+and VISUAL environment variables, and falls back to `vi` on Unix, or
+`notepad.exe` on Windows.
+
+## osenv.shell()
+
+The SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'
+or 'cmd'.
--- /dev/null
+var isWindows = process.platform === 'win32'
+var windir = isWindows ? process.env.windir || 'C:\\Windows' : null
+var path = require('path')
+var exec = require('child_process').exec
+
+// looking up envs is a bit costly.
+// Also, sometimes we want to have a fallback
+// Pass in a callback to wait for the fallback on failures
+// After the first lookup, always returns the same thing.
+function memo (key, lookup, fallback) {
+ var fell = false
+ var falling = false
+ exports[key] = function (cb) {
+ var val = lookup()
+ if (!val && !fell && !falling && fallback) {
+ fell = true
+ falling = true
+ exec(fallback, function (er, output, stderr) {
+ falling = false
+ if (er) return // oh well, we tried
+ val = output.trim()
+ })
+ }
+ exports[key] = function (cb) {
+ if (cb) process.nextTick(cb.bind(null, null, val))
+ return val
+ }
+ if (cb && !falling) process.nextTick(cb.bind(null, null, val))
+ return val
+ }
+}
+
+memo('user', function () {
+ return ( isWindows
+ ? process.env.USERDOMAIN + '\\' + process.env.USERNAME
+ : process.env.USER
+ )
+}, 'whoami')
+
+memo('prompt', function () {
+ return isWindows ? process.env.PROMPT : process.env.PS1
+})
+
+memo('hostname', function () {
+ return isWindows ? process.env.COMPUTERNAME : process.env.HOSTNAME
+}, 'hostname')
+
+memo('tmpdir', function () {
+ var t = isWindows ? 'temp' : 'tmp'
+ return process.env.TMPDIR ||
+ process.env.TMP ||
+ process.env.TEMP ||
+ ( exports.home() ? path.resolve(exports.home(), t)
+ : isWindows ? path.resolve(windir, t)
+ : '/tmp'
+ )
+})
+
+memo('home', function () {
+ return ( isWindows ? process.env.USERPROFILE
+ : process.env.HOME
+ )
+})
+
+memo('path', function () {
+ return (process.env.PATH ||
+ process.env.Path ||
+ process.env.path).split(isWindows ? ';' : ':')
+})
+
+memo('editor', function () {
+ return process.env.EDITOR ||
+ process.env.VISUAL ||
+ (isWindows ? 'notepad.exe' : 'vi')
+})
+
+memo('shell', function () {
+ return isWindows ? process.env.ComSpec || 'cmd'
+ : process.env.SHELL || 'bash'
+})
--- /dev/null
+{
+ "name": "osenv",
+ "version": "0.0.3",
+ "main": "osenv.js",
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/osenv"
+ },
+ "keywords": [
+ "environment",
+ "variable",
+ "home",
+ "tmpdir",
+ "path",
+ "prompt",
+ "ps1"
+ ],
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "license": "BSD",
+ "description": "Look up environment settings specific to different operating systems",
+ "readme": "# osenv\n\nLook up environment settings specific to different operating systems.\n\n## Usage\n\n```javascript\nvar osenv = require('osenv')\nvar path = osenv.path()\nvar user = osenv.user()\n// etc.\n\n// Some things are not reliably in the env, and have a fallback command:\nvar h = osenv.hostname(function (er, hostname) {\n h = hostname\n})\n// This will still cause it to be memoized, so calling osenv.hostname()\n// is now an immediate operation.\n\n// You can always send a cb, which will get called in the nextTick\n// if it's been memoized, or wait for the fallback data if it wasn't\n// found in the environment.\nosenv.hostname(function (er, hostname) {\n if (er) console.error('error looking up hostname')\n else console.log('this machine calls itself %s', hostname)\n})\n```\n\n## osenv.hostname()\n\nThe machine name. Calls `hostname` if not found.\n\n## osenv.user()\n\nThe currently logged-in user. Calls `whoami` if not found.\n\n## osenv.prompt()\n\nEither PS1 on unix, or PROMPT on Windows.\n\n## osenv.tmpdir()\n\nThe place where temporary files should be created.\n\n## osenv.home()\n\nNo place like it.\n\n## osenv.path()\n\nAn array of the places that the operating system will search for\nexecutables.\n\n## osenv.editor() \n\nReturn the executable name of the editor program. This uses the EDITOR\nand VISUAL environment variables, and falls back to `vi` on Unix, or\n`notepad.exe` on Windows.\n\n## osenv.shell()\n\nThe SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'\nor 'cmd'.\n",
+ "_id": "osenv@0.0.3",
+ "_from": "osenv@latest"
+}
{
"name": "read-package-json",
- "version": "0.0.6",
+ "version": "0.0.9",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
- "description": "The thing npm uses to read package.json files with semantics and defaults and validation",
+ "description": "This is the thing that npm uses to read package.json files. It",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/read-package-json.git"
"graceful-fs": "~1.1.8"
},
"readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\nreadJson('/path/to/package.json', function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n}\n```\n\n## readJson(file, cb)\n\n* `file` {String} The path to the package.json file\n* `cb` {Function}\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of `<name> : <filename>` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n",
- "_id": "read-package-json@0.0.6",
- "_from": "read-package-json@latest"
+ "_id": "read-package-json@0.0.9",
+ "_from": "read-package-json@0"
}
function readmeDescription (file, data) {
var d = data.readme
- if (!d) return
- d = d.split('\n')
- d = d.filter(function (line) {
- return /\s+/.test(line)
- && line.trim() !== data.name
- && !line.trim().match(/^#/)
- })[0]
- d = d.trim()
- d = d.replace(/\.$/, '')
- if (d) data.description = d
+ if (!d) return;
+ // the first block of text before the first heading
+ // that isn't the first line heading
+ d = d.trim().split('\n')
+ for (var s = 0; d[s].trim().match(/^(#|$)/); s ++);
+ for (var e = s + 1; d[e].trim(); e ++);
+ data.description = d.slice(s, e).join(' ').trim()
}
function readme (file, data, cb) {
}
function bins (file, data, cb) {
+ if (Array.isArray(data.bin)) {
+ return bins_(file, data, data.bin, cb)
+ }
var m = data.directories && data.directories.bin
if (data.bin || !m) return cb(null, data);
m = path.resolve(path.dirname(file), m)
}
function bins_ (file, data, bins, cb) {
var m = data.directories && data.directories.bin
- data.bin = bins.map(function (mf) {
- return path.resolve(m, mf)
- })
+ data.bin = bins.reduce(function (acc, mf) {
+ if (mf && mf.charAt(0) !== '.') {
+ var f = path.basename(mf)
+ acc[f] = path.join(m, mf)
+ }
+ return acc
+ }, {})
return cb(null, data)
}
{
- "version": "1.1.27",
+ "version": "1.1.29",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
"read-package-json": "0",
"read-installed": "0",
"glob": "~3.1.9",
- "init-package-json": "0"
+ "init-package-json": "0",
+ "osenv": "0"
},
"bundleDependencies": [
"semver",
"read-package-json",
"read-installed",
"glob",
- "init-package-json"
+ "init-package-json",
+ "osenv"
],
"devDependencies": {
"ronn": "https://github.com/isaacs/ronnjs/tarball/master"
--- /dev/null
+#!/usr/bin/env node
+console.log('ok')
--- /dev/null
+{ "name":"npm-test-array-bin"
+, "version":"1.2.5"
+, "bin": [ "bin/array-bin" ]
+, "scripts": { "test": "node test.js" } }
--- /dev/null
+var c = require('child_process').spawn('array-bin', [], {
+ env: process.env }).on('close', function (code) {
+ if (code) throw new Error('exited badly with code = ' + code)
+})
+c.stdout.pipe(process.stdout)
+c.stderr.pipe(process.stderr)
--- /dev/null
+#!/usr/bin/env node
+console.log('ok')
--- /dev/null
+{ "name":"npm-test-dir-bin"
+, "version":"1.2.5"
+, "directories": { "bin": "./bin" }
+, "scripts": { "test": "node test.js" } }
--- /dev/null
+require('child_process').spawn('dir-bin', [], {
+ env: process.env }).on('exit', function (code) {
+ if (code) throw new Error('exited badly with code = ' + code)
+})
+