diff options
author | npm-robot <ops+robot@npmjs.com> | 2022-05-05 12:55:34 +0300 |
---|---|---|
committer | Juan José Arboleda <soyjuanarbol@gmail.com> | 2022-06-01 05:13:28 +0300 |
commit | 3dfc632f12ce9c832beb1445e5caa4a663132ff3 (patch) | |
tree | 40a845e45774df2ad1e397fdbf13e6db19a88deb | |
parent | a746943fcb31465d7d01bc92a73ad70888564ccc (diff) |
deps: upgrade npm to 8.9.0
PR-URL: https://github.com/nodejs/node/pull/42968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
127 files changed, 666 insertions, 364 deletions
diff --git a/deps/npm/docs/content/commands/npm-dedupe.md b/deps/npm/docs/content/commands/npm-dedupe.md index f816b994335..570e018342f 100644 --- a/deps/npm/docs/content/commands/npm-dedupe.md +++ b/deps/npm/docs/content/commands/npm-dedupe.md @@ -147,10 +147,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/commands/npm-find-dupes.md b/deps/npm/docs/content/commands/npm-find-dupes.md index a92c57bd7e1..4da6c296c6b 100644 --- a/deps/npm/docs/content/commands/npm-find-dupes.md +++ b/deps/npm/docs/content/commands/npm-find-dupes.md @@ -87,10 +87,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/commands/npm-install-test.md b/deps/npm/docs/content/commands/npm-install-test.md index 931ff050718..3dd860ea5c6 100644 --- a/deps/npm/docs/content/commands/npm-install-test.md +++ b/deps/npm/docs/content/commands/npm-install-test.md @@ -162,10 +162,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/commands/npm-install.md b/deps/npm/docs/content/commands/npm-install.md index c0a1272c550..d6668a2c2bd 100644 --- a/deps/npm/docs/content/commands/npm-install.md +++ b/deps/npm/docs/content/commands/npm-install.md @@ -552,10 +552,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/commands/npm-link.md b/deps/npm/docs/content/commands/npm-link.md index fb2b23921b0..975c807c38b 100644 --- a/deps/npm/docs/content/commands/npm-link.md +++ b/deps/npm/docs/content/commands/npm-link.md @@ -224,10 +224,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/commands/npm-owner.md b/deps/npm/docs/content/commands/npm-owner.md index 0779984e19a..72dfe6a22d0 100644 --- a/deps/npm/docs/content/commands/npm-owner.md +++ b/deps/npm/docs/content/commands/npm-owner.md @@ -73,6 +73,52 @@ password, npm will prompt on the command line for one. <!-- automatically generated, do not edit manually --> <!-- see lib/utils/config/definitions.js --> +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +<!-- automatically generated, do not edit manually --> +<!-- see lib/utils/config/definitions.js --> + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +<!-- automatically generated, do not edit manually --> +<!-- see lib/utils/config/definitions.js --> + <!-- AUTOGENERATED CONFIG DESCRIPTIONS END --> ### See Also diff --git a/deps/npm/docs/content/commands/npm-pkg.md b/deps/npm/docs/content/commands/npm-pkg.md index 576e1335efb..deff7e82c69 100644 --- a/deps/npm/docs/content/commands/npm-pkg.md +++ b/deps/npm/docs/content/commands/npm-pkg.md @@ -76,6 +76,14 @@ Returned values are always in **json** format. npm pkg get contributors[0].email ``` + For complex fields you can also name a property in square brackets + to specifically select a child field. This is especially helpful + with the exports object: + + ```bash + npm pkg get "exports[.].require" + ``` + * `npm pkg set <field>=<value>` Sets a `value` in your `package.json` based on the `field` value. When diff --git a/deps/npm/docs/content/commands/npm-update.md b/deps/npm/docs/content/commands/npm-update.md index 39477321499..421d04ca3dc 100644 --- a/deps/npm/docs/content/commands/npm-update.md +++ b/deps/npm/docs/content/commands/npm-update.md @@ -280,10 +280,6 @@ this warning is treated as a failure. If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index ba79dd505a8..4dc2829825d 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -1219,10 +1219,6 @@ The package to install for [`npm exec`](/commands/npm-exec) If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use `npm prune`. - This configuration does not affect `npm ci`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/docs/output/commands/npm-dedupe.html b/deps/npm/docs/output/commands/npm-dedupe.html index 5bc84af0a26..89d62caf702 100644 --- a/deps/npm/docs/output/commands/npm-dedupe.html +++ b/deps/npm/docs/output/commands/npm-dedupe.html @@ -253,9 +253,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html index 9e57bd78dff..0e3ee085609 100644 --- a/deps/npm/docs/output/commands/npm-find-dupes.html +++ b/deps/npm/docs/output/commands/npm-find-dupes.html @@ -210,9 +210,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html index 9e3655c49f7..6306ceb5938 100644 --- a/deps/npm/docs/output/commands/npm-install-test.html +++ b/deps/npm/docs/output/commands/npm-install-test.html @@ -273,9 +273,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html index de949e9493a..509702b5bd4 100644 --- a/deps/npm/docs/output/commands/npm-install.html +++ b/deps/npm/docs/output/commands/npm-install.html @@ -599,9 +599,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm-link.html b/deps/npm/docs/output/commands/npm-link.html index 33a2f33b69c..f7d5f66a9e2 100644 --- a/deps/npm/docs/output/commands/npm-link.html +++ b/deps/npm/docs/output/commands/npm-link.html @@ -312,9 +312,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 707324960a8..4b44cbfbc3d 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -166,7 +166,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.8.0 /path/to/npm +<pre lang="bash"><code>npm@8.9.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 </code></pre> diff --git a/deps/npm/docs/output/commands/npm-owner.html b/deps/npm/docs/output/commands/npm-owner.html index b76967a18da..744f7821408 100644 --- a/deps/npm/docs/output/commands/npm-owner.html +++ b/deps/npm/docs/output/commands/npm-owner.html @@ -142,7 +142,7 @@ npm command-line interface <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#registry"><code>registry</code></a></li><li><a href="#otp"><code>otp</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#registry"><code>registry</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> </section> <div id="_content"><h3 id="synopsis">Synopsis</h3> @@ -198,6 +198,45 @@ when publishing or changing package permissions with <code>npm access</code>.</p password, npm will prompt on the command line for one.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> +<h4 id="workspace"><code>workspace</code></h4> +<ul> +<li>Default:</li> +<li>Type: String (can be set multiple times)</li> +</ul> +<p>Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.</p> +<p>Valid values for the <code>workspace</code> config are either:</p> +<ul> +<li>Workspace names</li> +<li>Path to a workspace directory</li> +<li>Path to a parent workspace directory (will result in selecting all +workspaces within that folder)</li> +</ul> +<p>When set for the <code>npm init</code> command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.</p> +<p>This value is not exported to the environment for child processes.</p> +<!-- raw HTML omitted --> +<!-- raw HTML omitted --> +<h4 id="workspaces"><code>workspaces</code></h4> +<ul> +<li>Default: null</li> +<li>Type: null or Boolean</li> +</ul> +<p>Set to true to run the command in the context of <strong>all</strong> configured +workspaces.</p> +<p>Explicitly setting this to false will cause commands like <code>install</code> to +ignore workspaces altogether. When not set explicitly:</p> +<ul> +<li>Commands that operate on the <code>node_modules</code> tree (install, update, etc.) +will link workspaces into the <code>node_modules</code> folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +<em>unless</em> one or more workspaces are specified in the <code>workspace</code> config.</li> +</ul> +<p>This value is not exported to the environment for child processes.</p> +<!-- raw HTML omitted --> +<!-- raw HTML omitted --> <!-- raw HTML omitted --> <h3 id="see-also">See Also</h3> <ul> diff --git a/deps/npm/docs/output/commands/npm-pkg.html b/deps/npm/docs/output/commands/npm-pkg.html index 221afc4e594..95635ee6028 100644 --- a/deps/npm/docs/output/commands/npm-pkg.html +++ b/deps/npm/docs/output/commands/npm-pkg.html @@ -192,6 +192,11 @@ an item in an array field. To just get the email address of the first contributor in the list, you can run:</p> <pre lang="bash"><code>npm pkg get contributors[0].email </code></pre> +<p>For complex fields you can also name a property in square brackets +to specifically select a child field. This is especially helpful +with the exports object:</p> +<pre lang="bash"><code>npm pkg get "exports[.].require" +</code></pre> </li> <li> <p><code>npm pkg set <field>=<value></code></p> diff --git a/deps/npm/docs/output/commands/npm-update.html b/deps/npm/docs/output/commands/npm-update.html index 2ada2dcb7cc..d88ea8578ba 100644 --- a/deps/npm/docs/output/commands/npm-update.html +++ b/deps/npm/docs/output/commands/npm-update.html @@ -352,9 +352,6 @@ this warning is treated as a failure.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index a48efdbe4f6..947e5a7ee17 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -149,7 +149,7 @@ npm command-line interface <!-- raw HTML omitted --> <!-- raw HTML omitted --> <h3 id="version">Version</h3> -<p>8.8.0</p> +<p>8.9.0</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 diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 57e6e21073d..e1edc365007 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -1123,9 +1123,6 @@ password, npm will prompt on the command line for one.</p> </ul> <p>If set to false, then ignore <code>package-lock.json</code> files when installing. This will also prevent <em>writing</em> <code>package-lock.json</code> if <code>save</code> is true.</p> -<p>When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use <code>npm prune</code>.</p> <p>This configuration does not affect <code>npm ci</code>.</p> <!-- raw HTML omitted --> <!-- raw HTML omitted --> diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js index ca0438f1a24..f5bee1eb83f 100644 --- a/deps/npm/lib/commands/doctor.js +++ b/deps/npm/lib/commands/doctor.js @@ -1,5 +1,4 @@ const cacache = require('cacache') -const chalk = require('chalk') const fs = require('fs') const fetch = require('make-fetch-happen') const table = require('text-table') @@ -102,28 +101,19 @@ class Doctor extends BaseCommand { messages.push(line) } - const outHead = ['Check', 'Value', 'Recommendation/Notes'].map( - !this.npm.color ? h => h : h => chalk.underline(h) - ) + const outHead = ['Check', 'Value', 'Recommendation/Notes'].map(h => this.npm.chalk.underline(h)) let allOk = true - const outBody = messages.map( - !this.npm.color - ? item => { - allOk = allOk && item[1] - item[1] = item[1] ? 'ok' : 'not ok' - item[2] = String(item[2]) - return item - } - : item => { - allOk = allOk && item[1] - if (!item[1]) { - item[0] = chalk.red(item[0]) - item[2] = chalk.magenta(String(item[2])) - } - item[1] = item[1] ? chalk.green('ok') : chalk.red('not ok') - return item - } - ) + const outBody = messages.map(item => { + if (!item[1]) { + allOk = false + item[0] = this.npm.chalk.red(item[0]) + item[1] = this.npm.chalk.red('not ok') + item[2] = this.npm.chalk.magenta(String(item[2])) + } else { + item[1] = this.npm.chalk.green('ok') + } + return item + }) const outTable = [outHead, ...outBody] const tableOpts = { stringLength: s => ansiTrim(s).length, diff --git a/deps/npm/lib/commands/exec.js b/deps/npm/lib/commands/exec.js index f764cea528a..d9a686cc9a3 100644 --- a/deps/npm/lib/commands/exec.js +++ b/deps/npm/lib/commands/exec.js @@ -73,6 +73,9 @@ class Exec extends BaseCommand { return libexec({ ...flatOptions, + // we explicitly set packageLockOnly to false because if it's true + // when we try to install a missing package, we won't actually install it + packageLockOnly: false, args, call, localBin, diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js index 285b06be8e5..9338b22a5e8 100644 --- a/deps/npm/lib/commands/owner.js +++ b/deps/npm/lib/commands/owner.js @@ -22,6 +22,8 @@ class Owner extends BaseCommand { static params = [ 'registry', 'otp', + 'workspace', + 'workspaces', ] static usage = [ @@ -69,22 +71,43 @@ class Owner extends BaseCommand { } async exec ([action, ...args]) { - switch (action) { - case 'ls': - case 'list': - return this.ls(args[0]) - case 'add': - return this.changeOwners(args[0], args[1], 'add') - case 'rm': - case 'remove': - return this.changeOwners(args[0], args[1], 'rm') - default: + if (action === 'ls' || action === 'list') { + await this.ls(args[0]) + } else if (action === 'add') { + await this.changeOwners(args[0], args[1], 'add') + } else if (action === 'rm' || action === 'remove') { + await this.changeOwners(args[0], args[1], 'rm') + } else { + throw this.usageError() + } + } + + async execWorkspaces ([action, ...args], filters) { + await this.setWorkspaces(filters) + // ls pkg or owner add/rm package + if ((action === 'ls' && args.length > 0) || args.length > 1) { + const implicitWorkspaces = this.npm.config.get('workspace', 'default') + if (implicitWorkspaces.length === 0) { + log.warn(`Ignoring specified workspace(s)`) + } + return this.exec([action, ...args]) + } + + for (const [name] of this.workspaces) { + if (action === 'ls' || action === 'list') { + await this.ls(name) + } else if (action === 'add') { + await this.changeOwners(args[0], name, 'add') + } else if (action === 'rm' || action === 'remove') { + await this.changeOwners(args[0], name, 'rm') + } else { throw this.usageError() + } } } async ls (pkg) { - pkg = await this.getPkg(pkg) + pkg = await this.getPkg(this.npm.prefix, pkg) const spec = npa(pkg) try { @@ -101,12 +124,12 @@ class Owner extends BaseCommand { } } - async getPkg (pkg) { + async getPkg (prefix, pkg) { if (!pkg) { if (this.npm.config.get('global')) { throw this.usageError() } - const { name } = await readJson(resolve(this.npm.prefix, 'package.json')) + const { name } = await readJson(resolve(prefix, 'package.json')) if (!name) { throw this.usageError() } @@ -121,7 +144,7 @@ class Owner extends BaseCommand { throw this.usageError() } - pkg = await this.getPkg(pkg) + pkg = await this.getPkg(this.npm.prefix, pkg) log.verbose(`owner ${addOrRm}`, '%s to %s', user, pkg) const spec = npa(pkg) diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js index ff303669387..cbf0ccf4d65 100644 --- a/deps/npm/lib/commands/publish.js +++ b/deps/npm/lib/commands/publish.js @@ -7,7 +7,6 @@ const runScript = require('@npmcli/run-script') 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 otplease = require('../utils/otplease.js') @@ -151,8 +150,6 @@ class Publish extends BaseCommand { const results = {} const json = this.npm.config.get('json') const { silent } = this.npm - const noop = a => a - const color = this.npm.color ? chalk : { green: noop, bold: noop } await this.setWorkspaces(filters) for (const [name, workspace] of this.workspaces.entries()) { @@ -164,9 +161,9 @@ class Publish extends BaseCommand { log.warn( 'publish', `Skipping workspace ${ - color.green(name) + this.npm.chalk.green(name) }, marked as ${ - color.bold('private') + this.npm.chalk.bold('private') }` ) continue diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index c819a0807b5..732362565e2 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -1,16 +1,15 @@ const EventEmitter = require('events') const { resolve, dirname, join } = require('path') const Config = require('@npmcli/config') +const chalk = require('chalk') +const which = require('which') +const fs = require('@npmcli/fs') // Patch the global fs module here at the app level require('graceful-fs').gracefulify(require('fs')) const { definitions, flatten, shorthands } = require('./utils/config/index.js') const usage = require('./utils/npm-usage.js') - -const which = require('which') -const fs = require('@npmcli/fs') - const LogFile = require('./utils/log-file.js') const Timers = require('./utils/timers.js') const Display = require('./utils/display.js') @@ -37,6 +36,7 @@ class Npm extends EventEmitter { #tmpFolder = null #title = 'npm' #argvClean = [] + #chalk = null #logFile = new LogFile() #display = new Display() @@ -322,6 +322,17 @@ class Npm extends EventEmitter { return this.flatOptions.color } + get chalk () { + if (!this.#chalk) { + let level = chalk.level + if (!this.color) { + level = 0 + } + this.#chalk = new chalk.Instance({ level }) + } + return this.#chalk + } + get logColor () { return this.flatOptions.logColor } diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index 4a1f971d854..6f1b1a7244a 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -1448,10 +1448,6 @@ define('package-lock', { This will also prevent _writing_ \`package-lock.json\` if \`save\` is true. - When package package-locks are disabled, automatic pruning of extraneous - modules will also be disabled. To remove extraneous modules with - package-locks disabled use \`npm prune\`. - This configuration does not affect \`npm ci\`. `, flatten: (key, obj, flatOptions) => { diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 79ca419e53b..66e859f6a2a 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "April 2022" "" "" +.TH "NPM\-ACCESS" "1" "May 2022" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 6e755bf90e9..08a78c48e85 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "April 2022" "" "" +.TH "NPM\-ADDUSER" "1" "May 2022" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SS Synopsis diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index 5954f069d9a..d84fdd59e58 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-AUDIT" "1" "April 2022" "" "" +.TH "NPM\-AUDIT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-audit\fR \- Run a security audit .SS Synopsis diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index b6229ecc464..efe38ee8d91 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "April 2022" "" "" +.TH "NPM\-BIN" "1" "May 2022" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index d211456d50e..f56c459c6d7 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "April 2022" "" "" +.TH "NPM\-BUGS" "1" "May 2022" "" "" .SH "NAME" \fBnpm-bugs\fR \- Report bugs for a package in a web browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index a57d0343e0d..1b5e5a84372 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "April 2022" "" "" +.TH "NPM\-CACHE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SS Synopsis diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index 0cfdc6cf074..3aefdfc80b8 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CI" "1" "April 2022" "" "" +.TH "NPM\-CI" "1" "May 2022" "" "" .SH "NAME" \fBnpm-ci\fR \- Install a project with a clean slate .SS Synopsis diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 6b829353d44..87eb098ce92 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "April 2022" "" "" +.TH "NPM\-COMPLETION" "1" "May 2022" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 4517877124b..19f9ab6a06d 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "April 2022" "" "" +.TH "NPM\-CONFIG" "1" "May 2022" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SS Synopsis diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 71c319f04a2..c337c715017 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "April 2022" "" "" +.TH "NPM\-DEDUPE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication in the package tree .SS Synopsis @@ -141,10 +141,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBomit\fP .RS 0 diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index bf7fcfe728c..594b1689b73 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "April 2022" "" "" +.TH "NPM\-DEPRECATE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-diff.1 b/deps/npm/man/man1/npm-diff.1 index 6da0dd52e18..90bdfa94760 100644 --- a/deps/npm/man/man1/npm-diff.1 +++ b/deps/npm/man/man1/npm-diff.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIFF" "1" "April 2022" "" "" +.TH "NPM\-DIFF" "1" "May 2022" "" "" .SH "NAME" \fBnpm-diff\fR \- The registry diff command .SS Synopsis diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index 7130524d264..33166e1c45a 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "April 2022" "" "" +.TH "NPM\-DIST\-TAG" "1" "May 2022" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SS Synopsis diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 62a633dff1c..e7dc87e834e 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "April 2022" "" "" +.TH "NPM\-DOCS" "1" "May 2022" "" "" .SH "NAME" \fBnpm-docs\fR \- Open documentation for a package in a web browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 6a3b9b20fb3..4c7dd20a9df 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "April 2022" "" "" +.TH "NPM\-DOCTOR" "1" "May 2022" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your npm environment .SS Synopsis diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 433e8f7b4ae..d5e4fd9398f 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "April 2022" "" "" +.TH "NPM\-EDIT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1 index 01db093870f..1203e1427e0 100644 --- a/deps/npm/man/man1/npm-exec.1 +++ b/deps/npm/man/man1/npm-exec.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXEC" "1" "April 2022" "" "" +.TH "NPM\-EXEC" "1" "May 2022" "" "" .SH "NAME" \fBnpm-exec\fR \- Run a command from a local or remote npm package .SS Synopsis diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1 index a8d343c1d19..29866d5c36b 100644 --- a/deps/npm/man/man1/npm-explain.1 +++ b/deps/npm/man/man1/npm-explain.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLAIN" "1" "April 2022" "" "" +.TH "NPM\-EXPLAIN" "1" "May 2022" "" "" .SH "NAME" \fBnpm-explain\fR \- Explain installed packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index cdb01df980f..266248676df 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "April 2022" "" "" +.TH "NPM\-EXPLORE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-find-dupes.1 b/deps/npm/man/man1/npm-find-dupes.1 index d89bd9f3908..4f1652d54bb 100644 --- a/deps/npm/man/man1/npm-find-dupes.1 +++ b/deps/npm/man/man1/npm-find-dupes.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FIND\-DUPES" "1" "April 2022" "" "" +.TH "NPM\-FIND\-DUPES" "1" "May 2022" "" "" .SH "NAME" \fBnpm-find-dupes\fR \- Find duplication in the package tree .SS Synopsis @@ -75,10 +75,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBomit\fP .RS 0 diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index d501652230f..44d848357d5 100644 --- a/deps/npm/man/man1/npm-fund.1 +++ b/deps/npm/man/man1/npm-fund.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FUND" "1" "April 2022" "" "" +.TH "NPM\-FUND" "1" "May 2022" "" "" .SH "NAME" \fBnpm-fund\fR \- Retrieve funding information .SS Synopsis diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 73ac93576c8..f4e9ec4c91e 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "April 2022" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "May 2022" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SS Synopsis diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 8af1b37e83c..83cb8f92d04 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "April 2022" "" "" +.TH "NPM\-HELP" "1" "May 2022" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 index 32d92b03bc0..27b8888c8cd 100644 --- a/deps/npm/man/man1/npm-hook.1 +++ b/deps/npm/man/man1/npm-hook.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HOOK" "1" "April 2022" "" "" +.TH "NPM\-HOOK" "1" "May 2022" "" "" .SH "NAME" \fBnpm-hook\fR \- Manage registry hooks .SS Synopsis diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 30d3890d21f..829b1b4752b 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "April 2022" "" "" +.TH "NPM\-INIT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-init\fR \- Create a package\.json file .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index 3c253a0364c..aeddd06d146 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL\-CI\-TEST" "1" "April 2022" "" "" +.TH "NPM\-INSTALL\-CI\-TEST" "1" "May 2022" "" "" .SH "NAME" \fBnpm-install-ci-test\fR \- Install a project with a clean slate and run tests .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index b28c8300e19..17aadace62f 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL\-TEST" "1" "April 2022" "" "" +.TH "NPM\-INSTALL\-TEST" "1" "May 2022" "" "" .SH "NAME" \fBnpm-install-test\fR \- Install package(s) and run tests .SS Synopsis @@ -155,10 +155,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBforeground\-scripts\fP .RS 0 diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 1f3bf51ada1..7630adb0e28 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "April 2022" "" "" +.TH "NPM\-INSTALL" "1" "May 2022" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SS Synopsis @@ -566,10 +566,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBforeground\-scripts\fP .RS 0 diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index d726e669dd2..f59c7465194 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "April 2022" "" "" +.TH "NPM\-LINK" "1" "May 2022" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SS Synopsis @@ -223,10 +223,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBomit\fP .RS 0 diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 01dd67cdc1b..83079181007 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "April 2022" "" "" +.TH "NPM\-LOGOUT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 6485cb3650d..df207311c04 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "April 2022" "" "" +.TH "NPM\-LS" "1" "May 2022" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SS Synopsis @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@8\.8\.0 /path/to/npm +npm@8\.9\.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 841a3b5d7a4..28d623b204b 100644 --- a/deps/npm/man/man1/npm-org.1 +++ b/deps/npm/man/man1/npm-org.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ORG" "1" "April 2022" "" "" +.TH "NPM\-ORG" "1" "May 2022" "" "" .SH "NAME" \fBnpm-org\fR \- Manage orgs .SS Synopsis diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 46921b5a8ef..9fe1ddf692e 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "April 2022" "" "" +.TH "NPM\-OUTDATED" "1" "May 2022" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index d67b4cf339f..09f488ed8ea 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "April 2022" "" "" +.TH "NPM\-OWNER" "1" "May 2022" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SS Synopsis @@ -62,6 +62,60 @@ when publishing or changing package permissions with \fBnpm access\fP\|\. .P If not set, and a registry response fails with a challenge for a one\-time password, npm will prompt on the command line for one\. +.SS \fBworkspace\fP +.RS 0 +.IP \(bu 2 +Default: +.IP \(bu 2 +Type: String (can be set multiple times) + +.RE +.P +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option\. +.P +Valid values for the \fBworkspace\fP config are either: +.RS 0 +.IP \(bu 2 +Workspace names +.IP \(bu 2 +Path to a workspace directory +.IP \(bu 2 +Path to a parent workspace directory (will result in selecting all +workspaces within that folder) + +.RE +.P +When set for the \fBnpm init\fP command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project\. +.P +This value is not exported to the environment for child processes\. +.SS \fBworkspaces\fP +.RS 0 +.IP \(bu 2 +Default: null +.IP \(bu 2 +Type: null or Boolean + +.RE +.P +Set to true to run the command in the context of \fBall\fR configured +workspaces\. +.P +Explicitly setting this to false will cause commands like \fBinstall\fP to +ignore workspaces altogether\. When not set explicitly: +.RS 0 +.IP \(bu 2 +Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.) +will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do +other things (test, exec, publish, etc\.) will operate on the root project, +\fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\. + +.RE +.P +This value is not exported to the environment for child processes\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 3eabcc79878..94a0df9efc3 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "April 2022" "" "" +.TH "NPM\-PACK" "1" "May 2022" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index c564f5fdeac..bf065b16f15 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "April 2022" "" "" +.TH "NPM\-PING" "1" "May 2022" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-pkg.1 b/deps/npm/man/man1/npm-pkg.1 index 577e030d42c..1307a6664b1 100644 --- a/deps/npm/man/man1/npm-pkg.1 +++ b/deps/npm/man/man1/npm-pkg.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PKG" "1" "April 2022" "" "" +.TH "NPM\-PKG" "1" "May 2022" "" "" .SH "NAME" \fBnpm-pkg\fR \- Manages your package\.json .SS Synopsis @@ -69,6 +69,15 @@ Returned values are always in \fBjson\fR format\. npm pkg get contributors[0]\.email .fi .RE + For complex fields you can also name a property in square brackets + to specifically select a child field\. This is especially helpful + with the exports object: +.P +.RS 2 +.nf + npm pkg get "exports[\.]\.require" +.fi +.RE .IP \(bu 2 \fBnpm pkg set <field>=<value>\fP Sets a \fBvalue\fP in your \fBpackage\.json\fP based on the \fBfield\fP value\. When diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 356ad4e8636..2434c34678e 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "April 2022" "" "" +.TH "NPM\-PREFIX" "1" "May 2022" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SS Synopsis diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index d546955b8b6..a7a1733b63d 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PROFILE" "1" "April 2022" "" "" +.TH "NPM\-PROFILE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-profile\fR \- Change settings on your registry profile .SS Synopsis diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index a3d43f6455f..a0d23793206 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "April 2022" "" "" +.TH "NPM\-PRUNE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 4fabf6e3687..241f7cffd20 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "April 2022" "" "" +.TH "NPM\-PUBLISH" "1" "May 2022" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index bd5a47263f0..dab000878d1 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "April 2022" "" "" +.TH "NPM\-REBUILD" "1" "May 2022" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 0b298e82969..7fd6c738c9f 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "April 2022" "" "" +.TH "NPM\-REPO" "1" "May 2022" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 5ce2cc44c48..9866fa5792c 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "April 2022" "" "" +.TH "NPM\-RESTART" "1" "May 2022" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index dcc8c34de67..4e1a94be7b4 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "April 2022" "" "" +.TH "NPM\-ROOT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SS Synopsis diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index edf0561cec0..b9e2afb2696 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "April 2022" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SS Synopsis diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index ae56a5687ea..51fa43b80e7 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "April 2022" "" "" +.TH "NPM\-SEARCH" "1" "May 2022" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-set-script.1 b/deps/npm/man/man1/npm-set-script.1 index e82c766a83f..96ee6e3e346 100644 --- a/deps/npm/man/man1/npm-set-script.1 +++ b/deps/npm/man/man1/npm-set-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SET\-SCRIPT" "1" "April 2022" "" "" +.TH "NPM\-SET\-SCRIPT" "1" "May 2022" "" "" .SH "NAME" \fBnpm-set-script\fR \- Set tasks in the scripts section of package\.json .SS Synopsis diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index bd17cbf0090..fa87fb7e72b 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "April 2022" "" "" +.TH "NPM\-SHRINKWRAP" "1" "May 2022" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SS Synopsis diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 0bae2d1c1ce..6075139da7c 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "April 2022" "" "" +.TH "NPM\-STAR" "1" "May 2022" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 65ed2aff681..aa290760aad 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "April 2022" "" "" +.TH "NPM\-STARS" "1" "May 2022" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SS Synopsis diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 4f2044a5435..f45e4a2a24c 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "April 2022" "" "" +.TH "NPM\-START" "1" "May 2022" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 487837323a6..a7bb25b3a44 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "April 2022" "" "" +.TH "NPM\-STOP" "1" "May 2022" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 31a27eaaf7b..05f508427a4 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "April 2022" "" "" +.TH "NPM\-TEAM" "1" "May 2022" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SS Synopsis diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index b2e4dd13f09..590d9519df5 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "April 2022" "" "" +.TH "NPM\-TEST" "1" "May 2022" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index b95b41974f5..f2e32ea27fd 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TOKEN" "1" "April 2022" "" "" +.TH "NPM\-TOKEN" "1" "May 2022" "" "" .SH "NAME" \fBnpm-token\fR \- Manage your authentication tokens .SS Synopsis diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 387a037ca43..d918034ba19 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "April 2022" "" "" +.TH "NPM\-UNINSTALL" "1" "May 2022" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 7303db91374..20198422799 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "April 2022" "" "" +.TH "NPM\-UNPUBLISH" "1" "May 2022" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1 index ed84041591e..1fa7b88c64a 100644 --- a/deps/npm/man/man1/npm-unstar.1 +++ b/deps/npm/man/man1/npm-unstar.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNSTAR" "1" "April 2022" "" "" +.TH "NPM\-UNSTAR" "1" "May 2022" "" "" .SH "NAME" \fBnpm-unstar\fR \- Remove an item from your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index e681d6a5543..fa2903a18c2 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "April 2022" "" "" +.TH "NPM\-UPDATE" "1" "May 2022" "" "" .SH "NAME" \fBnpm-update\fR \- Update packages .SS Synopsis @@ -279,10 +279,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBforeground\-scripts\fP .RS 0 diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 8d24aed5274..444c0709759 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "April 2022" "" "" +.TH "NPM\-VERSION" "1" "May 2022" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SS Synopsis diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 877d8a8aa3d..b77c7705667 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "April 2022" "" "" +.TH "NPM\-VIEW" "1" "May 2022" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SS Synopsis diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 607d1a55c5e..d79c448a7a1 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "April 2022" "" "" +.TH "NPM\-WHOAMI" "1" "May 2022" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SS Synopsis diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 3147db3ad76..cbfc8e8ec6a 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,10 +1,10 @@ -.TH "NPM" "1" "April 2022" "" "" +.TH "NPM" "1" "May 2022" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis .SS Version .P -8\.8\.0 +8\.9\.0 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index c1230a94922..51634bc8e8f 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "April 2022" "" "" +.TH "NPX" "1" "May 2022" "" "" .SH "NAME" \fBnpx\fR \- Run a command from a local or remote npm package .SS Synopsis diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index 10e161c6796..74403f97bfc 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "April 2022" "" "" +.TH "FOLDERS" "5" "May 2022" "" "" .SH "NAME" \fBfolders\fR \- Folder Structures Used by npm .SS Description diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index ccccf3a696f..40d8a825c9e 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "April 2022" "" "" +.TH "INSTALL" "5" "May 2022" "" "" .SH "NAME" \fBinstall\fR \- Download and install node and npm .SS Description diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5 index dcc5cca516a..2928a9bae6c 100644 --- a/deps/npm/man/man5/npm-shrinkwrap-json.5 +++ b/deps/npm/man/man5/npm-shrinkwrap-json.5 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "April 2022" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "May 2022" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SS Description diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index 0e3e8edefa2..429bcc3875d 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "April 2022" "" "" +.TH "NPMRC" "5" "May 2022" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SS Description diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index b799144aaa3..47156509747 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "April 2022" "" "" +.TH "PACKAGE\.JSON" "5" "May 2022" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SS Description diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index dd0d17b88cb..569d9c5ae67 100644 --- a/deps/npm/man/man5/package-lock-json.5 +++ b/deps/npm/man/man5/package-lock-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "April 2022" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "May 2022" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SS Description diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 3bb501bcdae..eee1ac6c5f2 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "April 2022" "" "" +.TH "CONFIG" "7" "May 2022" "" "" .SH "NAME" \fBconfig\fR \- More than you probably want to know about npm configuration .SS Description @@ -1284,10 +1284,6 @@ Type: Boolean If set to false, then ignore \fBpackage\-lock\.json\fP files when installing\. This will also prevent \fIwriting\fR \fBpackage\-lock\.json\fP if \fBsave\fP is true\. .P -When package package\-locks are disabled, automatic pruning of extraneous -modules will also be disabled\. To remove extraneous modules with -package\-locks disabled use \fBnpm prune\fP\|\. -.P This configuration does not affect \fBnpm ci\fP\|\. .SS \fBpackage\-lock\-only\fP .RS 0 diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index 7b50a0dc6c5..12e9b535fce 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "April 2022" "" "" +.TH "DEVELOPERS" "7" "May 2022" "" "" .SH "NAME" \fBdevelopers\fR \- Developer Guide .SS Description diff --git a/deps/npm/man/man7/logging.7 b/deps/npm/man/man7/logging.7 index 41634c61a61..ea0a7a8f187 100644 --- a/deps/npm/man/man7/logging.7 +++ b/deps/npm/man/man7/logging.7 @@ -1,4 +1,4 @@ -.TH "LOGGING" "7" "April 2022" "" "" +.TH "LOGGING" "7" "May 2022" "" "" .SH "NAME" \fBLogging\fR \- Why, What & How We Log .SS Description diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index 0df92677495..84c949949dc 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "April 2022" "" "" +.TH "ORGS" "7" "May 2022" "" "" .SH "NAME" \fBorgs\fR \- Working with Teams & Orgs .SS Description diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index dcdb33934be..eff3f31ab64 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "April 2022" "" "" +.TH "REGISTRY" "7" "May 2022" "" "" .SH "NAME" \fBregistry\fR \- The JavaScript Package Registry .SS Description diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index 5743d339ecd..27bb1de4c99 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "April 2022" "" "" +.TH "REMOVAL" "7" "May 2022" "" "" .SH "NAME" \fBremoval\fR \- Cleaning the Slate .SS Synopsis diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index 0fd24d0fcb6..5d4f0e7270a 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "April 2022" "" "" +.TH "SCOPE" "7" "May 2022" "" "" .SH "NAME" \fBscope\fR \- Scoped packages .SS Description diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 9cedf62bc8c..2ced12c63d9 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "April 2022" "" "" +.TH "SCRIPTS" "7" "May 2022" "" "" .SH "NAME" \fBscripts\fR \- How npm handles the "scripts" field .SS Description diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index b5d6b3bde3d..494b4068621 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "April 2022" "" "" +.TH "WORKSPACES" "7" "May 2022" "" "" .SH "NAME" \fBworkspaces\fR \- Working with workspaces .SS Description diff --git a/deps/npm/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/cacache/lib/content/read.js index 8bffb2af83c..0aeb454725b 100644 --- a/deps/npm/node_modules/cacache/lib/content/read.js +++ b/deps/npm/node_modules/cacache/lib/content/read.js @@ -10,6 +10,7 @@ const Pipeline = require('minipass-pipeline') const lstat = util.promisify(fs.lstat) const readFile = util.promisify(fs.readFile) +const copyFile = util.promisify(fs.copyFile) module.exports = read @@ -90,12 +91,8 @@ function readStream (cache, integrity, opts = {}) { return stream } -let copyFile -if (fs.copyFile) { - module.exports.copy = copy - module.exports.copy.sync = copySync - copyFile = util.promisify(fs.copyFile) -} +module.exports.copy = copy +module.exports.copy.sync = copySync function copy (cache, integrity, dest) { return withContentSri(cache, integrity, (cpath, sri) => { diff --git a/deps/npm/node_modules/cacache/lib/content/write.js b/deps/npm/node_modules/cacache/lib/content/write.js index a71e81ad5e1..b0aa18c12ba 100644 --- a/deps/npm/node_modules/cacache/lib/content/write.js +++ b/deps/npm/node_modules/cacache/lib/content/write.js @@ -13,34 +13,37 @@ const path = require('path') const rimraf = util.promisify(require('rimraf')) const ssri = require('ssri') const uniqueFilename = require('unique-filename') -const { disposer } = require('./../util/disposer') const fsm = require('fs-minipass') const writeFile = util.promisify(fs.writeFile) module.exports = write -function write (cache, data, opts = {}) { +async function write (cache, data, opts = {}) { const { algorithms, size, integrity } = opts if (algorithms && algorithms.length > 1) { throw new Error('opts.algorithms only supports a single algorithm for now') } if (typeof size === 'number' && data.length !== size) { - return Promise.reject(sizeError(size, data.length)) + throw sizeError(size, data.length) } const sri = ssri.fromData(data, algorithms ? { algorithms } : {}) if (integrity && !ssri.checkData(data, integrity, opts)) { - return Promise.reject(checksumError(integrity, sri)) + throw checksumError(integrity, sri) } - return disposer(makeTmp(cache, opts), makeTmpDisposer, - (tmp) => { - return writeFile(tmp.target, data, { flag: 'wx' }) - .then(() => moveToDestination(tmp, cache, sri, opts)) - }) - .then(() => ({ integrity: sri, size: data.length })) + const tmp = await makeTmp(cache, opts) + try { + await writeFile(tmp.target, data, { flag: 'wx' }) + await moveToDestination(tmp, cache, sri, opts) + return { integrity: sri, size: data.length } + } finally { + if (!tmp.moved) { + await rimraf(tmp.target) + } + } } module.exports.stream = writeStream @@ -94,18 +97,22 @@ function writeStream (cache, opts = {}) { return new CacacheWriteStream(cache, opts) } -function handleContent (inputStream, cache, opts) { - return disposer(makeTmp(cache, opts), makeTmpDisposer, (tmp) => { - return pipeToTmp(inputStream, cache, tmp.target, opts) - .then((res) => { - return moveToDestination( - tmp, - cache, - res.integrity, - opts - ).then(() => res) - }) - }) +async function handleContent (inputStream, cache, opts) { + const tmp = await makeTmp(cache, opts) + try { + const res = await pipeToTmp(inputStream, cache, tmp.target, opts) + await moveToDestination( + tmp, + cache, + res.integrity, + opts + ) + return res + } finally { + if (!tmp.moved) { + await rimraf(tmp.target) + } + } } function pipeToTmp (inputStream, cache, tmpTarget, opts) { @@ -136,11 +143,7 @@ function pipeToTmp (inputStream, cache, tmpTarget, opts) { outStream ) - return pipeline.promise() - .then(() => ({ integrity, size })) - .catch(er => rimraf(tmpTarget).then(() => { - throw er - })) + return pipeline.promise().then(() => ({ integrity, size })) } function makeTmp (cache, opts) { @@ -151,14 +154,6 @@ function makeTmp (cache, opts) { })) } -function makeTmpDisposer (tmp) { - if (tmp.moved) { - return Promise.resolve() - } - - return rimraf(tmp.target) -} - function moveToDestination (tmp, cache, sri, opts) { const destination = contentPath(cache, sri) const destDir = path.dirname(destination) diff --git a/deps/npm/node_modules/cacache/lib/entry-index.js b/deps/npm/node_modules/cacache/lib/entry-index.js index 426778b8509..9d4485624ac 100644 --- a/deps/npm/node_modules/cacache/lib/entry-index.js +++ b/deps/npm/node_modules/cacache/lib/entry-index.js @@ -8,7 +8,6 @@ const path = require('path') const ssri = require('ssri') const uniqueFilename = require('unique-filename') -const { disposer } = require('./util/disposer') const contentPath = require('./content/path') const fixOwner = require('./util/fix-owner') const hashToSegments = require('./util/hash-to-segments') @@ -102,7 +101,12 @@ async function compact (cache, key, matchFn, opts = {}) { } // write the file atomically - await disposer(setup(), teardown, write) + const tmp = await setup() + try { + await write(tmp) + } finally { + await teardown(tmp) + } // we reverse the list we generated such that the newest // entries come first in order to make looping through them easier diff --git a/deps/npm/node_modules/cacache/lib/get.js b/deps/npm/node_modules/cacache/lib/get.js index d9d4bf4c641..58f357b1da3 100644 --- a/deps/npm/node_modules/cacache/lib/get.js +++ b/deps/npm/node_modules/cacache/lib/get.js @@ -3,15 +3,11 @@ const Collect = require('minipass-collect') const Minipass = require('minipass') const Pipeline = require('minipass-pipeline') -const fs = require('fs') -const util = require('util') const index = require('./entry-index') const memo = require('./memoization') const read = require('./content/read') -const writeFile = util.promisify(fs.writeFile) - function getData (cache, key, opts = {}) { const { integrity, memoize, size } = opts const memoized = memo.get(cache, key, opts) @@ -209,42 +205,25 @@ function info (cache, key, opts = {}) { module.exports.info = info function copy (cache, key, dest, opts = {}) { - if (read.copy) { - return index.find(cache, key, opts).then((entry) => { - if (!entry) { - throw new index.NotFoundError(cache, key) - } - return read.copy(cache, entry.integrity, dest, opts) - .then(() => { - return { - metadata: entry.metadata, - size: entry.size, - integrity: entry.integrity, - } - }) - }) - } - - return getData(cache, key, opts).then((res) => { - return writeFile(dest, res.data).then(() => { - return { - metadata: res.metadata, - size: res.size, - integrity: res.integrity, - } - }) + return index.find(cache, key, opts).then((entry) => { + if (!entry) { + throw new index.NotFoundError(cache, key) + } + return read.copy(cache, entry.integrity, dest, opts) + .then(() => { + return { + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity, + } + }) }) } + module.exports.copy = copy function copyByDigest (cache, key, dest, opts = {}) { - if (read.copy) { - return read.copy(cache, key, dest, opts).then(() => key) - } - - return getDataByDigest(cache, key, opts).then((res) => { - return writeFile(dest, res).then(() => key) - }) + return read.copy(cache, key, dest, opts).then(() => key) } module.exports.copy.byDigest = copyByDigest diff --git a/deps/npm/node_modules/cacache/lib/put.js b/deps/npm/node_modules/cacache/lib/put.js index d6904fa3012..eed51874f9f 100644 --- a/deps/npm/node_modules/cacache/lib/put.js +++ b/deps/npm/node_modules/cacache/lib/put.js @@ -37,6 +37,7 @@ function putStream (cache, key, opts = {}) { opts = putOpts(opts) let integrity let size + let error let memoData const pipeline = new Pipeline() @@ -58,6 +59,9 @@ function putStream (cache, key, opts = {}) { .on('size', (s) => { size = s }) + .on('error', (err) => { + error = err + }) pipeline.push(contentStream) @@ -65,21 +69,17 @@ function putStream (cache, key, opts = {}) { // and memoize if we're doing that pipeline.push(new Flush({ flush () { - return index - .insert(cache, key, integrity, { ...opts, size }) - .then((entry) => { - if (memoize && memoData) { - memo.put(cache, entry, memoData, opts) - } - - if (integrity) { + if (!error) { + return index + .insert(cache, key, integrity, { ...opts, size }) + .then((entry) => { + if (memoize && memoData) { + memo.put(cache, entry, memoData, opts) + } pipeline.emit('integrity', integrity) - } - - if (size) { pipeline.emit('size', size) - } - }) + }) + } }, })) diff --git a/deps/npm/node_modules/cacache/lib/util/disposer.js b/deps/npm/node_modules/cacache/lib/util/disposer.js deleted file mode 100644 index 52d7d3edda7..00000000000 --- a/deps/npm/node_modules/cacache/lib/util/disposer.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict' - -module.exports.disposer = disposer - -function disposer (creatorFn, disposerFn, fn) { - const runDisposer = (resource, result, shouldThrow = false) => { - return disposerFn(resource) - .then( - // disposer resolved, do something with original fn's promise - () => { - if (shouldThrow) { - throw result - } - - return result - }, - // Disposer fn failed, crash process - (err) => { - throw err - // Or process.exit? - }) - } - - return creatorFn - .then((resource) => { - // fn(resource) can throw, so wrap in a promise here - return Promise.resolve().then(() => fn(resource)) - .then((result) => runDisposer(resource, result)) - .catch((err) => runDisposer(resource, err, true)) - }) -} diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index 9eb646df76b..cd7e4de5e0c 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "16.0.6", + "version": "16.0.7", "cache-version": { "content": "2", "index": "5" @@ -12,7 +12,6 @@ "lib/" ], "scripts": { - "benchmarks": "node test/benchmarks", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", @@ -71,10 +70,6 @@ "devDependencies": { "@npmcli/eslint-config": "^3.0.1", "@npmcli/template-oss": "3.4.1", - "benchmark": "^2.1.4", - "chalk": "^4.1.2", - "require-inject": "^1.4.4", - "tacks": "^1.3.0", "tap": "^16.0.0" }, "tap": { diff --git a/deps/npm/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/pacote/lib/fetcher.js index 65e97e20520..d88724c5d19 100644 --- a/deps/npm/node_modules/pacote/lib/fetcher.js +++ b/deps/npm/node_modules/pacote/lib/fetcher.js @@ -105,8 +105,15 @@ class FetcherBase { this[_readPackageJson] = readPackageJsonFast } - // config values: npmjs (default), never - this.replaceRegistryHost = opts.replaceRegistryHost === 'never' ? 'never' : 'npmjs' + // config values: npmjs (default), never, always + // we don't want to mutate the original value + if (opts.replaceRegistryHost !== 'never' + && opts.replaceRegistryHost !== 'always' + ) { + this.replaceRegistryHost = 'npmjs' + } else { + this.replaceRegistryHost = opts.replaceRegistryHost + } this.defaultTag = opts.defaultTag || 'latest' this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org') diff --git a/deps/npm/node_modules/pacote/lib/registry.js b/deps/npm/node_modules/pacote/lib/registry.js index b4f890d310d..e8ca16f596d 100644 --- a/deps/npm/node_modules/pacote/lib/registry.js +++ b/deps/npm/node_modules/pacote/lib/registry.js @@ -165,6 +165,9 @@ class RegistryFetcher extends Fetcher { } if (this.integrity) { mani._integrity = String(this.integrity) + if (dist.signatures) { + mani._signatures = dist.signatures + } } this.package = rpj.normalize(mani) return this.package diff --git a/deps/npm/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/pacote/lib/remote.js index 3404ea94749..14e687805d4 100644 --- a/deps/npm/node_modules/pacote/lib/remote.js +++ b/deps/npm/node_modules/pacote/lib/remote.js @@ -5,7 +5,7 @@ const pacoteVersion = require('../package.json').version const fetch = require('npm-registry-fetch') const Minipass = require('minipass') // The default registry URL is a string of great magic. -const magic = /^https?:\/\/registry\.npmjs\.org\// +const magicHost = 'https://registry.npmjs.org' const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') const _headers = Symbol('_headers') @@ -13,10 +13,13 @@ class RemoteFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) this.resolved = this.spec.fetchSpec - if (this.replaceRegistryHost === 'npmjs' - && magic.test(this.resolved) - && !magic.test(this.registry + '/')) { - this.resolved = this.resolved.replace(magic, this.registry + '/') + const resolvedURL = new URL(this.resolved) + if ( + (this.replaceRegistryHost === 'npmjs' + && resolvedURL.origin === magicHost) + || this.replaceRegistryHost === 'always' + ) { + this.resolved = new URL(resolvedURL.pathname, this.registry).href } // nam is a fermented pork sausage that is good to eat diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index af8166d4ea1..2f4323c4414 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "13.1.1", + "version": "13.3.0", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -26,11 +26,11 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.4.3", "hosted-git-info": "^5.0.0", "mutate-fs": "^2.1.1", "nock": "^13.2.4", - "npm-registry-mock": "^1.3.1", + "npm-registry-mock": "^1.3.2", "tap": "^16.0.1" }, "files": [ @@ -74,7 +74,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2", + "version": "3.4.3", "windowsCI": false } } diff --git a/deps/npm/package.json b/deps/npm/package.json index e1f68321931..d3e55ad623a 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "8.8.0", + "version": "8.9.0", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -65,7 +65,7 @@ "@npmcli/run-script": "^3.0.1", "abbrev": "~1.1.1", "archy": "~1.0.0", - "cacache": "^16.0.6", + "cacache": "^16.0.7", "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^4.0.0", @@ -107,7 +107,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "^6.0.2", "opener": "^1.5.2", - "pacote": "^13.1.1", + "pacote": "^13.3.0", "parse-conflict-json": "^2.0.2", "proc-log": "^2.0.1", "qrcode-terminal": "^0.12.0", @@ -213,7 +213,7 @@ "test": "tap", "test-all": "npm run test --if-present --workspaces --include-workspace-root", "snap": "tap", - "postsnap": "make -s mandocs", + "postsnap": "make -s docs", "test:nocleanup": "NO_TEST_CLEANUP=1 npm run test --", "sudotest": "sudo npm run test --", "sudotest:nocleanup": "sudo NO_TEST_CLEANUP=1 npm run test --", diff --git a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 37349cbe01e..eccb06580d9 100644 --- a/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -596,6 +596,8 @@ npm owner ls [<@scope>/]<pkg> Options: [--registry <registry>] [--otp <otp>] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: author diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index ff00f9a0f9b..42db6ce030b 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -1302,10 +1302,6 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for packa If set to false, then ignore \`package-lock.json\` files when installing. This will also prevent _writing_ \`package-lock.json\` if \`save\` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use \`npm prune\`. - This configuration does not affect \`npm ci\`. ` diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index 6740b94c772..d0ce3a26f76 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -1093,10 +1093,6 @@ The package to install for [\`npm exec\`](/commands/npm-exec) If set to false, then ignore \`package-lock.json\` files when installing. This will also prevent _writing_ \`package-lock.json\` if \`save\` is true. -When package package-locks are disabled, automatic pruning of extraneous -modules will also be disabled. To remove extraneous modules with -package-locks disabled use \`npm prune\`. - This configuration does not affect \`npm ci\`. <!-- automatically generated, do not edit manually --> diff --git a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index 941def42ee1..bbb3563405d 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -664,6 +664,8 @@ All commands: Options: [--registry <registry>] [--otp <otp>] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] alias: author diff --git a/deps/npm/test/coverage-map.js b/deps/npm/test/coverage-map.js index 0ea90981860..9a289b6489e 100644 --- a/deps/npm/test/coverage-map.js +++ b/deps/npm/test/coverage-map.js @@ -12,6 +12,7 @@ const coverageMap = (filename) => { if (/^test\/lib\/commands/.test(filename) || filename === 'test/lib/npm.js') { return [ filename.replace(/^test\//, ''), + 'lib/npm.js', 'lib/base-command.js', 'lib/exec/get-workspace-location-msg.js', ] diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js index 4263dc8fbed..c9701ebc237 100644 --- a/deps/npm/test/fixtures/mock-npm.js +++ b/deps/npm/test/fixtures/mock-npm.js @@ -132,7 +132,9 @@ const LoadMockNpm = async (t, { }) const npm = init ? new Npm() : null - t.teardown(() => npm && npm.unload()) + t.teardown(() => { + npm && npm.unload() + }) if (load) { await npm.load() diff --git a/deps/npm/test/lib/commands/exec.js b/deps/npm/test/lib/commands/exec.js index d6e598d568d..1117885b917 100644 --- a/deps/npm/test/lib/commands/exec.js +++ b/deps/npm/test/lib/commands/exec.js @@ -385,6 +385,64 @@ t.test('npm exec foo, not present locally or in central loc', async t => { ]) }) +t.test('npm exec foo, packageLockOnly set to true', async t => { + const path = t.testdir() + const installDir = resolve('npx-cache-dir/f7fbba6e0636f890') + npm.localPrefix = path + npm.config.set('package-lock-only', true) + t.teardown(() => { + npm.config.set('package-lock-only', false) + }) + + ARB_ACTUAL_TREE[path] = { + inventory: { + query () { + return new Set() + }, + }, + } + ARB_ACTUAL_TREE[installDir] = { + inventory: { + query () { + return new Set() + }, + }, + } + MANIFESTS.foo = { + name: 'foo', + version: '1.2.3', + bin: { + foo: 'foo', + }, + _from: 'foo@', + } + await exec.exec(['foo', 'one arg', 'two arg']) + t.strictSame(MKDIRPS, [installDir], 'need to make install dir') + t.match(ARB_CTOR, [{ + path, + packageLockOnly: false, + }]) + t.match(ARB_REIFY, [{ + add: ['foo@'], + legacyPeerDeps: false, + packageLockOnly: false, + }], 'need to install foo@') + t.equal(PROGRESS_ENABLED, true, 'progress re-enabled') + const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}` + t.match(RUN_SCRIPTS, [ + { + pkg: { scripts: { npx: 'foo' } }, + args: ['one arg', 'two arg'], + banner: false, + path: process.cwd(), + stdioString: true, + event: 'npx', + env: { PATH }, + stdio: 'inherit', + }, + ]) +}) + t.test('npm exec foo, not present locally but in central loc', async t => { const path = t.testdir() const installDir = resolve('npx-cache-dir/f7fbba6e0636f890') diff --git a/deps/npm/test/lib/commands/owner.js b/deps/npm/test/lib/commands/owner.js index d80ce36fece..800d5b96a58 100644 --- a/deps/npm/test/lib/commands/owner.js +++ b/deps/npm/test/lib/commands/owner.js @@ -2,6 +2,7 @@ const t = require('tap') const { load: loadMockNpm } = require('../../fixtures/mock-npm.js') const MockRegistry = require('../../fixtures/mock-registry.js') +const path = require('path') const npa = require('npm-package-arg') const packageName = '@npmcli/test-package' const spec = npa(packageName) @@ -12,6 +13,42 @@ const maintainers = [ { email: 'test-user-b@npmjs.org', name: 'test-user-b' }, ] +const workspaceFixture = { + 'package.json': JSON.stringify({ + name: packageName, + version: '1.2.3-test', + workspaces: ['workspace-a', 'workspace-b', 'workspace-c'], + }), + 'workspace-a': { + 'package.json': JSON.stringify({ + name: 'workspace-a', + version: '1.2.3-a', + }), + }, + 'workspace-b': { + 'package.json': JSON.stringify({ + name: 'workspace-b', + version: '1.2.3-n', + }), + }, + 'workspace-c': JSON.stringify({ + 'package.json': { + name: 'workspace-n', + version: '1.2.3-n', + }, + }), +} + +function registryPackage (t, registry, name) { + const mockRegistry = new MockRegistry({ tap: t, registry }) + + const manifest = mockRegistry.manifest({ + name, + packuments: [{ maintainers, version: '1.0.0' }], + }) + mockRegistry.package({ manifest }) +} + t.test('owner no args', async t => { const { npm } = await loadMockNpm(t) await t.rejects( @@ -429,6 +466,158 @@ t.test('owner rm <user> no cwd package', async t => { ) }) +t.test('workspaces', async t => { + t.test('owner no args --workspace', async t => { + const { npm } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + }) + npm.config.set('workspace', ['workspace-a']) + await t.rejects( + npm.exec('owner', []), + { code: 'EUSAGE' }, + 'rejects with usage' + ) + }) + + t.test('owner ls implicit workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => path.join(prefix, 'workspace-a'), + }), + }) + registryPackage(t, npm.config.get('registry'), 'workspace-a') + await npm.exec('owner', ['ls']) + t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) + }) + + t.test('owner ls explicit workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => prefix, + }), + }) + npm.config.set('workspace', ['workspace-a']) + registryPackage(t, npm.config.get('registry'), 'workspace-a') + await npm.exec('owner', ['ls']) + t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) + }) + + t.test('owner ls <pkg> implicit workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => path.join(prefix, 'workspace-a'), + }), + }) + registryPackage(t, npm.config.get('registry'), packageName) + await npm.exec('owner', ['ls', packageName]) + t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) + }) + + t.test('owner ls <pkg> explicit workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => prefix, + }), + }) + npm.config.set('workspace', ['workspace-a']) + registryPackage(t, npm.config.get('registry'), packageName) + await npm.exec('owner', ['ls', packageName]) + t.match(joinedOutput(), maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) + }) + + t.test('owner add implicit workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => path.join(prefix, 'workspace-a'), + }), + }) + const username = 'foo' + const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) + + const manifest = registry.manifest({ + name: 'workspace-a', + packuments: [{ maintainers, version: '1.0.0' }], + }) + registry.package({ manifest }) + registry.couchuser({ username }) + registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { + t.match(body, { + _id: manifest._id, + _rev: manifest._rev, + maintainers: [ + ...manifest.maintainers, + { name: username, email: '' }, + ], + }) + return true + }).reply(200, {}) + await npm.exec('owner', ['add', username]) + t.equal(joinedOutput(), `+ ${username} (workspace-a)`) + }) + + t.test('owner add --workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + }) + npm.config.set('workspace', ['workspace-a']) + const username = 'foo' + const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) + + const manifest = registry.manifest({ + name: 'workspace-a', + packuments: [{ maintainers, version: '1.0.0' }], + }) + registry.package({ manifest }) + registry.couchuser({ username }) + registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { + t.match(body, { + _id: manifest._id, + _rev: manifest._rev, + maintainers: [ + ...manifest.maintainers, + { name: username, email: '' }, + ], + }) + return true + }).reply(200, {}) + await npm.exec('owner', ['add', username]) + t.equal(joinedOutput(), `+ ${username} (workspace-a)`) + }) + + t.test('owner rm --workspace', async t => { + const { npm, joinedOutput } = await loadMockNpm(t, { + prefixDir: workspaceFixture, + globals: ({ prefix }) => ({ + 'process.cwd': () => path.join(prefix, 'workspace-a'), + }), + }) + const registry = new MockRegistry({ tap: t, registry: npm.config.get('registry') }) + + const username = maintainers[0].name + const manifest = registry.manifest({ + name: 'workspace-a', + packuments: [{ maintainers, version: '1.0.0' }], + }) + registry.package({ manifest }) + registry.couchuser({ username }) + registry.nock.put(`/workspace-a/-rev/${manifest._rev}`, body => { + t.match(body, { + _id: manifest._id, + _rev: manifest._rev, + maintainers: maintainers.slice(1), + }) + return true + }).reply(200, {}) + await npm.exec('owner', ['rm', username]) + t.equal(joinedOutput(), `- ${username} (workspace-a)`) + }) +}) + t.test('completion', async t => { t.test('basic commands', async t => { const { npm } = await loadMockNpm(t) diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index 1966ca96000..566cbca20f6 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -620,7 +620,7 @@ t.test('implicit workspace rejection', async t => { }), }) await t.rejects( - mock.npm.exec('owner', []), + mock.npm.exec('team', []), /This command does not support workspaces/ ) }) |