Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: upgrade npm to 7.6.2 #37679

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/npm/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -757,3 +757,4 @@ kumavis <aaron@kumavis.me>
Christof Lemke <christoflemke@github.com>
Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Bjørn Johansen <bjjohans@microsoft.com>
Fraqe <f@fraqe.ca>
30 changes: 30 additions & 0 deletions deps/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## v7.6.2 (2021-03-09)

### BUG FIXES

* [`e0a3a5218`](https://github.com/npm/cli/commit/e0a3a5218cac7ca5850930aaaad8a939ddf75d4d)
[#2831](https://github.com/npm/cli/issues/2831)
Fix cb() never called in search with --json option
([@fraqe](https://github.com/fraqe))
* [`85a8694dd`](https://github.com/npm/cli/commit/85a8694dd9b4a924a474ba75261914511a216868)
[#2795](https://github.com/npm/cli/issues/2795)
fix(npm.output): make output go through npm.output
([@wraithgar](https://github.com/wraithgar))
* [`9fe0df5b5`](https://github.com/npm/cli/commit/9fe0df5b5d7606e5841288d9931be6c04767c9ca)
[#2821](https://github.com/npm/cli/issues/2821)
fix(usage): clean up usage declarations
([@wraithgar](https://github.com/wraithgar))

### DEPENDENCIES

* [`7f470b5c2`](https://github.com/npm/cli/commit/7f470b5c25d544e36d97b28e28ae20dfa1d4ab31)
`@npmcli/arborist@2.2.7`
* fix(install): Do not revert a file: dep to version on bare name re-install
* [`e9b7fc275`](https://github.com/npm/cli/commit/e9b7fc275a0bdf8f00dbcf5dd2283675776fc459)
`libnpmdiff@2.0.4`
* fix(diff): Gracefully handle packages with prepare script
* [`c7314aa62`](https://github.com/npm/cli/commit/c7314aa62195b7f0d8886776692e8a2c892413ed)
`byte-size@7.0.1`
* [`864f48d43`](https://github.com/npm/cli/commit/864f48d4327269f521161cf89888ea2b6db5fdab)
`pacote@11.3.0`

## v7.6.1 (2021-03-04)

### BUG FIXES
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
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@7.6.1 /path/to/npm
<pre lang="bash"><code>npm@7.6.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.6.1</p>
<p>7.6.2</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
Expand Down
51 changes: 19 additions & 32 deletions deps/npm/lib/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ const path = require('path')
const libaccess = require('libnpmaccess')
const readPackageJson = require('read-package-json-fast')

const output = require('./utils/output.js')
const otplease = require('./utils/otplease.js')
const usageUtil = require('./utils/usage.js')
const getIdentity = require('./utils/get-identity.js')
const BaseCommand = require('./base-command.js')

const subcommands = [
'public',
Expand All @@ -20,24 +19,23 @@ const subcommands = [
'2fa-not-required',
]

class Access {
constructor (npm) {
this.npm = npm
class Access extends BaseCommand {
static get name () {
return 'access'
}

get usage () {
return usageUtil(
'access',
'npm access public [<package>]\n' +
'npm access restricted [<package>]\n' +
'npm access grant <read-only|read-write> <scope:team> [<package>]\n' +
'npm access revoke <scope:team> [<package>]\n' +
'npm access 2fa-required [<package>]\n' +
'npm access 2fa-not-required [<package>]\n' +
'npm access ls-packages [<user>|<scope>|<scope:team>]\n' +
'npm access ls-collaborators [<package> [<user>]]\n' +
'npm access edit [<package>]'
)
static get usage () {
return [
'public [<package>]',
'restricted [<package>]',
'grant <read-only|read-write> <scope:team> [<package>]',
'revoke <scope:team> [<package>]',
'2fa-required [<package>]',
'2fa-not-required [<package>]',
'ls-packages [<user>|<scope>|<scope:team>]',
'ls-collaborators [<package> [<user>]]',
'edit [<package>]',
]
}

async completion (opts) {
Expand Down Expand Up @@ -67,12 +65,7 @@ class Access {
}

exec (args, cb) {
this.access(args)
.then(x => cb(null, x))
.catch(err => err.code === 'EUSAGE'
? cb(err.message)
: cb(err)
)
this.access(args).then(() => cb()).catch(cb)
}

async access ([cmd, ...args]) {
Expand Down Expand Up @@ -157,7 +150,7 @@ class Access {
const pkgs = await libaccess.lsPackages(owner, opts)

// TODO - print these out nicely (breaking change)
output(JSON.stringify(pkgs, null, 2))
this.npm.output(JSON.stringify(pkgs, null, 2))
}

get ['ls-collaborators'] () {
Expand All @@ -169,7 +162,7 @@ class Access {
const collabs = await libaccess.lsCollaborators(pkgName, usr, opts)

// TODO - print these out nicely (breaking change)
output(JSON.stringify(collabs, null, 2))
this.npm.output(JSON.stringify(collabs, null, 2))
}

async edit () {
Expand Down Expand Up @@ -203,12 +196,6 @@ class Access {
return name
}
}

usageError (msg) {
return Object.assign(new Error(`\nUsage: ${msg}\n\n` + this.usage), {
code: 'EUSAGE',
})
}
}

module.exports = Access
19 changes: 7 additions & 12 deletions deps/npm/lib/adduser.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
const log = require('npmlog')
const output = require('./utils/output.js')
const usageUtil = require('./utils/usage.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'),
}

class AddUser {
constructor (npm) {
this.npm = npm
class AddUser extends BaseCommand {
static get name () {
return 'adduser'
}

/* istanbul ignore next - see test/lib/load-all-commands.js */
get usage () {
return usageUtil(
'adduser',
'npm adduser [--registry=url] [--scope=@orgname] [--always-auth]'
)
static get usage () {
return ['[--registry=url] [--scope=@orgname] [--always-auth]']
}

exec (args, cb) {
Expand Down Expand Up @@ -49,7 +44,7 @@ class AddUser {
scope,
})

output(message)
this.npm.output(message)
}

getRegistry ({ scope, registry }) {
Expand Down
24 changes: 11 additions & 13 deletions deps/npm/lib/audit.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
const Arborist = require('@npmcli/arborist')
const auditReport = require('npm-audit-report')
const output = require('./utils/output.js')
const reifyFinish = require('./utils/reify-finish.js')
const auditError = require('./utils/audit-error.js')
const usageUtil = require('./utils/usage.js')
const BaseCommand = require('./base-command.js')

class Audit {
constructor (npm) {
this.npm = npm
class Audit extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'audit'
}

/* istanbul ignore next - see test/lib/load-all-commands.js */
get usage () {
return usageUtil(
'audit',
'npm audit [--json] [--production]' +
'\nnpm audit fix ' +
'[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]'
)
static get usage () {
return [
'[--json] [--production]',
'fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]',
]
}

async completion (opts) {
Expand Down Expand Up @@ -57,7 +55,7 @@ class Audit {
reporter,
})
process.exitCode = process.exitCode || result.exitCode
output(result.report)
this.npm.output(result.report)
}
}
}
Expand Down
38 changes: 38 additions & 0 deletions deps/npm/lib/base-command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Base class for npm.commands[cmd]
const usageUtil = require('./utils/usage.js')

class BaseCommand {
constructor (npm) {
this.npm = npm
}

get usage () {
let usage = `npm ${this.constructor.name}\n\n`
if (this.constructor.description)
usage = `${usage}${this.constructor.description}\n\n`

usage = `${usage}Usage:\n`
if (!this.constructor.usage)
usage = `${usage}npm ${this.constructor.name}`
else
usage = `${usage}${this.constructor.usage.map(u => `npm ${this.constructor.name} ${u}`).join('\n')}`

// Mostly this just appends aliases, this could be more clear
usage = usageUtil(this.constructor.name, usage)
usage = `${usage}\n\nRun "npm ${this.constructor.name} help" for more info`
return usage
}

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}`), {
code: 'EUSAGE',
})
}
}
module.exports = BaseCommand
16 changes: 7 additions & 9 deletions deps/npm/lib/bin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const output = require('./utils/output.js')
const envPath = require('./utils/path.js')
const usageUtil = require('./utils/usage.js')
const BaseCommand = require('./base-command.js')

class Bin {
constructor (npm) {
this.npm = npm
class Bin extends BaseCommand {
static get name () {
return 'bin'
}

/* istanbul ignore next - see test/lib/load-all-commands.js */
get usage () {
return usageUtil('bin', 'npm bin [-g]')
static get usage () {
return ['[-g]']
}

exec (args, cb) {
Expand All @@ -18,7 +16,7 @@ class Bin {

async bin (args) {
const b = this.npm.bin
output(b)
this.npm.output(b)
if (this.npm.flatOptions.global && !envPath.includes(b))
console.error('(not in PATH env variable)')
}
Expand Down
13 changes: 6 additions & 7 deletions deps/npm/lib/bugs.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
const log = require('npmlog')
const pacote = require('pacote')
const openUrl = require('./utils/open-url.js')
const usageUtil = require('./utils/usage.js')
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
const BaseCommand = require('./base-command.js')

class Bugs {
constructor (npm) {
this.npm = npm
class Bugs extends BaseCommand {
static get name () {
return 'bugs'
}

/* istanbul ignore next - see test/lib/load-all-commands.js */
get usage () {
return usageUtil('bugs', 'npm bugs [<pkgname>]')
static get usage () {
return ['[<pkgname>]']
}

exec (args, cb) {
Expand Down
45 changes: 23 additions & 22 deletions deps/npm/lib/cache.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
const cacache = require('cacache')
const { promisify } = require('util')
const log = require('npmlog')
const output = require('./utils/output.js')
const pacote = require('pacote')
const path = require('path')
const rimraf = promisify(require('rimraf'))
const BaseCommand = require('./base-command.js')

const usageUtil = require('./utils/usage.js')
class Cache {
constructor (npm) {
this.npm = npm
class Cache extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'cache'
}

get usage () {
return usageUtil('cache',
'npm cache add <tarball file>' +
'\nnpm cache add <folder>' +
'\nnpm cache add <tarball url>' +
'\nnpm cache add <git url>' +
'\nnpm cache add <name>@<version>' +
'\nnpm cache clean' +
'\nnpm cache verify'
)
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
return [
'add <tarball file>',
'add <folder>',
'add <tarball url>',
'add <git url>',
'add <name>@<version>',
'clean',
'verify',
]
}

async completion (opts) {
Expand Down Expand Up @@ -116,13 +117,13 @@ with --force.`)
? `~${cache.substr(process.env.HOME.length)}`
: cache
const stats = await cacache.verify(cache)
output(`Cache verified and compressed (${prefix})`)
output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
stats.badContentCount && output(`Corrupted content removed: ${stats.badContentCount}`)
stats.reclaimedCount && output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
stats.missingContent && output(`Missing content: ${stats.missingContent}`)
output(`Index entries: ${stats.totalEntries}`)
output(`Finished in ${stats.runTime.total / 1000}s`)
this.npm.output(`Cache verified and compressed (${prefix})`)
this.npm.output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
stats.badContentCount && this.npm.output(`Corrupted content removed: ${stats.badContentCount}`)
stats.reclaimedCount && this.npm.output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
stats.missingContent && this.npm.output(`Missing content: ${stats.missingContent}`)
this.npm.output(`Index entries: ${stats.totalEntries}`)
this.npm.output(`Finished in ${stats.runTime.total / 1000}s`)
}
}

Expand Down
Loading