diff options
author | isaacs <i@izs.me> | 2012-08-21 16:27:30 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-08-21 16:27:30 -0700 |
commit | 024f4b12a5557a2e935fc16950240709c89178ea (patch) | |
tree | 07edf61ea0af3fa853135f0ca17cd670efddd0dd /deps/npm/lib | |
parent | 2bcb9ab7bcd474590f109bd04c43ba8e39a90dfa (diff) | |
download | node-024f4b12a5557a2e935fc16950240709c89178ea.tar.gz |
npm: Upgrade to 1.1.56
Diffstat (limited to 'deps/npm/lib')
-rw-r--r-- | deps/npm/lib/install.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index c58d5a1e6..ecb5d0d76 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -104,11 +104,10 @@ function install (args, cb_) { // install dependencies locally by default, // or install current folder globally if (!args.length) { + var opt = { dev: npm.config.get("dev") || !npm.config.get("production") } + if (npm.config.get("global")) args = ["."] - else return readDependencies( null - , where - , { dev: !npm.config.get("production") } - , function (er, data) { + else return readDependencies(null, where, opt, function (er, data) { if (er) { log.error("install", "Couldn't read dependencies") return cb(er) @@ -184,6 +183,12 @@ function readDependencies (context, where, opts, cb) { }) } + if (!npm.config.get("optional") && data.optionalDependencies) { + Object.keys(data.optionalDependencies).forEach(function (d) { + delete data.dependencies[d] + }) + } + if (wrap) { log.verbose("readDependencies: using existing wrap", [where, wrap]) var rv = {} @@ -456,7 +461,8 @@ function installMany (what, where, context, cb) { // dependencies we'll iterate below comes from an existing shrinkwrap from a // parent level, a new shrinkwrap at this level, or package.json at this // level, as well as which shrinkwrap (if any) our dependencies should use. - readDependencies(context, where, {}, function (er, data, wrap) { + var opt = { dev: npm.config.get("dev") } + readDependencies(context, where, opt, function (er, data, wrap) { if (er) data = {} var parent = data @@ -888,7 +894,8 @@ function write (target, targetFolder, context, cb_) { if (er) return cb(er) // before continuing to installing dependencies, check for a shrinkwrap. - readDependencies(context, targetFolder, {}, function (er, data, wrap) { + var opt = { dev: npm.config.get("dev") } + readDependencies(context, targetFolder, opt, function (er, data, wrap) { var deps = Object.keys(data.dependencies || {}) // don't install bundleDependencies, unless they're missing. |