1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | module.exports = update
|
9 |
|
10 | update.usage = "npm update [pkg]"
|
11 |
|
12 | var npm = require("./npm.js")
|
13 | , asyncMap = require("slide").asyncMap
|
14 | , log = require("npmlog")
|
15 |
|
16 |
|
17 |
|
18 | , install = require("./install.js")
|
19 | , build = require("./build.js")
|
20 |
|
21 | update.completion = npm.commands.outdated.completion
|
22 |
|
23 | function update (args, cb) {
|
24 | npm.commands.outdated(args, true, function (er, outdated) {
|
25 | log.info("outdated", "updating", outdated)
|
26 | if (er) return cb(er)
|
27 |
|
28 | asyncMap(outdated, function (ww, cb) {
|
29 |
|
30 | var where = ww[0]
|
31 | , dep = ww[1]
|
32 | , want = ww[3]
|
33 | , what = dep + "@" + want
|
34 | , req = ww[5]
|
35 | , url = require('url')
|
36 |
|
37 |
|
38 | if (url.parse(req).protocol) what = req
|
39 | npm.commands.install(where, what, cb)
|
40 | }, cb)
|
41 | })
|
42 | }
|