]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/lib/star.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / lib / star.js
1
2 module.exports = star
3
4 var npm = require("./npm.js")
5   , log = require("npmlog")
6   , asyncMap = require("slide").asyncMap
7   , mapToRegistry = require("./utils/map-to-registry.js")
8
9 star.usage = "npm star <package> [pkg, pkg, ...]\n"
10            + "npm unstar <package> [pkg, pkg, ...]"
11
12 star.completion = function (opts, cb) {
13   // FIXME: there used to be registry completion here, but it stopped making
14   // sense somewhere around 50,000 packages on the registry
15   cb()
16 }
17
18 function star (args, cb) {
19   if (!args.length) return cb(star.usage)
20   var s = npm.config.get("unicode") ? "\u2605 " : "(*)"
21     , u = npm.config.get("unicode") ? "\u2606 " : "( )"
22     , using = !(npm.command.match(/^un/))
23   if (!using) s = u
24   asyncMap(args, function (pkg, cb) {
25     mapToRegistry(pkg, npm.config, function (er, uri, auth) {
26       if (er) return cb(er)
27
28       var params = {
29         starred : using,
30         auth    : auth
31       }
32       npm.registry.star(uri, params, function (er, data, raw, req) {
33         if (!er) {
34           console.log(s + " "+pkg)
35           log.verbose("star", data)
36         }
37         cb(er, data, raw, req)
38       })
39     })
40   }, cb)
41 }