PATH:
usr
/
local
/
lib
/
node_modules
/
npm
/
lib
'use strict' const BB = require('bluebird') const fetch = require('libnpm/fetch') const figgyPudding = require('figgy-pudding') const log = require('npmlog') const npa = require('libnpm/parse-arg') const npm = require('./npm.js') const npmConfig = require('./config/figgy-config.js') const output = require('./utils/output.js') const usage = require('./utils/usage.js') const whoami = require('./whoami.js') const StarConfig = figgyPudding({ 'unicode': {} }) star.usage = usage( 'star', '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() } module.exports = star function star (args, cb) { const opts = StarConfig(npmConfig()) return BB.try(() => { if (!args.length) throw new Error(star.usage) let s = opts.unicode ? '\u2605 ' : '(*)' const u = opts.unicode ? '\u2606 ' : '( )' const using = !(npm.command.match(/^un/)) if (!using) s = u return BB.map(args.map(npa), pkg => { return BB.all([ whoami([pkg], true, () => {}), fetch.json(pkg.escapedName, opts.concat({ spec: pkg, query: {write: true}, 'prefer-online': true })) ]).then(([username, fullData]) => { if (!username) { throw new Error('You need to be logged in!') } const body = { _id: fullData._id, _rev: fullData._rev, users: fullData.users || {} } if (using) { log.info('star', 'starring', body._id) body.users[username] = true log.verbose('star', 'starring', body) } else { delete body.users[username] log.info('star', 'unstarring', body._id) log.verbose('star', 'unstarring', body) } return fetch.json(pkg.escapedName, opts.concat({ spec: pkg, method: 'PUT', body })) }).then(data => { output(s + ' ' + pkg.name) log.verbose('star', data) return data }) }) }).nodeify(cb) }
[-] star.js
[edit]
[-] ping.js
[edit]
[-] xmas.js
[edit]
[+]
search
[-] stop.js
[edit]
[-] team.js
[edit]
[-] run-script.js
[edit]
[-] edit.js
[edit]
[-] explore.js
[edit]
[-] access.js
[edit]
[-] repo.js
[edit]
[-] root.js
[edit]
[-] completion.js
[edit]
[-] bugs.js
[edit]
[-] restart.js
[edit]
[+]
..
[-] pack.js
[edit]
[-] unbuild.js
[edit]
[-] fetch-package-metadata.md
[edit]
[-] npm.js
[edit]
[-] install-test.js
[edit]
[+]
utils
[-] org.js
[edit]
[-] dedupe.js
[edit]
[+]
auth
[-] visnup.js
[edit]
[-] test.js
[edit]
[-] audit.js
[edit]
[-] install-ci-test.js
[edit]
[-] cache.js
[edit]
[-] outdated.js
[edit]
[-] link.js
[edit]
[-] substack.js
[edit]
[-] logout.js
[edit]
[-] install.js
[edit]
[-] fetch-package-metadata.js
[edit]
[-] fund.js
[edit]
[-] ci.js
[edit]
[-] get.js
[edit]
[-] profile.js
[edit]
[-] uninstall.js
[edit]
[+]
doctor
[-] init.js
[edit]
[-] prune.js
[edit]
[-] dist-tag.js
[edit]
[-] search.js
[edit]
[-] view.js
[edit]
[-] owner.js
[edit]
[+]
config
[-] rebuild.js
[edit]
[-] start.js
[edit]
[-] config.js
[edit]
[-] update.js
[edit]
[-] docs.js
[edit]
[+]
install
[-] build.js
[edit]
[-] help.js
[edit]
[-] ls.js
[edit]
[-] deprecate.js
[edit]
[-] hook.js
[edit]
[-] publish.js
[edit]
[-] prefix.js
[edit]
[-] adduser.js
[edit]
[-] shrinkwrap.js
[edit]
[-] help-search.js
[edit]
[-] stars.js
[edit]
[-] doctor.js
[edit]
[-] set.js
[edit]
[-] whoami.js
[edit]
[-] version.js
[edit]
[-] bin.js
[edit]
[-] token.js
[edit]
[-] unpublish.js
[edit]