From ce300d6f768c74ab639722bb88b806f8cd7d7add Mon Sep 17 00:00:00 2001
From: Ruy Adorno Description
the results to only the paths to the packages named. Note that nested
packages will also show the paths to the specified packages. For
example, running npm ls promzard
in npm’s source tree will show:
npm@7.7.0 /path/to/npm
+npm@7.7.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index f55659d9ee82a1..90e4019f1bc5d6 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -148,7 +148,7 @@ Table of contents
npm <command> [args]
Version
-7.7.0
+7.7.4
Description
npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html
index dc50eb72b71ca4..6fe8f828157683 100644
--- a/deps/npm/docs/output/using-npm/config.html
+++ b/deps/npm/docs/output/using-npm/config.html
@@ -141,7 +141,7 @@
config
Table of contents
-- Description
- Shorthands and Other CLI Niceties
- Config Settings
_auth
access
all
allow-same-version
always-auth
audit
audit-level
before
bin-links
browser
ca
cache
cafile
call
cert
ci-name
cidr
color
commit-hooks
depth
description
diff
diff-dst-prefix
diff-ignore-all-space
diff-name-only
diff-no-prefix
diff-src-prefix
diff-text
diff-unified
dry-run
editor
engine-strict
fetch-retries
fetch-retry-factor
fetch-retry-maxtimeout
fetch-retry-mintimeout
fetch-timeout
force
foreground-scripts
format-package-lock
fund
git
git-tag-version
global
global-style
globalconfig
heading
https-proxy
if-present
ignore-scripts
include
include-staged
init-author-email
init-author-name
init-author-url
init-license
init-module
init-version
json
key
legacy-bundling
legacy-peer-deps
link
local-address
loglevel
logs-max
long
maxsockets
message
node-options
node-version
noproxy
npm-version
offline
omit
otp
package
package-lock
package-lock-only
parseable
prefer-offline
prefer-online
prefix
preid
progress
proxy
read-only
rebuild-bundle
registry
save
save-bundle
save-dev
save-exact
save-optional
save-peer
save-prefix
save-prod
scope
script-shell
searchexclude
searchlimit
searchopts
searchstaleness
shell
sign-git-commit
sign-git-tag
strict-peer-deps
strict-ssl
tag
tag-version-prefix
timing
umask
unicode
update-notifier
usage
user-agent
userconfig
version
versions
viewer
which
workspace
workspaces
yes
also
auth-type
cache-max
cache-min
init.author.email
init.author.name
init.author.url
init.license
init.module
init.version
only
optional
production
shrinkwrap
sso-poll-frequency
sso-type
tmp
- See also
+- Description
- Shorthands and Other CLI Niceties
- Config Settings
_auth
access
all
allow-same-version
always-auth
audit
audit-level
before
bin-links
browser
ca
cache
cafile
call
cert
ci-name
cidr
color
commit-hooks
depth
description
diff
diff-dst-prefix
diff-ignore-all-space
diff-name-only
diff-no-prefix
diff-src-prefix
diff-text
diff-unified
dry-run
editor
engine-strict
fetch-retries
fetch-retry-factor
fetch-retry-maxtimeout
fetch-retry-mintimeout
fetch-timeout
force
foreground-scripts
format-package-lock
fund
git
git-tag-version
global
global-style
globalconfig
heading
https-proxy
if-present
ignore-scripts
include
include-staged
init-author-email
init-author-name
init-author-url
init-license
init-module
init-version
json
key
legacy-bundling
legacy-peer-deps
link
local-address
loglevel
logs-max
long
maxsockets
message
node-options
node-version
noproxy
npm-version
offline
omit
otp
package
package-lock
package-lock-only
parseable
prefer-offline
prefer-online
prefix
preid
progress
proxy
read-only
rebuild-bundle
registry
save
save-bundle
save-dev
save-exact
save-optional
save-peer
save-prefix
save-prod
scope
script-shell
searchexclude
searchlimit
searchopts
searchstaleness
shell
sign-git-commit
sign-git-tag
strict-peer-deps
strict-ssl
tag
tag-version-prefix
timing
umask
unicode
update-notifier
usage
user-agent
userconfig
version
versions
viewer
which
workspace
workspaces
yes
also
auth-type
cache-max
cache-min
dev
init.author.email
init.author.name
init.author.url
init.license
init.module
init.version
only
optional
production
shrinkwrap
sso-poll-frequency
sso-type
tmp
- See also
Description
@@ -297,7 +297,7 @@ audit
audit-level
- Default: null
-- Type: “low”, “moderate”, “high”, “critical”, “none”, or null
+- Type: “info”, “low”, “moderate”, “high”, “critical”, “none”, or null
The minimum level of vulnerability for npm audit
to exit with a non-zero
exit code.
@@ -1305,6 +1305,13 @@ cache-min
DEPRECATED: This option has been deprecated in favor of --prefer-offline
.
--cache-min=9999 (or bigger)
is an alias for --prefer-offline
.
+dev
+
+- Default: false
+- Type: Boolean
+- DEPRECATED: Please use –include=dev instead.
+
+Alias for --include=dev
.
init.author.email
- Default: “”
@@ -1365,8 +1372,8 @@ optional
Alias for –include=optional or –omit=optional
production
-- Default: false
-- Type: Boolean
+- Default: null
+- Type: null or Boolean
- DEPRECATED: Use
--omit=dev
instead.
Alias for --omit=dev
diff --git a/deps/npm/lib/audit.js b/deps/npm/lib/audit.js
index f990e1fa5efaa9..9df26985892783 100644
--- a/deps/npm/lib/audit.js
+++ b/deps/npm/lib/audit.js
@@ -18,6 +18,7 @@ class Audit extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
return [
+ 'audit-level',
'dry-run',
'force',
'json',
diff --git a/deps/npm/lib/ci.js b/deps/npm/lib/ci.js
index b73b3a85911148..9ae31950ef1021 100644
--- a/deps/npm/lib/ci.js
+++ b/deps/npm/lib/ci.js
@@ -42,8 +42,14 @@ class CI extends BaseCommand {
}
const where = this.npm.prefix
- const arb = new Arborist({ ...this.npm.flatOptions, path: where })
+ const opts = {
+ ...this.npm.flatOptions,
+ path: where,
+ log: this.npm.log,
+ save: false, // npm ci should never modify the lockfile or package.json
+ }
+ const arb = new Arborist(opts)
await Promise.all([
arb.loadVirtual().catch(er => {
log.verbose('loadVirtual', er.stack)
@@ -55,8 +61,7 @@ class CI extends BaseCommand {
}),
removeNodeModules(where),
])
- // npm ci should never modify the lockfile or package.json
- await arb.reify({ ...this.npm.flatOptions, save: false })
+ await arb.reify(opts)
const ignoreScripts = this.npm.config.get('ignore-scripts')
// run the same set of scripts that `npm install` runs.
diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js
index d5ef6ec50a5e60..f53d7e5ae271bc 100644
--- a/deps/npm/lib/config.js
+++ b/deps/npm/lib/config.js
@@ -88,6 +88,11 @@ class Config extends BaseCommand {
this.config(args).then(() => cb()).catch(cb)
}
+ execWorkspaces (args, filters, cb) {
+ this.npm.log.warn('config', 'This command does not support workspaces.')
+ this.exec(args, cb)
+ }
+
async config ([action, ...args]) {
this.npm.log.disableProgress()
try {
diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js
index b80a777fcc2f75..9649025739c601 100644
--- a/deps/npm/lib/dedupe.js
+++ b/deps/npm/lib/dedupe.js
@@ -30,6 +30,7 @@ class Dedupe extends BaseCommand {
const where = this.npm.prefix
const opts = {
...this.npm.flatOptions,
+ log: this.npm.log,
path: where,
dryRun,
}
diff --git a/deps/npm/lib/exec.js b/deps/npm/lib/exec.js
index 0a61de7c1200cd..5967ee42345920 100644
--- a/deps/npm/lib/exec.js
+++ b/deps/npm/lib/exec.js
@@ -175,7 +175,11 @@ class Exec extends BaseCommand {
if (needInstall) {
const installDir = this.cacheInstallDir(packages)
await mkdirp(installDir)
- const arb = new Arborist({ ...this.npm.flatOptions, path: installDir })
+ const arb = new Arborist({
+ ...this.npm.flatOptions,
+ log: this.npm.log,
+ path: installDir,
+ })
const tree = await arb.loadActual()
// at this point, we have to ensure that we get the exact same
@@ -212,7 +216,11 @@ class Exec extends BaseCommand {
throw new Error('canceled')
}
}
- await arb.reify({ ...this.npm.flatOptions, add })
+ await arb.reify({
+ ...this.npm.flatOptions,
+ log: this.npm.log,
+ add,
+ })
}
pathArr.unshift(resolve(installDir, 'node_modules/.bin'))
}
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js
index 54ea6d82510512..a023015ed823a3 100644
--- a/deps/npm/lib/install.js
+++ b/deps/npm/lib/install.js
@@ -126,15 +126,16 @@ class Install extends BaseCommand {
if (this.npm.config.get('dev'))
log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.')
- const arb = new Arborist({
+ const opts = {
...this.npm.flatOptions,
+ log: this.npm.log,
+ auditLevel: null,
path: where,
- })
-
- await arb.reify({
- ...this.npm.flatOptions,
add: args,
- })
+ }
+ const arb = new Arborist(opts)
+ await arb.reify(opts)
+
if (!args.length && !isGlobalInstall && !ignoreScripts) {
const scriptShell = this.npm.config.get('script-shell') || undefined
const scripts = [
diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js
index fe9cfd3a6b254a..3e9ec1807fca1a 100644
--- a/deps/npm/lib/link.js
+++ b/deps/npm/lib/link.js
@@ -66,6 +66,7 @@ class Link extends BaseCommand {
const globalOpts = {
...this.npm.flatOptions,
path: globalTop,
+ log: this.npm.log,
global: true,
prune: false,
}
@@ -113,12 +114,14 @@ class Link extends BaseCommand {
// reify all the pending names as symlinks there
const localArb = new Arborist({
...this.npm.flatOptions,
+ log: this.npm.log,
path: this.npm.prefix,
save,
})
await localArb.reify({
...this.npm.flatOptions,
path: this.npm.prefix,
+ log: this.npm.log,
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
save,
})
@@ -131,9 +134,13 @@ class Link extends BaseCommand {
const arb = new Arborist({
...this.npm.flatOptions,
path: globalTop,
+ log: this.npm.log,
global: true,
})
- await arb.reify({ add: [`file:${this.npm.prefix}`] })
+ await arb.reify({
+ add: [`file:${this.npm.prefix}`],
+ log: this.npm.log,
+ })
await reifyFinish(this.npm, arb)
}
diff --git a/deps/npm/lib/prune.js b/deps/npm/lib/prune.js
index 1da86a3e821878..5c4a549d4d7ada 100644
--- a/deps/npm/lib/prune.js
+++ b/deps/npm/lib/prune.js
@@ -30,11 +30,13 @@ class Prune extends BaseCommand {
async prune () {
const where = this.npm.prefix
- const arb = new Arborist({
+ const opts = {
...this.npm.flatOptions,
path: where,
- })
- await arb.prune(this.npm.flatOptions)
+ log: this.npm.log,
+ }
+ const arb = new Arborist(opts)
+ await arb.prune(opts)
await reifyFinish(this.npm, arb)
}
}
diff --git a/deps/npm/lib/set-script.js b/deps/npm/lib/set-script.js
index df101a0acb7090..9d4aadad558fbf 100644
--- a/deps/npm/lib/set-script.js
+++ b/deps/npm/lib/set-script.js
@@ -2,6 +2,7 @@ const log = require('npmlog')
const fs = require('fs')
const parseJSON = require('json-parse-even-better-errors')
const rpj = require('read-package-json-fast')
+const { resolve } = require('path')
const BaseCommand = require('./base-command.js')
class SetScript extends BaseCommand {
@@ -20,6 +21,16 @@ class SetScript extends BaseCommand {
return ['[