mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
deps: upgrade npm to 8.1.3
PR-URL: https://github.com/nodejs/node/pull/40726 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
25a166dd25
commit
c0200e20a0
285 files changed
+12499
-15207
No files matched your search
+1
-1
@@ -159,7 +159,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
|
||||
the results to only the paths to the packages named. Note that nested
|
||||
packages will <em>also</em> show the paths to the specified packages. For
|
||||
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
|
||||
<pre lang="bash"><code>npm@8.1.2 /path/to/npm
|
||||
<pre lang="bash"><code>npm@8.1.3 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
</code></pre>
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ npm command-line interface
|
||||
<pre lang="bash"><code>npm <command> [args]
|
||||
</code></pre>
|
||||
<h3 id="version">Version</h3>
|
||||
<p>8.1.2</p>
|
||||
<p>8.1.3</p>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>npm is the package manager for the Node JavaScript platform. It puts
|
||||
modules in place so that node can find them, and manages dependency
|
||||
|
||||
Vendored
+2
-3
@@ -1,5 +1,4 @@
|
||||
if (require.main === module) {
|
||||
if (require.main === module)
|
||||
require('./lib/cli.js')(process)
|
||||
} else {
|
||||
else
|
||||
throw new Error('The programmatic API was removed in npm v8.0.0')
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
// a list of workspace names and passes it on to new Arborist() to
|
||||
// be able to run a filtered Arborist.reify() at some point.
|
||||
|
||||
const BaseCommand = require('../base-command.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
class ArboristCmd extends BaseCommand {
|
||||
get isArboristCmd () {
|
||||
return true
|
||||
@@ -17,12 +17,9 @@ class ArboristCmd extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.setWorkspaces(filters, true)
|
||||
.then(() => {
|
||||
this.exec(args, cb)
|
||||
})
|
||||
.catch(er => cb(er))
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
return this.exec(args)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-10
@@ -1,4 +1,4 @@
|
||||
// Base class for npm.commands[cmd]
|
||||
// Base class for npm commands
|
||||
const usageUtil = require('./utils/usage.js')
|
||||
const ConfigDefinitions = require('./utils/config/definitions.js')
|
||||
const getWorkspaces = require('./workspaces/get-workspaces.js')
|
||||
@@ -53,19 +53,15 @@ class BaseCommand {
|
||||
return results
|
||||
}
|
||||
|
||||
usageError (msg) {
|
||||
if (!msg) {
|
||||
return Object.assign(new Error(`\nUsage: ${this.usage}`), {
|
||||
code: 'EUSAGE',
|
||||
})
|
||||
}
|
||||
|
||||
return Object.assign(new Error(`\nUsage: ${msg}\n\n${this.usage}`), {
|
||||
usageError (prefix = '') {
|
||||
if (prefix)
|
||||
prefix += '\n\n'
|
||||
return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
|
||||
code: 'EUSAGE',
|
||||
})
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
async execWorkspaces (args, filters) {
|
||||
throw Object.assign(
|
||||
new Error('This command does not support workspaces.'),
|
||||
{ code: 'ENOWORKSPACES' }
|
||||
|
||||
Vendored
+9
-8
@@ -18,7 +18,8 @@ module.exports = async (process) => {
|
||||
|
||||
checkForUnsupportedNode()
|
||||
|
||||
const npm = require('../lib/npm.js')
|
||||
const Npm = require('../lib/npm.js')
|
||||
const npm = new Npm()
|
||||
const exitHandler = require('../lib/utils/exit-handler.js')
|
||||
exitHandler.setNpm(npm)
|
||||
|
||||
@@ -38,6 +39,7 @@ module.exports = async (process) => {
|
||||
|
||||
const updateNotifier = require('../lib/utils/update-notifier.js')
|
||||
|
||||
let cmd
|
||||
// now actually fire up npm and run the command.
|
||||
// this is how to use npm programmatically:
|
||||
try {
|
||||
@@ -55,24 +57,23 @@ module.exports = async (process) => {
|
||||
|
||||
updateNotifier(npm)
|
||||
|
||||
const cmd = npm.argv.shift()
|
||||
cmd = npm.argv.shift()
|
||||
if (!cmd) {
|
||||
npm.output(npm.usage)
|
||||
npm.output(await npm.usage)
|
||||
process.exitCode = 1
|
||||
return exitHandler()
|
||||
}
|
||||
|
||||
const impl = npm.commands[cmd]
|
||||
if (!impl) {
|
||||
await npm.exec(cmd, npm.argv)
|
||||
exitHandler()
|
||||
} catch (err) {
|
||||
if (err.code === 'EUNKNOWNCOMMAND') {
|
||||
const didYouMean = require('./utils/did-you-mean.js')
|
||||
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
|
||||
npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`)
|
||||
process.exitCode = 1
|
||||
return exitHandler()
|
||||
}
|
||||
|
||||
impl(npm.argv, exitHandler)
|
||||
} catch (err) {
|
||||
return exitHandler(err)
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ const path = require('path')
|
||||
const libaccess = require('libnpmaccess')
|
||||
const readPackageJson = require('read-package-json-fast')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const getIdentity = require('./utils/get-identity.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const getIdentity = require('../utils/get-identity.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
const subcommands = [
|
||||
'public',
|
||||
@@ -76,11 +76,7 @@ class Access extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.access(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async access ([cmd, ...args]) {
|
||||
async exec ([cmd, ...args]) {
|
||||
if (!cmd)
|
||||
throw this.usageError('Subcommand is required.')
|
||||
|
||||
+7
-11
@@ -1,11 +1,11 @@
|
||||
const log = require('npmlog')
|
||||
const replaceInfo = require('./utils/replace-info.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const replaceInfo = require('../utils/replace-info.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
const authTypes = {
|
||||
legacy: require('./auth/legacy.js'),
|
||||
oauth: require('./auth/oauth.js'),
|
||||
saml: require('./auth/saml.js'),
|
||||
sso: require('./auth/sso.js'),
|
||||
legacy: require('../auth/legacy.js'),
|
||||
oauth: require('../auth/oauth.js'),
|
||||
saml: require('../auth/saml.js'),
|
||||
sso: require('../auth/sso.js'),
|
||||
}
|
||||
|
||||
class AddUser extends BaseCommand {
|
||||
@@ -24,11 +24,7 @@ class AddUser extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.adduser(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async adduser (args) {
|
||||
async exec (args) {
|
||||
const { scope } = this.npm.flatOptions
|
||||
const registry = this.getRegistry(this.npm.flatOptions)
|
||||
const auth = this.getAuthType(this.npm.flatOptions)
|
||||
+4
-8
@@ -1,8 +1,8 @@
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const auditReport = require('npm-audit-report')
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const auditError = require('./utils/audit-error.js')
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
const auditError = require('../utils/audit-error.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class Audit extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -47,11 +47,7 @@ class Audit extends ArboristWorkspaceCmd {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.audit(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async audit (args) {
|
||||
async exec (args) {
|
||||
const reporter = this.npm.config.get('json') ? 'json' : 'detail'
|
||||
const opts = {
|
||||
...this.npm.flatOptions,
|
||||
+3
-7
@@ -1,5 +1,5 @@
|
||||
const envPath = require('./utils/path.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const envPath = require('../utils/path.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Bin extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -14,11 +14,7 @@ class Bin extends BaseCommand {
|
||||
return ['global']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.bin(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async bin (args) {
|
||||
async exec (args) {
|
||||
const b = this.npm.bin
|
||||
this.npm.output(b)
|
||||
if (this.npm.config.get('global') && !envPath.includes(b))
|
||||
@@ -1,10 +1,11 @@
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Birthday extends BaseCommand {
|
||||
exec (args, cb) {
|
||||
async exec () {
|
||||
this.npm.config.set('package', ['@npmcli/npm-birthday'])
|
||||
this.npm.config.set('yes', true)
|
||||
return this.npm.commands.exec(['npm-birthday'], cb)
|
||||
const exec = await this.npm.cmd('exec')
|
||||
return exec.exec(['npm-birthday'])
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -1,8 +1,8 @@
|
||||
const log = require('npmlog')
|
||||
const pacote = require('pacote')
|
||||
const openUrl = require('./utils/open-url.js')
|
||||
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Bugs extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -22,11 +22,7 @@ class Bugs extends BaseCommand {
|
||||
return ['browser', 'registry']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.bugs(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async bugs (args) {
|
||||
async exec (args) {
|
||||
if (!args || !args.length)
|
||||
args = ['.']
|
||||
|
||||
+4
-13
@@ -5,7 +5,7 @@ const pacote = require('pacote')
|
||||
const path = require('path')
|
||||
const rimraf = promisify(require('rimraf'))
|
||||
const semver = require('semver')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
const npa = require('npm-package-arg')
|
||||
const jsonParse = require('json-parse-even-better-errors')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
@@ -104,11 +104,7 @@ class Cache extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.cache(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async cache (args) {
|
||||
async exec (args) {
|
||||
const cmd = args.shift()
|
||||
switch (cmd) {
|
||||
case 'rm': case 'clear': case 'clean':
|
||||
@@ -120,7 +116,7 @@ class Cache extends BaseCommand {
|
||||
case 'ls':
|
||||
return await this.ls(args)
|
||||
default:
|
||||
throw Object.assign(new Error(this.usage), { code: 'EUSAGE' })
|
||||
throw this.usageError()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,14 +161,9 @@ class Cache extends BaseCommand {
|
||||
// npm cache add <tarball>...
|
||||
// npm cache add <folder>...
|
||||
async add (args) {
|
||||
const usage = 'Usage:\n' +
|
||||
' npm cache add <tarball-url>...\n' +
|
||||
' npm cache add <pkg>@<ver>...\n' +
|
||||
' npm cache add <tarball>...\n' +
|
||||
' npm cache add <folder>...\n'
|
||||
log.silly('cache add', 'args', args)
|
||||
if (args.length === 0)
|
||||
throw Object.assign(new Error(usage), { code: 'EUSAGE' })
|
||||
throw this.usageError('First argument to `add` is required')
|
||||
|
||||
return Promise.all(args.map(spec => {
|
||||
log.silly('cache add', 'spec', spec)
|
||||
+3
-7
@@ -1,7 +1,7 @@
|
||||
const util = require('util')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const rimraf = util.promisify(require('rimraf'))
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
const runScript = require('@npmcli/run-script')
|
||||
const fs = require('fs')
|
||||
const readdir = util.promisify(fs.readdir)
|
||||
@@ -17,7 +17,7 @@ const removeNodeModules = async where => {
|
||||
await Promise.all(entries.map(f => rimraf(`${path}/${f}`, rimrafOpts)))
|
||||
process.emit('timeEnd', 'npm-ci:rm')
|
||||
}
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class CI extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -39,11 +39,7 @@ class CI extends ArboristWorkspaceCmd {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.ci().then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async ci () {
|
||||
async exec () {
|
||||
if (this.npm.config.get('global')) {
|
||||
const err = new Error('`npm ci` does not work for global packages')
|
||||
err.code = 'ECIGLOBAL'
|
||||
@@ -29,20 +29,20 @@
|
||||
// as an array.
|
||||
//
|
||||
|
||||
const { definitions, shorthands } = require('./utils/config/index.js')
|
||||
const deref = require('./utils/deref-command.js')
|
||||
const { aliases, cmdList, plumbing } = require('./utils/cmd-list.js')
|
||||
const { definitions, shorthands } = require('../utils/config/index.js')
|
||||
const deref = require('../utils/deref-command.js')
|
||||
const { aliases, cmdList, plumbing } = require('../utils/cmd-list.js')
|
||||
const aliasNames = Object.keys(aliases)
|
||||
const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c))
|
||||
const nopt = require('nopt')
|
||||
const configNames = Object.keys(definitions)
|
||||
const shorthandNames = Object.keys(shorthands)
|
||||
const allConfs = configNames.concat(shorthandNames)
|
||||
const isWindowsShell = require('./utils/is-windows-shell.js')
|
||||
const fileExists = require('./utils/file-exists.js')
|
||||
const isWindowsShell = require('../utils/is-windows-shell.js')
|
||||
const fileExists = require('../utils/file-exists.js')
|
||||
|
||||
const { promisify } = require('util')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Completion extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -75,11 +75,7 @@ class Completion extends BaseCommand {
|
||||
return out
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.compl(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async compl (args) {
|
||||
async exec (args) {
|
||||
if (isWindowsShell) {
|
||||
const msg = 'npm completion supported only in MINGW / Git bash on Windows'
|
||||
throw Object.assign(new Error(msg), {
|
||||
@@ -163,8 +159,8 @@ class Completion extends BaseCommand {
|
||||
// at this point, if words[1] is some kind of npm command,
|
||||
// then complete on it.
|
||||
// otherwise, do nothing
|
||||
const impl = this.npm.commands[cmd]
|
||||
if (impl && impl.completion) {
|
||||
const impl = this.npm.cmd(cmd)
|
||||
if (impl.completion) {
|
||||
const comps = await impl.completion(opts)
|
||||
return this.wrap(opts, comps)
|
||||
}
|
||||
@@ -195,19 +191,11 @@ const dumpScript = async () => {
|
||||
const fs = require('fs')
|
||||
const readFile = promisify(fs.readFile)
|
||||
const { resolve } = require('path')
|
||||
const p = resolve(__dirname, 'utils/completion.sh')
|
||||
const p = resolve(__dirname, '..', 'utils', 'completion.sh')
|
||||
|
||||
const d = (await readFile(p, 'utf8')).replace(/^#!.*?\n/, '')
|
||||
await new Promise((res, rej) => {
|
||||
let done = false
|
||||
process.stdout.write(d, () => {
|
||||
if (done)
|
||||
return
|
||||
|
||||
done = true
|
||||
res()
|
||||
})
|
||||
|
||||
process.stdout.on('error', er => {
|
||||
if (done)
|
||||
return
|
||||
@@ -224,11 +212,21 @@ const dumpScript = async () => {
|
||||
// Really, one should not be tossing away EPIPE errors, or any
|
||||
// errors, so casually. But, without this, `. <(npm completion)`
|
||||
// can never ever work on OS X.
|
||||
// TODO Ignoring coverage, see 'non EPIPE errors cause failures' test.
|
||||
/* istanbul ignore next */
|
||||
if (er.errno === 'EPIPE')
|
||||
res()
|
||||
else
|
||||
rej(er)
|
||||
})
|
||||
|
||||
process.stdout.write(d, () => {
|
||||
if (done)
|
||||
return
|
||||
|
||||
done = true
|
||||
res()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// don't expand so that we only assemble the set of defaults when needed
|
||||
const configDefs = require('./utils/config/index.js')
|
||||
const configDefs = require('../utils/config/index.js')
|
||||
|
||||
const mkdirp = require('mkdirp-infer-owner')
|
||||
const { dirname } = require('path')
|
||||
@@ -29,7 +29,7 @@ const keyValues = args => {
|
||||
|
||||
const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k)
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Config extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Manage the npm configuration files'
|
||||
@@ -96,16 +96,12 @@ class Config extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.config(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
async execWorkspaces (args, filters) {
|
||||
this.npm.log.warn('config', 'This command does not support workspaces.')
|
||||
this.exec(args, cb)
|
||||
return this.exec(args)
|
||||
}
|
||||
|
||||
async config ([action, ...args]) {
|
||||
async exec ([action, ...args]) {
|
||||
this.npm.log.disableProgress()
|
||||
try {
|
||||
switch (action) {
|
||||
@@ -1,8 +1,8 @@
|
||||
// dedupe duplicated packages, or find them in the tree
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class Dedupe extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -32,11 +32,7 @@ class Dedupe extends ArboristWorkspaceCmd {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.dedupe(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async dedupe (args) {
|
||||
async exec (args) {
|
||||
if (this.npm.config.get('global')) {
|
||||
const er = new Error('`npm dedupe` does not work in global mode.')
|
||||
er.code = 'EDEDUPEGLOBAL'
|
||||
@@ -1,10 +1,10 @@
|
||||
const fetch = require('npm-registry-fetch')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const npa = require('npm-package-arg')
|
||||
const semver = require('semver')
|
||||
const getIdentity = require('./utils/get-identity.js')
|
||||
const getIdentity = require('../utils/get-identity.js')
|
||||
const libaccess = require('libnpmaccess')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Deprecate extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -42,13 +42,7 @@ class Deprecate extends BaseCommand {
|
||||
name.startsWith(opts.conf.argv.remain[0])))
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.deprecate(args)
|
||||
.then(() => cb())
|
||||
.catch(err => cb(err.code === 'EUSAGE' ? err.message : err))
|
||||
}
|
||||
|
||||
async deprecate ([pkg, msg]) {
|
||||
async exec ([pkg, msg]) {
|
||||
// msg == null because '' is a valid value, it indicates undeprecate
|
||||
if (!pkg || msg == null)
|
||||
throw this.usageError()
|
||||
+12
-24
@@ -8,8 +8,8 @@ const npmlog = require('npmlog')
|
||||
const pacote = require('pacote')
|
||||
const pickManifest = require('npm-pick-manifest')
|
||||
|
||||
const readPackageName = require('./utils/read-package-name.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const readPackageName = require('../utils/read-package-name.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Diff extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -47,24 +47,12 @@ class Diff extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.diff(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.diffWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async diff (args) {
|
||||
async exec (args) {
|
||||
const specs = this.npm.config.get('diff').filter(d => d)
|
||||
if (specs.length > 2) {
|
||||
throw new TypeError(
|
||||
'Can\'t use more than two --diff arguments.\n\n' +
|
||||
`Usage:\n${this.usage}`
|
||||
)
|
||||
}
|
||||
if (specs.length > 2)
|
||||
throw this.usageError(`Can't use more than two --diff arguments.`)
|
||||
|
||||
// diffWorkspaces may have set this already
|
||||
// execWorkspaces may have set this already
|
||||
if (!this.prefix)
|
||||
this.prefix = this.npm.prefix
|
||||
|
||||
@@ -89,12 +77,12 @@ class Diff extends BaseCommand {
|
||||
return this.npm.output(res)
|
||||
}
|
||||
|
||||
async diffWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
for (const workspacePath of this.workspacePaths) {
|
||||
this.top = workspacePath
|
||||
this.prefix = workspacePath
|
||||
await this.diff(args)
|
||||
await this.exec(args)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +97,7 @@ class Diff extends BaseCommand {
|
||||
}
|
||||
|
||||
if (!name)
|
||||
throw this.usageError('Needs multiple arguments to compare or run from a project dir.\n')
|
||||
throw this.usageError('Needs multiple arguments to compare or run from a project dir.')
|
||||
|
||||
return name
|
||||
}
|
||||
@@ -141,7 +129,7 @@ class Diff extends BaseCommand {
|
||||
noPackageJson = true
|
||||
}
|
||||
|
||||
const missingPackageJson = this.usageError('Needs multiple arguments to compare or run from a project dir.\n')
|
||||
const missingPackageJson = this.usageError('Needs multiple arguments to compare or run from a project dir.')
|
||||
|
||||
// using a valid semver range, that means it should just diff
|
||||
// the cwd against a published version to the registry using the
|
||||
@@ -230,7 +218,7 @@ class Diff extends BaseCommand {
|
||||
`file:${this.prefix}`,
|
||||
]
|
||||
} else
|
||||
throw this.usageError(`Spec type ${spec.type} not supported.\n`)
|
||||
throw this.usageError(`Spec type ${spec.type} not supported.`)
|
||||
}
|
||||
|
||||
async convertVersionsToSpecs ([a, b]) {
|
||||
@@ -247,7 +235,7 @@ class Diff extends BaseCommand {
|
||||
}
|
||||
|
||||
if (!pkgName)
|
||||
throw this.usageError('Needs to be run from a project dir in order to diff two versions.\n')
|
||||
throw this.usageError('Needs to be run from a project dir in order to diff two versions.')
|
||||
|
||||
return [`${pkgName}@${a}`, `${pkgName}@${b}`]
|
||||
}
|
||||
@@ -3,9 +3,9 @@ const npa = require('npm-package-arg')
|
||||
const regFetch = require('npm-registry-fetch')
|
||||
const semver = require('semver')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const readPackageName = require('./utils/read-package-name.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const readPackageName = require('../utils/read-package-name.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class DistTag extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -42,11 +42,7 @@ class DistTag extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.distTag(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async distTag ([cmdName, pkg, tag]) {
|
||||
async exec ([cmdName, pkg, tag]) {
|
||||
const opts = this.npm.flatOptions
|
||||
|
||||
if (['add', 'a', 'set', 's'].includes(cmdName))
|
||||
@@ -66,11 +62,7 @@ class DistTag extends BaseCommand {
|
||||
throw this.usageError()
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.distTagWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async distTagWorkspaces ([cmdName, pkg, tag], filters) {
|
||||
async execWorkspaces ([cmdName, pkg, tag], filters) {
|
||||
// cmdName is some form of list
|
||||
// pkg is one of:
|
||||
// - unset
|
||||
@@ -90,7 +82,7 @@ class DistTag extends BaseCommand {
|
||||
// anything else is just a regular dist-tag command
|
||||
// so we fallback to the non-workspaces implementation
|
||||
log.warn('Ignoring workspaces for specified package')
|
||||
return this.distTag([cmdName, pkg, tag])
|
||||
return this.exec([cmdName, pkg, tag])
|
||||
}
|
||||
|
||||
async add (spec, tag, opts) {
|
||||
+6
-14
@@ -1,9 +1,9 @@
|
||||
const log = require('npmlog')
|
||||
const pacote = require('pacote')
|
||||
const openUrl = require('./utils/open-url.js')
|
||||
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Docs extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -31,24 +31,16 @@ class Docs extends BaseCommand {
|
||||
return ['[<pkgname> [<pkgname> ...]]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.docs(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.docsWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async docs (args) {
|
||||
async exec (args) {
|
||||
if (!args || !args.length)
|
||||
args = ['.']
|
||||
|
||||
await Promise.all(args.map(pkg => this.getDocs(pkg)))
|
||||
}
|
||||
|
||||
async docsWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
return this.docs(this.workspacePaths)
|
||||
return this.exec(this.workspacePaths)
|
||||
}
|
||||
|
||||
async getDocs (pkg) {
|
||||
+7
-11
@@ -8,10 +8,10 @@ const pacote = require('pacote')
|
||||
const { resolve } = require('path')
|
||||
const semver = require('semver')
|
||||
const { promisify } = require('util')
|
||||
const ansiTrim = require('./utils/ansi-trim.js')
|
||||
const isWindows = require('./utils/is-windows.js')
|
||||
const ping = require('./utils/ping.js')
|
||||
const { registry: { default: defaultRegistry } } = require('./utils/config/definitions.js')
|
||||
const ansiTrim = require('../utils/ansi-trim.js')
|
||||
const isWindows = require('../utils/is-windows.js')
|
||||
const ping = require('../utils/ping.js')
|
||||
const { registry: { default: defaultRegistry } } = require('../utils/config/definitions.js')
|
||||
const lstat = promisify(fs.lstat)
|
||||
const readdir = promisify(fs.readdir)
|
||||
const access = promisify(fs.access)
|
||||
@@ -30,7 +30,7 @@ const maskLabel = mask => {
|
||||
return label.join(', ')
|
||||
}
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Doctor extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -47,11 +47,7 @@ class Doctor extends BaseCommand {
|
||||
return ['registry']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.doctor(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async doctor (args) {
|
||||
async exec (args) {
|
||||
this.npm.log.info('Running checkup')
|
||||
|
||||
// each message is [title, ok, message]
|
||||
@@ -121,7 +117,7 @@ class Doctor extends BaseCommand {
|
||||
console.error('')
|
||||
}
|
||||
if (!allOk)
|
||||
throw 'Some problems found. See above for recommendations.'
|
||||
throw new Error('Some problems found. See above for recommendations.')
|
||||
}
|
||||
|
||||
async checkPing () {
|
||||
+6
-15
@@ -4,9 +4,9 @@
|
||||
const { resolve } = require('path')
|
||||
const fs = require('graceful-fs')
|
||||
const { spawn } = require('child_process')
|
||||
const splitPackageNames = require('./utils/split-package-names.js')
|
||||
const completion = require('./utils/completion/installed-shallow.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const splitPackageNames = require('../utils/split-package-names.js')
|
||||
const completion = require('../utils/completion/installed-shallow.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Edit extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -33,13 +33,9 @@ class Edit extends BaseCommand {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.edit(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async edit (args) {
|
||||
async exec (args) {
|
||||
if (args.length !== 1)
|
||||
throw new Error(this.usage)
|
||||
throw this.usageError()
|
||||
|
||||
const path = splitPackageNames(args[0])
|
||||
const dir = resolve(this.npm.dir, path)
|
||||
@@ -54,12 +50,7 @@ class Edit extends BaseCommand {
|
||||
editor.on('exit', (code) => {
|
||||
if (code)
|
||||
return reject(new Error(`editor process exited with code: ${code}`))
|
||||
this.npm.commands.rebuild([dir], (err) => {
|
||||
if (err)
|
||||
return reject(err)
|
||||
|
||||
resolve()
|
||||
})
|
||||
this.npm.exec('rebuild', [dir]).catch(reject).then(resolve)
|
||||
})
|
||||
})
|
||||
})
|
||||
+10
-20
@@ -1,6 +1,6 @@
|
||||
const libexec = require('libnpmexec')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const getLocationMsg = require('./exec/get-workspace-location-msg.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
const getLocationMsg = require('../exec/get-workspace-location-msg.js')
|
||||
|
||||
// it's like this:
|
||||
//
|
||||
@@ -59,19 +59,13 @@ class Exec extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
const path = this.npm.localPrefix
|
||||
const runPath = process.cwd()
|
||||
this._exec(args, { path, runPath }).then(() => cb()).catch(cb)
|
||||
}
|
||||
async exec (_args, { locationMsg, path, runPath } = {}) {
|
||||
if (!path)
|
||||
path = this.npm.localPrefix
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this._execWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
if (!runPath)
|
||||
runPath = process.cwd()
|
||||
|
||||
// When commands go async and we can dump the boilerplate exec methods this
|
||||
// can be named correctly
|
||||
async _exec (_args, { locationMsg, path, runPath }) {
|
||||
const args = [..._args]
|
||||
const call = this.npm.config.get('call')
|
||||
const {
|
||||
@@ -86,7 +80,7 @@ class Exec extends BaseCommand {
|
||||
const yes = this.npm.config.get('yes')
|
||||
|
||||
if (call && _args.length)
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
|
||||
return libexec({
|
||||
...flatOptions,
|
||||
@@ -105,17 +99,13 @@ class Exec extends BaseCommand {
|
||||
})
|
||||
}
|
||||
|
||||
async _execWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
const color = this.npm.color
|
||||
|
||||
for (const path of this.workspacePaths) {
|
||||
const locationMsg = await getLocationMsg({ color, path })
|
||||
await this._exec(args, {
|
||||
locationMsg,
|
||||
path,
|
||||
runPath: path,
|
||||
})
|
||||
await this.exec(args, { locationMsg, path, runPath: path })
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-10
@@ -1,11 +1,11 @@
|
||||
const { explainNode } = require('./utils/explain-dep.js')
|
||||
const completion = require('./utils/completion/installed-deep.js')
|
||||
const { explainNode } = require('../utils/explain-dep.js')
|
||||
const completion = require('../utils/completion/installed-deep.js')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const npa = require('npm-package-arg')
|
||||
const semver = require('semver')
|
||||
const { relative, resolve } = require('path')
|
||||
const validName = require('validate-npm-package-name')
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class Explain extends ArboristWorkspaceCmd {
|
||||
static get description () {
|
||||
@@ -35,13 +35,9 @@ class Explain extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.explain(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async explain (args) {
|
||||
async exec (args) {
|
||||
if (!args.length)
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
|
||||
const arb = new Arborist({ path: this.npm.prefix, ...this.npm.flatOptions })
|
||||
const tree = await arb.loadActual()
|
||||
@@ -67,7 +63,7 @@ class Explain extends ArboristWorkspaceCmd {
|
||||
}
|
||||
}
|
||||
if (nodes.size === 0)
|
||||
throw `No dependencies found matching ${args.join(', ')}`
|
||||
throw new Error(`No dependencies found matching ${args.join(', ')}`)
|
||||
|
||||
const expls = []
|
||||
for (const node of nodes) {
|
||||
@@ -4,8 +4,8 @@
|
||||
const rpj = require('read-package-json-fast')
|
||||
const runScript = require('@npmcli/run-script')
|
||||
const { join, resolve, relative } = require('path')
|
||||
const completion = require('./utils/completion/installed-shallow.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const completion = require('../utils/completion/installed-shallow.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Explore extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -32,20 +32,16 @@ class Explore extends BaseCommand {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.explore(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async explore (args) {
|
||||
async exec (args) {
|
||||
if (args.length < 1 || !args[0])
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
|
||||
const pkgname = args.shift()
|
||||
|
||||
// detect and prevent any .. shenanigans
|
||||
const path = join(this.npm.dir, join('/', pkgname))
|
||||
if (relative(path, this.npm.dir) === '')
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
|
||||
// run as if running a script named '_explore', which we set to either
|
||||
// the set of arguments, or the shell config, and let @npmcli/run-script
|
||||
@@ -1,5 +1,5 @@
|
||||
// dedupe duplicated packages, or find them in the tree
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class FindDupes extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -28,9 +28,9 @@ class FindDupes extends ArboristWorkspaceCmd {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
async exec (args, cb) {
|
||||
this.npm.config.set('dry-run', true)
|
||||
this.npm.commands.dedupe([], cb)
|
||||
return this.npm.exec('dedupe', [])
|
||||
}
|
||||
}
|
||||
module.exports = FindDupes
|
||||
+4
-8
@@ -11,9 +11,9 @@ const {
|
||||
isValidFunding,
|
||||
} = require('libnpmfund')
|
||||
|
||||
const completion = require('./utils/completion/installed-deep.js')
|
||||
const openUrl = require('./utils/open-url.js')
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const completion = require('../utils/completion/installed-deep.js')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
const getPrintableName = ({ name, version }) => {
|
||||
const printableVersion = version ? `@${version}` : ''
|
||||
@@ -52,11 +52,7 @@ class Fund extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.fund(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async fund (args) {
|
||||
async exec (args) {
|
||||
const spec = args[0]
|
||||
const numberArg = this.npm.config.get('which')
|
||||
|
||||
+5
-4
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Get extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -18,11 +18,12 @@ class Get extends BaseCommand {
|
||||
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
async completion (opts) {
|
||||
return this.npm.commands.config.completion(opts)
|
||||
const config = await this.npm.cmd('config')
|
||||
return config.completion(opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.npm.commands.config(['get'].concat(args), cb)
|
||||
async exec (args) {
|
||||
return this.npm.exec('config', ['get'].concat(args))
|
||||
}
|
||||
}
|
||||
module.exports = Get
|
||||
@@ -4,7 +4,7 @@ const color = require('ansicolors')
|
||||
const { promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const readFile = promisify(fs.readFile)
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class HelpSearch extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -26,15 +26,11 @@ class HelpSearch extends BaseCommand {
|
||||
return ['long']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.helpSearch(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async helpSearch (args) {
|
||||
async exec (args) {
|
||||
if (!args.length)
|
||||
return this.npm.output(this.usage)
|
||||
throw this.usageError()
|
||||
|
||||
const docPath = path.resolve(__dirname, '..', 'docs/content')
|
||||
const docPath = path.resolve(__dirname, '..', '..', 'docs/content')
|
||||
const files = await glob(`${docPath}/*/*.md`)
|
||||
const data = await this.readFiles(files)
|
||||
const results = await this.searchFiles(args, data, files)
|
||||
+8
-21
@@ -1,11 +1,11 @@
|
||||
const { spawn } = require('child_process')
|
||||
const path = require('path')
|
||||
const openUrl = require('./utils/open-url.js')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
const { promisify } = require('util')
|
||||
const glob = promisify(require('glob'))
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
// Strips out the number from foo.7 or foo.7. or foo.7.tgz
|
||||
// We don't currently compress our man pages but if we ever did this would
|
||||
@@ -36,7 +36,7 @@ class Help extends BaseCommand {
|
||||
async completion (opts) {
|
||||
if (opts.conf.argv.remain.length > 2)
|
||||
return []
|
||||
const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]')
|
||||
const g = path.resolve(__dirname, '../../man/man[0-9]/*.[0-9]')
|
||||
const files = await glob(g)
|
||||
|
||||
return Object.keys(files.reduce(function (acc, file) {
|
||||
@@ -47,11 +47,7 @@ class Help extends BaseCommand {
|
||||
}, { help: true }))
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.help(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async help (args) {
|
||||
async exec (args) {
|
||||
// By default we search all of our man subdirectories, but if the user has
|
||||
// asked for a specific one we limit the search to just there
|
||||
let manSearch = 'man*'
|
||||
@@ -59,7 +55,7 @@ class Help extends BaseCommand {
|
||||
manSearch = `man${args.shift()}`
|
||||
|
||||
if (!args.length)
|
||||
return this.npm.output(this.npm.usage)
|
||||
return this.npm.output(await this.npm.usage)
|
||||
|
||||
// npm help foo bar baz: search topics
|
||||
if (args.length > 1)
|
||||
@@ -70,7 +66,7 @@ class Help extends BaseCommand {
|
||||
// support `npm help package.json`
|
||||
section = section.replace('.json', '-json')
|
||||
|
||||
const manroot = path.resolve(__dirname, '..', 'man')
|
||||
const manroot = path.resolve(__dirname, '..', '..', 'man')
|
||||
// find either section.n or npm-section.n
|
||||
const f = `${manroot}/${manSearch}/?(npm-)${section}.[0-9]*`
|
||||
let mans = await glob(f)
|
||||
@@ -94,16 +90,7 @@ class Help extends BaseCommand {
|
||||
}
|
||||
|
||||
helpSearch (args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.npm.commands['help-search'](args, (err) => {
|
||||
// This would only error if args was empty, which it never is
|
||||
/* istanbul ignore next */
|
||||
if (err)
|
||||
return reject(err)
|
||||
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
return this.npm.exec('help-search', args)
|
||||
}
|
||||
|
||||
async viewMan (man) {
|
||||
@@ -161,7 +148,7 @@ class Help extends BaseCommand {
|
||||
sect = 'using-npm'
|
||||
break
|
||||
}
|
||||
return 'file://' + path.resolve(__dirname, '..', 'docs', 'output', sect, f + '.html')
|
||||
return 'file:///' + path.resolve(__dirname, '..', '..', 'docs', 'output', sect, f + '.html')
|
||||
}
|
||||
}
|
||||
module.exports = Help
|
||||
+4
-8
@@ -1,9 +1,9 @@
|
||||
const hookApi = require('libnpmhook')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const relativeDate = require('tiny-relative-date')
|
||||
const Table = require('cli-table3')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Hook extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Manage registry hooks'
|
||||
@@ -30,11 +30,7 @@ class Hook extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.hook(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async hook (args) {
|
||||
async exec (args) {
|
||||
return otplease(this.npm.flatOptions, (opts) => {
|
||||
switch (args[0]) {
|
||||
case 'add':
|
||||
@@ -47,7 +43,7 @@ class Hook extends BaseCommand {
|
||||
case 'up':
|
||||
return this.update(args[1], args[2], args[3], opts)
|
||||
default:
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
}
|
||||
})
|
||||
}
|
||||
+5
-13
@@ -8,8 +8,8 @@ const libexec = require('libnpmexec')
|
||||
const mapWorkspaces = require('@npmcli/map-workspaces')
|
||||
const PackageJson = require('@npmcli/package-json')
|
||||
|
||||
const getLocationMsg = require('./exec/get-workspace-location-msg.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const getLocationMsg = require('../exec/get-workspace-location-msg.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Init extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -36,15 +36,7 @@ class Init extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.init(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.initWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async init (args) {
|
||||
async exec (args) {
|
||||
// npm exec style
|
||||
if (args.length)
|
||||
return (await this.execCreate({ args, path: process.cwd() }))
|
||||
@@ -53,10 +45,10 @@ class Init extends BaseCommand {
|
||||
await this.template()
|
||||
}
|
||||
|
||||
async initWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
// if the root package is uninitiated, take care of it first
|
||||
if (this.npm.flatOptions.includeWorkspaceRoot)
|
||||
await this.init(args)
|
||||
await this.exec(args)
|
||||
|
||||
// reads package.json for the top-level folder first, by doing this we
|
||||
// ensure the command throw if no package.json is found before trying
|
||||
@@ -13,12 +13,9 @@ class InstallCITest extends CI {
|
||||
return 'install-ci-test'
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.npm.commands.ci(args, (er) => {
|
||||
if (er)
|
||||
return cb(er)
|
||||
this.npm.commands.test([], cb)
|
||||
})
|
||||
async exec (args, cb) {
|
||||
await this.npm.exec('ci', args)
|
||||
return this.npm.exec('test', [])
|
||||
}
|
||||
}
|
||||
module.exports = InstallCITest
|
||||
@@ -13,12 +13,9 @@ class InstallTest extends Install {
|
||||
return 'install-test'
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.npm.commands.install(args, (er) => {
|
||||
if (er)
|
||||
return cb(er)
|
||||
this.npm.commands.test([], cb)
|
||||
})
|
||||
async exec (args, cb) {
|
||||
await this.npm.exec('install', args)
|
||||
return this.npm.exec('test', [])
|
||||
}
|
||||
}
|
||||
module.exports = InstallTest
|
||||
@@ -3,7 +3,7 @@
|
||||
const fs = require('fs')
|
||||
const util = require('util')
|
||||
const readdir = util.promisify(fs.readdir)
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
const log = require('npmlog')
|
||||
const { resolve, join } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
@@ -11,7 +11,7 @@ const runScript = require('@npmcli/run-script')
|
||||
const pacote = require('pacote')
|
||||
const checks = require('npm-install-checks')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Install extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -118,11 +118,7 @@ class Install extends ArboristWorkspaceCmd {
|
||||
// 50,000 packages on the registry
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.install(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async install (args) {
|
||||
async exec (args) {
|
||||
// the /path/to/node_modules/..
|
||||
const globalTop = resolve(this.npm.globalDir, '..')
|
||||
const ignoreScripts = this.npm.config.get('ignore-scripts')
|
||||
+3
-7
@@ -8,9 +8,9 @@ const npa = require('npm-package-arg')
|
||||
const rpj = require('read-package-json-fast')
|
||||
const semver = require('semver')
|
||||
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Link extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -56,11 +56,7 @@ class Link extends ArboristWorkspaceCmd {
|
||||
return files.filter(f => !/^[._-]/.test(f))
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.link(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async link (args) {
|
||||
async exec (args) {
|
||||
if (this.npm.config.get('global')) {
|
||||
throw Object.assign(
|
||||
new Error(
|
||||
+2
-2
@@ -11,9 +11,9 @@ class LL extends LS {
|
||||
return ['[[<@scope>/]<pkg> ...]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
async exec (args) {
|
||||
this.npm.config.set('long', true)
|
||||
super.exec(args, cb)
|
||||
return super.exec(args)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const log = require('npmlog')
|
||||
const getAuth = require('npm-registry-fetch/auth.js')
|
||||
const npmFetch = require('npm-registry-fetch')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Logout extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -22,11 +22,7 @@ class Logout extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.logout(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async logout (args) {
|
||||
async exec (args) {
|
||||
const registry = this.npm.config.get('registry')
|
||||
const scope = this.npm.config.get('scope')
|
||||
const regRef = scope ? `${scope}:registry` : 'registry'
|
||||
+3
-7
@@ -8,7 +8,7 @@ const Arborist = require('@npmcli/arborist')
|
||||
const { breadth } = require('treeverse')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
const completion = require('./utils/completion/installed-deep.js')
|
||||
const completion = require('../utils/completion/installed-deep.js')
|
||||
|
||||
const _depth = Symbol('depth')
|
||||
const _dedupe = Symbol('dedupe')
|
||||
@@ -21,7 +21,7 @@ const _parent = Symbol('parent')
|
||||
const _problems = Symbol('problems')
|
||||
const _required = Symbol('required')
|
||||
const _type = Symbol('type')
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
|
||||
class LS extends ArboristWorkspaceCmd {
|
||||
@@ -62,11 +62,7 @@ class LS extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.ls(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async ls (args) {
|
||||
async exec (args) {
|
||||
const all = this.npm.config.get('all')
|
||||
const color = this.npm.color
|
||||
const depth = this.npm.config.get('depth')
|
||||
+4
-13
@@ -1,7 +1,7 @@
|
||||
const liborg = require('libnpmorg')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const Table = require('cli-table3')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Org extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -48,16 +48,7 @@ class Org extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.org(args)
|
||||
.then(x => cb(null, x))
|
||||
.catch(err => err.code === 'EUSAGE'
|
||||
? cb(err.message)
|
||||
: cb(err)
|
||||
)
|
||||
}
|
||||
|
||||
async org ([cmd, orgname, username, role], cb) {
|
||||
async exec ([cmd, orgname, username, role], cb) {
|
||||
return otplease(this.npm.flatOptions, opts => {
|
||||
switch (cmd) {
|
||||
case 'add':
|
||||
@@ -68,7 +59,7 @@ class Org extends BaseCommand {
|
||||
case 'ls':
|
||||
return this.ls(orgname, username, opts)
|
||||
default:
|
||||
throw Object.assign(new Error(this.usage), { code: 'EUSAGE' })
|
||||
throw this.usageError()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -10,8 +10,8 @@ const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
|
||||
const ansiTrim = require('./utils/ansi-trim.js')
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ansiTrim = require('../utils/ansi-trim.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
|
||||
class Outdated extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -41,11 +41,7 @@ class Outdated extends ArboristWorkspaceCmd {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.outdated(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async outdated (args) {
|
||||
async exec (args) {
|
||||
const global = path.resolve(this.npm.globalDir, '..')
|
||||
const where = this.npm.config.get('global')
|
||||
? global
|
||||
+4
-8
@@ -3,9 +3,9 @@ const npa = require('npm-package-arg')
|
||||
const npmFetch = require('npm-registry-fetch')
|
||||
const pacote = require('pacote')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const readLocalPkgName = require('./utils/read-package-name.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const readLocalPkgName = require('../utils/read-package-name.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Owner extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -64,11 +64,7 @@ class Owner extends BaseCommand {
|
||||
return []
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.owner(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async owner ([action, ...args]) {
|
||||
async exec ([action, ...args]) {
|
||||
const opts = this.npm.flatOptions
|
||||
switch (action) {
|
||||
case 'ls':
|
||||
+6
-14
@@ -5,11 +5,11 @@ const libpack = require('libnpmpack')
|
||||
const npa = require('npm-package-arg')
|
||||
const path = require('path')
|
||||
|
||||
const { getContents, logTar } = require('./utils/tar.js')
|
||||
const { getContents, logTar } = require('../utils/tar.js')
|
||||
|
||||
const writeFile = util.promisify(require('fs').writeFile)
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Pack extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -39,15 +39,7 @@ class Pack extends BaseCommand {
|
||||
return ['[[<@scope>/]<pkg>...]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.pack(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.packWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async pack (args) {
|
||||
async exec (args) {
|
||||
if (args.length === 0)
|
||||
args = ['.']
|
||||
|
||||
@@ -94,7 +86,7 @@ class Pack extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
async packWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
// If they either ask for nothing, or explicitly include '.' in the args,
|
||||
// we effectively translate that into each workspace requested
|
||||
|
||||
@@ -102,11 +94,11 @@ class Pack extends BaseCommand {
|
||||
|
||||
if (!useWorkspaces) {
|
||||
this.npm.log.warn('Ignoring workspaces for specified package(s)')
|
||||
return this.pack(args)
|
||||
return this.exec(args)
|
||||
}
|
||||
|
||||
await this.setWorkspaces(filters)
|
||||
return this.pack([...this.workspacePaths, ...args.filter(a => a !== '.')])
|
||||
return this.exec([...this.workspacePaths, ...args.filter(a => a !== '.')])
|
||||
}
|
||||
}
|
||||
module.exports = Pack
|
||||
+3
-7
@@ -1,6 +1,6 @@
|
||||
const log = require('npmlog')
|
||||
const pingUtil = require('./utils/ping.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const pingUtil = require('../utils/ping.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Ping extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -18,11 +18,7 @@ class Ping extends BaseCommand {
|
||||
return 'ping'
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.ping(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async ping (args) {
|
||||
async exec (args) {
|
||||
log.notice('PING', this.npm.config.get('registry'))
|
||||
const start = Date.now()
|
||||
const details = await pingUtil(this.npm.flatOptions)
|
||||
+11
-21
@@ -1,6 +1,6 @@
|
||||
const PackageJson = require('@npmcli/package-json')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const Queryable = require('./utils/queryable.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
const Queryable = require('../utils/queryable.js')
|
||||
|
||||
class Pkg extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -31,16 +31,12 @@ class Pkg extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.prefix = this.npm.localPrefix
|
||||
this.pkg(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
async exec (args, { prefix } = {}) {
|
||||
if (!prefix)
|
||||
this.prefix = this.npm.localPrefix
|
||||
else
|
||||
this.prefix = prefix
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.pkgWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async pkg (args) {
|
||||
if (this.npm.config.get('global')) {
|
||||
throw Object.assign(
|
||||
new Error(`There's no package.json file to manage on global mode`),
|
||||
@@ -61,12 +57,12 @@ class Pkg extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
async pkgWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
const result = {}
|
||||
for (const [workspaceName, workspacePath] of this.workspaces.entries()) {
|
||||
this.prefix = workspacePath
|
||||
result[workspaceName] = await this.pkg(args)
|
||||
result[workspaceName] = await this.exec(args, { prefix: workspacePath })
|
||||
}
|
||||
// when running in workspaces names, make sure to key by workspace
|
||||
// name the results of each value retrieved in each ws
|
||||
@@ -100,10 +96,7 @@ class Pkg extends BaseCommand {
|
||||
|
||||
async set (args) {
|
||||
const setError = () =>
|
||||
Object.assign(
|
||||
new TypeError('npm pkg set expects a key=value pair of args.'),
|
||||
{ code: 'EPKGSET' }
|
||||
)
|
||||
this.usageError('npm pkg set expects a key=value pair of args.')
|
||||
|
||||
if (!args.length)
|
||||
throw setError()
|
||||
@@ -127,10 +120,7 @@ class Pkg extends BaseCommand {
|
||||
|
||||
async delete (args) {
|
||||
const setError = () =>
|
||||
Object.assign(
|
||||
new TypeError('npm pkg delete expects key args.'),
|
||||
{ code: 'EPKGDELETE' }
|
||||
)
|
||||
this.usageError('npm pkg delete expects key args.')
|
||||
|
||||
if (!args.length)
|
||||
throw setError()
|
||||
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Prefix extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
@@ -21,11 +21,7 @@ class Prefix extends BaseCommand {
|
||||
return ['[-g]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.prefix(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async prefix (args) {
|
||||
async exec (args) {
|
||||
return this.npm.output(this.npm.prefix)
|
||||
}
|
||||
}
|
||||
+6
-10
@@ -6,9 +6,9 @@ const npmProfile = require('npm-profile')
|
||||
const qrcodeTerminal = require('qrcode-terminal')
|
||||
const Table = require('cli-table3')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const pulseTillDone = require('./utils/pulse-till-done.js')
|
||||
const readUserInfo = require('./utils/read-user-info.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const pulseTillDone = require('../utils/pulse-till-done.js')
|
||||
const readUserInfo = require('../utils/read-user-info.js')
|
||||
|
||||
const qrcode = url =>
|
||||
new Promise((resolve) => qrcodeTerminal.generate(url, resolve))
|
||||
@@ -36,7 +36,7 @@ const writableProfileKeys = [
|
||||
'github',
|
||||
]
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Profile extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Change settings on your registry profile'
|
||||
@@ -88,13 +88,9 @@ class Profile extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.profile(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async profile (args) {
|
||||
async exec (args) {
|
||||
if (args.length === 0)
|
||||
throw new Error(this.usage)
|
||||
throw this.usageError()
|
||||
|
||||
log.gauge.show('profile')
|
||||
|
||||
+3
-7
@@ -1,8 +1,8 @@
|
||||
// prune extraneous packages
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Prune extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -24,11 +24,7 @@ class Prune extends ArboristWorkspaceCmd {
|
||||
return ['[[<@scope>/]<pkg>...]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.prune().then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async prune () {
|
||||
async exec () {
|
||||
const where = this.npm.prefix
|
||||
const opts = {
|
||||
...this.npm.flatOptions,
|
||||
+8
-16
@@ -8,23 +8,23 @@ const pacote = require('pacote')
|
||||
const npa = require('npm-package-arg')
|
||||
const npmFetch = require('npm-registry-fetch')
|
||||
const chalk = require('chalk')
|
||||
const replaceInfo = require('./utils/replace-info.js')
|
||||
const replaceInfo = require('../utils/replace-info.js')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const { getContents, logTar } = require('./utils/tar.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const { getContents, logTar } = require('../utils/tar.js')
|
||||
|
||||
// for historical reasons, publishConfig in package.json can contain ANY config
|
||||
// keys that npm supports in .npmrc files and elsewhere. We *may* want to
|
||||
// revisit this at some point, and have a minimal set that's a SemVer-major
|
||||
// change that ought to get a RFC written on it.
|
||||
const flatten = require('./utils/config/flatten.js')
|
||||
const flatten = require('../utils/config/flatten.js')
|
||||
|
||||
// this is the only case in the CLI where we want to use the old full slow
|
||||
// 'read-package-json' module, because we want to pull in all the defaults and
|
||||
// metadata, like git sha's and default scripts and all that.
|
||||
const readJson = util.promisify(require('read-package-json'))
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Publish extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Publish a package'
|
||||
@@ -55,15 +55,7 @@ class Publish extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.publish(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.publishWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async publish (args) {
|
||||
async exec (args) {
|
||||
if (args.length === 0)
|
||||
args = ['.']
|
||||
if (args.length !== 1)
|
||||
@@ -157,7 +149,7 @@ class Publish extends BaseCommand {
|
||||
return pkgContents
|
||||
}
|
||||
|
||||
async publishWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
// Suppresses JSON output in publish() so we can handle it here
|
||||
this.suppressOutput = true
|
||||
|
||||
@@ -171,7 +163,7 @@ class Publish extends BaseCommand {
|
||||
for (const [name, workspace] of this.workspaces.entries()) {
|
||||
let pkgContents
|
||||
try {
|
||||
pkgContents = await this.publish([workspace])
|
||||
pkgContents = await this.exec([workspace])
|
||||
} catch (err) {
|
||||
if (err.code === 'EPRIVATE') {
|
||||
log.warn(
|
||||
@@ -2,9 +2,9 @@ const { resolve } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const npa = require('npm-package-arg')
|
||||
const semver = require('semver')
|
||||
const completion = require('./utils/completion/installed-deep.js')
|
||||
const completion = require('../utils/completion/installed-deep.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Rebuild extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -36,11 +36,7 @@ class Rebuild extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.rebuild(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async rebuild (args) {
|
||||
async exec (args) {
|
||||
const globalTop = resolve(this.npm.globalDir, '..')
|
||||
const where = this.npm.config.get('global') ? globalTop : this.npm.prefix
|
||||
const arb = new Arborist({
|
||||
+6
-14
@@ -2,10 +2,10 @@ const log = require('npmlog')
|
||||
const pacote = require('pacote')
|
||||
const { URL } = require('url')
|
||||
|
||||
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
|
||||
const openUrl = require('./utils/open-url.js')
|
||||
const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
|
||||
const openUrl = require('../utils/open-url.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Repo extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -27,24 +27,16 @@ class Repo extends BaseCommand {
|
||||
return ['[<pkgname> [<pkgname> ...]]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.repo(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.repoWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async repo (args) {
|
||||
async exec (args) {
|
||||
if (!args || !args.length)
|
||||
args = ['.']
|
||||
|
||||
await Promise.all(args.map(pkg => this.get(pkg)))
|
||||
}
|
||||
|
||||
async repoWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
return this.repo(this.workspacePaths)
|
||||
return this.exec(this.workspacePaths)
|
||||
}
|
||||
|
||||
async get (pkg) {
|
||||
@@ -1,4 +1,4 @@
|
||||
const LifecycleCmd = require('./utils/lifecycle-cmd.js')
|
||||
const LifecycleCmd = require('../lifecycle-cmd.js')
|
||||
|
||||
// This ends up calling run-script(['restart', ...args])
|
||||
class Restart extends LifecycleCmd {
|
||||
+2
-6
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Root extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -15,11 +15,7 @@ class Root extends BaseCommand {
|
||||
return ['global']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.root(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async root () {
|
||||
async exec () {
|
||||
this.npm.output(this.npm.dir)
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ const runScript = require('@npmcli/run-script')
|
||||
const { isServerPackage } = runScript
|
||||
const rpj = require('read-package-json-fast')
|
||||
const log = require('npmlog')
|
||||
const didYouMean = require('./utils/did-you-mean.js')
|
||||
const isWindowsShell = require('./utils/is-windows-shell.js')
|
||||
const didYouMean = require('../utils/did-you-mean.js')
|
||||
const isWindowsShell = require('../utils/is-windows-shell.js')
|
||||
|
||||
const cmdList = [
|
||||
'publish',
|
||||
@@ -26,7 +26,7 @@ const nocolor = {
|
||||
green: s => s,
|
||||
}
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class RunScript extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -65,18 +65,18 @@ class RunScript extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
async exec (args) {
|
||||
if (args.length)
|
||||
this.run(args).then(() => cb()).catch(cb)
|
||||
return this.run(args)
|
||||
else
|
||||
this.list(args).then(() => cb()).catch(cb)
|
||||
return this.list(args)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
async execWorkspaces (args, filters) {
|
||||
if (args.length)
|
||||
this.runWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
return this.runWorkspaces(args, filters)
|
||||
else
|
||||
this.listWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
return this.listWorkspaces(args, filters)
|
||||
}
|
||||
|
||||
async run ([event, ...args], { path = this.npm.localPrefix, pkg } = {}) {
|
||||
@@ -3,8 +3,8 @@ const Pipeline = require('minipass-pipeline')
|
||||
const libSearch = require('libnpmsearch')
|
||||
const log = require('npmlog')
|
||||
|
||||
const formatPackageStream = require('./search/format-package-stream.js')
|
||||
const packageFilter = require('./search/package-filter.js')
|
||||
const formatPackageStream = require('../search/format-package-stream.js')
|
||||
const packageFilter = require('../search/package-filter.js')
|
||||
|
||||
function prepareIncludes (args) {
|
||||
return args
|
||||
@@ -24,7 +24,7 @@ function prepareExcludes (searchexclude) {
|
||||
.filter(s => s)
|
||||
}
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Search extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -58,11 +58,7 @@ class Search extends BaseCommand {
|
||||
return ['[search terms ...]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.search(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async search (args) {
|
||||
async exec (args) {
|
||||
const opts = {
|
||||
...this.npm.flatOptions,
|
||||
...this.npm.flatOptions.search,
|
||||
@@ -3,7 +3,7 @@ const log = require('npmlog')
|
||||
const rpj = require('read-package-json-fast')
|
||||
const PackageJson = require('@npmcli/package-json')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class SetScript extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -44,22 +44,14 @@ class SetScript extends BaseCommand {
|
||||
throw new Error(`Expected 2 arguments: got ${args.length}`)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.setScript(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async setScript (args) {
|
||||
async exec (args) {
|
||||
this.validate(args)
|
||||
const warn = await this.doSetScript(this.npm.localPrefix, args[0], args[1])
|
||||
if (warn)
|
||||
log.warn('set-script', `Script "${args[0]}" was overwritten`)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.setScriptWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async setScriptWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
this.validate(args)
|
||||
await this.setWorkspaces(filters)
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Set extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -17,13 +17,13 @@ class Set extends BaseCommand {
|
||||
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
async completion (opts) {
|
||||
return this.npm.commands.config.completion(opts)
|
||||
return this.npm.cmd('config').completion(opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
async exec (args) {
|
||||
if (!args.length)
|
||||
return cb(this.usageError())
|
||||
this.npm.commands.config(['set'].concat(args), cb)
|
||||
throw this.usageError()
|
||||
return this.npm.exec('config', ['set'].concat(args))
|
||||
}
|
||||
}
|
||||
module.exports = Set
|
||||
@@ -1,11 +1,9 @@
|
||||
const { resolve, basename } = require('path')
|
||||
const util = require('util')
|
||||
const fs = require('fs')
|
||||
const { unlink } = fs.promises || { unlink: util.promisify(fs.unlink) }
|
||||
const { unlink } = require('fs').promises
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const log = require('npmlog')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Shrinkwrap extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -17,15 +15,10 @@ class Shrinkwrap extends BaseCommand {
|
||||
return 'shrinkwrap'
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.shrinkwrap().then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async shrinkwrap () {
|
||||
async exec () {
|
||||
// if has a npm-shrinkwrap.json, nothing to do
|
||||
// if has a package-lock.json, rename to npm-shrinkwrap.json
|
||||
// if has neither, load the actual tree and save that as npm-shrinkwrap.json
|
||||
// in all cases, re-cast to current lockfile version
|
||||
//
|
||||
// loadVirtual, fall back to loadActual
|
||||
// rename shrinkwrap file type, and tree.meta.save()
|
||||
@@ -44,17 +37,37 @@ class Shrinkwrap extends BaseCommand {
|
||||
const oldFilename = meta.filename
|
||||
const notSW = !newFile && basename(oldFilename) !== 'npm-shrinkwrap.json'
|
||||
|
||||
// The computed lockfile version of a hidden lockfile is always 3
|
||||
// even if the actual value of the property is a different.
|
||||
// When shrinkwrap is run with only a hidden lockfile we want to
|
||||
// set the shrinkwrap lockfile version as whatever was explicitly
|
||||
// requested with a fallback to the actual value from the hidden
|
||||
// lockfile.
|
||||
if (meta.hiddenLockfile) {
|
||||
meta.lockfileVersion = arb.options.lockfileVersion ||
|
||||
meta.originalLockfileVersion
|
||||
}
|
||||
meta.hiddenLockfile = false
|
||||
meta.filename = sw
|
||||
await meta.save()
|
||||
|
||||
if (newFile)
|
||||
log.notice('', 'created a lockfile as npm-shrinkwrap.json')
|
||||
else if (notSW) {
|
||||
const updatedVersion = meta.originalLockfileVersion !== meta.lockfileVersion
|
||||
? meta.lockfileVersion
|
||||
: null
|
||||
|
||||
if (newFile) {
|
||||
let message = 'created a lockfile as npm-shrinkwrap.json'
|
||||
if (updatedVersion)
|
||||
message += ` with version ${updatedVersion}`
|
||||
log.notice('', message)
|
||||
} else if (notSW) {
|
||||
await unlink(oldFilename)
|
||||
log.notice('', 'package-lock.json has been renamed to npm-shrinkwrap.json')
|
||||
} else if (meta.originalLockfileVersion !== this.npm.lockfileVersion)
|
||||
log.notice('', `npm-shrinkwrap.json updated to version ${this.npm.lockfileVersion}`)
|
||||
let message = 'package-lock.json has been renamed to npm-shrinkwrap.json'
|
||||
if (updatedVersion)
|
||||
message += ` and updated to version ${updatedVersion}`
|
||||
log.notice('', message)
|
||||
} else if (updatedVersion)
|
||||
log.notice('', `npm-shrinkwrap.json updated to version ${updatedVersion}`)
|
||||
else
|
||||
log.notice('', 'npm-shrinkwrap.json up to date')
|
||||
}
|
||||
+4
-8
@@ -2,9 +2,9 @@ const fetch = require('npm-registry-fetch')
|
||||
const log = require('npmlog')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
const getIdentity = require('./utils/get-identity')
|
||||
const getIdentity = require('../utils/get-identity')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Star extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Mark your favorite packages'
|
||||
@@ -28,13 +28,9 @@ class Star extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.star(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async star (args) {
|
||||
async exec (args) {
|
||||
if (!args.length)
|
||||
throw new Error(this.usage)
|
||||
throw this.usageError()
|
||||
|
||||
// if we're unstarring, then show an empty star image
|
||||
// otherwise, show the full star image
|
||||
+20
-23
@@ -1,9 +1,9 @@
|
||||
const log = require('npmlog')
|
||||
const fetch = require('npm-registry-fetch')
|
||||
|
||||
const getIdentity = require('./utils/get-identity.js')
|
||||
const getIdentity = require('../utils/get-identity.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Stars extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -27,28 +27,25 @@ class Stars extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.stars(args).then(() => cb()).catch(er => {
|
||||
if (er.code === 'ENEEDAUTH')
|
||||
async exec ([user]) {
|
||||
try {
|
||||
if (!user)
|
||||
user = await getIdentity(this.npm, this.npm.flatOptions)
|
||||
|
||||
const { rows } = await fetch.json('/-/_view/starredByUser', {
|
||||
...this.npm.flatOptions,
|
||||
query: { key: `"${user}"` },
|
||||
})
|
||||
if (rows.length === 0)
|
||||
log.warn('stars', 'user has not starred any packages')
|
||||
|
||||
for (const row of rows)
|
||||
this.npm.output(row.value)
|
||||
} catch (err) {
|
||||
if (err.code === 'ENEEDAUTH')
|
||||
log.warn('stars', 'auth is required to look up your username')
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
|
||||
async stars ([user]) {
|
||||
if (!user)
|
||||
user = await getIdentity(this.npm, this.npm.flatOptions)
|
||||
|
||||
const { rows } = await fetch.json('/-/_view/starredByUser', {
|
||||
...this.npm.flatOptions,
|
||||
query: { key: `"${user}"` },
|
||||
})
|
||||
|
||||
if (rows.length === 0)
|
||||
log.warn('stars', 'user has not starred any packages')
|
||||
|
||||
for (const row of rows)
|
||||
this.npm.output(row.value)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = Stars
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const LifecycleCmd = require('./utils/lifecycle-cmd.js')
|
||||
const LifecycleCmd = require('../lifecycle-cmd.js')
|
||||
|
||||
// This ends up calling run-script(['start', ...args])
|
||||
class Start extends LifecycleCmd {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const LifecycleCmd = require('./utils/lifecycle-cmd.js')
|
||||
const LifecycleCmd = require('../lifecycle-cmd.js')
|
||||
|
||||
// This ends up calling run-script(['stop', ...args])
|
||||
class Stop extends LifecycleCmd {
|
||||
+4
-8
@@ -1,9 +1,9 @@
|
||||
const columns = require('cli-columns')
|
||||
const libteam = require('libnpmteam')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Team extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Manage organization teams and team memberships'
|
||||
@@ -48,11 +48,7 @@ class Team extends BaseCommand {
|
||||
throw new Error(argv[2] + ' not recognized')
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.team(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async team ([cmd, entity = '', user = '']) {
|
||||
async exec ([cmd, entity = '', user = '']) {
|
||||
// Entities are in the format <scope>:<team>
|
||||
// XXX: "description" option to libnpmteam is used as a description of the
|
||||
// team, but in npm's options, this is a boolean meaning "show the
|
||||
@@ -72,7 +68,7 @@ class Team extends BaseCommand {
|
||||
return this.listTeams(entity, opts)
|
||||
}
|
||||
default:
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
}
|
||||
})
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const LifecycleCmd = require('./utils/lifecycle-cmd.js')
|
||||
const LifecycleCmd = require('../lifecycle-cmd.js')
|
||||
|
||||
// This ends up calling run-script(['test', ...args])
|
||||
class Test extends LifecycleCmd {
|
||||
+5
-9
@@ -4,11 +4,11 @@ const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
|
||||
const log = require('npmlog')
|
||||
const profile = require('npm-profile')
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const pulseTillDone = require('./utils/pulse-till-done.js')
|
||||
const readUserInfo = require('./utils/read-user-info.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const pulseTillDone = require('../utils/pulse-till-done.js')
|
||||
const readUserInfo = require('../utils/read-user-info.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Token extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Manage your authentication tokens'
|
||||
@@ -50,11 +50,7 @@ class Token extends BaseCommand {
|
||||
throw new Error(argv[2] + ' not recognized')
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.token(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async token (args, cb) {
|
||||
async exec (args, cb) {
|
||||
log.gauge.show('token')
|
||||
if (args.length === 0)
|
||||
return this.list()
|
||||
@@ -2,10 +2,10 @@ const { resolve } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const rpj = require('read-package-json-fast')
|
||||
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const completion = require('./utils/completion/installed-shallow.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
const completion = require('../utils/completion/installed-shallow.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Uninstall extends ArboristWorkspaceCmd {
|
||||
static get description () {
|
||||
return 'Remove a package'
|
||||
@@ -31,11 +31,7 @@ class Uninstall extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.uninstall(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async uninstall (args) {
|
||||
async exec (args) {
|
||||
// the /path/to/node_modules/..
|
||||
const global = this.npm.config.get('global')
|
||||
const path = global
|
||||
@@ -54,7 +50,7 @@ class Uninstall extends ArboristWorkspaceCmd {
|
||||
if (er.code !== 'ENOENT' && er.code !== 'ENOTDIR')
|
||||
throw er
|
||||
else
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
}
|
||||
|
||||
args.push(pkg.name)
|
||||
@@ -6,10 +6,10 @@ const npmFetch = require('npm-registry-fetch')
|
||||
const libunpub = require('libnpmpublish').unpublish
|
||||
const readJson = util.promisify(require('read-package-json'))
|
||||
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const getIdentity = require('./utils/get-identity.js')
|
||||
const otplease = require('../utils/otplease.js')
|
||||
const getIdentity = require('../utils/get-identity.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Unpublish extends BaseCommand {
|
||||
static get description () {
|
||||
return 'Remove a package from the registry'
|
||||
@@ -62,15 +62,7 @@ class Unpublish extends BaseCommand {
|
||||
return versions.map(v => `${pkgs[0]}@${v}`)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.unpublish(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.unpublishWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async unpublish (args) {
|
||||
async exec (args) {
|
||||
if (args.length > 1)
|
||||
throw this.usageError()
|
||||
|
||||
@@ -127,7 +119,7 @@ class Unpublish extends BaseCommand {
|
||||
this.npm.output(`- ${pkgName}${pkgVersion}`)
|
||||
}
|
||||
|
||||
async unpublishWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
await this.setWorkspaces(filters)
|
||||
|
||||
const force = this.npm.config.get('force')
|
||||
@@ -139,7 +131,7 @@ class Unpublish extends BaseCommand {
|
||||
}
|
||||
|
||||
for (const name of this.workspaceNames)
|
||||
await this.unpublish([name])
|
||||
await this.exec([name])
|
||||
}
|
||||
}
|
||||
module.exports = Unpublish
|
||||
@@ -20,9 +20,9 @@ class Unstar extends Star {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
async exec (args) {
|
||||
this.npm.config.set('star.unstar', true)
|
||||
super.exec(args, cb)
|
||||
return super.exec(args)
|
||||
}
|
||||
}
|
||||
module.exports = Unstar
|
||||
@@ -3,10 +3,10 @@ const path = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const log = require('npmlog')
|
||||
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const completion = require('./utils/completion/installed-deep.js')
|
||||
const reifyFinish = require('../utils/reify-finish.js')
|
||||
const completion = require('../utils/completion/installed-deep.js')
|
||||
|
||||
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
|
||||
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
|
||||
class Update extends ArboristWorkspaceCmd {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -46,11 +46,7 @@ class Update extends ArboristWorkspaceCmd {
|
||||
return completion(this.npm, opts)
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.update(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async update (args) {
|
||||
async exec (args) {
|
||||
const update = args.length === 0 ? true : args
|
||||
const global = path.resolve(this.npm.globalDir, '..')
|
||||
const where = this.npm.config.get('global')
|
||||
+5
-13
@@ -3,7 +3,7 @@ const { resolve } = require('path')
|
||||
const { promisify } = require('util')
|
||||
const readFile = promisify(require('fs').readFile)
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
|
||||
class Version extends BaseCommand {
|
||||
static get description () {
|
||||
@@ -52,33 +52,25 @@ class Version extends BaseCommand {
|
||||
]
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
return this.version(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.versionWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async version (args) {
|
||||
async exec (args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
return this.list()
|
||||
case 1:
|
||||
return this.change(args)
|
||||
default:
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
}
|
||||
}
|
||||
|
||||
async versionWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
return this.listWorkspaces(filters)
|
||||
case 1:
|
||||
return this.changeWorkspaces(args, filters)
|
||||
default:
|
||||
throw this.usage
|
||||
throw this.usageError()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-14
@@ -7,7 +7,7 @@ const jsonParse = require('json-parse-even-better-errors')
|
||||
const log = require('npmlog')
|
||||
const npa = require('npm-package-arg')
|
||||
const { resolve } = require('path')
|
||||
const formatBytes = require('./utils/format-bytes.js')
|
||||
const formatBytes = require('../utils/format-bytes.js')
|
||||
const relativeDate = require('tiny-relative-date')
|
||||
const semver = require('semver')
|
||||
const style = require('ansistyles')
|
||||
@@ -17,8 +17,8 @@ const { packument } = require('pacote')
|
||||
const readFile = promisify(fs.readFile)
|
||||
const readJson = async file => jsonParse(await readFile(file, 'utf8'))
|
||||
|
||||
const Queryable = require('./utils/queryable.js')
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const Queryable = require('../utils/queryable.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class View extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -92,15 +92,7 @@ class View extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.view(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.viewWorkspaces(args, filters).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async view (args) {
|
||||
async exec (args) {
|
||||
if (!args.length)
|
||||
args = ['.']
|
||||
let pkg = args.shift()
|
||||
@@ -144,7 +136,7 @@ class View extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
async viewWorkspaces (args, filters) {
|
||||
async execWorkspaces (args, filters) {
|
||||
if (!args.length)
|
||||
args = ['.']
|
||||
|
||||
@@ -153,7 +145,7 @@ class View extends BaseCommand {
|
||||
const local = /^\.@/.test(pkg) || pkg === '.'
|
||||
if (!local) {
|
||||
this.npm.log.warn('Ignoring workspaces for specified package(s)')
|
||||
return this.view([pkg, ...args])
|
||||
return this.exec([pkg, ...args])
|
||||
}
|
||||
let wholePackument = false
|
||||
if (!args.length) {
|
||||
@@ -1,6 +1,6 @@
|
||||
const getIdentity = require('./utils/get-identity.js')
|
||||
const getIdentity = require('../utils/get-identity.js')
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class Whoami extends BaseCommand {
|
||||
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
||||
static get description () {
|
||||
@@ -17,11 +17,7 @@ class Whoami extends BaseCommand {
|
||||
return ['registry']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.whoami(args).then(() => cb()).catch(cb)
|
||||
}
|
||||
|
||||
async whoami (args) {
|
||||
async exec (args) {
|
||||
const username = await getIdentity(this.npm, this.npm.flatOptions)
|
||||
this.npm.output(
|
||||
this.npm.config.get('json') ? JSON.stringify(username) : username
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// The implementation of commands that are just "run a script"
|
||||
// restart, start, stop, test
|
||||
|
||||
const BaseCommand = require('./base-command.js')
|
||||
class LifecycleCmd extends BaseCommand {
|
||||
static get usage () {
|
||||
return ['[-- <args>]']
|
||||
}
|
||||
|
||||
async exec (args, cb) {
|
||||
return this.npm.exec('run-script', [this.constructor.name, ...args])
|
||||
}
|
||||
|
||||
async execWorkspaces (args, filters, cb) {
|
||||
return this.npm.exec('run-script', [this.constructor.name, ...args])
|
||||
}
|
||||
}
|
||||
module.exports = LifecycleCmd
|
||||
Vendored
+45
-68
@@ -9,29 +9,6 @@ require('graceful-fs').gracefulify(require('fs'))
|
||||
// TODO make this only ever load once (or unload) in tests
|
||||
const procLogListener = require('./utils/proc-log-listener.js')
|
||||
|
||||
const proxyCmds = new Proxy({}, {
|
||||
get: (target, cmd) => {
|
||||
const actual = deref(cmd)
|
||||
if (actual && !Reflect.has(target, actual)) {
|
||||
const Impl = require(`./${actual}.js`)
|
||||
const impl = new Impl(npm)
|
||||
// Our existing npm.commands[x] act like a function with attributes, but
|
||||
// our modules have non-inumerable attributes so we can't just assign
|
||||
// them to an anonymous function like we used to. This acts like that
|
||||
// old way of doing things, until we can make breaking changes to the
|
||||
// npm.commands[x] api
|
||||
target[actual] = new Proxy(
|
||||
(args, cb) => npm[_runCmd](actual, impl, args, cb),
|
||||
{
|
||||
get: (target, attr, receiver) => {
|
||||
return Reflect.get(impl, attr, receiver)
|
||||
},
|
||||
})
|
||||
}
|
||||
return target[actual]
|
||||
},
|
||||
})
|
||||
|
||||
// Timers in progress
|
||||
const timers = new Map()
|
||||
// Finished timers
|
||||
@@ -63,23 +40,26 @@ const cleanUpLogFiles = require('./utils/cleanup-log-files.js')
|
||||
const getProjectScope = require('./utils/get-project-scope.js')
|
||||
|
||||
let warnedNonDashArg = false
|
||||
const _runCmd = Symbol('_runCmd')
|
||||
const _load = Symbol('_load')
|
||||
const _tmpFolder = Symbol('_tmpFolder')
|
||||
const _title = Symbol('_title')
|
||||
const pkg = require('../package.json')
|
||||
|
||||
class Npm extends EventEmitter {
|
||||
static get version () {
|
||||
return pkg.version
|
||||
}
|
||||
|
||||
const npm = module.exports = new class extends EventEmitter {
|
||||
constructor () {
|
||||
super()
|
||||
this.started = Date.now()
|
||||
this.command = null
|
||||
this.commands = proxyCmds
|
||||
this.timings = timings
|
||||
this.timers = timers
|
||||
this.perfStart()
|
||||
process.on('time', processOnTimeHandler)
|
||||
process.on('timeEnd', processOnTimeEndHandler)
|
||||
procLogListener()
|
||||
process.emit('time', 'npm')
|
||||
this.version = require('../package.json').version
|
||||
this.config = new Config({
|
||||
npmPath: dirname(__dirname),
|
||||
definitions,
|
||||
@@ -90,14 +70,8 @@ const npm = module.exports = new class extends EventEmitter {
|
||||
this.updateNotification = null
|
||||
}
|
||||
|
||||
perfStart () {
|
||||
process.on('time', processOnTimeHandler)
|
||||
process.on('timeEnd', processOnTimeEndHandler)
|
||||
}
|
||||
|
||||
perfStop () {
|
||||
process.off('time', processOnTimeHandler)
|
||||
process.off('timeEnd', processOnTimeEndHandler)
|
||||
get version () {
|
||||
return this.constructor.version
|
||||
}
|
||||
|
||||
get shelloutCommands () {
|
||||
@@ -108,21 +82,32 @@ const npm = module.exports = new class extends EventEmitter {
|
||||
return deref(c)
|
||||
}
|
||||
|
||||
// this will only ever be called with cmd set to the canonical command name
|
||||
[_runCmd] (cmd, impl, args, cb) {
|
||||
if (!this.loaded) {
|
||||
throw new Error(
|
||||
'Call npm.load() before using this command.\n' +
|
||||
'See lib/cli.js for example usage.'
|
||||
)
|
||||
// Get an instantiated npm command
|
||||
// npm.command is already taken as the currently running command, a refactor
|
||||
// would be needed to change this
|
||||
async cmd (cmd) {
|
||||
await this.load()
|
||||
const command = this.deref(cmd)
|
||||
if (!command) {
|
||||
throw Object.assign(new Error(`Unknown command ${cmd}`), {
|
||||
code: 'EUNKNOWNCOMMAND',
|
||||
})
|
||||
}
|
||||
const Impl = require(`./commands/${command}.js`)
|
||||
const impl = new Impl(this)
|
||||
return impl
|
||||
}
|
||||
|
||||
// Call an npm command
|
||||
async exec (cmd, args) {
|
||||
const command = await this.cmd(cmd)
|
||||
process.emit('time', `command:${cmd}`)
|
||||
|
||||
// since 'test', 'start', 'stop', etc. commands re-enter this function
|
||||
// to call the run-script command, we need to only set it one time.
|
||||
if (!this.command) {
|
||||
process.env.npm_command = cmd
|
||||
this.command = cmd
|
||||
process.env.npm_command = command.name
|
||||
this.command = command.name
|
||||
}
|
||||
|
||||
// Options are prefixed by a hyphen-minus (-, \u2d).
|
||||
@@ -138,42 +123,38 @@ const npm = module.exports = new class extends EventEmitter {
|
||||
const workspacesEnabled = this.config.get('workspaces')
|
||||
const workspacesFilters = this.config.get('workspace')
|
||||
if (workspacesEnabled === false && workspacesFilters.length > 0)
|
||||
return cb(new Error('Can not use --no-workspaces and --workspace at the same time'))
|
||||
throw new Error('Can not use --no-workspaces and --workspace at the same time')
|
||||
|
||||
const filterByWorkspaces = workspacesEnabled || workspacesFilters.length > 0
|
||||
// normally this would go in the constructor, but our tests don't
|
||||
// actually use a real npm object so this.npm.config isn't always
|
||||
// populated. this is the compromise until we can make that a reality
|
||||
// and then move this into the constructor.
|
||||
impl.workspaces = this.config.get('workspaces')
|
||||
impl.workspacePaths = null
|
||||
command.workspaces = this.config.get('workspaces')
|
||||
command.workspacePaths = null
|
||||
// normally this would be evaluated in base-command#setWorkspaces, see
|
||||
// above for explanation
|
||||
impl.includeWorkspaceRoot = this.config.get('include-workspace-root')
|
||||
command.includeWorkspaceRoot = this.config.get('include-workspace-root')
|
||||
|
||||
if (this.config.get('usage')) {
|
||||
this.output(impl.usage)
|
||||
cb()
|
||||
} else if (filterByWorkspaces) {
|
||||
this.output(command.usage)
|
||||
return
|
||||
}
|
||||
if (filterByWorkspaces) {
|
||||
if (this.config.get('global'))
|
||||
return cb(new Error('Workspaces not supported for global packages'))
|
||||
throw new Error('Workspaces not supported for global packages')
|
||||
|
||||
impl.execWorkspaces(args, this.config.get('workspace'), er => {
|
||||
return command.execWorkspaces(args, this.config.get('workspace')).finally(() => {
|
||||
process.emit('timeEnd', `command:${cmd}`)
|
||||
cb(er)
|
||||
})
|
||||
} else {
|
||||
impl.exec(args, er => {
|
||||
return command.exec(args).finally(() => {
|
||||
process.emit('timeEnd', `command:${cmd}`)
|
||||
cb(er)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
load (cb) {
|
||||
if (cb && typeof cb !== 'function')
|
||||
throw new TypeError('callback must be a function if provided')
|
||||
|
||||
async load () {
|
||||
if (!this.loadPromise) {
|
||||
process.emit('time', 'npm:load')
|
||||
this.log.pause()
|
||||
@@ -190,12 +171,7 @@ const npm = module.exports = new class extends EventEmitter {
|
||||
})
|
||||
})
|
||||
}
|
||||
if (!cb)
|
||||
return this.loadPromise
|
||||
|
||||
// loadPromise is returned here for legacy purposes, old code was allowing
|
||||
// the mixing of callback and promise here.
|
||||
return this.loadPromise.then(cb, cb)
|
||||
return this.loadPromise
|
||||
}
|
||||
|
||||
get loaded () {
|
||||
@@ -366,4 +342,5 @@ const npm = module.exports = new class extends EventEmitter {
|
||||
console.log(...msg)
|
||||
this.log.showProgress()
|
||||
}
|
||||
}()
|
||||
}
|
||||
module.exports = Npm
|
||||
Vendored
+7
-3
@@ -3,10 +3,14 @@ const readJson = require('read-package-json-fast')
|
||||
const { cmdList } = require('./cmd-list.js')
|
||||
|
||||
const didYouMean = async (npm, path, scmd) => {
|
||||
let best = cmdList
|
||||
// const cmd = await npm.cmd(str)
|
||||
const close = cmdList
|
||||
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd)
|
||||
.map(str => ` npm ${str} # ${npm.commands[str].description}`)
|
||||
|
||||
let best = []
|
||||
for (const str of close) {
|
||||
const cmd = await npm.cmd(str)
|
||||
best.push(` npm ${str} # ${cmd.description}`)
|
||||
}
|
||||
// We would already be suggesting this in `npm x` so omit them here
|
||||
const runScripts = ['stop', 'start', 'test', 'restart']
|
||||
try {
|
||||
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
// The implementation of commands that are just "run a script"
|
||||
// restart, start, stop, test
|
||||
|
||||
const BaseCommand = require('../base-command.js')
|
||||
class LifecycleCmd extends BaseCommand {
|
||||
static get usage () {
|
||||
return ['[-- <args>]']
|
||||
}
|
||||
|
||||
exec (args, cb) {
|
||||
this.npm.commands['run-script']([this.constructor.name, ...args], cb)
|
||||
}
|
||||
|
||||
execWorkspaces (args, filters, cb) {
|
||||
this.npm.commands['run-script']([this.constructor.name, ...args], cb)
|
||||
}
|
||||
}
|
||||
module.exports = LifecycleCmd
|
||||
Vendored
+10
-9
@@ -2,7 +2,7 @@ const { dirname } = require('path')
|
||||
const { cmdList } = require('./cmd-list')
|
||||
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
||||
|
||||
module.exports = (npm) => {
|
||||
module.exports = async (npm) => {
|
||||
const usesBrowser = npm.config.get('viewer') === 'browser'
|
||||
? ' (in a browser)' : ''
|
||||
return `npm <command>
|
||||
@@ -19,7 +19,7 @@ npm help <term> search for help on <term>${usesBrowser}
|
||||
npm help npm more involved overview${usesBrowser}
|
||||
|
||||
All commands:
|
||||
${allCommands(npm)}
|
||||
${await allCommands(npm)}
|
||||
|
||||
Specify configs in the ini-formatted file:
|
||||
${npm.config.get('userconfig')}
|
||||
@@ -31,7 +31,7 @@ Configuration fields: npm help 7 config
|
||||
npm@${npm.version} ${dirname(dirname(__dirname))}`
|
||||
}
|
||||
|
||||
const allCommands = (npm) => {
|
||||
const allCommands = async (npm) => {
|
||||
if (npm.config.get('long'))
|
||||
return usages(npm)
|
||||
return ('\n ' + wrap(cmdList))
|
||||
@@ -55,15 +55,16 @@ const wrap = (arr) => {
|
||||
return out.join('\n ').substr(2)
|
||||
}
|
||||
|
||||
const usages = (npm) => {
|
||||
const usages = async (npm) => {
|
||||
// return a string of <command>: <usage>
|
||||
let maxLen = 0
|
||||
return cmdList.reduce((set, c) => {
|
||||
set.push([c, npm.commands[c].usage])
|
||||
const set = []
|
||||
for (const c of cmdList) {
|
||||
const cmd = await npm.cmd(c)
|
||||
set.push([c, cmd.usage])
|
||||
maxLen = Math.max(maxLen, c.length)
|
||||
return set
|
||||
}, [])
|
||||
.sort(([a], [b]) => localeCompare(a, b))
|
||||
}
|
||||
return set.sort(([a], [b]) => localeCompare(a, b))
|
||||
.map(([c, usage]) => `\n ${c}${' '.repeat(maxLen - c.length + 1)}${
|
||||
(usage.split('\n').join('\n' + ' '.repeat(maxLen + 5)))}`)
|
||||
.join('\n')
|
||||
|
||||
Vendored
+1
-3
@@ -1,8 +1,6 @@
|
||||
const reifyOutput = require('./reify-output.js')
|
||||
const ini = require('ini')
|
||||
const util = require('util')
|
||||
const fs = require('fs')
|
||||
const { writeFile } = fs.promises || { writeFile: util.promisify(fs.writeFile) }
|
||||
const { writeFile } = require('fs').promises
|
||||
const {resolve} = require('path')
|
||||
|
||||
const reifyFinish = async (npm, arb) => {
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-ACCESS" "1" "October 2021" "" ""
|
||||
.TH "NPM\-ACCESS" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-access\fR \- Set access level on published packages
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-ADDUSER" "1" "October 2021" "" ""
|
||||
.TH "NPM\-ADDUSER" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-adduser\fR \- Add a registry user account
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-AUDIT" "1" "October 2021" "" ""
|
||||
.TH "NPM\-AUDIT" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-audit\fR \- Run a security audit
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-BIN" "1" "October 2021" "" ""
|
||||
.TH "NPM\-BIN" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-bin\fR \- Display npm bin folder
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-BUGS" "1" "October 2021" "" ""
|
||||
.TH "NPM\-BUGS" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-bugs\fR \- Report bugs for a package in a web browser
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CACHE" "1" "October 2021" "" ""
|
||||
.TH "NPM\-CACHE" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-cache\fR \- Manipulates packages cache
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CI" "1" "October 2021" "" ""
|
||||
.TH "NPM\-CI" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-ci\fR \- Install a project with a clean slate
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-COMPLETION" "1" "October 2021" "" ""
|
||||
.TH "NPM\-COMPLETION" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-completion\fR \- Tab Completion for npm
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-CONFIG" "1" "October 2021" "" ""
|
||||
.TH "NPM\-CONFIG" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-config\fR \- Manage the npm configuration files
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DEDUPE" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DEDUPE" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-dedupe\fR \- Reduce duplication in the package tree
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DEPRECATE" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DEPRECATE" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-deprecate\fR \- Deprecate a version of a package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DIFF" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DIFF" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-diff\fR \- The registry diff command
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DIST\-TAG" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DIST\-TAG" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-dist-tag\fR \- Modify package distribution tags
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DOCS" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DOCS" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-docs\fR \- Open documentation for a package in a web browser
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-DOCTOR" "1" "October 2021" "" ""
|
||||
.TH "NPM\-DOCTOR" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-doctor\fR \- Check your npm environment
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EDIT" "1" "October 2021" "" ""
|
||||
.TH "NPM\-EDIT" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-edit\fR \- Edit an installed package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXEC" "1" "October 2021" "" ""
|
||||
.TH "NPM\-EXEC" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-exec\fR \- Run a command from a local or remote npm package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXPLAIN" "1" "October 2021" "" ""
|
||||
.TH "NPM\-EXPLAIN" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-explain\fR \- Explain installed packages
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-EXPLORE" "1" "October 2021" "" ""
|
||||
.TH "NPM\-EXPLORE" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-explore\fR \- Browse an installed package
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-FIND\-DUPES" "1" "October 2021" "" ""
|
||||
.TH "NPM\-FIND\-DUPES" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-find-dupes\fR \- Find duplication in the package tree
|
||||
.SS Synopsis
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH "NPM\-FUND" "1" "October 2021" "" ""
|
||||
.TH "NPM\-FUND" "1" "November 2021" "" ""
|
||||
.SH "NAME"
|
||||
\fBnpm-fund\fR \- Retrieve funding information
|
||||
.SS Synopsis
|
||||
|
||||
Loaded 100 of 285 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user