diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-06-05 15:18:15 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-06-06 15:07:29 -0700 |
commit | f051f317905b3b31945dfe965a492e54902e595f (patch) | |
tree | 06fedaefc3fc2dd5d6f197762afa4cd351659858 /deps/npm/lib/outdated.js | |
parent | 535c7777ac674ba86cf93c44824e07b0e23ea8c4 (diff) | |
download | node-new-f051f317905b3b31945dfe965a492e54902e595f.tar.gz |
npm: upgrade to v1.4.14
Diffstat (limited to 'deps/npm/lib/outdated.js')
-rw-r--r-- | deps/npm/lib/outdated.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index 6ca348726e..ef406fbdc5 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -155,12 +155,33 @@ function outdated_ (args, dir, parentHas, depth, cb) { } var deps = null readJson(path.resolve(dir, "package.json"), function (er, d) { + d = d || {} if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) deps = (er) ? true : (d.dependencies || {}) + + if (npm.config.get("save-dev")) { + deps = d.devDependencies || {} + return next() + } + + if (npm.config.get("save")) { + // remove optional dependencies from dependencies during --save. + Object.keys(d.optionalDependencies || {}).forEach(function (k) { + delete deps[k] + }) + return next() + } + + if (npm.config.get("save-optional")) { + deps = d.optionalDependencies || {} + return next() + } + var doUpdate = npm.config.get("dev") || (!npm.config.get("production") && !Object.keys(parentHas).length && !npm.config.get("global")) + if (!er && d && doUpdate) { Object.keys(d.devDependencies || {}).forEach(function (k) { if (!(k in parentHas)) { @@ -273,7 +294,7 @@ function shouldUpdate (args, dir, dep, has, req, depth, cb) { } // We didn't find the version in the doc. See if cache can find it. - cache.add(dep, req, onCacheAdd) + cache.add(dep, req, false, onCacheAdd) function onCacheAdd(er, d) { // if this fails, then it means we can't update this thing. |