Server IP : 66.29.132.122 / Your IP : 3.135.211.245 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/alt/alt-nodejs19/root/lib/node_modules/npm/lib/commands/ |
Upload File : |
const fetch = require('npm-registry-fetch') const npa = require('npm-package-arg') const log = require('../utils/log-shim') const getIdentity = require('../utils/get-identity') const BaseCommand = require('../base-command.js') class Star extends BaseCommand { static description = 'Mark your favorite packages' static name = 'star' static usage = ['[<package-spec>...]'] static params = [ 'registry', 'unicode', 'otp', ] static ignoreImplicitWorkspace = false async exec (args) { if (!args.length) { throw this.usageError() } // if we're unstarring, then show an empty star image // otherwise, show the full star image const unicode = this.npm.config.get('unicode') const full = unicode ? '\u2605 ' : '(*)' const empty = unicode ? '\u2606 ' : '( )' const show = this.name === 'star' ? full : empty const pkgs = args.map(npa) const username = await getIdentity(this.npm, this.npm.flatOptions) for (const pkg of pkgs) { const fullData = await fetch.json(pkg.escapedName, { ...this.npm.flatOptions, spec: pkg, query: { write: true }, preferOnline: true, }) const body = { _id: fullData._id, _rev: fullData._rev, users: fullData.users || {}, } if (this.name === 'star') { log.info('star', 'starring', body._id) body.users[username] = true log.verbose('star', 'starring', body) } else { delete body.users[username] log.info('unstar', 'unstarring', body._id) log.verbose('unstar', 'unstarring', body) } const data = await fetch.json(pkg.escapedName, { ...this.npm.flatOptions, spec: pkg, method: 'PUT', body, }) this.npm.output(show + ' ' + pkg.name) log.verbose('star', data) return data } } } module.exports = Star