Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add the 'must-install' config, and use it in bundling

  • Loading branch information...
commit df152ab031f2489b7f1a45aa2c3e525371ebf0b7 1 parent e427526
@isaacs isaacs authored
View
8 doc/config.md
@@ -319,3 +319,11 @@ For example: `listopts = remote`
`npm ls`
The output here will always filter by remote
+
+### must-install
+
+Default: true
+
+Set to false to not install over packages that already exist. By
+default, `npm install foo` will fetch and install the latest version of
+`foo`, even if it matches a version already installed.
View
5 lib/bundle.js
@@ -27,6 +27,7 @@ function bundle (args, cb_) {
var c = { root : location
, binroot : null
, manroot : null
+ , "must-install" : false
}
conf.unshift(c)
@@ -74,5 +75,7 @@ function install (data, location, cb) {
return v ? d + "@" + v : d
})
log.verbose(deps, "bundle deps")
- npm.commands.install(deps, cb)
+ npm.commands.install(deps, log.er(cb, "Some dependencies failed to bundle\n"
+ + "Bundle them separately with\n"
+ + " npm bundle install <pkg>"))
}
View
9 lib/install.js
@@ -39,6 +39,7 @@ var registry = require("./utils/registry")
, asyncMap = require("./utils/async-map")
function install (pkglist, cb) {
+ log.verbose(pkglist, "install")
if (pkglist.length === 0) pkglist = ["."]
// it's helpful to know what we have already
if (!installedPackages) return readInstalled([], function (er, data) {
@@ -48,7 +49,7 @@ function install (pkglist, cb) {
})
log.verbose(pkglist, "install pkglist")
- var mustInstall = pkglist.slice(0)
+ var mustInstall = npm.config.get("must-install") ? pkglist.slice(0) : []
// three lists: "pkglist", "next", and "reg"
// asyncMap over the "left" list: for each "it"
@@ -250,7 +251,11 @@ function buildAll (installed, cb) {
}, function (er) {
if (er) return cb(er)
log.verbose(list.join("\n"), "unpacked, building")
- npm.commands.build(buildList, cb)
+ if (buildList.length) npm.commands.build(buildList, cb)
+ else {
+ log.info("Nothing to do", "install")
+ cb()
+ }
})
}
function rollbackFailure (installList, cb) { return function (er) {
View
1  lib/utils/default-config.js
@@ -37,6 +37,7 @@ module.exports =
, force : false
, prune : undefined // if set to boolean false, then that means "never"
, listopts: ""
+ , "must-install" : true
//
// TODO: Fix when node's SSL client can upload properly.
// , registry : hasSSL ? "https://registry.npmjs.org/"
View
7 man1/config.1
@@ -409,3 +409,10 @@ For example: \fBlistopts = remote\fR
.
.P
The output here will always filter by remote
+.
+.SS "must\-install"
+Default: true
+.
+.P
+Set to false to not install over packages that already exist\. By
+default, \fBnpm install foo\fR will fetch and install the latest version of \fBfoo\fR, even if it matches a version already installed\.
Please sign in to comment.
Something went wrong with that request. Please try again.