summaryrefslogtreecommitdiff
path: root/deps/npm/lib/star.js
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-09-24 14:41:07 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-09-24 17:15:10 -0700
commit9fad8958df671c0e894506ef59b4c781c3dfb349 (patch)
tree4db7643b40c4ffd726fb27fb4aa276d420b3bfd8 /deps/npm/lib/star.js
parentb26dd4e5ab9192bad72b9dc61fa4ad2d8f215da2 (diff)
downloadnode-new-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.gz
deps: upgrade npm to 2.0.0
Diffstat (limited to 'deps/npm/lib/star.js')
-rw-r--r--deps/npm/lib/star.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/deps/npm/lib/star.js b/deps/npm/lib/star.js
index 9c0b4ea9ed..123c4ebbb4 100644
--- a/deps/npm/lib/star.js
+++ b/deps/npm/lib/star.js
@@ -1,19 +1,22 @@
module.exports = star
-var url = require("url")
- , npm = require("./npm.js")
+var npm = require("./npm.js")
, registry = npm.registry
, log = require("npmlog")
, asyncMap = require("slide").asyncMap
+ , mapToRegistry = require("./utils/map-to-registry.js")
star.usage = "npm star <package> [pkg, pkg, ...]\n"
+ "npm unstar <package> [pkg, pkg, ...]"
star.completion = function (opts, cb) {
- var uri = url.resolve(npm.config.get("registry"), "-/short")
- registry.get(uri, { timeout : 60000 }, function (er, list) {
- return cb(null, list || [])
+ mapToRegistry("-/short", npm.config, function (er, uri) {
+ if (er) return cb(er)
+
+ registry.get(uri, { timeout : 60000 }, function (er, list) {
+ return cb(null, list || [])
+ })
})
}
@@ -24,13 +27,16 @@ function star (args, cb) {
, using = !(npm.command.match(/^un/))
if (!using) s = u
asyncMap(args, function (pkg, cb) {
- var uri = url.resolve(npm.config.get("registry"), pkg)
- registry.star(uri, using, function (er, data, raw, req) {
- if (!er) {
- console.log(s + " "+pkg)
- log.verbose("star", data)
- }
- cb(er, data, raw, req)
+ mapToRegistry(pkg, npm.config, function (er, uri) {
+ if (er) return cb(er)
+
+ registry.star(uri, using, function (er, data, raw, req) {
+ if (!er) {
+ console.log(s + " "+pkg)
+ log.verbose("star", data)
+ }
+ cb(er, data, raw, req)
+ })
})
}, cb)
}