1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
for each pkg in prefix that isn't a git repo
look for a new version of pkg that satisfies dep
if so, install it.
if not, then update it
*/
module.exports = update
update.usage = "npm update [pkg]"
update.completion = function (args, index, cb) {
var installedPkgs = require("./utils/completion/installed-packages")
installedPkgs(args, index, false, true, cb)
}
var npm = require("../npm")
, lifecycle = require("./utils/lifecycle")
, asyncMap = require("./utils/async-map")
, log = require("./utils/log")
function update (args, cb) {
npm.commands.outdated(args, true, function (er, outdated) {
log(outdated, "outdated updating")
if (er) return cb(er)
asyncMap(outdated, function (ww, cb) {
log(ww, "updating")
var where = ww[0]
, what = ww[1]
npm.commands.install(where, what, cb)
}, cb)
})
}
|