diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-03-06 02:57:32 -0600 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-03-06 11:20:05 -0500 |
commit | fe14802fb700c5fea08b7c54f4298c3ac44a5c15 (patch) | |
tree | 74b43bf61e98f366089a416e4fe36b2f1256cd5d /deps/npm/lib/ls.js | |
parent | c09c90c1a9e74ee4f29a051daf10bc4c5d5f7755 (diff) | |
download | android-node-v8-fe14802fb700c5fea08b7c54f4298c3ac44a5c15.tar.gz android-node-v8-fe14802fb700c5fea08b7c54f4298c3ac44a5c15.tar.bz2 android-node-v8-fe14802fb700c5fea08b7c54f4298c3ac44a5c15.zip |
deps: upgrade npm to 2.7.0
PR-URL: https://github.com/iojs/io.js/pull/1080
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/npm/lib/ls.js')
-rw-r--r-- | deps/npm/lib/ls.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index eee4f2772e..05166ee6ab 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -40,6 +40,7 @@ function ls (args, silent, cb) { var opt = { depth: depth, log: log.warn, dev: true } readInstalled(dir, opt, function (er, data) { pruneNestedExtraneous(data) + filterByEnv(data) var bfs = bfsify(data, args) , lite = getLite(bfs) @@ -88,6 +89,21 @@ function pruneNestedExtraneous (data, visited) { } } +function filterByEnv (data) { + var dev = npm.config.get("dev") + var production = npm.config.get("production") + if (dev === production) return + var dependencies = {} + var devDependencies = data.devDependencies || [] + Object.keys(data.dependencies).forEach(function (name) { + var keys = Object.keys(devDependencies) + if (production && keys.indexOf(name) !== -1) return + if (dev && keys.indexOf(name) === -1) return + dependencies[name] = data.dependencies[name] + }) + data.dependencies = dependencies +} + function alphasort (a, b) { a = a.toLowerCase() b = b.toLowerCase() |