Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.144.235.195
module.exports = star
var npm = require('./npm.js')
var log = require('npmlog')
var asyncMap = require('slide').asyncMap
var mapToRegistry = require('./utils/map-to-registry.js')
star.usage = 'npm star [<pkg>...]\n' +
'npm unstar [<pkg>...]'
star.completion = function (opts, cb) {
// FIXME: there used to be registry completion here, but it stopped making
// sense somewhere around 50,000 packages on the registry
cb()
}
function star (args, cb) {
if (!args.length) return cb(star.usage)
var s = npm.config.get('unicode') ? '\u2605 ' : '(*)'
var u = npm.config.get('unicode') ? '\u2606 ' : '( )'
var using = !(npm.command.match(/^un/))
if (!using) s = u
asyncMap(args, function (pkg, cb) {
mapToRegistry(pkg, npm.config, function (er, uri, auth) {
if (er) return cb(er)
var params = {
starred: using,
auth: auth
}
npm.registry.star(uri, params, function (er, data, raw, req) {
if (!er) {
console.log(s + ' ' + pkg)
log.verbose('star', data)
}
cb(er, data, raw, req)
})
})
}, cb)
}
|