X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Flib%2Fupdate.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Flib%2Fupdate.js;h=3e9438e9231629a25d2b098c391bbe5c7d9a91cb;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/lib/update.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/lib/update.js new file mode 100644 index 00000000..3e9438e9 --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/lib/update.js @@ -0,0 +1,58 @@ +/* +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]" + +var npm = require("./npm.js") + , asyncMap = require("slide").asyncMap + , log = require("npmlog") + + // load these, just so that we know that they'll be available, in case + // npm itself is getting overwritten. + , install = require("./install.js") + , build = require("./build.js") + +update.completion = npm.commands.outdated.completion + +function update (args, cb) { + npm.commands.outdated(args, true, function (er, outdated) { + if (er) return cb(er) + + var wanted = outdated.filter(function (ww) { + var dep = ww[1] + var current = ww[2] + var wanted = ww[3] + var latest = ww[4] + if (current === wanted && wanted !== latest) { + log.verbose( + 'outdated', + 'not updating', dep, + "because it's currently at the maximum version that matches its specified semver range" + ) + } + return current !== wanted + }) + if (wanted.length === 0) return cb() + + log.info('outdated', 'updating', wanted) + asyncMap(wanted, function (ww, cb) { + // [[ dir, dep, has, want, req ]] + var where = ww[0] + , dep = ww[1] + , want = ww[3] + , what = dep + "@" + want + , req = ww[5] + , url = require('url') + + // use the initial installation method (repo, tar, git) for updating + if (url.parse(req).protocol) what = req + npm.commands.install(where, what, cb) + }, cb) + }) +}