Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authornpm team <ops+robot@npmjs.com>2022-04-01 01:43:17 +0300
committerMichaƫl Zasso <targos@protonmail.com>2022-04-09 13:56:30 +0300
commit2d84620f867cfc18be1a50f4e5f076dd79ba22e4 (patch)
tree9c8cc8a89fa79d4d8ac428b7d48ed2bb11f26cb3 /deps
parentbe011858446f7ec4b914fd1af2cb7555bd04877b (diff)
deps: upgrade npm to 8.6.0
PR-URL: https://github.com/nodejs/node/pull/42550 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/npm/docs/content/commands/npm-install.md2
-rw-r--r--deps/npm/docs/content/commands/npm-search.md2
-rw-r--r--deps/npm/docs/content/commands/npm-uninstall.md2
-rw-r--r--deps/npm/docs/content/commands/npm-version.md11
-rw-r--r--deps/npm/docs/content/commands/npm-view.md2
-rw-r--r--deps/npm/docs/content/using-npm/config.md30
-rw-r--r--deps/npm/docs/content/using-npm/logging.md33
-rw-r--r--deps/npm/docs/content/using-npm/scripts.md2
-rw-r--r--deps/npm/docs/output/commands/npm-install.html2
-rw-r--r--deps/npm/docs/output/commands/npm-ls.html2
-rw-r--r--deps/npm/docs/output/commands/npm-search.html2
-rw-r--r--deps/npm/docs/output/commands/npm-uninstall.html2
-rw-r--r--deps/npm/docs/output/commands/npm-version.html11
-rw-r--r--deps/npm/docs/output/commands/npm-view.html2
-rw-r--r--deps/npm/docs/output/commands/npm.html2
-rw-r--r--deps/npm/docs/output/using-npm/config.html27
-rw-r--r--deps/npm/docs/output/using-npm/logging.html25
-rw-r--r--deps/npm/docs/output/using-npm/scripts.html2
-rw-r--r--deps/npm/lib/base-command.js48
-rw-r--r--deps/npm/lib/cli.js32
-rw-r--r--deps/npm/lib/commands/bin.js12
-rw-r--r--deps/npm/lib/commands/birthday.js2
-rw-r--r--deps/npm/lib/commands/completion.js9
-rw-r--r--deps/npm/lib/commands/doctor.js4
-rw-r--r--deps/npm/lib/commands/edit.js27
-rw-r--r--deps/npm/lib/commands/exec.js1
-rw-r--r--deps/npm/lib/commands/help.js28
-rw-r--r--deps/npm/lib/commands/owner.js2
-rw-r--r--deps/npm/lib/commands/run-script.js3
-rw-r--r--deps/npm/lib/commands/unpublish.js90
-rw-r--r--deps/npm/lib/commands/version.js35
-rw-r--r--deps/npm/lib/commands/view.js3
-rw-r--r--deps/npm/lib/lifecycle-cmd.js1
-rw-r--r--deps/npm/lib/npm.js346
-rw-r--r--deps/npm/lib/utils/cmd-list.js172
-rw-r--r--deps/npm/lib/utils/config/definitions.js30
-rw-r--r--deps/npm/lib/utils/deref-command.js31
-rw-r--r--deps/npm/lib/utils/error-message.js2
-rw-r--r--deps/npm/lib/utils/exit-handler.js103
-rw-r--r--deps/npm/lib/utils/is-windows-bash.js3
-rw-r--r--deps/npm/lib/utils/is-windows-shell.js3
-rw-r--r--deps/npm/lib/utils/is-windows.js7
-rw-r--r--deps/npm/lib/utils/log-file.js74
-rw-r--r--deps/npm/lib/utils/npm-usage.js2
-rw-r--r--deps/npm/lib/utils/otplease.js10
-rw-r--r--deps/npm/lib/utils/path.js4
-rw-r--r--deps/npm/lib/utils/replace-info.js46
-rw-r--r--deps/npm/lib/utils/split-package-names.js25
-rw-r--r--deps/npm/lib/utils/timers.js45
-rw-r--r--deps/npm/lib/utils/unsupported.js39
-rw-r--r--deps/npm/lib/utils/update-notifier.js2
-rw-r--r--deps/npm/lib/utils/usage.js32
-rw-r--r--deps/npm/lib/utils/with-chown-sync.js13
-rw-r--r--deps/npm/man/man1/npm-install.12
-rw-r--r--deps/npm/man/man1/npm-ls.12
-rw-r--r--deps/npm/man/man1/npm-search.12
-rw-r--r--deps/npm/man/man1/npm-uninstall.12
-rw-r--r--deps/npm/man/man1/npm-version.111
-rw-r--r--deps/npm/man/man1/npm-view.12
-rw-r--r--deps/npm/man/man1/npm.12
-rw-r--r--deps/npm/man/man7/config.730
-rw-r--r--deps/npm/man/man7/logging.738
-rw-r--r--deps/npm/man/man7/scripts.72
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js24
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js5
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/tracker.js10
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/package.json26
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/common/owner-sync.js92
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/copy-file.js12
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/fs.js12
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/index.js2
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js17
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js11
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/with-owner-sync.js21
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/with-owner.js21
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js2
-rw-r--r--deps/npm/node_modules/@npmcli/fs/lib/write-file.js11
-rw-r--r--deps/npm/node_modules/@npmcli/fs/package.json29
-rw-r--r--deps/npm/node_modules/builtins/History.md39
-rw-r--r--deps/npm/node_modules/builtins/Readme.md35
-rw-r--r--deps/npm/node_modules/builtins/builtins.json35
-rw-r--r--deps/npm/node_modules/builtins/index.js79
-rw-r--r--deps/npm/node_modules/builtins/package.json18
-rw-r--r--deps/npm/node_modules/builtins/test.js5
-rw-r--r--deps/npm/node_modules/cacache/package.json33
-rw-r--r--deps/npm/node_modules/debug/package.json2
-rw-r--r--deps/npm/node_modules/debug/src/common.js2
-rw-r--r--deps/npm/node_modules/gauge/lib/index.js3
-rw-r--r--deps/npm/node_modules/gauge/package.json24
-rw-r--r--deps/npm/node_modules/init-package-json/lib/default-input.js34
-rw-r--r--deps/npm/node_modules/init-package-json/lib/init-package-json.js54
-rw-r--r--deps/npm/node_modules/init-package-json/package.json26
-rw-r--r--deps/npm/node_modules/just-diff-apply/index.d.ts17
-rw-r--r--deps/npm/node_modules/just-diff-apply/index.js78
-rw-r--r--deps/npm/node_modules/just-diff-apply/index.mjs25
-rw-r--r--deps/npm/node_modules/just-diff-apply/index.tests.ts108
-rw-r--r--deps/npm/node_modules/just-diff-apply/package.json3
-rw-r--r--deps/npm/node_modules/libnpmaccess/lib/index.js2
-rw-r--r--deps/npm/node_modules/libnpmaccess/package.json22
-rw-r--r--deps/npm/node_modules/libnpmdiff/package.json21
-rw-r--r--deps/npm/node_modules/libnpmexec/lib/file-exists.js2
-rw-r--r--deps/npm/node_modules/libnpmexec/lib/index.js4
-rw-r--r--deps/npm/node_modules/libnpmexec/package.json20
-rw-r--r--deps/npm/node_modules/libnpmfund/lib/index.js4
-rw-r--r--deps/npm/node_modules/libnpmfund/package.json20
-rw-r--r--deps/npm/node_modules/libnpmhook/package.json22
-rw-r--r--deps/npm/node_modules/libnpmorg/package.json22
-rw-r--r--deps/npm/node_modules/libnpmpack/package.json20
-rw-r--r--deps/npm/node_modules/libnpmpublish/package.json22
-rw-r--r--deps/npm/node_modules/libnpmsearch/package.json22
-rw-r--r--deps/npm/node_modules/libnpmteam/package.json22
-rw-r--r--deps/npm/node_modules/libnpmversion/package.json20
-rw-r--r--deps/npm/node_modules/lru-cache/index.js262
-rw-r--r--deps/npm/node_modules/lru-cache/package.json3
-rw-r--r--deps/npm/node_modules/make-fetch-happen/lib/agent.js5
-rw-r--r--deps/npm/node_modules/make-fetch-happen/lib/cache/index.js4
-rw-r--r--deps/npm/node_modules/make-fetch-happen/lib/dns.js49
-rw-r--r--deps/npm/node_modules/make-fetch-happen/lib/options.js4
-rw-r--r--deps/npm/node_modules/make-fetch-happen/package.json32
-rw-r--r--deps/npm/node_modules/minipass-fetch/lib/body.js6
-rw-r--r--deps/npm/node_modules/minipass-fetch/lib/index.js5
-rw-r--r--deps/npm/node_modules/minipass-fetch/package.json26
-rw-r--r--deps/npm/node_modules/npm-audit-report/lib/colors.js2
-rw-r--r--deps/npm/node_modules/npm-audit-report/lib/exit-code.js2
-rw-r--r--deps/npm/node_modules/npm-audit-report/lib/index.js12
-rw-r--r--deps/npm/node_modules/npm-audit-report/lib/reporters/detail.js22
-rw-r--r--deps/npm/node_modules/npm-audit-report/lib/reporters/install.js10
-rw-r--r--deps/npm/node_modules/npm-audit-report/package.json27
-rw-r--r--deps/npm/node_modules/npm-package-arg/README.md86
-rw-r--r--deps/npm/node_modules/npm-package-arg/package.json26
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/lib/check-response.js15
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/lib/clean-url.js24
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/lib/index.js6
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/lib/silentlog.js14
-rw-r--r--deps/npm/node_modules/npm-registry-fetch/package.json33
-rw-r--r--deps/npm/node_modules/parse-conflict-json/package.json29
-rw-r--r--deps/npm/node_modules/proc-log/package.json29
-rw-r--r--deps/npm/node_modules/validate-npm-package-name/lib/index.js (renamed from deps/npm/node_modules/validate-npm-package-name/index.js)22
-rw-r--r--deps/npm/node_modules/validate-npm-package-name/package.json44
-rw-r--r--deps/npm/node_modules/validate-npm-package-name/test/index.js109
-rw-r--r--deps/npm/package.json58
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs136
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs4
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/unpublish.js.test.cjs14
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/version.js.test.cjs94
-rw-r--r--deps/npm/tap-snapshots/test/lib/load-all-commands.js.test.cjs163
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs517
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs30
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs30
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs96
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs54
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/log-file.js.test.cjs118
-rw-r--r--deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs274
-rw-r--r--deps/npm/test/coverage-map.js27
-rw-r--r--deps/npm/test/fixtures/mock-npm.js33
-rw-r--r--deps/npm/test/fixtures/sandbox.js2
-rw-r--r--deps/npm/test/fixtures/tnock.js10
-rw-r--r--deps/npm/test/fixtures/tspawk.js16
-rw-r--r--deps/npm/test/lib/cli.js194
-rw-r--r--deps/npm/test/lib/commands/access.js16
-rw-r--r--deps/npm/test/lib/commands/bin.js86
-rw-r--r--deps/npm/test/lib/commands/cache.js2
-rw-r--r--deps/npm/test/lib/commands/completion.js2
-rw-r--r--deps/npm/test/lib/commands/config.js12
-rw-r--r--deps/npm/test/lib/commands/diff.js1
-rw-r--r--deps/npm/test/lib/commands/doctor.js14
-rw-r--r--deps/npm/test/lib/commands/edit.js201
-rw-r--r--deps/npm/test/lib/commands/exec.js8
-rw-r--r--deps/npm/test/lib/commands/explore.js1
-rw-r--r--deps/npm/test/lib/commands/help.js38
-rw-r--r--deps/npm/test/lib/commands/init.js1
-rw-r--r--deps/npm/test/lib/commands/owner.js1
-rw-r--r--deps/npm/test/lib/commands/profile.js1
-rw-r--r--deps/npm/test/lib/commands/restart.js7
-rw-r--r--deps/npm/test/lib/commands/run-script.js6
-rw-r--r--deps/npm/test/lib/commands/search.js1
-rw-r--r--deps/npm/test/lib/commands/star.js5
-rw-r--r--deps/npm/test/lib/commands/stars.js1
-rw-r--r--deps/npm/test/lib/commands/start.js7
-rw-r--r--deps/npm/test/lib/commands/stop.js7
-rw-r--r--deps/npm/test/lib/commands/team.js1
-rw-r--r--deps/npm/test/lib/commands/test.js7
-rw-r--r--deps/npm/test/lib/commands/unpublish.js720
-rw-r--r--deps/npm/test/lib/commands/update.js1
-rw-r--r--deps/npm/test/lib/commands/version.js117
-rw-r--r--deps/npm/test/lib/load-all-commands.js7
-rw-r--r--deps/npm/test/lib/load-all.js31
-rw-r--r--deps/npm/test/lib/npm.js305
-rw-r--r--deps/npm/test/lib/utils/config/definitions.js18
-rw-r--r--deps/npm/test/lib/utils/deref-command.js9
-rw-r--r--deps/npm/test/lib/utils/exit-handler.js83
-rw-r--r--deps/npm/test/lib/utils/is-windows-bash.js30
-rw-r--r--deps/npm/test/lib/utils/is-windows-shell.js8
-rw-r--r--deps/npm/test/lib/utils/is-windows.js43
-rw-r--r--deps/npm/test/lib/utils/log-file.js17
-rw-r--r--deps/npm/test/lib/utils/otplease.js22
-rw-r--r--deps/npm/test/lib/utils/path.js12
-rw-r--r--deps/npm/test/lib/utils/replace-info.js40
-rw-r--r--deps/npm/test/lib/utils/split-package-names.js18
-rw-r--r--deps/npm/test/lib/utils/timers.js32
-rw-r--r--deps/npm/test/lib/utils/unsupported.js102
-rw-r--r--deps/npm/test/lib/utils/update-notifier.js3
203 files changed, 4389 insertions, 3135 deletions
diff --git a/deps/npm/docs/content/commands/npm-install.md b/deps/npm/docs/content/commands/npm-install.md
index 2ffd3e3e9ff..c85a592eded 100644
--- a/deps/npm/docs/content/commands/npm-install.md
+++ b/deps/npm/docs/content/commands/npm-install.md
@@ -22,7 +22,7 @@ npm install <tarball url>
npm install <git:// url>
npm install <github username>/<github project>
-aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add
+aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
```
<!-- automatically generated, do not edit manually -->
diff --git a/deps/npm/docs/content/commands/npm-search.md b/deps/npm/docs/content/commands/npm-search.md
index db6a12bafab..340dea9684d 100644
--- a/deps/npm/docs/content/commands/npm-search.md
+++ b/deps/npm/docs/content/commands/npm-search.md
@@ -13,7 +13,7 @@ description: Search for packages
```bash
npm search [search terms ...]
-aliases: s, se, find
+aliases: find, s, se
```
<!-- automatically generated, do not edit manually -->
diff --git a/deps/npm/docs/content/commands/npm-uninstall.md b/deps/npm/docs/content/commands/npm-uninstall.md
index 8132bf6bc40..9316c686d40 100644
--- a/deps/npm/docs/content/commands/npm-uninstall.md
+++ b/deps/npm/docs/content/commands/npm-uninstall.md
@@ -13,7 +13,7 @@ description: Remove a package
```bash
npm uninstall [<@scope>/]<pkg>...
-aliases: un, unlink, remove, rm, r
+aliases: unlink, remove, rm, r, un
```
<!-- automatically generated, do not edit manually -->
diff --git a/deps/npm/docs/content/commands/npm-version.md b/deps/npm/docs/content/commands/npm-version.md
index 86e2ce90e9b..713e5ae410d 100644
--- a/deps/npm/docs/content/commands/npm-version.md
+++ b/deps/npm/docs/content/commands/npm-version.md
@@ -144,6 +144,17 @@ This value is not exported to the environment for child processes.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
+#### `workspaces-update`
+
+* Default: true
+* Type: Boolean
+
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the `node_modules` folder.
+
+<!-- automatically generated, do not edit manually -->
+<!-- see lib/utils/config/definitions.js -->
+
#### `include-workspace-root`
* Default: false
diff --git a/deps/npm/docs/content/commands/npm-view.md b/deps/npm/docs/content/commands/npm-view.md
index 53ca408a012..b50b4bfb56c 100644
--- a/deps/npm/docs/content/commands/npm-view.md
+++ b/deps/npm/docs/content/commands/npm-view.md
@@ -13,7 +13,7 @@ description: View registry info
```bash
npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]
-aliases: v, info, show
+aliases: info, show, v
```
<!-- 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 df259715f08..39870922c02 100644
--- a/deps/npm/docs/content/using-npm/config.md
+++ b/deps/npm/docs/content/using-npm/config.md
@@ -1027,6 +1027,17 @@ See also the `foreground-scripts` config.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
+#### `logs-dir`
+
+* Default: A directory named `_logs` inside the cache
+* Type: null or Path
+
+The location of npm's log directory. See [`npm logging`](/using-npm/logging)
+for more information.
+
+<!-- automatically generated, do not edit manually -->
+<!-- see lib/utils/config/definitions.js -->
+
#### `logs-max`
* Default: 10
@@ -1034,6 +1045,8 @@ See also the `foreground-scripts` config.
The maximum number of log files to store.
+If set to 0, no log files will be written for the current run.
+
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
@@ -1628,9 +1641,9 @@ particular, use care when overriding this setting for public packages.
* Default: false
* Type: Boolean
-If true, writes an `npm-debug` log to `_logs` and timing information to
-`_timing.json`, both in your cache, even if the command completes
-successfully. `_timing.json` is a newline delimited list of JSON objects.
+If true, writes a debug log to `logs-dir` and timing information to
+`_timing.json` in the cache, even if the command completes successfully.
+`_timing.json` is a newline delimited list of JSON objects.
You can quickly view it with this [json](https://npm.im/json) command line:
`npm exec -- json -g < ~/.npm/_timing.json`.
@@ -1823,6 +1836,17 @@ This value is not exported to the environment for child processes.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
+#### `workspaces-update`
+
+* Default: true
+* Type: Boolean
+
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the `node_modules` folder.
+
+<!-- automatically generated, do not edit manually -->
+<!-- see lib/utils/config/definitions.js -->
+
#### `yes`
* Default: null
diff --git a/deps/npm/docs/content/using-npm/logging.md b/deps/npm/docs/content/using-npm/logging.md
index b7c5e899778..eb83b167e69 100644
--- a/deps/npm/docs/content/using-npm/logging.md
+++ b/deps/npm/docs/content/using-npm/logging.md
@@ -1,13 +1,24 @@
---
title: Logging
section: 7
-description: Why, What & How we Log
+description: Why, What & How We Log
---
### Description
The `npm` CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments.
+### Setting Log File Location
+
+All logs are written to a debug log, with the path to that file printed if the execution of a command fails.
+
+The default location of the logs directory is a directory named `_logs` inside the npm cache. This can be changed
+with the `logs-dir` config option.
+
+Log files will be removed from the `logs-dir` when the number of log files exceeds `logs-max`, with the oldest logs being deleted first.
+
+To turn off logs completely set `--logs-max=0`.
+
### Setting Log Levels
#### `loglevel`
@@ -28,8 +39,6 @@ The default value of `loglevel` is `"notice"` but there are several levels/types
All logs pertaining to a level proceeding the current setting will be shown.
-All logs are written to a debug log, with the path to that file printed if the execution of a command fails.
-
##### Aliases
The log levels listed above have various corresponding aliases, including:
@@ -47,6 +56,15 @@ The log levels listed above have various corresponding aliases, including:
The `npm` CLI began hiding the output of lifecycle scripts for `npm install` as of `v7`. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in `package.json`. If you'd like to change this behavior & log this output you can set `foreground-scripts` to `true`.
+### Timing Information
+
+The `--timing` config can be set which does two things:
+
+1. Always shows the full path to the debug log regardless of command exit status
+1. Write timing information to a timing file in the cache or `logs-dir`
+
+This file is a newline delimited list of JSON objects that can be inspected to see timing data for each task in a `npm` CLI run.
+
### Registry Response Headers
#### `npm-notice`
@@ -55,6 +73,15 @@ The `npm` CLI reads from & logs any `npm-notice` headers that are returned from
This header is not cached, and will not be logged if the request is served from the cache.
+### Logs and Sensitive Information
+
+The `npm` CLI makes a best effort to redact the following from terminal output and log files:
+
+- Passwords inside basic auth URLs
+- npm tokens
+
+However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use `--loglevel=silent` and `--logs-max=0` to ensure no logs are written to your terminal or filesystem.
+
### See also
* [config](/using-npm/config)
diff --git a/deps/npm/docs/content/using-npm/scripts.md b/deps/npm/docs/content/using-npm/scripts.md
index f79ddc65e9b..b37ca593e4c 100644
--- a/deps/npm/docs/content/using-npm/scripts.md
+++ b/deps/npm/docs/content/using-npm/scripts.md
@@ -339,7 +339,7 @@ file.
* Don't prefix your script commands with "sudo". If root permissions
are required for some reason, then it'll fail with that error, and
the user will sudo the npm command in question.
-* Don't use `install`. Use a `.gyp` file for compilation, and `prepublish`
+* Don't use `install`. Use a `.gyp` file for compilation, and `prepare`
for anything else. You should almost never have to explicitly set a
preinstall or install script. If you are doing this, please consider if
there is another option. The only valid use of `install` or `preinstall`
diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html
index 755dee22402..3fcc2ddf9cb 100644
--- a/deps/npm/docs/output/commands/npm-install.html
+++ b/deps/npm/docs/output/commands/npm-install.html
@@ -160,7 +160,7 @@ npm install &lt;tarball url&gt;
npm install &lt;git:// url&gt;
npm install &lt;github username&gt;/&lt;github project&gt;
-aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add
+aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
</code></pre>
<!-- 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 19bf6080bf1..798b6f0f2ce 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.5.5 /path/to/npm
+<pre lang="bash"><code>npm@8.6.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-search.html b/deps/npm/docs/output/commands/npm-search.html
index 2e224afec52..4976e2d8a63 100644
--- a/deps/npm/docs/output/commands/npm-search.html
+++ b/deps/npm/docs/output/commands/npm-search.html
@@ -151,7 +151,7 @@ npm command-line interface
<!-- raw HTML omitted -->
<pre lang="bash"><code>npm search [search terms ...]
-aliases: s, se, find
+aliases: find, s, se
</code></pre>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html
index f7f7760da74..d8d6f7b5e6c 100644
--- a/deps/npm/docs/output/commands/npm-uninstall.html
+++ b/deps/npm/docs/output/commands/npm-uninstall.html
@@ -151,7 +151,7 @@ npm command-line interface
<!-- raw HTML omitted -->
<pre lang="bash"><code>npm uninstall [&lt;@scope&gt;/]&lt;pkg&gt;...
-aliases: un, unlink, remove, rm, r
+aliases: unlink, remove, rm, r, un
</code></pre>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html
index a4e8ff6dbdc..2cb99f3bc07 100644
--- a/deps/npm/docs/output/commands/npm-version.html
+++ b/deps/npm/docs/output/commands/npm-version.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="#configuration">Configuration</a></li><ul><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li></ul><li><a href="#description">Description</a></li><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="#configuration">Configuration</a></li><ul><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#workspaces-update"><code>workspaces-update</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li></ul><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
</section>
<div id="_content"><h3 id="synopsis">Synopsis</h3>
@@ -258,6 +258,15 @@ other things (test, exec, publish, etc.) will operate on the root project,
<p>This value is not exported to the environment for child processes.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
+<h4 id="workspaces-update"><code>workspaces-update</code></h4>
+<ul>
+<li>Default: true</li>
+<li>Type: Boolean</li>
+</ul>
+<p>If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the <code>node_modules</code> folder.</p>
+<!-- raw HTML omitted -->
+<!-- raw HTML omitted -->
<h4 id="include-workspace-root"><code>include-workspace-root</code></h4>
<ul>
<li>Default: false</li>
diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html
index 28be6ea90c8..e2b9a4ffec1 100644
--- a/deps/npm/docs/output/commands/npm-view.html
+++ b/deps/npm/docs/output/commands/npm-view.html
@@ -151,7 +151,7 @@ npm command-line interface
<!-- raw HTML omitted -->
<pre lang="bash"><code>npm view [&lt;@scope&gt;/]&lt;pkg&gt;[@&lt;version&gt;] [&lt;field&gt;[.subfield]...]
-aliases: v, info, show
+aliases: info, show, v
</code></pre>
<!-- 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 8690cdc621a..c1f1667d85c 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.5.5</p>
+<p>8.6.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 66f848bf6fd..db165abd3f0 100644
--- a/deps/npm/docs/output/using-npm/config.html
+++ b/deps/npm/docs/output/using-npm/config.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="#description">Description</a></li><ul><li><a href="#command-line-flags">Command Line Flags</a></li><li><a href="#environment-variables">Environment Variables</a></li><li><a href="#npmrc-files">npmrc Files</a></li><li><a href="#default-configs">Default Configs</a></li></ul><li><a href="#shorthands-and-other-cli-niceties">Shorthands and Other CLI Niceties</a></li><li><a href="#config-settings">Config Settings</a></li><ul><li><a href="#auth"><code>_auth</code></a></li><li><a href="#access"><code>access</code></a></li><li><a href="#all"><code>all</code></a></li><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#before"><code>before</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#browser"><code>browser</code></a></li><li><a href="#ca"><code>ca</code></a></li><li><a href="#cache"><code>cache</code></a></li><li><a href="#cafile"><code>cafile</code></a></li><li><a href="#call"><code>call</code></a></li><li><a href="#cert"><code>cert</code></a></li><li><a href="#ci-name"><code>ci-name</code></a></li><li><a href="#cidr"><code>cidr</code></a></li><li><a href="#color"><code>color</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#depth"><code>depth</code></a></li><li><a href="#description2"><code>description</code></a></li><li><a href="#diff"><code>diff</code></a></li><li><a href="#diff-dst-prefix"><code>diff-dst-prefix</code></a></li><li><a href="#diff-ignore-all-space"><code>diff-ignore-all-space</code></a></li><li><a href="#diff-name-only"><code>diff-name-only</code></a></li><li><a href="#diff-no-prefix"><code>diff-no-prefix</code></a></li><li><a href="#diff-src-prefix"><code>diff-src-prefix</code></a></li><li><a href="#diff-text"><code>diff-text</code></a></li><li><a href="#diff-unified"><code>diff-unified</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#editor"><code>editor</code></a></li><li><a href="#engine-strict"><code>engine-strict</code></a></li><li><a href="#fetch-retries"><code>fetch-retries</code></a></li><li><a href="#fetch-retry-factor"><code>fetch-retry-factor</code></a></li><li><a href="#fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></a></li><li><a href="#fetch-retry-mintimeout"><code>fetch-retry-mintimeout</code></a></li><li><a href="#fetch-timeout"><code>fetch-timeout</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#format-package-lock"><code>format-package-lock</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#git"><code>git</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#globalconfig"><code>globalconfig</code></a></li><li><a href="#heading"><code>heading</code></a></li><li><a href="#https-proxy"><code>https-proxy</code></a></li><li><a href="#if-present"><code>if-present</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#include"><code>include</code></a></li><li><a href="#include-staged"><code>include-staged</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li><li><a href="#init-author-email"><code>init-author-email</code></a></li><li><a href="#init-author-name"><code>init-author-name</code></a></li><li><a href="#init-author-url"><code>init-author-url</code></a></li><li><a href="#init-license"><code>init-license</code></a></li><li><a href="#init-module"><code>init-module</code></a></li><li><a href="#init-version"><code>init-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#key"><code>key</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#legacy-peer-deps"><code>legacy-peer-deps</code></a></li><li><a href="#link"><code>link</code></a></li><li><a href="#local-address"><code>local-address</code></a></li><li><a href="#location"><code>location</code></a></li><li><a href="#lockfile-version"><code>lockfile-version</code></a></li><li><a href="#loglevel"><code>loglevel</code></a></li><li><a href="#logs-max"><code>logs-max</code></a></li><li><a href="#long"><code>long</code></a></li><li><a href="#maxsockets"><code>maxsockets</code></a></li><li><a href="#message"><code>message</code></a></li><li><a href="#node-options"><code>node-options</code></a></li><li><a href="#node-version"><code>node-version</code></a></li><li><a href="#noproxy"><code>noproxy</code></a></li><li><a href="#npm-version"><code>npm-version</code></a></li><li><a href="#offline"><code>offline</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#pack-destination"><code>pack-destination</code></a></li><li><a href="#package"><code>package</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#parseable"><code>parseable</code></a></li><li><a href="#prefer-offline"><code>prefer-offline</code></a></li><li><a href="#prefer-online"><code>prefer-online</code></a></li><li><a href="#prefix"><code>prefix</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#progress"><code>progress</code></a></li><li><a href="#proxy"><code>proxy</code></a></li><li><a href="#read-only"><code>read-only</code></a></li><li><a href="#rebuild-bundle"><code>rebuild-bundle</code></a></li><li><a href="#registry"><code>registry</code></a></li><li><a href="#save"><code>save</code></a></li><li><a href="#save-bundle"><code>save-bundle</code></a></li><li><a href="#save-dev"><code>save-dev</code></a></li><li><a href="#save-exact"><code>save-exact</code></a></li><li><a href="#save-optional"><code>save-optional</code></a></li><li><a href="#save-peer"><code>save-peer</code></a></li><li><a href="#save-prefix"><code>save-prefix</code></a></li><li><a href="#save-prod"><code>save-prod</code></a></li><li><a href="#scope"><code>scope</code></a></li><li><a href="#script-shell"><code>script-shell</code></a></li><li><a href="#searchexclude"><code>searchexclude</code></a></li><li><a href="#searchlimit"><code>searchlimit</code></a></li><li><a href="#searchopts"><code>searchopts</code></a></li><li><a href="#searchstaleness"><code>searchstaleness</code></a></li><li><a href="#shell"><code>shell</code></a></li><li><a href="#sign-git-commit"><code>sign-git-commit</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#strict-ssl"><code>strict-ssl</code></a></li><li><a href="#tag"><code>tag</code></a></li><li><a href="#tag-version-prefix"><code>tag-version-prefix</code></a></li><li><a href="#timing"><code>timing</code></a></li><li><a href="#umask"><code>umask</code></a></li><li><a href="#unicode"><code>unicode</code></a></li><li><a href="#update-notifier"><code>update-notifier</code></a></li><li><a href="#usage"><code>usage</code></a></li><li><a href="#user-agent"><code>user-agent</code></a></li><li><a href="#userconfig"><code>userconfig</code></a></li><li><a href="#version"><code>version</code></a></li><li><a href="#versions"><code>versions</code></a></li><li><a href="#viewer"><code>viewer</code></a></li><li><a href="#which"><code>which</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#yes"><code>yes</code></a></li><li><a href="#also"><code>also</code></a></li><li><a href="#auth-type"><code>auth-type</code></a></li><li><a href="#cache-max"><code>cache-max</code></a></li><li><a href="#cache-min"><code>cache-min</code></a></li><li><a href="#dev"><code>dev</code></a></li><li><a href="#initauthoremail"><code>init.author.email</code></a></li><li><a href="#initauthorname"><code>init.author.name</code></a></li><li><a href="#initauthorurl"><code>init.author.url</code></a></li><li><a href="#initlicense"><code>init.license</code></a></li><li><a href="#initmodule"><code>init.module</code></a></li><li><a href="#initversion"><code>init.version</code></a></li><li><a href="#only"><code>only</code></a></li><li><a href="#optional"><code>optional</code></a></li><li><a href="#production"><code>production</code></a></li><li><a href="#shrinkwrap"><code>shrinkwrap</code></a></li><li><a href="#sso-poll-frequency"><code>sso-poll-frequency</code></a></li><li><a href="#sso-type"><code>sso-type</code></a></li><li><a href="#tmp"><code>tmp</code></a></li></ul><li><a href="#see-also">See also</a></li></ul></div>
+<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><ul><li><a href="#command-line-flags">Command Line Flags</a></li><li><a href="#environment-variables">Environment Variables</a></li><li><a href="#npmrc-files">npmrc Files</a></li><li><a href="#default-configs">Default Configs</a></li></ul><li><a href="#shorthands-and-other-cli-niceties">Shorthands and Other CLI Niceties</a></li><li><a href="#config-settings">Config Settings</a></li><ul><li><a href="#auth"><code>_auth</code></a></li><li><a href="#access"><code>access</code></a></li><li><a href="#all"><code>all</code></a></li><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#before"><code>before</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#browser"><code>browser</code></a></li><li><a href="#ca"><code>ca</code></a></li><li><a href="#cache"><code>cache</code></a></li><li><a href="#cafile"><code>cafile</code></a></li><li><a href="#call"><code>call</code></a></li><li><a href="#cert"><code>cert</code></a></li><li><a href="#ci-name"><code>ci-name</code></a></li><li><a href="#cidr"><code>cidr</code></a></li><li><a href="#color"><code>color</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#depth"><code>depth</code></a></li><li><a href="#description2"><code>description</code></a></li><li><a href="#diff"><code>diff</code></a></li><li><a href="#diff-dst-prefix"><code>diff-dst-prefix</code></a></li><li><a href="#diff-ignore-all-space"><code>diff-ignore-all-space</code></a></li><li><a href="#diff-name-only"><code>diff-name-only</code></a></li><li><a href="#diff-no-prefix"><code>diff-no-prefix</code></a></li><li><a href="#diff-src-prefix"><code>diff-src-prefix</code></a></li><li><a href="#diff-text"><code>diff-text</code></a></li><li><a href="#diff-unified"><code>diff-unified</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#editor"><code>editor</code></a></li><li><a href="#engine-strict"><code>engine-strict</code></a></li><li><a href="#fetch-retries"><code>fetch-retries</code></a></li><li><a href="#fetch-retry-factor"><code>fetch-retry-factor</code></a></li><li><a href="#fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></a></li><li><a href="#fetch-retry-mintimeout"><code>fetch-retry-mintimeout</code></a></li><li><a href="#fetch-timeout"><code>fetch-timeout</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#format-package-lock"><code>format-package-lock</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#git"><code>git</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#globalconfig"><code>globalconfig</code></a></li><li><a href="#heading"><code>heading</code></a></li><li><a href="#https-proxy"><code>https-proxy</code></a></li><li><a href="#if-present"><code>if-present</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#include"><code>include</code></a></li><li><a href="#include-staged"><code>include-staged</code></a></li><li><a href="#include-workspace-root"><code>include-workspace-root</code></a></li><li><a href="#init-author-email"><code>init-author-email</code></a></li><li><a href="#init-author-name"><code>init-author-name</code></a></li><li><a href="#init-author-url"><code>init-author-url</code></a></li><li><a href="#init-license"><code>init-license</code></a></li><li><a href="#init-module"><code>init-module</code></a></li><li><a href="#init-version"><code>init-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#key"><code>key</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#legacy-peer-deps"><code>legacy-peer-deps</code></a></li><li><a href="#link"><code>link</code></a></li><li><a href="#local-address"><code>local-address</code></a></li><li><a href="#location"><code>location</code></a></li><li><a href="#lockfile-version"><code>lockfile-version</code></a></li><li><a href="#loglevel"><code>loglevel</code></a></li><li><a href="#logs-dir"><code>logs-dir</code></a></li><li><a href="#logs-max"><code>logs-max</code></a></li><li><a href="#long"><code>long</code></a></li><li><a href="#maxsockets"><code>maxsockets</code></a></li><li><a href="#message"><code>message</code></a></li><li><a href="#node-options"><code>node-options</code></a></li><li><a href="#node-version"><code>node-version</code></a></li><li><a href="#noproxy"><code>noproxy</code></a></li><li><a href="#npm-version"><code>npm-version</code></a></li><li><a href="#offline"><code>offline</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#pack-destination"><code>pack-destination</code></a></li><li><a href="#package"><code>package</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#parseable"><code>parseable</code></a></li><li><a href="#prefer-offline"><code>prefer-offline</code></a></li><li><a href="#prefer-online"><code>prefer-online</code></a></li><li><a href="#prefix"><code>prefix</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#progress"><code>progress</code></a></li><li><a href="#proxy"><code>proxy</code></a></li><li><a href="#read-only"><code>read-only</code></a></li><li><a href="#rebuild-bundle"><code>rebuild-bundle</code></a></li><li><a href="#registry"><code>registry</code></a></li><li><a href="#save"><code>save</code></a></li><li><a href="#save-bundle"><code>save-bundle</code></a></li><li><a href="#save-dev"><code>save-dev</code></a></li><li><a href="#save-exact"><code>save-exact</code></a></li><li><a href="#save-optional"><code>save-optional</code></a></li><li><a href="#save-peer"><code>save-peer</code></a></li><li><a href="#save-prefix"><code>save-prefix</code></a></li><li><a href="#save-prod"><code>save-prod</code></a></li><li><a href="#scope"><code>scope</code></a></li><li><a href="#script-shell"><code>script-shell</code></a></li><li><a href="#searchexclude"><code>searchexclude</code></a></li><li><a href="#searchlimit"><code>searchlimit</code></a></li><li><a href="#searchopts"><code>searchopts</code></a></li><li><a href="#searchstaleness"><code>searchstaleness</code></a></li><li><a href="#shell"><code>shell</code></a></li><li><a href="#sign-git-commit"><code>sign-git-commit</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#strict-ssl"><code>strict-ssl</code></a></li><li><a href="#tag"><code>tag</code></a></li><li><a href="#tag-version-prefix"><code>tag-version-prefix</code></a></li><li><a href="#timing"><code>timing</code></a></li><li><a href="#umask"><code>umask</code></a></li><li><a href="#unicode"><code>unicode</code></a></li><li><a href="#update-notifier"><code>update-notifier</code></a></li><li><a href="#usage"><code>usage</code></a></li><li><a href="#user-agent"><code>user-agent</code></a></li><li><a href="#userconfig"><code>userconfig</code></a></li><li><a href="#version"><code>version</code></a></li><li><a href="#versions"><code>versions</code></a></li><li><a href="#viewer"><code>viewer</code></a></li><li><a href="#which"><code>which</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#workspaces-update"><code>workspaces-update</code></a></li><li><a href="#yes"><code>yes</code></a></li><li><a href="#also"><code>also</code></a></li><li><a href="#auth-type"><code>auth-type</code></a></li><li><a href="#cache-max"><code>cache-max</code></a></li><li><a href="#cache-min"><code>cache-min</code></a></li><li><a href="#dev"><code>dev</code></a></li><li><a href="#initauthoremail"><code>init.author.email</code></a></li><li><a href="#initauthorname"><code>init.author.name</code></a></li><li><a href="#initauthorurl"><code>init.author.url</code></a></li><li><a href="#initlicense"><code>init.license</code></a></li><li><a href="#initmodule"><code>init.module</code></a></li><li><a href="#initversion"><code>init.version</code></a></li><li><a href="#only"><code>only</code></a></li><li><a href="#optional"><code>optional</code></a></li><li><a href="#production"><code>production</code></a></li><li><a href="#shrinkwrap"><code>shrinkwrap</code></a></li><li><a href="#sso-poll-frequency"><code>sso-poll-frequency</code></a></li><li><a href="#sso-type"><code>sso-type</code></a></li><li><a href="#tmp"><code>tmp</code></a></li></ul><li><a href="#see-also">See also</a></li></ul></div>
</section>
<div id="_content"><h3 id="description">Description</h3>
@@ -971,12 +971,22 @@ path to that file printed if the execution of a command fails.</p>
<p>See also the <code>foreground-scripts</code> config.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
+<h4 id="logs-dir"><code>logs-dir</code></h4>
+<ul>
+<li>Default: A directory named <code>_logs</code> inside the cache</li>
+<li>Type: null or Path</li>
+</ul>
+<p>The location of npm's log directory. See <a href="../using-npm/logging.html"><code>npm logging</code></a>
+for more information.</p>
+<!-- raw HTML omitted -->
+<!-- raw HTML omitted -->
<h4 id="logs-max"><code>logs-max</code></h4>
<ul>
<li>Default: 10</li>
<li>Type: Number</li>
</ul>
<p>The maximum number of log files to store.</p>
+<p>If set to 0, no log files will be written for the current run.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="long"><code>long</code></h4>
@@ -1446,9 +1456,9 @@ particular, use care when overriding this setting for public packages.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>If true, writes an <code>npm-debug</code> log to <code>_logs</code> and timing information to
-<code>_timing.json</code>, both in your cache, even if the command completes
-successfully. <code>_timing.json</code> is a newline delimited list of JSON objects.</p>
+<p>If true, writes a debug log to <code>logs-dir</code> and timing information to
+<code>_timing.json</code> in the cache, even if the command completes successfully.
+<code>_timing.json</code> is a newline delimited list of JSON objects.</p>
<p>You can quickly view it with this <a href="https://npm.im/json">json</a> command line:
<code>npm exec -- json -g &lt; ~/.npm/_timing.json</code>.</p>
<!-- raw HTML omitted -->
@@ -1605,6 +1615,15 @@ other things (test, exec, publish, etc.) will operate on the root project,
<p>This value is not exported to the environment for child processes.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
+<h4 id="workspaces-update"><code>workspaces-update</code></h4>
+<ul>
+<li>Default: true</li>
+<li>Type: Boolean</li>
+</ul>
+<p>If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the <code>node_modules</code> folder.</p>
+<!-- raw HTML omitted -->
+<!-- raw HTML omitted -->
<h4 id="yes"><code>yes</code></h4>
<ul>
<li>Default: null</li>
diff --git a/deps/npm/docs/output/using-npm/logging.html b/deps/npm/docs/output/using-npm/logging.html
index d4b9760967a..078ebde7b85 100644
--- a/deps/npm/docs/output/using-npm/logging.html
+++ b/deps/npm/docs/output/using-npm/logging.html
@@ -137,16 +137,22 @@ npm command-line interface
<section id="content">
<header class="title">
<h1 id="logging">Logging</h1>
-<span class="description">Why, What &amp; How we Log</span>
+<span class="description">Why, What &amp; How We Log</span>
</header>
<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
-<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#setting-log-levels">Setting Log Levels</a></li><ul><li><a href="#loglevel"><code>loglevel</code></a></li><ul><li><a href="#aliases">Aliases</a></li></ul><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li></ul><li><a href="#registry-response-headers">Registry Response Headers</a></li><ul><li><a href="#npm-notice"><code>npm-notice</code></a></li></ul><li><a href="#see-also">See also</a></li></ul></div>
+<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#setting-log-file-location">Setting Log File Location</a></li><li><a href="#setting-log-levels">Setting Log Levels</a></li><ul><li><a href="#loglevel"><code>loglevel</code></a></li><ul><li><a href="#aliases">Aliases</a></li></ul><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li></ul><li><a href="#timing-information">Timing Information</a></li><li><a href="#registry-response-headers">Registry Response Headers</a></li><ul><li><a href="#npm-notice"><code>npm-notice</code></a></li></ul><li><a href="#logs-and-sensitive-information">Logs and Sensitive Information</a></li><li><a href="#see-also">See also</a></li></ul></div>
</section>
<div id="_content"><h3 id="description">Description</h3>
<p>The <code>npm</code> CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations &amp; environments.</p>
+<h3 id="setting-log-file-location">Setting Log File Location</h3>
+<p>All logs are written to a debug log, with the path to that file printed if the execution of a command fails.</p>
+<p>The default location of the logs directory is a directory named <code>_logs</code> inside the npm cache. This can be changed
+with the <code>logs-dir</code> config option.</p>
+<p>Log files will be removed from the <code>logs-dir</code> when the number of log files exceeds <code>logs-max</code>, with the oldest logs being deleted first.</p>
+<p>To turn off logs completely set <code>--logs-max=0</code>.</p>
<h3 id="setting-log-levels">Setting Log Levels</h3>
<h4 id="loglevel"><code>loglevel</code></h4>
<p><code>loglevel</code> is a global argument/config that can be set to determine the type of information to be displayed.</p>
@@ -163,7 +169,6 @@ npm command-line interface
<li><code>"silly"</code></li>
</ul>
<p>All logs pertaining to a level proceeding the current setting will be shown.</p>
-<p>All logs are written to a debug log, with the path to that file printed if the execution of a command fails.</p>
<h5 id="aliases">Aliases</h5>
<p>The log levels listed above have various corresponding aliases, including:</p>
<ul>
@@ -178,10 +183,24 @@ npm command-line interface
</ul>
<h4 id="foreground-scripts"><code>foreground-scripts</code></h4>
<p>The <code>npm</code> CLI began hiding the output of lifecycle scripts for <code>npm install</code> as of <code>v7</code>. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in <code>package.json</code>. If you'd like to change this behavior &amp; log this output you can set <code>foreground-scripts</code> to <code>true</code>.</p>
+<h3 id="timing-information">Timing Information</h3>
+<p>The <code>--timing</code> config can be set which does two things:</p>
+<ol>
+<li>Always shows the full path to the debug log regardless of command exit status</li>
+<li>Write timing information to a timing file in the cache or <code>logs-dir</code></li>
+</ol>
+<p>This file is a newline delimited list of JSON objects that can be inspected to see timing data for each task in a <code>npm</code> CLI run.</p>
<h3 id="registry-response-headers">Registry Response Headers</h3>
<h4 id="npm-notice"><code>npm-notice</code></h4>
<p>The <code>npm</code> CLI reads from &amp; logs any <code>npm-notice</code> headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur.</p>
<p>This header is not cached, and will not be logged if the request is served from the cache.</p>
+<h3 id="logs-and-sensitive-information">Logs and Sensitive Information</h3>
+<p>The <code>npm</code> CLI makes a best effort to redact the following from terminal output and log files:</p>
+<ul>
+<li>Passwords inside basic auth URLs</li>
+<li>npm tokens</li>
+</ul>
+<p>However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use <code>--loglevel=silent</code> and <code>--logs-max=0</code> to ensure no logs are written to your terminal or filesystem.</p>
<h3 id="see-also">See also</h3>
<ul>
<li><a href="../using-npm/config.html">config</a></li>
diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html
index a1b691f3768..e13d0c488ee 100644
--- a/deps/npm/docs/output/using-npm/scripts.html
+++ b/deps/npm/docs/output/using-npm/scripts.html
@@ -442,7 +442,7 @@ probably set it up that way for a reason.</li>
<li>Don't prefix your script commands with "sudo". If root permissions
are required for some reason, then it'll fail with that error, and
the user will sudo the npm command in question.</li>
-<li>Don't use <code>install</code>. Use a <code>.gyp</code> file for compilation, and <code>prepublish</code>
+<li>Don't use <code>install</code>. Use a <code>.gyp</code> file for compilation, and <code>prepare</code>
for anything else. You should almost never have to explicitly set a
preinstall or install script. If you are doing this, please consider if
there is another option. The only valid use of <code>install</code> or <code>preinstall</code>
diff --git a/deps/npm/lib/base-command.js b/deps/npm/lib/base-command.js
index b6e3d6d2318..3ab800adbfd 100644
--- a/deps/npm/lib/base-command.js
+++ b/deps/npm/lib/base-command.js
@@ -2,10 +2,11 @@
const { relative } = require('path')
-const usageUtil = require('./utils/usage.js')
const ConfigDefinitions = require('./utils/config/definitions.js')
const getWorkspaces = require('./workspaces/get-workspaces.js')
+const cmdAliases = require('./utils/cmd-list').aliases
+
class BaseCommand {
constructor (npm) {
this.wrapWidth = 80
@@ -25,28 +26,43 @@ class BaseCommand {
}
get usage () {
- let usage = `npm ${this.constructor.name}\n\n`
- if (this.constructor.description) {
- usage = `${usage}${this.constructor.description}\n\n`
- }
+ const usage = [
+ `${this.constructor.description}`,
+ '',
+ 'Usage:',
+ ]
- usage = `${usage}Usage:\n`
if (!this.constructor.usage) {
- usage = `${usage}npm ${this.constructor.name}`
+ usage.push(`npm ${this.constructor.name}`)
} else {
- usage = `${usage}${this.constructor.usage
- .map(u => `npm ${this.constructor.name} ${u}`)
- .join('\n')}`
+ usage.push(...this.constructor.usage.map(u => `npm ${this.constructor.name} ${u}`))
}
if (this.constructor.params) {
- usage = `${usage}\n\nOptions:\n${this.wrappedParams}`
+ usage.push('')
+ usage.push('Options:')
+ usage.push(this.wrappedParams)
+ }
+
+ const aliases = Object.keys(cmdAliases).reduce((p, c) => {
+ if (cmdAliases[c] === this.constructor.name) {
+ p.push(c)
+ }
+ return p
+ }, [])
+
+ if (aliases.length === 1) {
+ usage.push('')
+ usage.push(`alias: ${aliases.join(', ')}`)
+ } else if (aliases.length > 1) {
+ usage.push('')
+ usage.push(`aliases: ${aliases.join(', ')}`)
}
- // Mostly this just appends aliases, this could be more clear
- usage = usageUtil(this.constructor.name, usage)
- usage = `${usage}\n\nRun "npm help ${this.constructor.name}" for more info`
- return usage
+ usage.push('')
+ usage.push(`Run "npm help ${this.constructor.name}" for more info`)
+
+ return usage.join('\n')
}
get wrappedParams () {
@@ -69,7 +85,7 @@ class BaseCommand {
if (prefix) {
prefix += '\n\n'
}
- return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
+ return Object.assign(new Error(`\n${prefix}${this.usage}`), {
code: 'EUSAGE',
})
}
diff --git a/deps/npm/lib/cli.js b/deps/npm/lib/cli.js
index 3d0c32d4bed..7b87b94452e 100644
--- a/deps/npm/lib/cli.js
+++ b/deps/npm/lib/cli.js
@@ -11,9 +11,25 @@ module.exports = async process => {
// so now both broken and unsupported use console, but only broken
// will process.exit. It is important to now perform *both* of these
// checks as early as possible so the user gets the error message.
- const { checkForBrokenNode, checkForUnsupportedNode } = require('./utils/unsupported.js')
- checkForBrokenNode()
- checkForUnsupportedNode()
+ const semver = require('semver')
+ const supported = require('../package.json').engines.node
+ const knownBroken = '<12.5.0'
+
+ const nodejsVersion = process.version.replace(/-.*$/, '')
+ /* eslint-disable no-console */
+ if (semver.satisfies(nodejsVersion, knownBroken)) {
+ console.error('ERROR: npm is known not to run on Node.js ' + process.version)
+ console.error("You'll need to upgrade to a newer Node.js version in order to use this")
+ console.error('version of npm. You can find the latest version at https://nodejs.org/')
+ process.exit(1)
+ }
+ if (!semver.satisfies(nodejsVersion, supported)) {
+ console.error('npm does not support Node.js ' + process.version)
+ console.error('You should probably upgrade to a newer version of node as we')
+ console.error("can't make any promises that npm will work with this version.")
+ console.error('You can find the latest version at https://nodejs.org/')
+ }
+ /* eslint-enable no-console */
const exitHandler = require('./utils/exit-handler.js')
process.on('uncaughtException', exitHandler)
@@ -30,14 +46,12 @@ module.exports = async process => {
}
const log = require('./utils/log-shim.js')
- const replaceInfo = require('./utils/replace-info.js')
- log.verbose('cli', replaceInfo(process.argv))
-
+ // only log node and npm paths in argv initially since argv can contain
+ // sensitive info. a cleaned version will be logged later
+ log.verbose('cli', process.argv.slice(0, 2).join(' '))
log.info('using', 'npm@%s', npm.version)
log.info('using', 'node@%s', process.version)
- const updateNotifier = require('./utils/update-notifier.js')
-
let cmd
// now actually fire up npm and run the command.
// this is how to use npm programmatically:
@@ -54,8 +68,6 @@ module.exports = async process => {
npm.config.set('usage', false, 'cli')
}
- updateNotifier(npm)
-
cmd = npm.argv.shift()
if (!cmd) {
npm.output(await npm.usage)
diff --git a/deps/npm/lib/commands/bin.js b/deps/npm/lib/commands/bin.js
index 77028f06dd4..4200d5b8ca5 100644
--- a/deps/npm/lib/commands/bin.js
+++ b/deps/npm/lib/commands/bin.js
@@ -1,5 +1,10 @@
-const envPath = require('../utils/path.js')
+const log = require('../utils/log-shim.js')
const BaseCommand = require('../base-command.js')
+// TODO this may not be needed at all. Ignoring because our tests normalize
+// process.env.path already
+/* istanbul ignore next */
+const path = process.env.path || process.env.Path || process.env.PATH
+const { delimiter } = require('path')
class Bin extends BaseCommand {
static description = 'Display npm bin folder'
@@ -10,9 +15,8 @@ class Bin extends BaseCommand {
async exec (args) {
const b = this.npm.bin
this.npm.output(b)
- if (this.npm.config.get('global') && !envPath.includes(b)) {
- // XXX: does this need to be console?
- console.error('(not in PATH env variable)')
+ if (this.npm.config.get('global') && !path.split(delimiter).includes(b)) {
+ log.error('bin', '(not in PATH env variable)')
}
}
}
diff --git a/deps/npm/lib/commands/birthday.js b/deps/npm/lib/commands/birthday.js
index e889b39f253..c7b5b31c54a 100644
--- a/deps/npm/lib/commands/birthday.js
+++ b/deps/npm/lib/commands/birthday.js
@@ -2,7 +2,9 @@ const BaseCommand = require('../base-command.js')
class Birthday extends BaseCommand {
static name = 'birthday'
+ static description = 'Birthday'
static ignoreImplicitWorkspace = true
+ static isShellout = true
async exec () {
this.npm.config.set('yes', true)
diff --git a/deps/npm/lib/commands/completion.js b/deps/npm/lib/commands/completion.js
index 0317753a15a..d0c68af6ceb 100644
--- a/deps/npm/lib/commands/completion.js
+++ b/deps/npm/lib/commands/completion.js
@@ -30,7 +30,6 @@
//
const { definitions, shorthands } = require('../utils/config/index.js')
-const deref = require('../utils/deref-command.js')
const { aliases, cmdList, plumbing } = require('../utils/cmd-list.js')
const aliasNames = Object.keys(aliases)
const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c))
@@ -38,7 +37,7 @@ const nopt = require('nopt')
const configNames = Object.keys(definitions)
const shorthandNames = Object.keys(shorthands)
const allConfs = configNames.concat(shorthandNames)
-const isWindowsShell = require('../utils/is-windows-shell.js')
+const { isWindowsShell } = require('../utils/is-windows.js')
const fileExists = require('../utils/file-exists.js')
const { promisify } = require('util')
@@ -152,7 +151,7 @@ class Completion extends BaseCommand {
// check if there's a command already.
const cmd = parsed.argv.remain[1]
if (!cmd) {
- return this.wrap(opts, cmdCompl(opts))
+ return this.wrap(opts, cmdCompl(opts, this.npm))
}
Object.keys(parsed).forEach(k => this.npm.config.set(k, parsed[k]))
@@ -269,13 +268,13 @@ const isFlag = word => {
// complete against the npm commands
// if they all resolve to the same thing, just return the thing it already is
-const cmdCompl = opts => {
+const cmdCompl = (opts, npm) => {
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
if (!matches.length) {
return matches
}
- const derefs = new Set([...matches.map(c => deref(c))])
+ const derefs = new Set([...matches.map(c => npm.deref(c))])
if (derefs.size === 1) {
return [...derefs]
}
diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js
index 630150c0886..22a25477e22 100644
--- a/deps/npm/lib/commands/doctor.js
+++ b/deps/npm/lib/commands/doctor.js
@@ -131,10 +131,6 @@ class Doctor extends BaseCommand {
if (!this.npm.silent) {
this.npm.output(table(outTable, tableOpts))
- if (!allOk) {
- // TODO is this really needed?
- console.error('')
- }
}
if (!allOk) {
throw new Error('Some problems found. See above for recommendations.')
diff --git a/deps/npm/lib/commands/edit.js b/deps/npm/lib/commands/edit.js
index ce74ff79b2b..0256f4f3a6f 100644
--- a/deps/npm/lib/commands/edit.js
+++ b/deps/npm/lib/commands/edit.js
@@ -3,11 +3,32 @@
const { resolve } = require('path')
const fs = require('graceful-fs')
-const { spawn } = require('child_process')
-const splitPackageNames = require('../utils/split-package-names.js')
+const cp = require('child_process')
const completion = require('../utils/completion/installed-shallow.js')
const BaseCommand = require('../base-command.js')
+const splitPackageNames = (path) => {
+ return path.split('/')
+ // combine scoped parts
+ .reduce((parts, part) => {
+ if (parts.length === 0) {
+ return [part]
+ }
+
+ const lastPart = parts[parts.length - 1]
+ // check if previous part is the first part of a scoped package
+ if (lastPart[0] === '@' && !lastPart.includes('/')) {
+ parts[parts.length - 1] += '/' + part
+ } else {
+ parts.push(part)
+ }
+
+ return parts
+ }, [])
+ .join('/node_modules/')
+ .replace(/(\/node_modules)+/, '/node_modules')
+}
+
class Edit extends BaseCommand {
static description = 'Edit an installed package'
static name = 'edit'
@@ -36,7 +57,7 @@ class Edit extends BaseCommand {
return reject(err)
}
const [bin, ...args] = this.npm.config.get('editor').split(/\s+/)
- const editor = spawn(bin, [...args, dir], { stdio: 'inherit' })
+ const editor = cp.spawn(bin, [...args, dir], { stdio: 'inherit' })
editor.on('exit', (code) => {
if (code) {
return reject(new Error(`editor process exited with code: ${code}`))
diff --git a/deps/npm/lib/commands/exec.js b/deps/npm/lib/commands/exec.js
index 6b402c856ab..5e6a94296d2 100644
--- a/deps/npm/lib/commands/exec.js
+++ b/deps/npm/lib/commands/exec.js
@@ -46,6 +46,7 @@ class Exec extends BaseCommand {
]
static ignoreImplicitWorkspace = false
+ static isShellout = true
async exec (_args, { locationMsg, path, runPath } = {}) {
if (!path) {
diff --git a/deps/npm/lib/commands/help.js b/deps/npm/lib/commands/help.js
index 40f5ad9b300..d31b3ca6976 100644
--- a/deps/npm/lib/commands/help.js
+++ b/deps/npm/lib/commands/help.js
@@ -11,6 +11,8 @@ const BaseCommand = require('../base-command.js')
// We don't currently compress our man pages but if we ever did this would
// seemlessly continue supporting it
const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/
+// Searches for the "npm-" prefix in page names, to prefer those.
+const manNpmPrefixRegex = /\/npm-/
class Help extends BaseCommand {
static description = 'Get help on npm'
@@ -61,13 +63,27 @@ class Help extends BaseCommand {
const f = `${manroot}/${manSearch}/?(npm-)${section}.[0-9]*`
let mans = await glob(f)
mans = mans.sort((a, b) => {
- // Because of the glob we know the manNumberRegex will pass
- const aManNumber = a.match(manNumberRegex)[1]
- const bManNumber = b.match(manNumberRegex)[1]
+ // Prefer the page with an npm prefix, if there's only one.
+ const aHasPrefix = manNpmPrefixRegex.test(a)
+ const bHasPrefix = manNpmPrefixRegex.test(b)
+ if (aHasPrefix !== bHasPrefix) {
+ return aHasPrefix ? -1 : 1
+ }
- // man number sort first so that 1 aka commands are preferred
- if (aManNumber !== bManNumber) {
- return aManNumber - bManNumber
+ // Because the glob is (subtly) different from manNumberRegex,
+ // we can't rely on it passing.
+ const aManNumberMatch = a.match(manNumberRegex)
+ const bManNumberMatch = b.match(manNumberRegex)
+ if (aManNumberMatch) {
+ if (!bManNumberMatch) {
+ return -1
+ }
+ // man number sort first so that 1 aka commands are preferred
+ if (aManNumberMatch[1] !== bManNumberMatch[1]) {
+ return aManNumberMatch[1] - bManNumberMatch[1]
+ }
+ } else if (bManNumberMatch) {
+ return 1
}
return localeCompare(a, b)
diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js
index e74efac1baf..07f71c59747 100644
--- a/deps/npm/lib/commands/owner.js
+++ b/deps/npm/lib/commands/owner.js
@@ -125,7 +125,7 @@ class Owner extends BaseCommand {
throw err
}
- if (user && (!u || !u.name || u.error)) {
+ if (!u || !u.name || u.error) {
throw Object.assign(
new Error(
"Couldn't get user data for " + user + ': ' + JSON.stringify(u)
diff --git a/deps/npm/lib/commands/run-script.js b/deps/npm/lib/commands/run-script.js
index 74757e984ae..a1591c7900b 100644
--- a/deps/npm/lib/commands/run-script.js
+++ b/deps/npm/lib/commands/run-script.js
@@ -5,7 +5,7 @@ const { isServerPackage } = runScript
const rpj = require('read-package-json-fast')
const log = require('../utils/log-shim.js')
const didYouMean = require('../utils/did-you-mean.js')
-const isWindowsShell = require('../utils/is-windows-shell.js')
+const { isWindowsShell } = require('../utils/is-windows.js')
const cmdList = [
'publish',
@@ -41,6 +41,7 @@ class RunScript extends BaseCommand {
static name = 'run-script'
static usage = ['<command> [-- <args>]']
static ignoreImplicitWorkspace = false
+ static isShellout = true
async completion (opts) {
const argv = opts.conf.argv.remain
diff --git a/deps/npm/lib/commands/unpublish.js b/deps/npm/lib/commands/unpublish.js
index d8de9edfa6b..f27be2e41c1 100644
--- a/deps/npm/lib/commands/unpublish.js
+++ b/deps/npm/lib/commands/unpublish.js
@@ -1,13 +1,15 @@
-const path = require('path')
-const util = require('util')
-const npa = require('npm-package-arg')
const libaccess = require('libnpmaccess')
-const npmFetch = require('npm-registry-fetch')
const libunpub = require('libnpmpublish').unpublish
+const npa = require('npm-package-arg')
+const npmFetch = require('npm-registry-fetch')
+const path = require('path')
+const util = require('util')
const readJson = util.promisify(require('read-package-json'))
+
+const flatten = require('../utils/config/flatten.js')
+const getIdentity = require('../utils/get-identity.js')
const log = require('../utils/log-shim')
const otplease = require('../utils/otplease.js')
-const getIdentity = require('../utils/get-identity.js')
const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' +
'It will block from republishing a new version for 24 hours.\n' +
@@ -22,7 +24,8 @@ class Unpublish extends BaseCommand {
static ignoreImplicitWorkspace = false
async getKeysOfVersions (name, opts) {
- const json = await npmFetch.json(npa(name).escapedName, opts)
+ const pkgUri = npa(name).escapedName
+ const json = await npmFetch.json(`${pkgUri}?write=true`, opts)
return Object.keys(json.versions)
}
@@ -67,12 +70,10 @@ class Unpublish extends BaseCommand {
throw this.usageError()
}
- const spec = args.length && npa(args[0])
+ let spec = args.length && npa(args[0])
const force = this.npm.config.get('force')
const { silent } = this.npm
const dryRun = this.npm.config.get('dry-run')
- let pkgName
- let pkgVersion
log.silly('unpublish', 'args[0]', args[0])
log.silly('unpublish', 'spec', spec)
@@ -85,53 +86,52 @@ class Unpublish extends BaseCommand {
}
const opts = { ...this.npm.flatOptions }
- if (!spec || path.resolve(spec.name) === this.npm.localPrefix) {
- // if there's a package.json in the current folder, then
- // read the package name and version out of that.
+
+ let pkgName
+ let pkgVersion
+ let manifest
+ let manifestErr
+ try {
const pkgJson = path.join(this.npm.localPrefix, 'package.json')
- let manifest
- try {
- manifest = await readJson(pkgJson)
- } catch (err) {
- if (err && err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {
- throw err
- } else {
+ manifest = await readJson(pkgJson)
+ } catch (err) {
+ manifestErr = err
+ }
+ if (spec) {
+ // If cwd has a package.json with a name that matches the package being
+ // unpublished, load up the publishConfig
+ if (manifest && manifest.name === spec.name && manifest.publishConfig) {
+ flatten(manifest.publishConfig, opts)
+ }
+ const versions = await this.getKeysOfVersions(spec.name, opts)
+ if (versions.length === 1 && !force) {
+ throw this.usageError(LAST_REMAINING_VERSION_ERROR)
+ }
+ pkgName = spec.name
+ pkgVersion = spec.type === 'version' ? `@${spec.rawSpec}` : ''
+ } else {
+ if (manifestErr) {
+ if (manifestErr.code === 'ENOENT' || manifestErr.code === 'ENOTDIR') {
throw this.usageError()
+ } else {
+ throw manifestErr
}
}
log.verbose('unpublish', manifest)
- const { name, version, publishConfig } = manifest
- const pkgJsonSpec = npa.resolve(name, version)
- const optsWithPub = { ...opts, publishConfig }
-
- const versions = await this.getKeysOfVersions(name, optsWithPub)
- if (versions.length === 1 && !force) {
- throw this.usageError(
- LAST_REMAINING_VERSION_ERROR
- )
+ spec = npa.resolve(manifest.name, manifest.version)
+ if (manifest.publishConfig) {
+ flatten(manifest.publishConfig, opts)
}
- if (!dryRun) {
- await otplease(opts, opts => libunpub(pkgJsonSpec, optsWithPub))
- }
- pkgName = name
- pkgVersion = version ? `@${version}` : ''
- } else {
- const versions = await this.getKeysOfVersions(spec.name, opts)
- if (versions.length === 1 && !force) {
- throw this.usageError(
- LAST_REMAINING_VERSION_ERROR
- )
- }
- if (!dryRun) {
- await otplease(opts, opts => libunpub(spec, opts))
- }
- pkgName = spec.name
- pkgVersion = spec.type === 'version' ? `@${spec.rawSpec}` : ''
+ pkgName = manifest.name
+ pkgVersion = manifest.version ? `@${manifest.version}` : ''
}
+ if (!dryRun) {
+ await otplease(opts, opts => libunpub(spec, opts))
+ }
if (!silent) {
this.npm.output(`- ${pkgName}${pkgVersion}`)
}
diff --git a/deps/npm/lib/commands/version.js b/deps/npm/lib/commands/version.js
index f49a309a74f..ed506f663e8 100644
--- a/deps/npm/lib/commands/version.js
+++ b/deps/npm/lib/commands/version.js
@@ -3,6 +3,9 @@ const { resolve } = require('path')
const { promisify } = require('util')
const readFile = promisify(require('fs').readFile)
+const Arborist = require('@npmcli/arborist')
+const reifyFinish = require('../utils/reify-finish.js')
+
const BaseCommand = require('../base-command.js')
class Version extends BaseCommand {
@@ -17,6 +20,7 @@ class Version extends BaseCommand {
'sign-git-tag',
'workspace',
'workspaces',
+ 'workspaces-update',
'include-workspace-root',
]
@@ -81,6 +85,7 @@ class Version extends BaseCommand {
async changeWorkspaces (args, filters) {
const prefix = this.npm.config.get('tag-version-prefix')
await this.setWorkspaces(filters)
+ const updatedWorkspaces = []
for (const [name, path] of this.workspaces) {
this.npm.output(name)
const version = await libnpmversion(args[0], {
@@ -88,8 +93,10 @@ class Version extends BaseCommand {
'git-tag-version': false,
path,
})
+ updatedWorkspaces.push(name)
this.npm.output(`${prefix}${version}`)
}
+ return this.update(updatedWorkspaces)
}
async list (results = {}) {
@@ -129,6 +136,34 @@ class Version extends BaseCommand {
}
return this.list(results)
}
+
+ async update (args) {
+ if (!this.npm.flatOptions.workspacesUpdate || !args.length) {
+ return
+ }
+
+ // default behavior is to not save by default in order to avoid
+ // race condition problems when publishing multiple workspaces
+ // that have dependencies on one another, it might still be useful
+ // in some cases, which then need to set --save
+ const save = this.npm.config.isDefault('save')
+ ? false
+ : this.npm.config.get('save')
+
+ // runs a minimalistic reify update, targetting only the workspaces
+ // that had version updates and skipping fund/audit/save
+ const opts = {
+ ...this.npm.flatOptions,
+ audit: false,
+ fund: false,
+ path: this.npm.localPrefix,
+ save,
+ }
+ const arb = new Arborist(opts)
+
+ await arb.reify({ ...opts, update: args })
+ await reifyFinish(this.npm, arb)
+ }
}
module.exports = Version
diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js
index 85087057d65..99cf2981306 100644
--- a/deps/npm/lib/commands/view.js
+++ b/deps/npm/lib/commands/view.js
@@ -1,3 +1,6 @@
+/* eslint-disable no-console */
+// XXX: remove console.log later
+
// npm view [pkg [pkg ...]]
const color = require('ansicolors')
diff --git a/deps/npm/lib/lifecycle-cmd.js b/deps/npm/lib/lifecycle-cmd.js
index e2190c2de1c..41633a4ba38 100644
--- a/deps/npm/lib/lifecycle-cmd.js
+++ b/deps/npm/lib/lifecycle-cmd.js
@@ -4,6 +4,7 @@
const BaseCommand = require('./base-command.js')
class LifecycleCmd extends BaseCommand {
static usage = ['[-- <args>]']
+ static isShellout = true
async exec (args, cb) {
return this.npm.exec('run-script', [this.constructor.name, ...args])
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index 9999cf195d7..74825c97c23 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -1,72 +1,83 @@
const EventEmitter = require('events')
-const { resolve, dirname } = require('path')
+const { resolve, dirname, join } = require('path')
const Config = require('@npmcli/config')
// 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 { shellouts } = require('./utils/cmd-list.js')
const usage = require('./utils/npm-usage.js')
const which = require('which')
+const fs = require('@npmcli/fs')
-const deref = require('./utils/deref-command.js')
const LogFile = require('./utils/log-file.js')
const Timers = require('./utils/timers.js')
const Display = require('./utils/display.js')
const log = require('./utils/log-shim')
const replaceInfo = require('./utils/replace-info.js')
+const updateNotifier = require('./utils/update-notifier.js')
+const pkg = require('../package.json')
+const cmdList = require('./utils/cmd-list.js')
let warnedNonDashArg = false
const _load = Symbol('_load')
-const _tmpFolder = Symbol('_tmpFolder')
-const _title = Symbol('_title')
-const pkg = require('../package.json')
class Npm extends EventEmitter {
static get version () {
return pkg.version
}
- #unloaded = false
- #timers = null
- #logFile = null
- #display = null
-
- constructor () {
- super()
- this.command = null
- this.#logFile = new LogFile()
- this.#display = new Display()
- this.#timers = new Timers({
- start: 'npm',
- listener: (name, ms) => {
- const args = ['timing', name, `Completed in ${ms}ms`]
- this.#logFile.log(...args)
- this.#display.log(...args)
- },
- })
- this.config = new Config({
- npmPath: dirname(__dirname),
- definitions,
- flatten,
- shorthands,
- })
- this[_title] = process.title
- this.updateNotification = null
- }
+ command = null
+ updateNotification = null
+ loadErr = null
+ argv = []
+
+ #loadPromise = null
+ #tmpFolder = null
+ #title = 'npm'
+ #argvClean = []
+
+ #logFile = new LogFile()
+ #display = new Display()
+ #timers = new Timers({
+ start: 'npm',
+ listener: (name, ms) => {
+ const args = ['timing', name, `Completed in ${ms}ms`]
+ this.#logFile.log(...args)
+ this.#display.log(...args)
+ },
+ })
+
+ config = new Config({
+ npmPath: dirname(__dirname),
+ definitions,
+ flatten,
+ shorthands,
+ })
get version () {
return this.constructor.version
}
- get shelloutCommands () {
- return shellouts
- }
-
deref (c) {
- return deref(c)
+ if (!c) {
+ return
+ }
+ if (c.match(/[A-Z]/)) {
+ c = c.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
+ }
+ if (cmdList.plumbing.indexOf(c) !== -1) {
+ return c
+ }
+ // first deref the abbrev, if there is one
+ // then resolve any aliases
+ // so `npm install-cl` will resolve to `install-clean` then to `ci`
+ let a = cmdList.abbrevs[c]
+ while (cmdList.aliases[a]) {
+ a = cmdList.aliases[a]
+ }
+ return a
}
// Get an instantiated npm command
@@ -88,15 +99,21 @@ class Npm extends EventEmitter {
// Call an npm command
async exec (cmd, args) {
const command = await this.cmd(cmd)
- process.emit('time', `command:${cmd}`)
+ const timeEnd = this.time(`command:${cmd}`)
// since 'test', 'start', 'stop', etc. commands re-enter this function
// to call the run-script command, we need to only set it one time.
if (!this.command) {
process.env.npm_command = command.name
this.command = command.name
+ this.commandInstance = command
}
+ // this is async but we dont await it, since its ok if it doesnt
+ // finish before the command finishes running. it uses command and argv
+ // so it must be initiated here, after the command name is set
+ updateNotifier(this).then((msg) => (this.updateNotification = msg))
+
// Options are prefixed by a hyphen-minus (-, \u2d).
// Other dash-type chars look similar but are invalid.
if (!warnedNonDashArg) {
@@ -112,68 +129,60 @@ class Npm extends EventEmitter {
})
}
+ const isGlobal = this.config.get('global')
const workspacesEnabled = this.config.get('workspaces')
const implicitWorkspace = this.config.get('workspace', 'default').length > 0
const workspacesFilters = this.config.get('workspace')
- if (workspacesEnabled === false && workspacesFilters.length > 0) {
- throw new Error('Can not use --no-workspaces and --workspace at the same time')
- }
-
+ const includeWorkspaceRoot = this.config.get('include-workspace-root')
// only call execWorkspaces when we have workspaces explicitly set
// or when it is implicit and not in our ignore list
- const filterByWorkspaces =
- (workspacesEnabled || workspacesFilters.length > 0)
- && (!implicitWorkspace || !command.ignoreImplicitWorkspace)
+ const hasWorkspaceFilters = workspacesFilters.length > 0
+ const invalidWorkspaceConfig = workspacesEnabled === false && hasWorkspaceFilters
+ const filterByWorkspaces = (workspacesEnabled || hasWorkspaceFilters) &&
+ (!implicitWorkspace || !command.ignoreImplicitWorkspace)
// normally this would go in the constructor, but our tests don't
// actually use a real npm object so this.npm.config isn't always
// populated. this is the compromise until we can make that a reality
// and then move this into the constructor.
- command.workspaces = this.config.get('workspaces')
+ command.workspaces = workspacesEnabled
command.workspacePaths = null
// normally this would be evaluated in base-command#setWorkspaces, see
// above for explanation
- command.includeWorkspaceRoot = this.config.get('include-workspace-root')
+ command.includeWorkspaceRoot = includeWorkspaceRoot
+ let execPromise = Promise.resolve()
if (this.config.get('usage')) {
this.output(command.usage)
- return
- }
- if (filterByWorkspaces) {
- if (this.config.get('global')) {
- throw new Error('Workspaces not supported for global packages')
+ } else if (invalidWorkspaceConfig) {
+ execPromise = Promise.reject(
+ new Error('Can not use --no-workspaces and --workspace at the same time'))
+ } else if (filterByWorkspaces) {
+ if (isGlobal) {
+ execPromise = Promise.reject(new Error('Workspaces not supported for global packages'))
+ } else {
+ execPromise = command.execWorkspaces(args, workspacesFilters)
}
-
- return command.execWorkspaces(args, this.config.get('workspace')).finally(() => {
- process.emit('timeEnd', `command:${cmd}`)
- })
} else {
- return command.exec(args).finally(() => {
- process.emit('timeEnd', `command:${cmd}`)
- })
+ execPromise = command.exec(args)
}
+
+ return execPromise.finally(timeEnd)
}
async load () {
- if (!this.loadPromise) {
- process.emit('time', 'npm:load')
- this.loadPromise = new Promise((resolve, reject) => {
- this[_load]()
- .catch(er => er)
- .then(er => {
- this.loadErr = er
- if (!er && this.config.get('force')) {
- log.warn('using --force', 'Recommended protections disabled.')
- }
-
- process.emit('timeEnd', 'npm:load')
- if (er) {
- return reject(er)
- }
- resolve()
- })
- })
+ if (!this.#loadPromise) {
+ this.#loadPromise = this.time('npm:load', () => this[_load]().catch(er => er).then((er) => {
+ this.loadErr = er
+ if (!er) {
+ if (this.config.get('force')) {
+ log.warn('using --force', 'Recommended protections disabled.')
+ }
+ } else {
+ throw er
+ }
+ }))
}
- return this.loadPromise
+ return this.#loadPromise
}
get loaded () {
@@ -184,106 +193,115 @@ class Npm extends EventEmitter {
// during any tests to cleanup all of our listeners
// Everything in here should be synchronous
unload () {
- // Track if we've already unloaded so we dont
- // write multiple timing files. This is only an
- // issue in tests right now since we unload
- // in both tap teardowns and the exit handler
- if (this.#unloaded) {
- return
- }
this.#timers.off()
this.#display.off()
this.#logFile.off()
- if (this.loaded && this.config.get('timing')) {
- this.#timers.writeFile({
- command: process.argv.slice(2),
- // We used to only ever report a single log file
- // so to be backwards compatible report the last logfile
- // XXX: remove this in npm 9 or just keep it forever
- logfile: this.logFiles[this.logFiles.length - 1],
- logfiles: this.logFiles,
- version: this.version,
- })
- }
- this.#unloaded = true
+ }
+
+ time (name, fn) {
+ return this.#timers.time(name, fn)
+ }
+
+ writeTimingFile () {
+ this.#timers.writeFile({
+ command: this.#argvClean,
+ // We used to only ever report a single log file
+ // so to be backwards compatible report the last logfile
+ // XXX: remove this in npm 9 or just keep it forever
+ logfile: this.logFiles[this.logFiles.length - 1],
+ logfiles: this.logFiles,
+ version: this.version,
+ })
}
get title () {
- return this[_title]
+ return this.#title
}
set title (t) {
process.title = t
- this[_title] = t
+ this.#title = t
}
async [_load] () {
- process.emit('time', 'npm:load:whichnode')
- let node
- try {
- node = which.sync(process.argv[0])
- } catch {
- // TODO should we throw here?
- }
- process.emit('timeEnd', 'npm:load:whichnode')
+ const node = this.time('npm:load:whichnode', () => {
+ try {
+ return which.sync(process.argv[0])
+ } catch {} // TODO should we throw here?
+ })
+
if (node && node.toUpperCase() !== process.execPath.toUpperCase()) {
log.verbose('node symlink', node)
process.execPath = node
this.config.execPath = node
}
- process.emit('time', 'npm:load:configload')
- await this.config.load()
- process.emit('timeEnd', 'npm:load:configload')
+ await this.time('npm:load:configload', () => this.config.load())
+
+ // mkdir this separately since the logs dir can be set to
+ // a different location. an error here should be surfaced
+ // right away since it will error in cacache later
+ await this.time('npm:load:mkdirpcache', () =>
+ fs.mkdir(this.cache, { recursive: true, owner: 'inherit' }))
+
+ // its ok if this fails. user might have specified an invalid dir
+ // which we will tell them about at the end
+ await this.time('npm:load:mkdirplogs', () =>
+ fs.mkdir(this.logsDir, { recursive: true, owner: 'inherit' })
+ .catch((e) => log.warn('logfile', `could not create logs-dir: ${e}`)))
- this.argv = this.config.parsedArgv.remain
// note: this MUST be shorter than the actual argv length, because it
// uses the same memory, so node will truncate it if it's too long.
- // if it's a token revocation, then the argv contains a secret, so
- // don't show that. (Regrettable historical choice to put it there.)
- // Any other secrets are configs only, so showing only the positional
- // args keeps those from being leaked.
- process.emit('time', 'npm:load:setTitle')
- const tokrev = deref(this.argv[0]) === 'token' && this.argv[1] === 'revoke'
- this.title = tokrev
- ? 'npm token revoke' + (this.argv[2] ? ' ***' : '')
- : replaceInfo(['npm', ...this.argv].join(' '))
- process.emit('timeEnd', 'npm:load:setTitle')
-
- process.emit('time', 'npm:load:display')
- this.#display.load({
- // Use logColor since that is based on stderr
- color: this.logColor,
- progress: this.flatOptions.progress,
- silent: this.silent,
- timing: this.config.get('timing'),
- loglevel: this.config.get('loglevel'),
- unicode: this.config.get('unicode'),
- heading: this.config.get('heading'),
+ this.time('npm:load:setTitle', () => {
+ const { parsedArgv: { cooked, remain } } = this.config
+ this.argv = remain
+ // Secrets are mostly in configs, so title is set using only the positional args
+ // to keep those from being leaked.
+ this.title = ['npm'].concat(replaceInfo(remain)).join(' ').trim()
+ // The cooked argv is also logged separately for debugging purposes. It is
+ // cleaned as a best effort by replacing known secrets like basic auth
+ // password and strings that look like npm tokens. XXX: for this to be
+ // safer the config should create a sanitized version of the argv as it
+ // has the full context of what each option contains.
+ this.#argvClean = replaceInfo(cooked)
+ log.verbose('title', this.title)
+ log.verbose('argv', this.#argvClean.map(JSON.stringify).join(' '))
})
- process.emit('timeEnd', 'npm:load:display')
- process.env.COLOR = this.color ? '1' : '0'
- process.emit('time', 'npm:load:logFile')
- this.#logFile.load({
- dir: resolve(this.cache, '_logs'),
- logsMax: this.config.get('logs-max'),
+ this.time('npm:load:display', () => {
+ this.#display.load({
+ // Use logColor since that is based on stderr
+ color: this.logColor,
+ progress: this.flatOptions.progress,
+ silent: this.silent,
+ timing: this.config.get('timing'),
+ loglevel: this.config.get('loglevel'),
+ unicode: this.config.get('unicode'),
+ heading: this.config.get('heading'),
+ })
+ process.env.COLOR = this.color ? '1' : '0'
})
- log.verbose('logfile', this.#logFile.files[0])
- process.emit('timeEnd', 'npm:load:logFile')
- process.emit('time', 'npm:load:timers')
- this.#timers.load({
- dir: this.cache,
+ this.time('npm:load:logFile', () => {
+ this.#logFile.load({
+ dir: this.logsDir,
+ logsMax: this.config.get('logs-max'),
+ })
+ log.verbose('logfile', this.#logFile.files[0] || 'no logfile created')
})
- process.emit('timeEnd', 'npm:load:timers')
- process.emit('time', 'npm:load:configScope')
- const configScope = this.config.get('scope')
- if (configScope && !/^@/.test(configScope)) {
- this.config.set('scope', `@${configScope}`, this.config.find('scope'))
- }
- process.emit('timeEnd', 'npm:load:configScope')
+ this.time('npm:load:timers', () =>
+ this.#timers.load({
+ dir: this.config.get('timing') ? this.timingDir : null,
+ })
+ )
+
+ this.time('npm:load:configScope', () => {
+ const configScope = this.config.get('scope')
+ if (configScope && !/^@/.test(configScope)) {
+ this.config.set('scope', `@${configScope}`, this.config.find('scope'))
+ }
+ })
}
get flatOptions () {
@@ -329,6 +347,19 @@ class Npm extends EventEmitter {
return this.#logFile.files
}
+ get logsDir () {
+ return this.config.get('logs-dir') || join(this.cache, '_logs')
+ }
+
+ get timingFile () {
+ return this.#timers.file
+ }
+
+ get timingDir () {
+ // XXX(npm9): make this always in logs-dir
+ return this.config.get('logs-dir') || this.cache
+ }
+
get cache () {
return this.config.get('cache')
}
@@ -395,11 +426,11 @@ class Npm extends EventEmitter {
// XXX add logging to see if we actually use this
get tmp () {
- if (!this[_tmpFolder]) {
+ if (!this.#tmpFolder) {
const rand = require('crypto').randomBytes(4).toString('hex')
- this[_tmpFolder] = `npm-${process.pid}-${rand}`
+ this.#tmpFolder = `npm-${process.pid}-${rand}`
}
- return resolve(this.config.get('tmp'), this[_tmpFolder])
+ return resolve(this.config.get('tmp'), this.#tmpFolder)
}
// output to stdout in a progress bar compatible way
@@ -409,5 +440,12 @@ class Npm extends EventEmitter {
console.log(...msg)
log.showProgress()
}
+
+ outputError (...msg) {
+ log.clearProgress()
+ // eslint-disable-next-line no-console
+ console.error(...msg)
+ log.showProgress()
+ }
}
module.exports = Npm
diff --git a/deps/npm/lib/utils/cmd-list.js b/deps/npm/lib/utils/cmd-list.js
index b3089a62c60..c1d20186a82 100644
--- a/deps/npm/lib/utils/cmd-list.js
+++ b/deps/npm/lib/utils/cmd-list.js
@@ -1,5 +1,23 @@
-// short names for common things
-const shorthands = {
+const abbrev = require('abbrev')
+
+// plumbing should not have any aliases
+const aliases = {
+
+ // aliases
+ login: 'adduser',
+ author: 'owner',
+ home: 'docs',
+ issues: 'bugs',
+ info: 'view',
+ show: 'view',
+ find: 'search',
+ add: 'install',
+ unlink: 'uninstall',
+ remove: 'uninstall',
+ rm: 'uninstall',
+ r: 'uninstall',
+
+ // short names for common things
un: 'uninstall',
rb: 'rebuild',
list: 'ls',
@@ -21,12 +39,11 @@ const shorthands = {
'clean-install-test': 'cit',
x: 'exec',
why: 'explain',
-}
-
-const affordances = {
la: 'll',
verison: 'version',
ic: 'ci',
+
+ // typos
innit: 'init',
// manually abbrev so that install-test doesn't make insta stop working
in: 'install',
@@ -44,119 +61,90 @@ const affordances = {
'dist-tags': 'dist-tag',
upgrade: 'update',
udpate: 'update',
- login: 'adduser',
- 'add-user': 'adduser',
- author: 'owner',
- home: 'docs',
- issues: 'bugs',
- info: 'view',
- show: 'view',
- find: 'search',
- add: 'install',
- unlink: 'uninstall',
- remove: 'uninstall',
- rm: 'uninstall',
- r: 'uninstall',
rum: 'run-script',
sit: 'cit',
urn: 'run-script',
ogr: 'org',
+ 'add-user': 'adduser',
}
// these are filenames in .
+// Keep these sorted so that lib/utils/npm-usage.js outputs in order
const cmdList = [
- 'ci',
- 'install-ci-test',
- 'install',
- 'install-test',
- 'uninstall',
+ 'access',
+ 'adduser',
+ 'audit',
+ 'bin',
+ 'bugs',
'cache',
+ 'ci',
+ 'completion',
'config',
- 'set',
- 'get',
- 'update',
- 'outdated',
- 'prune',
- 'pack',
- 'find-dupes',
'dedupe',
+ 'deprecate',
+ 'diff',
+ 'dist-tag',
+ 'docs',
+ 'doctor',
+ 'edit',
+ 'exec',
+ 'explain',
+ 'explore',
+ 'find-dupes',
+ 'fund',
+ 'get',
+ 'help',
'hook',
-
- 'rebuild',
+ 'init',
+ 'install',
+ 'install-ci-test',
+ 'install-test',
'link',
-
- 'publish',
- 'star',
- 'stars',
- 'unstar',
- 'adduser',
+ 'll',
'login', // This is an alias for `adduser` but it can be confusing
'logout',
- 'unpublish',
- 'owner',
- 'access',
- 'team',
- 'deprecate',
- 'shrinkwrap',
- 'token',
- 'profile',
- 'audit',
- 'fund',
- 'org',
-
- 'help',
'ls',
- 'll',
- 'search',
- 'view',
- 'init',
- 'version',
- 'edit',
- 'explore',
- 'docs',
- 'repo',
- 'bugs',
- 'root',
- 'prefix',
- 'bin',
- 'whoami',
- 'diff',
- 'dist-tag',
+ 'org',
+ 'outdated',
+ 'owner',
+ 'pack',
'ping',
'pkg',
-
- 'test',
- 'stop',
- 'start',
+ 'prefix',
+ 'profile',
+ 'prune',
+ 'publish',
+ 'rebuild',
+ 'repo',
'restart',
+ 'root',
'run-script',
+ 'search',
+ 'set',
'set-script',
- 'completion',
- 'doctor',
- 'exec',
- 'explain',
-]
-
-const plumbing = ['birthday', 'help-search']
-
-// these commands just shell out to something else or handle the
-// error themselves, so it's confusing and weird to write out
-// our full error log banner when they exit non-zero
-const shellouts = [
- 'exec',
- 'run-script',
- 'test',
+ 'shrinkwrap',
+ 'star',
+ 'stars',
'start',
'stop',
- 'restart',
- 'birthday',
+ 'team',
+ 'test',
+ 'token',
+ 'uninstall',
+ 'unpublish',
+ 'unstar',
+ 'update',
+ 'version',
+ 'view',
+ 'whoami',
]
+const plumbing = ['birthday', 'help-search']
+const abbrevs = abbrev(cmdList.concat(Object.keys(aliases)))
+
module.exports = {
- aliases: Object.assign({}, shorthands, affordances),
- shorthands,
- affordances,
+ abbrevs,
+ aliases,
cmdList,
plumbing,
- shellouts,
}
diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js
index ddccb147586..efc1f72a020 100644
--- a/deps/npm/lib/utils/config/definitions.js
+++ b/deps/npm/lib/utils/config/definitions.js
@@ -7,7 +7,7 @@ const { version: npmVersion } = require('../../../package.json')
const ciDetect = require('@npmcli/ci-detect')
const ciName = ciDetect()
const querystring = require('querystring')
-const isWindows = require('../is-windows.js')
+const { isWindows } = require('../is-windows.js')
const { join } = require('path')
// used by cafile flattening to flatOptions.ca
@@ -1229,11 +1229,25 @@ define('loglevel', {
},
})
+define('logs-dir', {
+ default: null,
+ type: [null, path],
+ defaultDescription: `
+ A directory named \`_logs\` inside the cache
+`,
+ description: `
+ The location of npm's log directory. See [\`npm
+ logging\`](/using-npm/logging) for more information.
+ `,
+})
+
define('logs-max', {
default: 10,
type: Number,
description: `
The maximum number of log files to store.
+
+ If set to 0, no log files will be written for the current run.
`,
})
@@ -2025,8 +2039,8 @@ define('timing', {
default: false,
type: Boolean,
description: `
- If true, writes an \`npm-debug\` log to \`_logs\` and timing information
- to \`_timing.json\`, both in your cache, even if the command completes
+ If true, writes a debug log to \`logs-dir\` and timing information
+ to \`_timing.json\` in the cache, even if the command completes
successfully. \`_timing.json\` is a newline delimited list of JSON
objects.
@@ -2270,6 +2284,16 @@ define('workspaces', {
},
})
+define('workspaces-update', {
+ default: true,
+ type: Boolean,
+ description: `
+ If set to true, the npm cli will run an update after operations that may
+ possibly change the workspaces installed to the \`node_modules\` folder.
+ `,
+ flatten,
+})
+
define('yes', {
default: null,
type: [null, Boolean],
diff --git a/deps/npm/lib/utils/deref-command.js b/deps/npm/lib/utils/deref-command.js
deleted file mode 100644
index 0a3c8c90bc9..00000000000
--- a/deps/npm/lib/utils/deref-command.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// de-reference abbreviations and shorthands into canonical command name
-
-const { aliases, cmdList, plumbing } = require('./cmd-list.js')
-const aliasNames = Object.keys(aliases)
-const fullList = cmdList.concat(aliasNames).filter(c => !plumbing.includes(c))
-const abbrev = require('abbrev')
-const abbrevs = abbrev(fullList)
-
-module.exports = c => {
- if (!c || typeof c !== 'string') {
- return ''
- }
-
- if (c.match(/[A-Z]/)) {
- c = c.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
- }
-
- if (plumbing.indexOf(c) !== -1) {
- return c
- }
-
- // first deref the abbrev, if there is one
- // then resolve any aliases
- // so `npm install-cl` will resolve to `install-clean` then to `ci`
- let a = abbrevs[c]
- while (aliases[a]) {
- a = aliases[a]
- }
-
- return a || ''
-}
diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js
index 5fa361efcd3..adf10a56f6d 100644
--- a/deps/npm/lib/utils/error-message.js
+++ b/deps/npm/lib/utils/error-message.js
@@ -60,7 +60,7 @@ module.exports = (er, npm) => {
npm.config.loaded &&
er.dest.startsWith(npm.config.get('cache'))
- const isWindows = require('./is-windows.js')
+ const { isWindows } = require('./is-windows.js')
if (!isWindows && (isCachePath || isCacheDest)) {
// user probably doesn't need this, but still add it to the debug log
diff --git a/deps/npm/lib/utils/exit-handler.js b/deps/npm/lib/utils/exit-handler.js
index 6186ea81dcc..d8ae9994dfe 100644
--- a/deps/npm/lib/utils/exit-handler.js
+++ b/deps/npm/lib/utils/exit-handler.js
@@ -1,14 +1,15 @@
const os = require('os')
-const log = require('./log-shim.js')
+const log = require('./log-shim.js')
const errorMessage = require('./error-message.js')
const replaceInfo = require('./replace-info.js')
const messageText = msg => msg.map(line => line.slice(1).join(' ')).join('\n')
+const indent = (val) => Array.isArray(val) ? val.map(v => indent(v)) : ` ${val}`
let npm = null // set by the cli
let exitHandlerCalled = false
-let showLogFileMessage = false
+let showLogFileError = false
process.on('exit', code => {
log.disableProgress()
@@ -36,42 +37,73 @@ process.on('exit', code => {
if (!exitHandlerCalled) {
process.exitCode = code || 1
log.error('', 'Exit handler never called!')
+ // eslint-disable-next-line no-console
console.error('')
log.error('', 'This is an error with npm itself. Please report this error at:')
log.error('', ' <https://github.com/npm/cli/issues>')
- showLogFileMessage = true
- }
-
- // In timing mode we always show the log file message
- if (hasLoadedNpm && npm.config.get('timing')) {
- showLogFileMessage = true
+ showLogFileError = true
}
// npm must be loaded to know where the log file was written
- if (showLogFileMessage && hasLoadedNpm) {
- // just a line break if not in silent mode
- if (!npm.silent) {
- console.error('')
- }
+ if (hasLoadedNpm) {
+ // write the timing file now, this might do nothing based on the configs set.
+ // we need to call it here in case it errors so we dont tell the user
+ // about a timing file that doesn't exist
+ npm.writeTimingFile()
- log.error(
- '',
- [
- 'A complete log of this run can be found in:',
- ...npm.logFiles.map(f => ' ' + f),
- ].join('\n')
- )
- }
+ const logsDir = npm.logsDir
+ const logFiles = npm.logFiles
- // This removes any listeners npm setup and writes files if necessary
- // This is mostly used for tests to avoid max listener warnings
- if (hasLoadedNpm) {
+ const timingDir = npm.timingDir
+ const timingFile = npm.timingFile
+
+ const timing = npm.config.get('timing')
+ const logsMax = npm.config.get('logs-max')
+
+ // Determine whether to show log file message and why it is
+ // being shown since in timing mode we always show the log file message
+ const logMethod = showLogFileError ? 'error' : timing ? 'info' : null
+
+ if (logMethod) {
+ if (!npm.silent) {
+ // just a line break if not in silent mode
+ // eslint-disable-next-line no-console
+ console.error('')
+ }
+
+ const message = []
+
+ if (timingFile) {
+ message.push('Timing info written to:', indent(timingFile))
+ } else if (timing) {
+ message.push(
+ `The timing file was not written due to an error writing to the directory: ${timingDir}`
+ )
+ }
+
+ if (logFiles.length) {
+ message.push('A complete log of this run can be found in:', ...indent(logFiles))
+ } else if (logsMax <= 0) {
+ // user specified no log file
+ message.push(`Log files were not written due to the config logs-max=${logsMax}`)
+ } else {
+ // could be an error writing to the directory
+ message.push(
+ `Log files were not written due to an error writing to the directory: ${logsDir}`,
+ 'You can rerun the command with `--loglevel=verbose` to see the logs in your terminal'
+ )
+ }
+
+ log[logMethod]('', message.join('\n'))
+ }
+
+ // This removes any listeners npm setup, mostly for tests to avoid max listener warnings
npm.unload()
}
// these are needed for the tests to have a clean slate in each test case
exitHandlerCalled = false
- showLogFileMessage = false
+ showLogFileError = false
})
const exitHandler = err => {
@@ -84,12 +116,14 @@ const exitHandler = err => {
if (!hasNpm) {
err = err || new Error('Exit prior to setting npm in exit handler')
+ // eslint-disable-next-line no-console
console.error(err.stack || err.message)
return process.exit(1)
}
if (!hasLoadedNpm) {
err = err || new Error('Exit prior to config file resolving.')
+ // eslint-disable-next-line no-console
console.error(err.stack || err.message)
}
@@ -110,7 +144,7 @@ const exitHandler = err => {
// will presumably print its own errors and exit with a proper status
// code if there's a problem. If we got an error with a code=0, then...
// something else went wrong along the way, so maybe an npm problem?
- const isShellout = npm.shelloutCommands.includes(npm.command)
+ const isShellout = npm.commandInstance && npm.commandInstance.constructor.isShellout
const quietShellout = isShellout && typeof err.code === 'number' && err.code
if (quietShellout) {
exitCode = err.code
@@ -135,10 +169,8 @@ const exitHandler = err => {
}
}
- const args = replaceInfo(process.argv)
log.verbose('cwd', process.cwd())
log.verbose('', os.type() + ' ' + os.release())
- log.verbose('argv', args.map(JSON.stringify).join(' '))
log.verbose('node', process.version)
log.verbose('npm ', 'v' + npm.version)
@@ -162,7 +194,7 @@ const exitHandler = err => {
detail: messageText(msg.detail),
},
}
- console.error(JSON.stringify(error, null, 2))
+ npm.outputError(JSON.stringify(error, null, 2))
}
if (typeof err.errno === 'number') {
@@ -175,17 +207,18 @@ const exitHandler = err => {
log.verbose('exit', exitCode || 0)
- showLogFileMessage = (hasLoadedNpm && npm.silent) || noLogMessage
+ showLogFileError = (hasLoadedNpm && npm.silent) || noLogMessage
? false
: !!exitCode
// explicitly call process.exit now so we don't hang on things like the
- // update notifier, also flush stdout beforehand because process.exit doesn't
+ // update notifier, also flush stdout/err beforehand because process.exit doesn't
// wait for that to happen.
- process.stdout.write('', () => process.exit(exitCode))
+ let flushed = 0
+ const flush = [process.stderr, process.stdout]
+ const exit = () => ++flushed === flush.length && process.exit(exitCode)
+ flush.forEach((f) => f.write('', exit))
}
module.exports = exitHandler
-module.exports.setNpm = n => {
- npm = n
-}
+module.exports.setNpm = n => (npm = n)
diff --git a/deps/npm/lib/utils/is-windows-bash.js b/deps/npm/lib/utils/is-windows-bash.js
deleted file mode 100644
index 0ae99e212cc..00000000000
--- a/deps/npm/lib/utils/is-windows-bash.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const isWindows = require('./is-windows.js')
-module.exports = isWindows &&
- (/^MINGW(32|64)$/.test(process.env.MSYSTEM) || process.env.TERM === 'cygwin')
diff --git a/deps/npm/lib/utils/is-windows-shell.js b/deps/npm/lib/utils/is-windows-shell.js
deleted file mode 100644
index 477bd43cc10..00000000000
--- a/deps/npm/lib/utils/is-windows-shell.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const isWindows = require('./is-windows.js')
-const isWindowsBash = require('./is-windows-bash.js')
-module.exports = isWindows && !isWindowsBash
diff --git a/deps/npm/lib/utils/is-windows.js b/deps/npm/lib/utils/is-windows.js
index fbece90ad74..57f6599b6ae 100644
--- a/deps/npm/lib/utils/is-windows.js
+++ b/deps/npm/lib/utils/is-windows.js
@@ -1 +1,6 @@
-module.exports = process.platform === 'win32'
+const isWindows = process.platform === 'win32'
+const isWindowsShell = isWindows &&
+ !/^MINGW(32|64)$/.test(process.env.MSYSTEM) && process.env.TERM !== 'cygwin'
+
+exports.isWindows = isWindows
+exports.isWindowsShell = isWindowsShell
diff --git a/deps/npm/lib/utils/log-file.js b/deps/npm/lib/utils/log-file.js
index 0bf1e0054ea..282c72700e5 100644
--- a/deps/npm/lib/utils/log-file.js
+++ b/deps/npm/lib/utils/log-file.js
@@ -5,8 +5,8 @@ const rimraf = promisify(require('rimraf'))
const glob = promisify(require('glob'))
const MiniPass = require('minipass')
const fsMiniPass = require('fs-minipass')
+const fs = require('@npmcli/fs')
const log = require('./log-shim')
-const withChownSync = require('./with-chown-sync')
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')
@@ -82,7 +82,9 @@ class LogFiles {
this[_endStream]()
}
- load ({ dir, logsMax } = {}) {
+ load ({ dir, logsMax = Infinity } = {}) {
+ // dir is user configurable and is required to exist so
+ // this can error if the dir is missing or not configured correctly
this.#dir = dir
this.#logsMax = logsMax
@@ -90,16 +92,22 @@ class LogFiles {
if (!this.#logStream) {
return
}
+
+ log.verbose('logfile', `logs-max:${logsMax} dir:${dir}`)
+
// Pipe our initial stream to our new file stream and
// set that as the new log logstream for future writes
- const initialFile = this[_openLogFile]()
- if (initialFile) {
- this.#logStream = this.#logStream.pipe(initialFile)
+ // if logs max is 0 then the user does not want a log file
+ if (this.#logsMax > 0) {
+ const initialFile = this[_openLogFile]()
+ if (initialFile) {
+ this.#logStream = this.#logStream.pipe(initialFile)
+ }
}
- // Kickoff cleaning process. This is async but it wont delete
- // our next log file since it deletes oldest first. Return the
- // result so it can be awaited in tests
+ // Kickoff cleaning process, even if we aren't writing a logfile.
+ // This is async but it will always ignore the current logfile
+ // Return the result so it can be awaited in tests
return this[_cleanLogs]()
}
@@ -164,8 +172,8 @@ class LogFiles {
return LogFiles.format(this.#totalLogCount++, ...args)
}
- [_getLogFilePath] (prefix, suffix, sep = '-') {
- return path.resolve(this.#dir, prefix + sep + 'debug' + sep + suffix + '.log')
+ [_getLogFilePath] (count = '') {
+ return path.resolve(this.#dir, `${this.#logId}-debug-${count}.log`)
}
[_openLogFile] () {
@@ -173,17 +181,19 @@ class LogFiles {
const count = this.#files.length
try {
- const logStream = withChownSync(
- // Pad with zeros so that our log files are always sorted properly
- // We never want to write files ending in `-9.log` and `-10.log` because
- // log file cleaning is done by deleting the oldest so in this example
- // `-10.log` would be deleted next
- this[_getLogFilePath](this.#logId, padZero(count, this.#MAX_FILES_PER_PROCESS)),
- // Some effort was made to make the async, but we need to write logs
- // during process.on('exit') which has to be synchronous. So in order
- // to never drop log messages, it is easiest to make it sync all the time
- // and this was measured to be about 1.5% slower for 40k lines of output
- (f) => new fsMiniPass.WriteStreamSync(f, { flags: 'a' })
+ // Pad with zeros so that our log files are always sorted properly
+ // We never want to write files ending in `-9.log` and `-10.log` because
+ // log file cleaning is done by deleting the oldest so in this example
+ // `-10.log` would be deleted next
+ const f = this[_getLogFilePath](padZero(count, this.#MAX_FILES_PER_PROCESS))
+ // Some effort was made to make the async, but we need to write logs
+ // during process.on('exit') which has to be synchronous. So in order
+ // to never drop log messages, it is easiest to make it sync all the time
+ // and this was measured to be about 1.5% slower for 40k lines of output
+ const logStream = fs.withOwnerSync(
+ f,
+ () => new fsMiniPass.WriteStreamSync(f, { flags: 'a' }),
+ { owner: 'inherit' }
)
if (count > 0) {
// Reset file log count if we are opening
@@ -193,9 +203,7 @@ class LogFiles {
this.#files.push(logStream.path)
return logStream
} catch (e) {
- // XXX: do something here for errors?
- // log to display only?
- return null
+ log.warn('logfile', `could not be created: ${e}`)
}
}
@@ -206,14 +214,16 @@ class LogFiles {
// Promise that succeeds when we've tried to delete everything,
// just for the benefit of testing this function properly.
- if (typeof this.#logsMax !== 'number') {
- return
- }
-
try {
- // Handle the old (prior to 8.2.0) log file names which did not have an counter suffix
- // so match by anything after `-debug` and before `.log` (including nothing)
- const logGlob = this[_getLogFilePath]('*-', '*', '')
+ const logPath = this[_getLogFilePath]()
+ const logGlob = path.join(path.dirname(logPath), path.basename(logPath)
+ // tell glob to only match digits
+ .replace(/\d/g, '[0123456789]')
+ // Handle the old (prior to 8.2.0) log file names which did not have a
+ // counter suffix
+ .replace(/-\.log$/, '*.log')
+ )
+
// Always ignore the currently written files
const files = await glob(logGlob, { ignore: this.#files })
const toDelete = files.length - this.#logsMax
@@ -233,6 +243,8 @@ class LogFiles {
}
} catch (e) {
log.warn('logfile', 'error cleaning log files', e)
+ } finally {
+ log.silly('logfile', 'done cleaning log files')
}
}
}
diff --git a/deps/npm/lib/utils/npm-usage.js b/deps/npm/lib/utils/npm-usage.js
index b0c98b2ae6c..8d31f015509 100644
--- a/deps/npm/lib/utils/npm-usage.js
+++ b/deps/npm/lib/utils/npm-usage.js
@@ -45,7 +45,7 @@ const wrap = (arr) => {
: Math.min(60, Math.max(process.stdout.columns - 16, 24))
let l = 0
- for (const c of arr.sort((a, b) => a < b ? -1 : 1)) {
+ for (const c of arr) {
if (out[l].length + c.length + 2 < line) {
out[l] += ', ' + c
} else {
diff --git a/deps/npm/lib/utils/otplease.js b/deps/npm/lib/utils/otplease.js
index 566c24ef2e2..83985b6bc17 100644
--- a/deps/npm/lib/utils/otplease.js
+++ b/deps/npm/lib/utils/otplease.js
@@ -1,17 +1,17 @@
-const readUserInfo = require('./read-user-info.js')
-
-module.exports = otplease
async function otplease (opts, fn) {
try {
- await fn(opts)
+ return await fn(opts)
} catch (err) {
+ const readUserInfo = require('./read-user-info.js')
if (err.code !== 'EOTP' && (err.code !== 'E401' || !/one-time pass/.test(err.body))) {
throw err
} else if (!process.stdin.isTTY || !process.stdout.isTTY) {
throw err
} else {
const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:')
- return fn({ ...opts, otp })
+ return await fn({ ...opts, otp })
}
}
}
+
+module.exports = otplease
diff --git a/deps/npm/lib/utils/path.js b/deps/npm/lib/utils/path.js
deleted file mode 100644
index ad0065a2c52..00000000000
--- a/deps/npm/lib/utils/path.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// return the PATH array in a cross-platform way
-const PATH = process.env.PATH || process.env.Path || process.env.path
-const { delimiter } = require('path')
-module.exports = PATH.split(delimiter)
diff --git a/deps/npm/lib/utils/replace-info.js b/deps/npm/lib/utils/replace-info.js
index e9d19ef5fb2..b9ce61935ff 100644
--- a/deps/npm/lib/utils/replace-info.js
+++ b/deps/npm/lib/utils/replace-info.js
@@ -1,33 +1,31 @@
-const URL = require('url').URL
+const { cleanUrl } = require('npm-registry-fetch')
+const isString = (v) => typeof v === 'string'
-// replaces auth info in an array of arguments or in a strings
-function replaceInfo (arg) {
- const isArray = Array.isArray(arg)
- const isString = str => typeof str === 'string'
-
- if (!isArray && !isString(arg)) {
- return arg
- }
+// split on \s|= similar to how nopt parses options
+const splitAndReplace = (str) => {
+ // stateful regex, don't move out of this scope
+ const splitChars = /[\s=]/g
- const testUrlAndReplace = str => {
- try {
- const url = new URL(str)
- return url.password === '' ? str : str.replace(url.password, '***')
- } catch (e) {
- return str
- }
+ let match = null
+ let result = ''
+ let index = 0
+ while (match = splitChars.exec(str)) {
+ result += cleanUrl(str.slice(index, match.index)) + match[0]
+ index = splitChars.lastIndex
}
- const args = isString(arg) ? arg.split(' ') : arg
- const info = args.map(a => {
- if (isString(a) && a.indexOf(' ') > -1) {
- return a.split(' ').map(testUrlAndReplace).join(' ')
- }
+ return result + cleanUrl(str.slice(index))
+}
- return testUrlAndReplace(a)
- })
+// replaces auth info in an array of arguments or in a strings
+function replaceInfo (arg) {
+ if (isString(arg)) {
+ return splitAndReplace(arg)
+ } else if (Array.isArray(arg)) {
+ return arg.map((a) => isString(a) ? splitAndReplace(a) : a)
+ }
- return isString(arg) ? info.join(' ') : info
+ return arg
}
module.exports = replaceInfo
diff --git a/deps/npm/lib/utils/split-package-names.js b/deps/npm/lib/utils/split-package-names.js
deleted file mode 100644
index 395c2517d59..00000000000
--- a/deps/npm/lib/utils/split-package-names.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict'
-
-const splitPackageNames = (path) => {
- return path.split('/')
- // combine scoped parts
- .reduce((parts, part) => {
- if (parts.length === 0) {
- return [part]
- }
-
- const lastPart = parts[parts.length - 1]
- // check if previous part is the first part of a scoped package
- if (lastPart[0] === '@' && !lastPart.includes('/')) {
- parts[parts.length - 1] += '/' + part
- } else {
- parts.push(part)
- }
-
- return parts
- }, [])
- .join('/node_modules/')
- .replace(/(\/node_modules)+/, '/node_modules')
-}
-
-module.exports = splitPackageNames
diff --git a/deps/npm/lib/utils/timers.js b/deps/npm/lib/utils/timers.js
index acff29eb052..3336c3b5192 100644
--- a/deps/npm/lib/utils/timers.js
+++ b/deps/npm/lib/utils/timers.js
@@ -1,8 +1,7 @@
const EE = require('events')
-const path = require('path')
-const fs = require('graceful-fs')
+const { resolve } = require('path')
+const fs = require('@npmcli/fs')
const log = require('./log-shim')
-const withChownSync = require('./with-chown-sync.js')
const _timeListener = Symbol('timeListener')
const _timeEndListener = Symbol('timeEndListener')
@@ -12,10 +11,11 @@ const _init = Symbol('init')
// only listen on a single internal event that gets
// emitted whenever a timer ends
class Timers extends EE {
+ file = null
+
#unfinished = new Map()
#finished = {}
#onTimeEnd = Symbol('onTimeEnd')
- #dir = null
#initialListener = null
#initialTimer = null
@@ -62,11 +62,27 @@ class Timers extends EE {
}
}
- load ({ dir }) {
- this.#dir = dir
+ time (name, fn) {
+ process.emit('time', name)
+ const end = () => process.emit('timeEnd', name)
+ if (typeof fn === 'function') {
+ const res = fn()
+ return res && res.finally ? res.finally(end) : (end(), res)
+ }
+ return end
+ }
+
+ load ({ dir } = {}) {
+ if (dir) {
+ this.file = resolve(dir, '_timing.json')
+ }
}
writeFile (fileData) {
+ if (!this.file) {
+ return
+ }
+
try {
const globalStart = this.started
const globalEnd = this.#finished.npm || Date.now()
@@ -79,16 +95,17 @@ class Timers extends EE {
return acc
}, {}),
}
- withChownSync(
- path.resolve(this.#dir, '_timing.json'),
- (f) =>
- // we append line delimited json to this file...forever
- // XXX: should we also write a process specific timing file?
- // with similar rules to the debug log (max files, etc)
- fs.appendFileSync(f, JSON.stringify(content) + '\n')
+ // we append line delimited json to this file...forever
+ // XXX: should we also write a process specific timing file?
+ // with similar rules to the debug log (max files, etc)
+ fs.withOwnerSync(
+ this.file,
+ () => fs.appendFileSync(this.file, JSON.stringify(content) + '\n'),
+ { owner: 'inherit' }
)
} catch (e) {
- log.warn('timing', 'could not write timing file', e)
+ this.file = null
+ log.warn('timing', `could not write timing file: ${e}`)
}
}
diff --git a/deps/npm/lib/utils/unsupported.js b/deps/npm/lib/utils/unsupported.js
deleted file mode 100644
index 75aad5e780e..00000000000
--- a/deps/npm/lib/utils/unsupported.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* eslint-disable no-console */
-const semver = require('semver')
-const supported = require('../../package.json').engines.node
-const knownBroken = '<6.2.0 || 9 <9.3.0'
-
-// Keep this file compatible with all practical versions of node
-// so we dont get syntax errors when trying to give the users
-// a nice error message. Don't use our log handler because
-// if we encounter a syntax error early on, that will never
-// get displayed to the user.
-
-const checkVersion = exports.checkVersion = version => {
- const versionNoPrerelease = version.replace(/-.*$/, '')
- return {
- version: versionNoPrerelease,
- broken: semver.satisfies(versionNoPrerelease, knownBroken),
- unsupported: !semver.satisfies(versionNoPrerelease, supported),
- }
-}
-
-exports.checkForBrokenNode = () => {
- const nodejs = checkVersion(process.version)
- if (nodejs.broken) {
- console.error('ERROR: npm is known not to run on Node.js ' + process.version)
- console.error("You'll need to upgrade to a newer Node.js version in order to use this")
- console.error('version of npm. You can find the latest version at https://nodejs.org/')
- process.exit(1)
- }
-}
-
-exports.checkForUnsupportedNode = () => {
- const nodejs = checkVersion(process.version)
- if (nodejs.unsupported) {
- console.error('npm does not support Node.js ' + process.version)
- console.error('You should probably upgrade to a newer version of node as we')
- console.error("can't make any promises that npm will work with this version.")
- console.error('You can find the latest version at https://nodejs.org/')
- }
-}
diff --git a/deps/npm/lib/utils/update-notifier.js b/deps/npm/lib/utils/update-notifier.js
index 875c3a99a25..dde0202b76f 100644
--- a/deps/npm/lib/utils/update-notifier.js
+++ b/deps/npm/lib/utils/update-notifier.js
@@ -122,5 +122,5 @@ module.exports = async npm => {
// fails, it's ok. might be using /dev/null as the cache or something weird
// like that.
writeFile(lastCheckedFile(npm), '').catch(() => {})
- npm.updateNotification = notification
+ return notification
}
diff --git a/deps/npm/lib/utils/usage.js b/deps/npm/lib/utils/usage.js
deleted file mode 100644
index 39eaa45e410..00000000000
--- a/deps/npm/lib/utils/usage.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const aliases = require('./cmd-list').aliases
-
-module.exports = function usage (cmd, txt, opt) {
- const post = Object.keys(aliases).reduce(function (p, c) {
- var val = aliases[c]
- if (val !== cmd) {
- return p
- }
- return p.concat(c)
- }, [])
-
- if (opt || post.length > 0) {
- txt += '\n\n'
- }
-
- if (post.length === 1) {
- txt += 'alias: '
- txt += post.join(', ')
- } else if (post.length > 1) {
- txt += 'aliases: '
- txt += post.join(', ')
- }
-
- if (opt) {
- if (post.length > 0) {
- txt += '\n'
- }
- txt += 'common options: ' + opt
- }
-
- return txt
-}
diff --git a/deps/npm/lib/utils/with-chown-sync.js b/deps/npm/lib/utils/with-chown-sync.js
deleted file mode 100644
index 481b5696dda..00000000000
--- a/deps/npm/lib/utils/with-chown-sync.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const mkdirp = require('mkdirp-infer-owner')
-const fs = require('graceful-fs')
-const path = require('path')
-
-module.exports = (file, method) => {
- const dir = path.dirname(file)
- mkdirp.sync(dir)
- const result = method(file)
- const st = fs.lstatSync(dir)
- fs.chownSync(dir, st.uid, st.gid)
- fs.chownSync(file, st.uid, st.gid)
- return result
-}
diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1
index cb36d9f8543..2f47c0865d6 100644
--- a/deps/npm/man/man1/npm-install.1
+++ b/deps/npm/man/man1/npm-install.1
@@ -16,7 +16,7 @@ npm install <tarball url>
npm install <git:// url>
npm install <github username>/<github project>
-aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add
+aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
.fi
.RE
.SS Description
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index 29d10078180..6e7e9acae0b 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
-npm@8\.5\.5 /path/to/npm
+npm@8\.6\.0 /path/to/npm
ā””ā”€ā”¬ init\-package\-json@0\.0\.4
ā””ā”€ā”€ promzard@0\.1\.5
.fi
diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1
index 73e3a471cec..da2d25f5cfd 100644
--- a/deps/npm/man/man1/npm-search.1
+++ b/deps/npm/man/man1/npm-search.1
@@ -7,7 +7,7 @@
.nf
npm search [search terms \.\.\.]
-aliases: s, se, find
+aliases: find, s, se
.fi
.RE
.P
diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1
index bb741021628..0638b2f728a 100644
--- a/deps/npm/man/man1/npm-uninstall.1
+++ b/deps/npm/man/man1/npm-uninstall.1
@@ -7,7 +7,7 @@
.nf
npm uninstall [<@scope>/]<pkg>\.\.\.
-aliases: un, unlink, remove, rm, r
+aliases: unlink, remove, rm, r, un
.fi
.RE
.SS Description
diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1
index 9b6b81c8a95..39bd8465b05 100644
--- a/deps/npm/man/man1/npm-version.1
+++ b/deps/npm/man/man1/npm-version.1
@@ -140,6 +140,17 @@ other things (test, exec, publish, etc\.) will operate on the root project,
.RE
.P
This value is not exported to the environment for child processes\.
+.SS \fBworkspaces\-update\fP
+.RS 0
+.IP \(bu 2
+Default: true
+.IP \(bu 2
+Type: Boolean
+
+.RE
+.P
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the \fBnode_modules\fP folder\.
.SS \fBinclude\-workspace\-root\fP
.RS 0
.IP \(bu 2
diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1
index dd0ac192d2f..f255dc4edb4 100644
--- a/deps/npm/man/man1/npm-view.1
+++ b/deps/npm/man/man1/npm-view.1
@@ -7,7 +7,7 @@
.nf
npm view [<@scope>/]<pkg>[@<version>] [<field>[\.subfield]\.\.\.]
-aliases: v, info, show
+aliases: info, show, v
.fi
.RE
.SS Description
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 3b5d8e9e336..cabc07a0110 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -4,7 +4,7 @@
.SS Synopsis
.SS Version
.P
-8\.5\.5
+8\.6\.0
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7
index 23150ebadfb..e5e112c5ab0 100644
--- a/deps/npm/man/man7/config.7
+++ b/deps/npm/man/man7/config.7
@@ -1088,6 +1088,17 @@ Any logs of a higher level than the setting are shown\. The default is
"notice"\.
.P
See also the \fBforeground\-scripts\fP config\.
+.SS \fBlogs\-dir\fP
+.RS 0
+.IP \(bu 2
+Default: A directory named \fB_logs\fP inside the cache
+.IP \(bu 2
+Type: null or Path
+
+.RE
+.P
+The location of npm's log directory\. See npm help \fBlogging\fP
+for more information\.
.SS \fBlogs\-max\fP
.RS 0
.IP \(bu 2
@@ -1098,6 +1109,8 @@ Type: Number
.RE
.P
The maximum number of log files to store\.
+.P
+If set to 0, no log files will be written for the current run\.
.SS \fBlong\fP
.RS 0
.IP \(bu 2
@@ -1696,9 +1709,9 @@ Type: Boolean
.RE
.P
-If true, writes an \fBnpm\-debug\fP log to \fB_logs\fP and timing information to
-\fB_timing\.json\fP, both in your cache, even if the command completes
-successfully\. \fB_timing\.json\fP is a newline delimited list of JSON objects\.
+If true, writes a debug log to \fBlogs\-dir\fP and timing information to
+\fB_timing\.json\fP in the cache, even if the command completes successfully\.
+\fB_timing\.json\fP is a newline delimited list of JSON objects\.
.P
You can quickly view it with this json \fIhttps://npm\.im/json\fR command line:
\fBnpm exec \-\- json \-g < ~/\.npm/_timing\.json\fP\|\.
@@ -1903,6 +1916,17 @@ other things (test, exec, publish, etc\.) will operate on the root project,
.RE
.P
This value is not exported to the environment for child processes\.
+.SS \fBworkspaces\-update\fP
+.RS 0
+.IP \(bu 2
+Default: true
+.IP \(bu 2
+Type: Boolean
+
+.RE
+.P
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the \fBnode_modules\fP folder\.
.SS \fByes\fP
.RS 0
.IP \(bu 2
diff --git a/deps/npm/man/man7/logging.7 b/deps/npm/man/man7/logging.7
index 06eb4c6a794..c410678f5da 100644
--- a/deps/npm/man/man7/logging.7
+++ b/deps/npm/man/man7/logging.7
@@ -1,9 +1,19 @@
.TH "LOGGING" "7" "March 2022" "" ""
.SH "NAME"
-\fBLogging\fR \- Why, What & How we Log
+\fBLogging\fR \- Why, What & How We Log
.SS Description
.P
The \fBnpm\fP CLI has various mechanisms for showing different levels of information back to end\-users for certain commands, configurations & environments\.
+.SS Setting Log File Location
+.P
+All logs are written to a debug log, with the path to that file printed if the execution of a command fails\.
+.P
+The default location of the logs directory is a directory named \fB_logs\fP inside the npm cache\. This can be changed
+with the \fBlogs\-dir\fP config option\.
+.P
+Log files will be removed from the \fBlogs\-dir\fP when the number of log files exceeds \fBlogs\-max\fP, with the oldest logs being deleted first\.
+.P
+To turn off logs completely set \fB\-\-logs\-max=0\fP\|\.
.SS Setting Log Levels
.SS \fBloglevel\fP
.P
@@ -33,8 +43,6 @@ The default value of \fBloglevel\fP is \fB"notice"\fP but there are several leve
.RE
.P
All logs pertaining to a level proceeding the current setting will be shown\.
-.P
-All logs are written to a debug log, with the path to that file printed if the execution of a command fails\.
.SS Aliases
.P
The log levels listed above have various corresponding aliases, including:
@@ -60,12 +68,36 @@ The log levels listed above have various corresponding aliases, including:
.SS \fBforeground\-scripts\fP
.P
The \fBnpm\fP CLI began hiding the output of lifecycle scripts for \fBnpm install\fP as of \fBv7\fP\|\. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in \fBpackage\.json\fP\|\. If you'd like to change this behavior & log this output you can set \fBforeground\-scripts\fP to \fBtrue\fP\|\.
+.SS Timing Information
+.P
+The \fB\-\-timing\fP config can be set which does two things:
+.RS 0
+.IP 1. 3
+Always shows the full path to the debug log regardless of command exit status
+.IP 2. 3
+Write timing information to a timing file in the cache or \fBlogs\-dir\fP
+
+.RE
+.P
+This file is a newline delimited list of JSON objects that can be inspected to see timing data for each task in a \fBnpm\fP CLI run\.
.SS Registry Response Headers
.SS \fBnpm\-notice\fP
.P
The \fBnpm\fP CLI reads from & logs any \fBnpm\-notice\fP headers that are returned from the configured registry\. This mechanism can be used by third\-party registries to provide useful information when network\-dependent requests occur\.
.P
This header is not cached, and will not be logged if the request is served from the cache\.
+.SS Logs and Sensitive Information
+.P
+The \fBnpm\fP CLI makes a best effort to redact the following from terminal output and log files:
+.RS 0
+.IP \(bu 2
+Passwords inside basic auth URLs
+.IP \(bu 2
+npm tokens
+
+.RE
+.P
+However, this behavior should not be relied on to keep all possible sensitive information redacted\. If you are concerned about secrets in your log file or terminal output, you can use \fB\-\-loglevel=silent\fP and \fB\-\-logs\-max=0\fP to ensure no logs are written to your terminal or filesystem\.
.SS See also
.RS 0
.IP \(bu 2
diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7
index 8be91e805dc..722faa7b165 100644
--- a/deps/npm/man/man7/scripts.7
+++ b/deps/npm/man/man7/scripts.7
@@ -438,7 +438,7 @@ Don't prefix your script commands with "sudo"\. If root permissions
are required for some reason, then it'll fail with that error, and
the user will sudo the npm command in question\.
.IP \(bu 2
-Don't use \fBinstall\fP\|\. Use a \fB\|\.gyp\fP file for compilation, and \fBprepublish\fP
+Don't use \fBinstall\fP\|\. Use a \fB\|\.gyp\fP file for compilation, and \fBprepare\fP
for anything else\. You should almost never have to explicitly set a
preinstall or install script\. If you are doing this, please consider if
there is another option\. The only valid use of \fBinstall\fP or \fBpreinstall\fP
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index 3f001f9e9eb..f3166c37e14 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -355,6 +355,21 @@ Try using the package name instead, e.g:
})
.then(tree => {
+ // search the virtual tree for invalid edges, if any are found add their source to
+ // the depsQueue so that we'll fix it later
+ depth({
+ tree,
+ getChildren: (node) => [...node.edgesOut.values()].map(edge => edge.to),
+ filter: node => node,
+ visit: node => {
+ for (const edge of node.edgesOut.values()) {
+ if (!edge.valid) {
+ this[_depsQueue].push(node)
+ break // no need to continue the loop after the first hit
+ }
+ }
+ },
+ })
// null the virtual tree, because we're about to hack away at it
// if you want another one, load another copy.
this.idealTree = tree
@@ -743,6 +758,12 @@ This is a one-time fix-up, please be patient...
continue
}
+ // if the node's location isn't within node_modules then this is actually
+ // a link target, so skip it. the link node itself will be queued later.
+ if (!node.location.startsWith('node_modules')) {
+ continue
+ }
+
queue.push(async () => {
log.silly('inflate', node.location)
const { resolved, version, path, name, location, integrity } = node
@@ -750,8 +771,7 @@ This is a one-time fix-up, please be patient...
const useResolved = resolved && (
!version || resolved.startsWith('file:')
)
- const id = useResolved ? resolved
- : version || `file:${node.path}`
+ const id = useResolved ? resolved : version
const spec = npa.resolve(name, id, dirname(path))
const t = `idealTree:inflate:${location}`
this.addTracker(t)
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
index 4d65e3da6f6..8a41e7686e7 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
@@ -79,7 +79,7 @@ module.exports = cls => class VirtualLoader extends cls {
async [loadRoot] (s) {
const pj = this.path + '/package.json'
const pkg = await rpj(pj).catch(() => s.data.packages['']) || {}
- return this[loadWorkspaces](this[loadNode]('', pkg))
+ return this[loadWorkspaces](this[loadNode]('', pkg, true))
}
async [loadFromShrinkwrap] (s, root) {
@@ -264,7 +264,7 @@ module.exports = cls => class VirtualLoader extends cls {
}
}
- [loadNode] (location, sw) {
+ [loadNode] (location, sw, loadOverrides) {
const p = this.virtualTree ? this.virtualTree.realpath : this.path
const path = resolve(p, location)
// shrinkwrap doesn't include package name unless necessary
@@ -290,6 +290,7 @@ module.exports = cls => class VirtualLoader extends cls {
optional,
devOptional,
peer,
+ loadOverrides,
})
// cast to boolean because they're undefined in the lock file when false
node.extraneous = !!sw.extraneous
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
index acb889cebca..7fd0ca7f607 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
@@ -1308,7 +1308,7 @@ module.exports = cls => class Reifier extends cls {
// to only names that are found in this list
const retrieveUpdatedNodes = names => {
const filterDirectDependencies = node =>
- !node.isRoot && node.resolveParent.isRoot
+ !node.isRoot && node.resolveParent && node.resolveParent.isRoot
&& (!names || names.includes(node.name))
&& exactVersion(node) // skip update for exact ranges
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js
index c2a456e4832..42c401e8799 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js
@@ -1,10 +1,12 @@
const _progress = Symbol('_progress')
const _onError = Symbol('_onError')
+const _setProgress = Symbol('_setProgess')
const npmlog = require('npmlog')
module.exports = cls => class Tracker extends cls {
constructor (options = {}) {
super(options)
+ this[_setProgress] = !!options.progress
this[_progress] = new Map()
}
@@ -27,7 +29,7 @@ module.exports = cls => class Tracker extends cls {
// 1. no existing tracker, no subsection
// Create a new tracker from npmlog
// starts progress bar
- if (this[_progress].size === 0) {
+ if (this[_setProgress] && this[_progress].size === 0) {
npmlog.enableProgress()
}
@@ -76,7 +78,7 @@ module.exports = cls => class Tracker extends cls {
// remove progress bar if all
// trackers are finished
- if (this[_progress].size === 0) {
+ if (this[_setProgress] && this[_progress].size === 0) {
npmlog.disableProgress()
}
} else if (!hasTracker && subsection === null) {
@@ -92,7 +94,9 @@ module.exports = cls => class Tracker extends cls {
}
[_onError] (msg) {
- npmlog.disableProgress()
+ if (this[_setProgress]) {
+ npmlog.disableProgress()
+ }
throw new Error(msg)
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index 258234b977e..8913b4449e2 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/node_modules/@npmcli/arborist/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/arborist",
- "version": "5.0.3",
+ "version": "5.0.4",
"description": "Manage node_modules trees",
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
@@ -39,7 +39,8 @@
"walk-up-path": "^1.0.0"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"benchmark": "^2.1.4",
"chalk": "^4.1.0",
"minify-registry-metadata": "^2.1.0",
@@ -57,24 +58,24 @@
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"benchmark": "node scripts/benchmark.js",
"benchclean": "rm -rf scripts/benchmark/*/",
"npmclilint": "npmcli-lint",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force"
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/arborist"
},
"author": "GitHub Inc.",
"license": "ISC",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"main": "lib/index.js",
"bin": {
@@ -96,13 +97,10 @@
"timeout": "360"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
- "eslintIgnore": [
- "test/fixtures/",
- "!test/fixtures/*.js"
- ],
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/common/owner-sync.js b/deps/npm/node_modules/@npmcli/fs/lib/common/owner-sync.js
new file mode 100644
index 00000000000..2055c4b21de
--- /dev/null
+++ b/deps/npm/node_modules/@npmcli/fs/lib/common/owner-sync.js
@@ -0,0 +1,92 @@
+const { dirname, resolve } = require('path')
+
+const fileURLToPath = require('./file-url-to-path/index.js')
+const fs = require('../fs.js')
+
+// given a path, find the owner of the nearest parent
+const find = (path) => {
+ // if we have no getuid, permissions are irrelevant on this platform
+ if (!process.getuid) {
+ return {}
+ }
+
+ // fs methods accept URL objects with a scheme of file: so we need to unwrap
+ // those into an actual path string before we can resolve it
+ const resolved = path != null && path.href && path.origin
+ ? resolve(fileURLToPath(path))
+ : resolve(path)
+
+ let stat
+
+ try {
+ stat = fs.lstatSync(resolved)
+ } finally {
+ // if we got a stat, return its contents
+ if (stat) {
+ return { uid: stat.uid, gid: stat.gid }
+ }
+
+ // try the parent directory
+ if (resolved !== dirname(resolved)) {
+ return find(dirname(resolved))
+ }
+
+ // no more parents, never got a stat, just return an empty object
+ return {}
+ }
+}
+
+// given a path, uid, and gid update the ownership of the path if necessary
+const update = (path, uid, gid) => {
+ // nothing to update, just exit
+ if (uid === undefined && gid === undefined) {
+ return
+ }
+
+ try {
+ // see if the permissions are already the same, if they are we don't
+ // need to do anything, so return early
+ const stat = fs.statSync(path)
+ if (uid === stat.uid && gid === stat.gid) {
+ return
+ }
+ } catch (err) {}
+
+ try {
+ fs.chownSync(path, uid, gid)
+ } catch (err) {}
+}
+
+// accepts a `path` and the `owner` property of an options object and normalizes
+// it into an object with numerical `uid` and `gid`
+const validate = (path, input) => {
+ let uid
+ let gid
+
+ if (typeof input === 'string' || typeof input === 'number') {
+ uid = input
+ gid = input
+ } else if (input && typeof input === 'object') {
+ uid = input.uid
+ gid = input.gid
+ }
+
+ if (uid === 'inherit' || gid === 'inherit') {
+ const owner = find(path)
+ if (uid === 'inherit') {
+ uid = owner.uid
+ }
+
+ if (gid === 'inherit') {
+ gid = owner.gid
+ }
+ }
+
+ return { uid, gid }
+}
+
+module.exports = {
+ find,
+ update,
+ validate,
+}
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js b/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js
index d9875aba11f..8888266d627 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js
@@ -1,22 +1,16 @@
const fs = require('./fs.js')
const getOptions = require('./common/get-options.js')
-const owner = require('./common/owner.js')
+const withOwner = require('./with-owner.js')
const copyFile = async (src, dest, opts) => {
const options = getOptions(opts, {
- copy: ['mode', 'owner'],
+ copy: ['mode'],
wrap: 'mode',
})
- const { uid, gid } = await owner.validate(dest, options.owner)
-
// the node core method as of 16.5.0 does not support the mode being in an
// object, so we have to pass the mode value directly
- const result = await fs.copyFile(src, dest, options.mode)
-
- await owner.update(dest, uid, gid)
-
- return result
+ return withOwner(dest, () => fs.copyFile(src, dest, options.mode), opts)
}
module.exports = copyFile
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/fs.js b/deps/npm/node_modules/@npmcli/fs/lib/fs.js
index 29e5fb57356..457da10eed0 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/fs.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/fs.js
@@ -1,8 +1,14 @@
const fs = require('fs')
const promisify = require('@gar/promisify')
-// this module returns the core fs module wrapped in a proxy that promisifies
+const isLower = (s) => s === s.toLowerCase() && s !== s.toUpperCase()
+
+const fsSync = Object.fromEntries(Object.entries(fs).filter(([k, v]) =>
+ typeof v === 'function' && (k.endsWith('Sync') || !isLower(k[0]))
+))
+
+// this module returns the core fs async fns wrapped in a proxy that promisifies
// method calls within the getter. we keep it in a separate module so that the
// overridden methods have a consistent way to get to promisified fs methods
-// without creating a circular dependency
-module.exports = promisify(fs)
+// without creating a circular dependency. the ctors and sync methods are kept untouched
+module.exports = { ...promisify(fs), ...fsSync }
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/index.js b/deps/npm/node_modules/@npmcli/fs/lib/index.js
index e40d748a7da..43892df5fee 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/index.js
@@ -6,5 +6,7 @@ module.exports = {
mkdtemp: require('./mkdtemp.js'),
rm: require('./rm/index.js'),
withTempDir: require('./with-temp-dir.js'),
+ withOwner: require('./with-owner.js'),
+ withOwnerSync: require('./with-owner-sync.js'),
writeFile: require('./write-file.js'),
}
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js
index 04ff4479034..e2691042daa 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js
@@ -1,7 +1,7 @@
const fs = require('../fs.js')
const getOptions = require('../common/get-options.js')
const node = require('../common/node.js')
-const owner = require('../common/owner.js')
+const withOwner = require('../with-owner.js')
const polyfill = require('./polyfill.js')
@@ -12,21 +12,18 @@ const useNative = node.satisfies('>=10.12.0')
// extends mkdir with the ability to specify an owner of the new dir
const mkdir = async (path, opts) => {
const options = getOptions(opts, {
- copy: ['mode', 'recursive', 'owner'],
+ copy: ['mode', 'recursive'],
wrap: 'mode',
})
- const { uid, gid } = await owner.validate(path, options.owner)
// the polyfill is tested separately from this module, no need to hack
// process.version to try to trigger it just for coverage
// istanbul ignore next
- const result = useNative
- ? await fs.mkdir(path, options)
- : await polyfill(path, options)
-
- await owner.update(path, uid, gid)
-
- return result
+ return withOwner(
+ path,
+ () => useNative ? fs.mkdir(path, options) : polyfill(path, options),
+ opts
+ )
}
module.exports = mkdir
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js b/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js
index b7f078029d1..60b12a788de 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js
@@ -2,11 +2,11 @@ const { dirname, sep } = require('path')
const fs = require('./fs.js')
const getOptions = require('./common/get-options.js')
-const owner = require('./common/owner.js')
+const withOwner = require('./with-owner.js')
const mkdtemp = async (prefix, opts) => {
const options = getOptions(opts, {
- copy: ['encoding', 'owner'],
+ copy: ['encoding'],
wrap: 'encoding',
})
@@ -16,13 +16,8 @@ const mkdtemp = async (prefix, opts) => {
// /tmp -> /tmpABCDEF, infers from /
// /tmp/ -> /tmp/ABCDEF, infers from /tmp
const root = prefix.endsWith(sep) ? prefix : dirname(prefix)
- const { uid, gid } = await owner.validate(root, options.owner)
- const result = await fs.mkdtemp(prefix, options)
-
- await owner.update(result, uid, gid)
-
- return result
+ return withOwner(root, () => fs.mkdtemp(prefix, options), opts)
}
module.exports = mkdtemp
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/with-owner-sync.js b/deps/npm/node_modules/@npmcli/fs/lib/with-owner-sync.js
new file mode 100644
index 00000000000..3597d1c8104
--- /dev/null
+++ b/deps/npm/node_modules/@npmcli/fs/lib/with-owner-sync.js
@@ -0,0 +1,21 @@
+const getOptions = require('./common/get-options.js')
+const owner = require('./common/owner-sync.js')
+
+const withOwnerSync = (path, fn, opts) => {
+ const options = getOptions(opts, {
+ copy: ['owner'],
+ })
+
+ const { uid, gid } = owner.validate(path, options.owner)
+
+ const result = fn({ uid, gid })
+
+ owner.update(path, uid, gid)
+ if (typeof result === 'string') {
+ owner.update(result, uid, gid)
+ }
+
+ return result
+}
+
+module.exports = withOwnerSync
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/with-owner.js b/deps/npm/node_modules/@npmcli/fs/lib/with-owner.js
new file mode 100644
index 00000000000..a679102883d
--- /dev/null
+++ b/deps/npm/node_modules/@npmcli/fs/lib/with-owner.js
@@ -0,0 +1,21 @@
+const getOptions = require('./common/get-options.js')
+const owner = require('./common/owner.js')
+
+const withOwner = async (path, fn, opts) => {
+ const options = getOptions(opts, {
+ copy: ['owner'],
+ })
+
+ const { uid, gid } = await owner.validate(path, options.owner)
+
+ const result = await fn({ uid, gid })
+
+ await Promise.all([
+ owner.update(path, uid, gid),
+ typeof result === 'string' ? owner.update(result, uid, gid) : null,
+ ])
+
+ return result
+}
+
+module.exports = withOwner
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js b/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js
index 353d5555d10..ac9ebb714b9 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js
@@ -27,7 +27,7 @@ const withTempDir = async (root, fn, opts) => {
try {
await rm(target, { force: true, recursive: true })
- } catch (err) {}
+ } catch {}
if (err) {
throw err
diff --git a/deps/npm/node_modules/@npmcli/fs/lib/write-file.js b/deps/npm/node_modules/@npmcli/fs/lib/write-file.js
index 01de531d980..ff900571a1f 100644
--- a/deps/npm/node_modules/@npmcli/fs/lib/write-file.js
+++ b/deps/npm/node_modules/@npmcli/fs/lib/write-file.js
@@ -1,19 +1,14 @@
const fs = require('./fs.js')
const getOptions = require('./common/get-options.js')
-const owner = require('./common/owner.js')
+const withOwner = require('./with-owner.js')
const writeFile = async (file, data, opts) => {
const options = getOptions(opts, {
- copy: ['encoding', 'mode', 'flag', 'signal', 'owner'],
+ copy: ['encoding', 'mode', 'flag', 'signal'],
wrap: 'encoding',
})
- const { uid, gid } = await owner.validate(file, options.owner)
- const result = await fs.writeFile(file, data, options)
-
- await owner.update(file, uid, gid)
-
- return result
+ return withOwner(file, () => fs.writeFile(file, data, options), opts)
}
module.exports = writeFile
diff --git a/deps/npm/node_modules/@npmcli/fs/package.json b/deps/npm/node_modules/@npmcli/fs/package.json
index cb64ac82023..799bf514f20 100644
--- a/deps/npm/node_modules/@npmcli/fs/package.json
+++ b/deps/npm/node_modules/@npmcli/fs/package.json
@@ -1,11 +1,11 @@
{
"name": "@npmcli/fs",
- "version": "1.1.0",
+ "version": "2.1.0",
"description": "filesystem utilities for the npm cli",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"scripts": {
"preversion": "npm test",
@@ -14,11 +14,16 @@
"snap": "tap",
"test": "tap",
"npmclilint": "npmcli-lint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"postsnap": "npm run lintfix --",
- "postlint": "npm-template-check"
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/fs.git"
},
"keywords": [
"npm",
@@ -27,15 +32,19 @@
"author": "GitHub Inc.",
"license": "ISC",
"devDependencies": {
- "@npmcli/template-oss": "^2.3.1",
- "tap": "^15.0.9"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.1.2",
+ "tap": "^15.1.6"
},
"dependencies": {
- "@gar/promisify": "^1.0.1",
+ "@gar/promisify": "^1.1.3",
"semver": "^7.3.5"
},
- "templateVersion": "2.3.1",
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+ },
+ "templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.1.2"
}
}
diff --git a/deps/npm/node_modules/builtins/History.md b/deps/npm/node_modules/builtins/History.md
deleted file mode 100644
index 0eb45c42077..00000000000
--- a/deps/npm/node_modules/builtins/History.md
+++ /dev/null
@@ -1,39 +0,0 @@
-
-0.0.7 / 2014-09-01
-==================
-
- * update .repository
-
-0.0.6 / 2014-09-01
-==================
-
- * add travis
- * add test script
- * add constants
-
-0.0.5 / 2014-06-27
-==================
-
- * add module
- * publish to public npm
-
-0.0.4 / 2014-04-25
-==================
-
- * add timers
-
-0.0.3 / 2014-02-22
-==================
-
- * add buffer
-
-0.0.2 / 2014-02-11
-==================
-
- * add assert
-
-0.0.1 / 2014-02-11
-==================
-
- * add main
- * initial commit
diff --git a/deps/npm/node_modules/builtins/Readme.md b/deps/npm/node_modules/builtins/Readme.md
index 96f4b1f6c4a..b1c0007d6f5 100644
--- a/deps/npm/node_modules/builtins/Readme.md
+++ b/deps/npm/node_modules/builtins/Readme.md
@@ -1,18 +1,39 @@
-
# builtins
- List of node.js [builtin modules](http://nodejs.org/api/).
+[![CI](https://github.com/juliangruber/builtins/actions/workflows/ci.yml/badge.svg)](https://github.com/juliangruber/builtins/actions/workflows/ci.yml)
+
+List of node.js [builtin modules](http://nodejs.org/api/).
+
+## Usage
+
+```js
+const builtins = require('builtins')
+```
+
+Get list of core modules for current Node.js version:
+
+```js
+assert(builtins().includes('http'))
+```
- [![build status](https://secure.travis-ci.org/juliangruber/builtins.svg)](http://travis-ci.org/juliangruber/builtins)
+Get list of core modules for specific Node.js version:
+
+```js
+assert(builtins({ version: '6.0.0' }).includes('http'))
+```
-## Example
+Get list of core modules present in one or mode Node.js versions:
```js
-var builtins = require('builtins');
+assert(builtins({ version: '*' }).includes('worker_threads'))
+```
-assert(builtins.indexOf('http') > -1);
+Add experimental modules to the list:
+
+```js
+assert(builtins({ experimental: true }).includes('wasi'))
```
## License
- MIT
+MIT
diff --git a/deps/npm/node_modules/builtins/builtins.json b/deps/npm/node_modules/builtins/builtins.json
deleted file mode 100644
index 45c05225644..00000000000
--- a/deps/npm/node_modules/builtins/builtins.json
+++ /dev/null
@@ -1,35 +0,0 @@
-[
- "assert",
- "buffer",
- "child_process",
- "cluster",
- "console",
- "constants",
- "crypto",
- "dgram",
- "dns",
- "domain",
- "events",
- "fs",
- "http",
- "https",
- "module",
- "net",
- "os",
- "path",
- "process",
- "punycode",
- "querystring",
- "readline",
- "repl",
- "stream",
- "string_decoder",
- "timers",
- "tls",
- "tty",
- "url",
- "util",
- "v8",
- "vm",
- "zlib"
-]
diff --git a/deps/npm/node_modules/builtins/index.js b/deps/npm/node_modules/builtins/index.js
new file mode 100644
index 00000000000..3c781da7354
--- /dev/null
+++ b/deps/npm/node_modules/builtins/index.js
@@ -0,0 +1,79 @@
+'use strict'
+
+const semver = require('semver')
+
+const permanentModules = [
+ 'assert',
+ 'buffer',
+ 'child_process',
+ 'cluster',
+ 'console',
+ 'constants',
+ 'crypto',
+ 'dgram',
+ 'dns',
+ 'domain',
+ 'events',
+ 'fs',
+ 'http',
+ 'https',
+ 'module',
+ 'net',
+ 'os',
+ 'path',
+ 'punycode',
+ 'querystring',
+ 'readline',
+ 'repl',
+ 'stream',
+ 'string_decoder',
+ 'sys',
+ 'timers',
+ 'tls',
+ 'tty',
+ 'url',
+ 'util',
+ 'vm',
+ 'zlib'
+]
+
+const versionLockedModules = {
+ freelist: '<6.0.0',
+ v8: '>=1.0.0',
+ process: '>=1.1.0',
+ inspector: '>=8.0.0',
+ async_hooks: '>=8.1.0',
+ http2: '>=8.4.0',
+ perf_hooks: '>=8.5.0',
+ trace_events: '>=10.0.0',
+ worker_threads: '>=12.0.0'
+}
+
+const experimentalModules = {
+ worker_threads: '>=10.5.0',
+ wasi: '>=12.16.0',
+ diagnostics_channel: '^14.17.0 || >=15.1.0'
+}
+
+module.exports = ({ version = process.version, experimental = false } = {}) => {
+ const builtins = [...permanentModules]
+
+ for (const [name, semverRange] of Object.entries(versionLockedModules)) {
+ if (version === '*' || semver.satisfies(version, semverRange)) {
+ builtins.push(name)
+ }
+ }
+
+ if (experimental) {
+ for (const [name, semverRange] of Object.entries(experimentalModules)) {
+ if (
+ !builtins.includes(name) &&
+ (version === '*' || semver.satisfies(version, semverRange))
+ ) {
+ builtins.push(name)
+ }
+ }
+ }
+
+ return builtins
+}
diff --git a/deps/npm/node_modules/builtins/package.json b/deps/npm/node_modules/builtins/package.json
index 819996532d5..9c6c108d3ff 100644
--- a/deps/npm/node_modules/builtins/package.json
+++ b/deps/npm/node_modules/builtins/package.json
@@ -1,14 +1,20 @@
{
"name": "builtins",
- "version": "1.0.3",
+ "version": "5.0.0",
"description": "List of node.js builtin modules",
"repository": "juliangruber/builtins",
"license": "MIT",
- "main": "builtins.json",
- "publishConfig": {
- "registry": "https://registry.npmjs.org"
- },
+ "main": "index.js",
+ "files": [],
"scripts": {
- "test": "node test.js"
+ "test": "prettier-standard && standard && node test.js"
+ },
+ "dependencies": {
+ "semver": "^7.0.0"
+ },
+ "devDependencies": {
+ "node-core-test": "^1.1.1",
+ "prettier-standard": "^15.0.1",
+ "standard": "^14.3.4"
}
}
diff --git a/deps/npm/node_modules/builtins/test.js b/deps/npm/node_modules/builtins/test.js
deleted file mode 100644
index ffbe8389c14..00000000000
--- a/deps/npm/node_modules/builtins/test.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var builtins = require('./builtins');
-
-builtins.forEach(function(name){
- require(name);
-});
diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json
index c240fa446df..edae9a4f995 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.2",
+ "version": "16.0.3",
"cache-version": {
"content": "2",
"index": "5"
@@ -8,8 +8,8 @@
"description": "Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"scripts": {
"benchmarks": "node test/benchmarks",
@@ -20,15 +20,18 @@
"snap": "tap",
"coverage": "tap",
"test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"npmclilint": "npmcli-lint",
"lintfix": "npm run lint -- --fix",
"postsnap": "npm run lintfix --",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force",
- "posttest": "npm run lint"
+ "postlint": "template-oss-check",
+ "posttest": "npm run lint",
+ "template-oss-apply": "template-oss-apply --force"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/cacache.git"
},
- "repository": "https://github.com/npm/cacache",
"keywords": [
"cache",
"caching",
@@ -46,13 +49,13 @@
],
"license": "ISC",
"dependencies": {
- "@npmcli/fs": "^1.0.0",
+ "@npmcli/fs": "^2.1.0",
"@npmcli/move-file": "^1.1.2",
"chownr": "^2.0.0",
"fs-minipass": "^2.1.0",
"glob": "^7.2.0",
"infer-owner": "^1.0.4",
- "lru-cache": "^7.5.1",
+ "lru-cache": "^7.7.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-flush": "^1.0.5",
@@ -66,23 +69,25 @@
"unique-filename": "^1.1.1"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.9.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.1.2",
"benchmark": "^2.1.4",
"chalk": "^4.1.2",
"require-inject": "^1.4.4",
"tacks": "^1.3.0",
- "tap": "^15.0.9"
+ "tap": "^16.0.0"
},
"tap": {
"100": true,
"test-regex": "test/[^/]*.js"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"windowsCI": false,
- "version": "2.9.2"
+ "version": "3.1.2"
},
"author": "GitHub Inc."
}
diff --git a/deps/npm/node_modules/debug/package.json b/deps/npm/node_modules/debug/package.json
index cb7efa8eec3..3bcdc242fc0 100644
--- a/deps/npm/node_modules/debug/package.json
+++ b/deps/npm/node_modules/debug/package.json
@@ -1,6 +1,6 @@
{
"name": "debug",
- "version": "4.3.3",
+ "version": "4.3.4",
"repository": {
"type": "git",
"url": "git://github.com/debug-js/debug.git"
diff --git a/deps/npm/node_modules/debug/src/common.js b/deps/npm/node_modules/debug/src/common.js
index 6d571d2844d..e3291b20faa 100644
--- a/deps/npm/node_modules/debug/src/common.js
+++ b/deps/npm/node_modules/debug/src/common.js
@@ -179,7 +179,7 @@ function setup(env) {
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
}
diff --git a/deps/npm/node_modules/gauge/lib/index.js b/deps/npm/node_modules/gauge/lib/index.js
index ce9ba7d638e..37fc5ac60a1 100644
--- a/deps/npm/node_modules/gauge/lib/index.js
+++ b/deps/npm/node_modules/gauge/lib/index.js
@@ -91,8 +91,7 @@ Gauge.prototype._computeTheme = function (theme) {
if (typeof theme === 'string') {
theme = this._themes.getTheme(theme)
} else if (
- theme &&
- (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)
+ Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null
) {
var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode
var useColor = theme.hasColor == null ? hasColor : theme.hasColor
diff --git a/deps/npm/node_modules/gauge/package.json b/deps/npm/node_modules/gauge/package.json
index 431d906a9e4..bce3e68a33f 100644
--- a/deps/npm/node_modules/gauge/package.json
+++ b/deps/npm/node_modules/gauge/package.json
@@ -1,23 +1,23 @@
{
"name": "gauge",
- "version": "4.0.3",
+ "version": "4.0.4",
"description": "A terminal based horizontal gauge",
"main": "lib",
"scripts": {
"test": "tap",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",
"posttest": "npm run lint",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/gauge"
+ "url": "https://github.com/npm/gauge.git"
},
"keywords": [
"progressbar",
@@ -41,16 +41,17 @@
"wide-align": "^1.1.5"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.9.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.0",
"readable-stream": "^3.6.0",
- "tap": "^15.1.6"
+ "tap": "^16.0.1"
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"branches": 79,
@@ -59,6 +60,7 @@
"lines": 90
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.0"
}
}
diff --git a/deps/npm/node_modules/init-package-json/lib/default-input.js b/deps/npm/node_modules/init-package-json/lib/default-input.js
index 00034729757..fe5abfdd85e 100644
--- a/deps/npm/node_modules/init-package-json/lib/default-input.js
+++ b/deps/npm/node_modules/init-package-json/lib/default-input.js
@@ -17,8 +17,8 @@ function niceName (n) {
function readDeps (test, excluded) {
return function (cb) {
- fs.readdir('node_modules', function (er, dir) {
- if (er) {
+ fs.readdir('node_modules', function (readdirErr, dir) {
+ if (readdirErr) {
return cb()
}
var deps = {}
@@ -35,8 +35,8 @@ function readDeps (test, excluded) {
}
var dp = path.join(dirname, 'node_modules', d, 'package.json')
- fs.readFile(dp, 'utf8', function (er, p) {
- if (er) {
+ fs.readFile(dp, 'utf8', function (readFileErr, p) {
+ if (readFileErr) {
return next()
}
try {
@@ -108,11 +108,11 @@ var version = package.version ||
'1.0.0'
exports.version = yes ?
version :
- prompt('version', version, function (version) {
- if (semver.valid(version)) {
- return version
+ prompt('version', version, function (promptedVersion) {
+ if (semver.valid(promptedVersion)) {
+ return promptedVersion
}
- var er = new Error('Invalid version: "' + version + '"')
+ var er = new Error('Invalid version: "' + promptedVersion + '"')
er.notValid = true
return er
})
@@ -128,8 +128,8 @@ if (!package.main) {
f = []
}
- f = f.filter(function (f) {
- return f.match(/\.js$/)
+ f = f.filter(function (filtered) {
+ return filtered.match(/\.js$/)
})
if (f.indexOf('index.js') !== -1) {
@@ -261,17 +261,17 @@ if (!package.repository) {
}
if (!package.keywords) {
- exports.keywords = yes ? '' : prompt('keywords', function (s) {
- if (!s) {
+ exports.keywords = yes ? '' : prompt('keywords', function (promptedKeywords) {
+ if (!promptedKeywords) {
return undefined
}
- if (Array.isArray(s)) {
- s = s.join(' ')
+ if (Array.isArray(promptedKeywords)) {
+ promptedKeywords = promptedKeywords.join(' ')
}
- if (typeof s !== 'string') {
- return s
+ if (typeof promptedKeywords !== 'string') {
+ return promptedKeywords
}
- return s.split(/[\s,]+/)
+ return promptedKeywords.split(/[\s,]+/)
})
}
diff --git a/deps/npm/node_modules/init-package-json/lib/init-package-json.js b/deps/npm/node_modules/init-package-json/lib/init-package-json.js
index f13a34ce6ff..230bcd81747 100644
--- a/deps/npm/node_modules/init-package-json/lib/init-package-json.js
+++ b/deps/npm/node_modules/init-package-json/lib/init-package-json.js
@@ -74,62 +74,62 @@ function init (dir, input, config, cb) {
var pz = new PZ(input, ctx)
pz.backupFile = def
pz.on('error', cb)
- pz.on('data', function (data) {
- Object.keys(data).forEach(function (k) {
- if (data[k] !== undefined && data[k] !== null) {
- pkg[k] = data[k]
+ pz.on('data', function (pzData) {
+ Object.keys(pzData).forEach(function (k) {
+ if (pzData[k] !== undefined && pzData[k] !== null) {
+ pkg[k] = pzData[k]
}
})
// only do a few of these.
// no need for mans or contributors if they're in the files
- var es = readJson.extraSet
+ es = readJson.extraSet
readJson.extraSet = es.filter(function (fn) {
return fn.name !== 'authors' && fn.name !== 'mans'
})
- readJson.extras(packageFile, pkg, function (er, pkg) {
- if (er) {
- return cb(er, pkg)
+ readJson.extras(packageFile, pkg, function (extrasErr, pkgWithExtras) {
+ if (extrasErr) {
+ return cb(extrasErr, pkgWithExtras)
}
readJson.extraSet = es
- pkg = unParsePeople(pkg)
+ pkgWithExtras = unParsePeople(pkgWithExtras)
// no need for the readme now.
- delete pkg.readme
- delete pkg.readmeFilename
+ delete pkgWithExtras.readme
+ delete pkgWithExtras.readmeFilename
// really don't want to have this lying around in the file
- delete pkg._id
+ delete pkgWithExtras._id
// ditto
- delete pkg.gitHead
+ delete pkgWithExtras.gitHead
// if the repo is empty, remove it.
- if (!pkg.repository) {
- delete pkg.repository
+ if (!pkgWithExtras.repository) {
+ delete pkgWithExtras.repository
}
// readJson filters out empty descriptions, but init-package-json
// traditionally leaves them alone
- if (!pkg.description) {
- pkg.description = data.description
+ if (!pkgWithExtras.description) {
+ pkgWithExtras.description = pzData.description
}
- var d = JSON.stringify(updateDeps(pkg), null, 2) + '\n'
- function write (yes) {
- fs.writeFile(packageFile, d, 'utf8', function (er) {
- if (!er && yes && !config.get('silent')) {
- console.log('Wrote to %s:\n\n%s\n', packageFile, d)
+ var stringified = JSON.stringify(updateDeps(pkgWithExtras), null, 2) + '\n'
+ function write (writeYes) {
+ fs.writeFile(packageFile, stringified, 'utf8', function (writeFileErr) {
+ if (!writeFileErr && writeYes && !config.get('silent')) {
+ console.log('Wrote to %s:\n\n%s\n', packageFile, stringified)
}
- return cb(er, pkg)
+ return cb(writeFileErr, pkgWithExtras)
})
}
if (ctx.yes) {
return write(true)
}
- console.log('About to write to %s:\n\n%s\n', packageFile, d)
- read({ prompt: 'Is this OK? ', default: 'yes' }, function (er, ok) {
- if (er) {
- return cb(er)
+ console.log('About to write to %s:\n\n%s\n', packageFile, stringified)
+ read({ prompt: 'Is this OK? ', default: 'yes' }, function (promptErr, ok) {
+ if (promptErr) {
+ return cb(promptErr)
}
if (!ok || ok.toLowerCase().charAt(0) !== 'y') {
console.log('Aborted.')
diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json
index 9219863cb67..91d4b7a109f 100644
--- a/deps/npm/node_modules/init-package-json/package.json
+++ b/deps/npm/node_modules/init-package-json/package.json
@@ -1,18 +1,18 @@
{
"name": "init-package-json",
- "version": "3.0.1",
+ "version": "3.0.2",
"main": "lib/init-package-json.js",
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"repository": {
"type": "git",
@@ -22,21 +22,22 @@
"license": "ISC",
"description": "A node module to get your node module started",
"dependencies": {
- "npm-package-arg": "^9.0.0",
+ "npm-package-arg": "^9.0.1",
"promzard": "^0.3.0",
"read": "^1.0.7",
"read-package-json": "^5.0.0",
"semver": "^7.3.5",
"validate-npm-package-license": "^3.0.4",
- "validate-npm-package-name": "^3.0.0"
+ "validate-npm-package-name": "^4.0.0"
},
"devDependencies": {
"@npmcli/config": "^4.0.1",
- "@npmcli/template-oss": "^2.9.2",
- "tap": "^15.1.6"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.1",
+ "tap": "^16.0.1"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"statements": "94",
@@ -54,10 +55,11 @@
"start"
],
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.1"
}
}
diff --git a/deps/npm/node_modules/just-diff-apply/index.d.ts b/deps/npm/node_modules/just-diff-apply/index.d.ts
new file mode 100644
index 00000000000..9fc05257af0
--- /dev/null
+++ b/deps/npm/node_modules/just-diff-apply/index.d.ts
@@ -0,0 +1,17 @@
+// Definitions by: Eddie Atkinson <https://github.com/eddie-atkinson>
+
+type Operation = "add" | "replace" | "remove";
+
+type DiffOps = Array<{
+ op: Operation;
+ path: Array<string | number>;
+ value?: any;
+}>;
+type PathConverter = (path: string) => string[];
+
+export function diffApply<T extends object>(
+ obj: T,
+ diff: DiffOps,
+ pathConverter?: PathConverter
+): T;
+export const jsonPatchPathConverter: PathConverter;
diff --git a/deps/npm/node_modules/just-diff-apply/index.js b/deps/npm/node_modules/just-diff-apply/index.js
index ceb32681172..c5d2c3265a8 100644
--- a/deps/npm/node_modules/just-diff-apply/index.js
+++ b/deps/npm/node_modules/just-diff-apply/index.js
@@ -47,6 +47,7 @@ module.exports = {
var REMOVE = 'remove';
var REPLACE = 'replace';
var ADD = 'add';
+var MOVE = 'move';
function diffApply(obj, diff, pathConverter) {
if (!obj || typeof obj != 'object') {
@@ -62,44 +63,99 @@ function diffApply(obj, diff, pathConverter) {
var thisDiff = diff[i];
var subObject = obj;
var thisOp = thisDiff.op;
- var thisPath = thisDiff.path;
- if (pathConverter) {
- thisPath = pathConverter(thisPath);
- if (!Array.isArray(thisPath)) {
- throw new Error('pathConverter must return an array');
+
+ var thisPath = transformPath(pathConverter, thisDiff.path);
+ var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from);
+ var toPath, toPathCopy, lastToProp, subToObject, valueToMove;
+
+ if (thisFromPath) {
+ // MOVE only, "fromPath" is effectively path and "path" is toPath
+ toPath = thisPath;
+ thisPath = thisFromPath;
+
+ toPathCopy = toPath.slice();
+ lastToProp = toPathCopy.pop();
+ prototypeCheck(lastToProp);
+ if (lastToProp == null) {
+ return false;
}
- } else {
- if (!Array.isArray(thisPath)) {
- throw new Error('diff path must be an array, consider supplying a path converter');
+
+ var thisToProp;
+ while (((thisToProp = toPathCopy.shift())) != null) {
+ prototypeCheck(thisToProp);
+ if (!(thisToProp in subToObject)) {
+ subToObject[thisToProp] = {};
+ }
+ subToObject = subToObject[thisToProp];
}
}
+
var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
+ prototypeCheck(lastProp);
if (lastProp == null) {
return false;
}
+
var thisProp;
while (((thisProp = pathCopy.shift())) != null) {
+ prototypeCheck(thisProp);
if (!(thisProp in subObject)) {
subObject[thisProp] = {};
}
subObject = subObject[thisProp];
}
- if (thisOp === REMOVE || thisOp === REPLACE) {
+ if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) {
+ var path = thisOp === MOVE ? thisDiff.from : thisDiff.path;
if (!subObject.hasOwnProperty(lastProp)) {
- throw new Error(['expected to find property', thisDiff.path, 'in object', obj].join(' '));
+ throw new Error(['expected to find property', path, 'in object', obj].join(' '));
}
}
- if (thisOp === REMOVE) {
+ if (thisOp === REMOVE || thisOp === MOVE) {
+ if (thisOp === MOVE) {
+ valueToMove = subObject[lastProp];
+ }
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}
if (thisOp === REPLACE || thisOp === ADD) {
subObject[lastProp] = thisDiff.value;
}
+
+ if (thisOp === MOVE) {
+ subObject[lastToProp] = valueToMove;
+ }
}
return subObject;
}
+function transformPath(pathConverter, thisPath) {
+ if(pathConverter) {
+ thisPath = pathConverter(thisPath);
+ if(!Array.isArray(thisPath)) {
+ throw new Error([
+ 'pathConverter must return an array, returned:',
+ thisPath,
+ ].join(' '));
+ }
+ } else {
+ if(!Array.isArray(thisPath)) {
+ throw new Error([
+ 'diff path',
+ thisPath,
+ 'must be an array, consider supplying a path converter']
+ .join(' '));
+ }
+ }
+ return thisPath;
+}
+
function jsonPatchPathConverter(stringPath) {
return stringPath.split('/').slice(1);
}
+
+function prototypeCheck(prop) {
+ // coercion is intentional to catch prop values like `['__proto__']`
+ if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') {
+ throw new Error('setting of prototype values not supported');
+ }
+}
diff --git a/deps/npm/node_modules/just-diff-apply/index.mjs b/deps/npm/node_modules/just-diff-apply/index.mjs
index fcd26c2f5a2..045830507cd 100644
--- a/deps/npm/node_modules/just-diff-apply/index.mjs
+++ b/deps/npm/node_modules/just-diff-apply/index.mjs
@@ -65,18 +65,18 @@ function diffApply(obj, diff, pathConverter) {
}
} else {
if (!Array.isArray(thisPath)) {
- throw new Error(
- 'diff path must be an array, consider supplying a path converter'
- );
+ throw new Error('diff path must be an array, consider supplying a path converter');
}
}
var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
+ prototypeCheck(lastProp);
if (lastProp == null) {
return false;
}
var thisProp;
- while ((thisProp = pathCopy.shift()) != null) {
+ while (((thisProp = pathCopy.shift())) != null) {
+ prototypeCheck(thisProp);
if (!(thisProp in subObject)) {
subObject[thisProp] = {};
}
@@ -84,17 +84,11 @@ function diffApply(obj, diff, pathConverter) {
}
if (thisOp === REMOVE || thisOp === REPLACE) {
if (!subObject.hasOwnProperty(lastProp)) {
- throw new Error(
- ['expected to find property', thisDiff.path, 'in object', obj].join(
- ' '
- )
- );
+ throw new Error(['expected to find property', thisDiff.path, 'in object', obj].join(' '));
}
}
if (thisOp === REMOVE) {
- Array.isArray(subObject)
- ? subObject.splice(lastProp, 1)
- : delete subObject[lastProp];
+ Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}
if (thisOp === REPLACE || thisOp === ADD) {
subObject[lastProp] = thisDiff.value;
@@ -107,4 +101,11 @@ function jsonPatchPathConverter(stringPath) {
return stringPath.split('/').slice(1);
}
+function prototypeCheck(prop) {
+ // coercion is intentional to catch prop values like `['__proto__']`
+ if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') {
+ throw new Error('setting of prototype values not supported');
+ }
+}
+
export {diffApply, jsonPatchPathConverter};
diff --git a/deps/npm/node_modules/just-diff-apply/index.tests.ts b/deps/npm/node_modules/just-diff-apply/index.tests.ts
new file mode 100644
index 00000000000..d02ba89b838
--- /dev/null
+++ b/deps/npm/node_modules/just-diff-apply/index.tests.ts
@@ -0,0 +1,108 @@
+import * as diffObj from "./index";
+
+const { diffApply, jsonPatchPathConverter } = diffObj;
+const obj1 = {
+ a: 2,
+ b: 3,
+ c: {
+ d: 5
+ }
+};
+const arr1 = [1, "bee"];
+
+const objOps: diffObj.DiffOps = [
+ {
+ op: "replace",
+ path: ["a"],
+ value: 10
+ },
+ {
+ op: "remove",
+ path: ["b"]
+ },
+ {
+ op: "add",
+ path: ["e"],
+ value: 15
+ },
+ {
+ op: "remove",
+ path: ["c", "d"]
+ }
+];
+
+const arrOps: diffObj.DiffOps = [
+ {
+ op: "replace",
+ path: [1],
+ value: 10
+ },
+ {
+ op: "remove",
+ path: [2]
+ },
+ {
+ op: "add",
+ path: [7],
+ value: 15
+ }
+];
+
+//OK
+diffApply(obj1, objOps);
+diffApply(obj1, []);
+diffApply(arr1, arrOps);
+diffApply(arr1, []);
+diffApply(obj1, objOps, jsonPatchPathConverter);
+diffApply(arr1, arrOps, jsonPatchPathConverter);
+
+// not OK
+// @ts-expect-error
+diffApply(obj1);
+// @ts-expect-error
+diffApply(arr2);
+// @ts-expect-error
+diffApply("a");
+// @ts-expect-error
+diffApply(true);
+
+// @ts-expect-error
+diffApply(obj1, 1);
+// @ts-expect-error
+diffApply(3, arr2);
+// @ts-expect-error
+diffApply(obj1, "a");
+// @ts-expect-error
+diffApply("b", arr2);
+
+// @ts-expect-error
+diffApply(obj1, [{ op: "delete", path: ["a"] }]);
+// @ts-expect-error
+diffApply(obj1, [{ op: "delete", path: ["a"] }], jsonPatchPathConverter);
+// @ts-expect-error
+diffApply(obj1, "a", jsonPatchPathConverter);
+// @ts-expect-error
+diffApply(obj1, ["a", "b", "c"], jsonPatchPathConverter);
+
+// @ts-expect-error
+diff("a", jsonPatchPathConverter);
+// @ts-expect-error
+diff(true, jsonPatchPathConverter);
+
+// @ts-expect-error
+diff(obj1, 1, jsonPatchPathConverter);
+// @ts-expect-error
+diff(3, arr2, jsonPatchPathConverter);
+// @ts-expect-error
+diff(obj1, "a", jsonPatchPathConverter);
+// @ts-expect-error
+diff("b", arr2, jsonPatchPathConverter);
+
+// @ts-expect-error
+diff(obj1, obj2, "a");
+// @ts-expect-error
+diff(arr1, arr2, 1);
+// @ts-expect-error
+diff(obj1, arr1, "bee");
+// @ts-expect-error
+diff(obj2, arr2, "nope");
diff --git a/deps/npm/node_modules/just-diff-apply/package.json b/deps/npm/node_modules/just-diff-apply/package.json
index c38bd47aa69..b8e5012ff83 100644
--- a/deps/npm/node_modules/just-diff-apply/package.json
+++ b/deps/npm/node_modules/just-diff-apply/package.json
@@ -1,6 +1,6 @@
{
"name": "just-diff-apply",
- "version": "4.0.1",
+ "version": "5.2.0",
"description": "Apply a diff to an object. Optionally supports jsonPatch protocol",
"main": "index.js",
"module": "index.mjs",
@@ -10,6 +10,7 @@
"default": "./index.mjs"
}
},
+ "types": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c"
diff --git a/deps/npm/node_modules/libnpmaccess/lib/index.js b/deps/npm/node_modules/libnpmaccess/lib/index.js
index 925f742921a..71219d0098c 100644
--- a/deps/npm/node_modules/libnpmaccess/lib/index.js
+++ b/deps/npm/node_modules/libnpmaccess/lib/index.js
@@ -116,7 +116,7 @@ cmd.lsPackages.stream = (entity, opts = {}) => {
if (err.code === 'E404' && !team) {
uri = `/-/user/${eu(scope)}/package`
npmFetch.json.stream(uri, '*', nextOpts)
- .on('error', err => ret.emit('error', err))
+ .on('error', streamErr => ret.emit('error', streamErr))
.pipe(ret)
} else {
ret.emit('error', err)
diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json
index 72fcfaf586a..68ac1c28902 100644
--- a/deps/npm/node_modules/libnpmaccess/package.json
+++ b/deps/npm/node_modules/libnpmaccess/package.json
@@ -9,23 +9,24 @@
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"test": "tap",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",
"posttest": "npm run lint",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
- "nock": "^12.0.1",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
+ "nock": "^13.2.4",
"tap": "^15.1.0"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmaccess"
},
"bugs": "https://github.com/npm/libnpmaccess/issues",
@@ -37,16 +38,17 @@
"npm-registry-fetch": "^13.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"check-coverage": true
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json
index 11d0f5887bb..eeddaf09fdc 100644
--- a/deps/npm/node_modules/libnpmdiff/package.json
+++ b/deps/npm/node_modules/libnpmdiff/package.json
@@ -4,16 +4,16 @@
"description": "The registry diff",
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmdiff"
},
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"keywords": [
"npm",
@@ -33,7 +33,7 @@
"license": "ISC",
"scripts": {
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"test": "tap",
"posttest": "npm run lint",
@@ -41,15 +41,15 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force"
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
- "eslint": "^8.1.0",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"tap": "^15.0.9"
},
"dependencies": {
@@ -63,6 +63,7 @@
"tar": "^6.1.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmexec/lib/file-exists.js b/deps/npm/node_modules/libnpmexec/lib/file-exists.js
index 05dddc89f08..f89cfc217d6 100644
--- a/deps/npm/node_modules/libnpmexec/lib/file-exists.js
+++ b/deps/npm/node_modules/libnpmexec/lib/file-exists.js
@@ -4,7 +4,7 @@ const stat = promisify(require('fs').stat)
const walkUp = require('walk-up-path')
const fileExists = (file) => stat(file)
- .then((stat) => stat.isFile())
+ .then((res) => res.isFile())
.catch(() => false)
const localFileExists = async (dir, binName, root = '/') => {
diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js
index 3c7be114913..81d152a20bd 100644
--- a/deps/npm/node_modules/libnpmexec/lib/index.js
+++ b/deps/npm/node_modules/libnpmexec/lib/index.js
@@ -119,11 +119,11 @@ const exec = async (opts) => {
...flatOptions,
path,
})
- const tree = await localArb.loadActual()
+ const localTree = await localArb.loadActual()
// do we have all the packages in manifest list?
const needInstall =
- manis.some(manifest => manifestMissing({ tree, manifest }))
+ manis.some(manifest => manifestMissing({ tree: localTree, manifest }))
if (needInstall) {
const { npxCache } = flatOptions
diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json
index 9af42b29942..7245f15b2ed 100644
--- a/deps/npm/node_modules/libnpmexec/package.json
+++ b/deps/npm/node_modules/libnpmexec/package.json
@@ -2,17 +2,17 @@
"name": "libnpmexec",
"version": "4.0.2",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"main": "lib/index.js",
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"description": "npm exec (npx) programmatic API",
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmexec"
},
"keywords": [
@@ -33,16 +33,16 @@
],
"license": "ISC",
"scripts": {
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"posttest": "npm run lint",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"color": true,
@@ -50,7 +50,8 @@
"files": "test/*.js"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"bin-links": "^3.0.0",
"tap": "^15.0.6"
},
@@ -69,6 +70,7 @@
"walk-up-path": "^1.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmfund/lib/index.js b/deps/npm/node_modules/libnpmfund/lib/index.js
index a3d2d8223ca..a53893dc1cf 100644
--- a/deps/npm/node_modules/libnpmfund/lib/index.js
+++ b/deps/npm/node_modules/libnpmfund/lib/index.js
@@ -91,8 +91,8 @@ function readTree (tree, opts) {
}
}
- function getFundingDependencies (tree) {
- const edges = tree && tree.edgesOut && tree.edgesOut.values()
+ function getFundingDependencies (t) {
+ const edges = t && t.edgesOut && t.edgesOut.values()
if (!edges) {
return empty()
}
diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json
index 2abf897eefe..ddc95f2f0a3 100644
--- a/deps/npm/node_modules/libnpmfund/package.json
+++ b/deps/npm/node_modules/libnpmfund/package.json
@@ -3,13 +3,13 @@
"version": "3.0.1",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"description": "Programmatic API for npm fund",
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmfund"
},
"keywords": [
@@ -32,7 +32,7 @@
"license": "ISC",
"scripts": {
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"test": "tap",
@@ -40,23 +40,25 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force"
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"tap": "^15.0.9"
},
"dependencies": {
"@npmcli/arborist": "^5.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json
index c95230114cb..4071d38ee52 100644
--- a/deps/npm/node_modules/libnpmhook/package.json
+++ b/deps/npm/node_modules/libnpmhook/package.json
@@ -4,29 +4,29 @@
"description": "programmatic API for managing npm registry hooks",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"scripts": {
"prerelease": "npm t",
"postrelease": "npm publish && git push --follow-tags",
"test": "tap",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"snap": "tap",
"posttest": "npm run lint",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmhook"
},
"keywords": [
@@ -42,14 +42,16 @@
"npm-registry-fetch": "^13.0.0"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
- "nock": "^9.6.1",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
+ "nock": "^13.2.4",
"tap": "^15.1.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json
index 582a60e2ded..58ca5ec42e3 100644
--- a/deps/npm/node_modules/libnpmorg/package.json
+++ b/deps/npm/node_modules/libnpmorg/package.json
@@ -17,30 +17,31 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"test": "tap",
"posttest": "npm run lint",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"minipass": "^3.1.1",
- "nock": "^12.0.1",
+ "nock": "^13.2.4",
"tap": "^15.0.0"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmorg"
},
"bugs": "https://github.com/npm/libnpmorg/issues",
@@ -50,9 +51,10 @@
"npm-registry-fetch": "^13.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json
index f98f0269b0f..4ee093c74d6 100644
--- a/deps/npm/node_modules/libnpmpack/package.json
+++ b/deps/npm/node_modules/libnpmpack/package.json
@@ -8,33 +8,34 @@
"Claudia HernƔndez <claudia@npmjs.com>"
],
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"license": "ISC",
"scripts": {
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"test": "tap",
"posttest": "npm run lint",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"nock": "^13.0.7",
"tap": "^15.0.0"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmpack"
},
"bugs": "https://github.com/npm/libnpmpack/issues",
@@ -45,9 +46,10 @@
"pacote": "^13.0.5"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json
index 2ad8baf3d4a..bb911039e30 100644
--- a/deps/npm/node_modules/libnpmpublish/package.json
+++ b/deps/npm/node_modules/libnpmpublish/package.json
@@ -9,36 +9,37 @@
"Claudia HernƔndez <claudia@npmjs.com>"
],
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"license": "ISC",
"scripts": {
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"test": "tap",
"posttest": "npm run lint",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"libnpmpack": "^4.0.0",
"lodash.clonedeep": "^4.5.0",
- "nock": "^12.0.2",
+ "nock": "^13.2.4",
"tap": "^15"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmpublish"
},
"bugs": "https://github.com/npm/cli/issues",
@@ -51,9 +52,10 @@
"ssri": "^8.0.1"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json
index 25e730395ae..7bf69ecb8af 100644
--- a/deps/npm/node_modules/libnpmsearch/package.json
+++ b/deps/npm/node_modules/libnpmsearch/package.json
@@ -5,8 +5,8 @@
"author": "GitHub Inc.",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"keywords": [
"npm",
@@ -21,23 +21,24 @@
"prepublishOnly": "git push origin --follow-tags",
"posttest": "npm run lint",
"test": "tap",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
- "nock": "^9.6.1",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
+ "nock": "^13.2.4",
"tap": "^15"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmsearch"
},
"bugs": "https://github.com/npm/libnpmsearch/issues",
@@ -46,9 +47,10 @@
"npm-registry-fetch": "^13.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json
index 485ab59735b..7f8ee98f286 100644
--- a/deps/npm/node_modules/libnpmteam/package.json
+++ b/deps/npm/node_modules/libnpmteam/package.json
@@ -9,27 +9,28 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"test": "tap",
"posttest": "npm run lint",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
- "nock": "^12.0.1",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
+ "nock": "^13.2.4",
"tap": "^15"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmteam"
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"homepage": "https://npmjs.com/package/libnpmteam",
"dependencies": {
@@ -37,12 +38,13 @@
"npm-registry-fetch": "^13.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"check-coverage": true
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json
index ddb56c1cf32..2a3a7716a13 100644
--- a/deps/npm/node_modules/libnpmversion/package.json
+++ b/deps/npm/node_modules/libnpmversion/package.json
@@ -3,35 +3,36 @@
"version": "3.0.1",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"description": "library to do the things that 'npm version' does",
"repository": {
"type": "git",
- "url": "https://github.com/npm/cli",
+ "url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmversion"
},
"author": "GitHub Inc.",
"license": "ISC",
"scripts": {
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"test": "tap",
"posttest": "npm run lint",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.4.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"require-inject": "^1.4.4",
"tap": "^15"
},
@@ -44,9 +45,10 @@
"stringify-package": "^1.0.1"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2"
}
}
diff --git a/deps/npm/node_modules/lru-cache/index.js b/deps/npm/node_modules/lru-cache/index.js
index e37f5161645..978b8f4ee95 100644
--- a/deps/npm/node_modules/lru-cache/index.js
+++ b/deps/npm/node_modules/lru-cache/index.js
@@ -1,6 +1,17 @@
const perf = typeof performance === 'object' && performance &&
typeof performance.now === 'function' ? performance : Date
+const hasAbortController = typeof AbortController !== 'undefined'
+
+/* istanbul ignore next - minimal backwards compatibility polyfill */
+const AC = hasAbortController ? AbortController : Object.assign(
+ class AbortController {
+ constructor () { this.signal = new AC.AbortSignal }
+ abort () { this.signal.aborted = true }
+ },
+ { AbortSignal: class AbortSignal { constructor () { this.aborted = false }}}
+)
+
const warned = new Set()
const deprecatedOption = (opt, instead) => {
const code = `LRU_CACHE_OPTION_${opt}`
@@ -24,12 +35,15 @@ const deprecatedProperty = (field, instead) => {
warn(code, `${field} property`, `cache.${instead}`, get)
}
}
-const shouldWarn = (code) => typeof process === 'object' &&
+
+const shouldWarn = code => typeof process === 'object' &&
process &&
- !(process.noDeprecation || warned.has(code))
+ !warned.has(code)
+
const warn = (code, what, instead, fn) => {
warned.add(code)
- process.emitWarning(`The ${what} is deprecated. Please use ${instead} instead.`, 'DeprecationWarning', code, fn)
+ const msg = `The ${what} is deprecated. Please use ${instead} instead.`
+ process.emitWarning(msg, 'DeprecationWarning', code, fn)
}
const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
@@ -58,7 +72,7 @@ class ZeroArray extends Array {
class Stack {
constructor (max) {
- const UintArray = getUintArray(max)
+ const UintArray = max ? getUintArray(max) : Array
this.heap = new UintArray(max)
this.length = 0
}
@@ -73,7 +87,7 @@ class Stack {
class LRUCache {
constructor (options = {}) {
const {
- max,
+ max = 0,
ttl,
ttlResolution = 1,
ttlAutopurge,
@@ -83,8 +97,9 @@ class LRUCache {
disposeAfter,
noDisposeOnSet,
noUpdateTTL,
- maxSize,
+ maxSize = 0,
sizeCalculation,
+ fetchMethod,
} = options
// deprecated options, don't trigger a warning for getting them if
@@ -95,17 +110,17 @@ class LRUCache {
stale,
} = options instanceof LRUCache ? {} : options
- if (!isPosInt(max)) {
- throw new TypeError('max option must be an integer')
+ if (max !== 0 && !isPosInt(max)) {
+ throw new TypeError('max option must be a nonnegative integer')
}
- const UintArray = getUintArray(max)
+ const UintArray = max ? getUintArray(max) : Array
if (!UintArray) {
throw new Error('invalid max value: ' + max)
}
this.max = max
- this.maxSize = maxSize || 0
+ this.maxSize = maxSize
this.sizeCalculation = sizeCalculation || length
if (this.sizeCalculation) {
if (!this.maxSize) {
@@ -115,6 +130,13 @@ class LRUCache {
throw new TypeError('sizeCalculating set to non-function')
}
}
+
+ this.fetchMethod = fetchMethod || null
+ if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
+ throw new TypeError('fetchMethod must be a function if specified')
+ }
+
+
this.keyMap = new Map()
this.keyList = new Array(max).fill(null)
this.valList = new Array(max).fill(null)
@@ -139,7 +161,7 @@ class LRUCache {
this.noDisposeOnSet = !!noDisposeOnSet
this.noUpdateTTL = !!noUpdateTTL
- if (this.maxSize) {
+ if (this.maxSize !== 0) {
if (!isPosInt(this.maxSize)) {
throw new TypeError('maxSize must be a positive integer if specified')
}
@@ -159,6 +181,20 @@ class LRUCache {
this.initializeTTLTracking()
}
+ // do not allow completely unbounded caches
+ if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
+ throw new TypeError('At least one of max, maxSize, or ttl is required')
+ }
+ if (!this.ttlAutopurge && !this.max && !this.maxSize) {
+ const code = 'LRU_CACHE_UNBOUNDED'
+ if (shouldWarn(code)) {
+ warned.add(code)
+ const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
+ 'result in unbounded memory consumption.'
+ process.emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)
+ }
+ }
+
if (stale) {
deprecatedOption('stale', 'allowStale')
}
@@ -170,9 +206,14 @@ class LRUCache {
}
}
+ getRemainingTTL (key) {
+ return this.has(key) ? Infinity : 0
+ }
+
initializeTTLTracking () {
this.ttls = new ZeroArray(this.max)
this.starts = new ZeroArray(this.max)
+
this.setItemTTL = (index, ttl) => {
this.starts[index] = ttl !== 0 ? perf.now() : 0
this.ttls[index] = ttl
@@ -188,9 +229,11 @@ class LRUCache {
}
}
}
+
this.updateItemAge = (index) => {
this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
}
+
// debounce calls to perf.now() to 1s so we're not hitting
// that costly call repeatedly.
let cachedNow = 0
@@ -206,6 +249,16 @@ class LRUCache {
}
return n
}
+
+ this.getRemainingTTL = (key) => {
+ const index = this.keyMap.get(key)
+ if (index === undefined) {
+ return 0
+ }
+ return this.ttls[index] === 0 || this.starts[index] === 0 ? Infinity
+ : ((this.starts[index] + this.ttls[index]) - (cachedNow || getNow()))
+ }
+
this.isStale = (index) => {
return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
@@ -219,9 +272,17 @@ class LRUCache {
this.calculatedSize = 0
this.sizes = new ZeroArray(this.max)
this.removeItemSize = index => this.calculatedSize -= this.sizes[index]
- this.addItemSize = (index, v, k, size, sizeCalculation) => {
- const s = size || (sizeCalculation ? sizeCalculation(v, k) : 0)
- this.sizes[index] = isPosInt(s) ? s : 0
+ this.requireSize = (k, v, size, sizeCalculation) => {
+ if (sizeCalculation && !size) {
+ size = sizeCalculation(v, k)
+ }
+ if (!isPosInt(size)) {
+ throw new TypeError('size must be positive integer')
+ }
+ return size
+ }
+ this.addItemSize = (index, v, k, size) => {
+ this.sizes[index] = size
const maxSize = this.maxSize - this.sizes[index]
while (this.calculatedSize > maxSize) {
this.evict()
@@ -239,15 +300,19 @@ class LRUCache {
}
}
removeItemSize (index) {}
- addItemSize (index, v, k, size, sizeCalculation) {}
+ addItemSize (index, v, k, size) {}
+ requireSize (k, v, size, sizeCalculation) {
+ if (size || sizeCalculation) {
+ throw new TypeError('cannot set size without setting maxSize on cache')
+ }
+ }
*indexes ({ allowStale = this.allowStale } = {}) {
if (this.size) {
- for (let i = this.tail, j; true; ) {
+ for (let i = this.tail; true; ) {
if (!this.isValidIndex(i)) {
break
}
- j = i === this.head
if (allowStale || !this.isStale(i)) {
yield i
}
@@ -262,14 +327,13 @@ class LRUCache {
*rindexes ({ allowStale = this.allowStale } = {}) {
if (this.size) {
- for (let i = this.head, j; true; ) {
+ for (let i = this.head; true; ) {
if (!this.isValidIndex(i)) {
break
}
if (allowStale || !this.isStale(i)) {
yield i
}
- // either the tail now, or WAS the tail, and deleted
if (i === this.tail) {
break
} else {
@@ -389,6 +453,7 @@ class LRUCache {
sizeCalculation = this.sizeCalculation,
noUpdateTTL = this.noUpdateTTL,
} = {}) {
+ size = this.requireSize(k, v, size, sizeCalculation)
let index = this.size === 0 ? undefined : this.keyMap.get(k)
if (index === undefined) {
// addition
@@ -400,21 +465,25 @@ class LRUCache {
this.prev[index] = this.tail
this.tail = index
this.size ++
- this.addItemSize(index, v, k, size, sizeCalculation)
+ this.addItemSize(index, v, k, size)
noUpdateTTL = false
} else {
// update
const oldVal = this.valList[index]
if (v !== oldVal) {
- if (!noDisposeOnSet) {
- this.dispose(oldVal, k, 'set')
- if (this.disposeAfter) {
- this.disposed.push([oldVal, k, 'set'])
+ if (this.isBackgroundFetch(oldVal)) {
+ oldVal.__abortController.abort()
+ } else {
+ if (!noDisposeOnSet) {
+ this.dispose(oldVal, k, 'set')
+ if (this.disposeAfter) {
+ this.disposed.push([oldVal, k, 'set'])
+ }
}
}
this.removeItemSize(index)
this.valList[index] = v
- this.addItemSize(index, v, k, size, sizeCalculation)
+ this.addItemSize(index, v, k, size)
}
this.moveToTail(index)
}
@@ -458,9 +527,13 @@ class LRUCache {
const head = this.head
const k = this.keyList[head]
const v = this.valList[head]
- this.dispose(v, k, 'evict')
- if (this.disposeAfter) {
- this.disposed.push([v, k, 'evict'])
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort()
+ } else {
+ this.dispose(v, k, 'evict')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'evict'])
+ }
}
this.removeItemSize(head)
this.head = this.next[head]
@@ -481,22 +554,117 @@ class LRUCache {
}
}
+ backgroundFetch (k, index, options) {
+ const v = index === undefined ? undefined : this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ return v
+ }
+ const ac = new AbortController()
+ const fetchOpts = {
+ signal: ac.signal,
+ options,
+ }
+ const p = Promise.resolve(this.fetchMethod(k, v, fetchOpts)).then(v => {
+ if (!ac.signal.aborted) {
+ this.set(k, v, fetchOpts.options)
+ }
+ return v
+ })
+ p.__abortController = ac
+ p.__staleWhileFetching = v
+ if (index === undefined) {
+ this.set(k, p, fetchOpts.options)
+ index = this.keyMap.get(k)
+ } else {
+ this.valList[index] = p
+ }
+ return p
+ }
+
+ isBackgroundFetch (p) {
+ return p && typeof p === 'object' && typeof p.then === 'function' &&
+ Object.prototype.hasOwnProperty.call(p, '__staleWhileFetching')
+ }
+
+ // this takes the union of get() and set() opts, because it does both
+ async fetch (k, {
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ ttl = this.ttl,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ } = {}) {
+ if (!this.fetchMethod) {
+ return this.get(k, {allowStale, updateAgeOnGet})
+ }
+
+ const options = {
+ allowStale,
+ updateAgeOnGet,
+ ttl,
+ noDisposeOnSet,
+ size,
+ sizeCalculation,
+ noUpdateTTL,
+ }
+
+ let index = this.keyMap.get(k)
+ if (index === undefined) {
+ return this.backgroundFetch(k, index, options)
+ } else {
+ // in cache, maybe already fetching
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ return allowStale && v.__staleWhileFetching !== undefined
+ ? v.__staleWhileFetching : v
+ }
+
+ if (!this.isStale(index)) {
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
+ }
+ return v
+ }
+
+ // ok, it is stale, and not already fetching
+ // refresh the cache.
+ const p = this.backgroundFetch(k, index, options)
+ return allowStale && p.__staleWhileFetching !== undefined
+ ? p.__staleWhileFetching : p
+ }
+ }
+
get (k, {
allowStale = this.allowStale,
updateAgeOnGet = this.updateAgeOnGet,
} = {}) {
const index = this.keyMap.get(k)
if (index !== undefined) {
+ const value = this.valList[index]
+ const fetching = this.isBackgroundFetch(value)
if (this.isStale(index)) {
- const value = allowStale ? this.valList[index] : undefined
- this.delete(k)
- return value
+ // delete only if not an in-flight background fetch
+ if (!fetching) {
+ this.delete(k)
+ return allowStale ? value : undefined
+ } else {
+ return allowStale ? value.__staleWhileFetching : undefined
+ }
} else {
+ // if we're currently fetching it, we don't actually have it yet
+ // it's not stale, which means this isn't a staleWhileRefetching,
+ // so we just return undefined
+ if (fetching) {
+ return undefined
+ }
this.moveToTail(index)
if (updateAgeOnGet) {
this.updateItemAge(index)
}
- return this.valList[index]
+ return value
}
}
}
@@ -540,9 +708,14 @@ class LRUCache {
this.clear()
} else {
this.removeItemSize(index)
- this.dispose(this.valList[index], k, 'delete')
- if (this.disposeAfter) {
- this.disposed.push([this.valList[index], k, 'delete'])
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort()
+ } else {
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
}
this.keyMap.delete(k)
this.keyList[index] = null
@@ -569,16 +742,19 @@ class LRUCache {
}
clear () {
- if (this.dispose !== LRUCache.prototype.dispose) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.dispose(this.valList[index], this.keyList[index], 'delete')
- }
- }
- if (this.disposeAfter) {
- for (const index of this.rindexes({ allowStale: true })) {
- this.disposed.push([this.valList[index], this.keyList[index], 'delete'])
+ for (const index of this.rindexes({ allowStale: true })) {
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort()
+ } else {
+ const k = this.keyList[index]
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
}
}
+
this.keyMap.clear()
this.valList.fill(null)
this.keyList.fill(null)
diff --git a/deps/npm/node_modules/lru-cache/package.json b/deps/npm/node_modules/lru-cache/package.json
index a62f74c2b64..84d199c2b21 100644
--- a/deps/npm/node_modules/lru-cache/package.json
+++ b/deps/npm/node_modules/lru-cache/package.json
@@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
- "version": "7.5.1",
+ "version": "7.7.1",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
@@ -22,6 +22,7 @@
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"benchmark": "^2.1.4",
+ "clock-mock": "^1.0.3",
"size-limit": "^7.0.8",
"tap": "^15.1.6"
},
diff --git a/deps/npm/node_modules/make-fetch-happen/lib/agent.js b/deps/npm/node_modules/make-fetch-happen/lib/agent.js
index d28a31bfbda..f64644ff611 100644
--- a/deps/npm/node_modules/make-fetch-happen/lib/agent.js
+++ b/deps/npm/node_modules/make-fetch-happen/lib/agent.js
@@ -2,6 +2,7 @@
const LRU = require('lru-cache')
const url = require('url')
const isLambda = require('is-lambda')
+const dns = require('./dns.js')
const AGENT_CACHE = new LRU({ max: 50 })
const HttpAgent = require('agentkeepalive')
@@ -77,11 +78,13 @@ function getAgent (uri, opts) {
rejectUnauthorized: opts.rejectUnauthorized,
timeout: agentTimeout,
freeSocketTimeout: 15000,
+ lookup: dns.getLookup(opts.dns),
}) : new HttpAgent({
maxSockets: agentMaxSockets,
localAddress: opts.localAddress,
timeout: agentTimeout,
freeSocketTimeout: 15000,
+ lookup: dns.getLookup(opts.dns),
})
AGENT_CACHE.set(key, agent)
return agent
@@ -171,6 +174,8 @@ const HttpsProxyAgent = require('https-proxy-agent')
const SocksProxyAgent = require('socks-proxy-agent')
module.exports.getProxy = getProxy
function getProxy (proxyUrl, opts, isHttps) {
+ // our current proxy agents do not support an overridden dns lookup method, so will not
+ // benefit from the dns cache
const popts = {
host: proxyUrl.hostname,
port: proxyUrl.port,
diff --git a/deps/npm/node_modules/make-fetch-happen/lib/cache/index.js b/deps/npm/node_modules/make-fetch-happen/lib/cache/index.js
index 17a6425592b..0de49d23fb9 100644
--- a/deps/npm/node_modules/make-fetch-happen/lib/cache/index.js
+++ b/deps/npm/node_modules/make-fetch-happen/lib/cache/index.js
@@ -14,8 +14,8 @@ const cacheFetch = async (request, options) => {
// otherwise, we make a request, store it and return it
const response = await remote(request, options)
- const entry = new CacheEntry({ request, response, options })
- return entry.store('miss')
+ const newEntry = new CacheEntry({ request, response, options })
+ return newEntry.store('miss')
}
// we have a cached response that satisfies this request, however if the cache
diff --git a/deps/npm/node_modules/make-fetch-happen/lib/dns.js b/deps/npm/node_modules/make-fetch-happen/lib/dns.js
new file mode 100644
index 00000000000..13102b57c4a
--- /dev/null
+++ b/deps/npm/node_modules/make-fetch-happen/lib/dns.js
@@ -0,0 +1,49 @@
+const LRUCache = require('lru-cache')
+const dns = require('dns')
+
+const defaultOptions = exports.defaultOptions = {
+ family: undefined,
+ hints: dns.ADDRCONFIG,
+ all: false,
+ verbatim: undefined,
+}
+
+const lookupCache = exports.lookupCache = new LRUCache({ max: 50 })
+
+// this is a factory so that each request can have its own opts (i.e. ttl)
+// while still sharing the cache across all requests
+exports.getLookup = (dnsOptions) => {
+ return (hostname, options, callback) => {
+ if (typeof options === 'function') {
+ callback = options
+ options = null
+ } else if (typeof options === 'number') {
+ options = { family: options }
+ }
+
+ options = { ...defaultOptions, ...options }
+
+ const key = JSON.stringify({
+ hostname,
+ family: options.family,
+ hints: options.hints,
+ all: options.all,
+ verbatim: options.verbatim,
+ })
+
+ if (lookupCache.has(key)) {
+ const [address, family] = lookupCache.get(key)
+ process.nextTick(callback, null, address, family)
+ return
+ }
+
+ dnsOptions.lookup(hostname, options, (err, address, family) => {
+ if (err) {
+ return callback(err)
+ }
+
+ lookupCache.set(key, [address, family], { ttl: dnsOptions.ttl })
+ return callback(null, address, family)
+ })
+ }
+}
diff --git a/deps/npm/node_modules/make-fetch-happen/lib/options.js b/deps/npm/node_modules/make-fetch-happen/lib/options.js
index a0c8664adf0..daa9ecd9d5d 100644
--- a/deps/npm/node_modules/make-fetch-happen/lib/options.js
+++ b/deps/npm/node_modules/make-fetch-happen/lib/options.js
@@ -1,3 +1,5 @@
+const dns = require('dns')
+
const conditionalHeaders = [
'if-modified-since',
'if-none-match',
@@ -26,6 +28,8 @@ const configureOptions = (opts) => {
options.retry = { retries: 0, ...options.retry }
}
+ options.dns = { ttl: 5 * 60 * 1000, lookup: dns.lookup, ...options.dns }
+
options.cache = options.cache || 'default'
if (options.cache === 'default') {
const hasConditionalHeader = Object.keys(options.headers || {}).some((name) => {
diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json
index e52131b8a8e..0e147be6988 100644
--- a/deps/npm/node_modules/make-fetch-happen/package.json
+++ b/deps/npm/node_modules/make-fetch-happen/package.json
@@ -1,11 +1,11 @@
{
"name": "make-fetch-happen",
- "version": "10.0.6",
+ "version": "10.1.1",
"description": "Opinionated, caching, retrying fetch client",
"main": "lib/index.js",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"scripts": {
"preversion": "npm test",
@@ -14,13 +14,16 @@
"test": "tap",
"posttest": "npm run lint",
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/make-fetch-happen.git"
},
- "repository": "https://github.com/npm/make-fetch-happen",
"keywords": [
"http",
"request",
@@ -34,12 +37,12 @@
"license": "ISC",
"dependencies": {
"agentkeepalive": "^4.2.1",
- "cacache": "^16.0.0",
+ "cacache": "^16.0.2",
"http-cache-semantics": "^4.1.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
- "lru-cache": "^7.5.1",
+ "lru-cache": "^7.7.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-fetch": "^2.0.3",
@@ -51,17 +54,17 @@
"ssri": "^8.0.1"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.9.2",
- "eslint": "^8.11.0",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.0",
"mkdirp": "^1.0.4",
"nock": "^13.2.4",
"rimraf": "^3.0.2",
"safe-buffer": "^5.2.1",
"standard-version": "^9.3.2",
- "tap": "^15.1.6"
+ "tap": "^16.0.0"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"color": 1,
@@ -69,6 +72,7 @@
"check-coverage": true
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.0"
}
}
diff --git a/deps/npm/node_modules/minipass-fetch/lib/body.js b/deps/npm/node_modules/minipass-fetch/lib/body.js
index 2b8e3bd2f9e..c7ffa5babcb 100644
--- a/deps/npm/node_modules/minipass-fetch/lib/body.js
+++ b/deps/npm/node_modules/minipass-fetch/lib/body.js
@@ -127,8 +127,10 @@ class Body {
: this.size ? new MinipassSized({ size: this.size })
: new Minipass()
- // allow timeout on slow response body
- const resTimeout = this.timeout ? setTimeout(() => {
+ // allow timeout on slow response body, but only if the stream is still writable. this
+ // makes the timeout center on the socket stream from lib/index.js rather than the
+ // intermediary minipass stream we create to receive the data
+ const resTimeout = this.timeout && stream.writable ? setTimeout(() => {
stream.emit('error', new FetchError(
`Response timeout while trying to fetch ${
this.url} (over ${this.timeout}ms)`, 'body-timeout'))
diff --git a/deps/npm/node_modules/minipass-fetch/lib/index.js b/deps/npm/node_modules/minipass-fetch/lib/index.js
index 22257a417af..b1878ac0c06 100644
--- a/deps/npm/node_modules/minipass-fetch/lib/index.js
+++ b/deps/npm/node_modules/minipass-fetch/lib/index.js
@@ -255,8 +255,8 @@ const fetch = async (url, opts) => {
size: request.size,
timeout: request.timeout,
counter: request.counter,
- trailer: new Promise(resolve =>
- res.on('end', () => resolve(createHeadersLenient(res.trailers)))),
+ trailer: new Promise(resolveTrailer =>
+ res.on('end', () => resolveTrailer(createHeadersLenient(res.trailers)))),
}
// HTTP-network fetch step 12.1.1.3
@@ -362,3 +362,4 @@ fetch.Headers = Headers
fetch.Request = Request
fetch.Response = Response
fetch.FetchError = FetchError
+fetch.AbortError = AbortError
diff --git a/deps/npm/node_modules/minipass-fetch/package.json b/deps/npm/node_modules/minipass-fetch/package.json
index 68e1ce134cd..1f663b9245d 100644
--- a/deps/npm/node_modules/minipass-fetch/package.json
+++ b/deps/npm/node_modules/minipass-fetch/package.json
@@ -1,6 +1,6 @@
{
"name": "minipass-fetch",
- "version": "2.0.3",
+ "version": "2.1.0",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
@@ -10,19 +10,20 @@
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
- "posttest": "npm run lint"
+ "posttest": "npm run lint",
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.9.2",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.1.2",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
@@ -30,7 +31,7 @@
"nock": "^13.2.4",
"parted": "^0.1.1",
"string-to-arraybuffer": "^1.0.2",
- "tap": "^15.1.6"
+ "tap": "^16.0.0"
},
"dependencies": {
"minipass": "^3.1.6",
@@ -42,7 +43,7 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/npm/minipass-fetch.git"
+ "url": "https://github.com/npm/minipass-fetch.git"
},
"keywords": [
"fetch",
@@ -51,14 +52,15 @@
"window.fetch"
],
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.1.2"
}
}
diff --git a/deps/npm/node_modules/npm-audit-report/lib/colors.js b/deps/npm/node_modules/npm-audit-report/lib/colors.js
index ad76870fd6f..2fbf5c36093 100644
--- a/deps/npm/node_modules/npm-audit-report/lib/colors.js
+++ b/deps/npm/node_modules/npm-audit-report/lib/colors.js
@@ -19,6 +19,6 @@ module.exports = color => {
magenta,
yellow,
white,
- severity
+ severity,
}
}
diff --git a/deps/npm/node_modules/npm-audit-report/lib/exit-code.js b/deps/npm/node_modules/npm-audit-report/lib/exit-code.js
index 7a32ac6db47..fcb580b5126 100644
--- a/deps/npm/node_modules/npm-audit-report/lib/exit-code.js
+++ b/deps/npm/node_modules/npm-audit-report/lib/exit-code.js
@@ -5,7 +5,7 @@ const severities = new Map(Object.entries([
'moderate',
'high',
'critical',
- 'none'
+ 'none',
]).map(s => s.reverse()))
module.exports = (data, level) =>
diff --git a/deps/npm/node_modules/npm-audit-report/lib/index.js b/deps/npm/node_modules/npm-audit-report/lib/index.js
index 9ee86be7915..63063f92526 100644
--- a/deps/npm/node_modules/npm-audit-report/lib/index.js
+++ b/deps/npm/node_modules/npm-audit-report/lib/index.js
@@ -4,7 +4,7 @@ const reporters = {
install: require('./reporters/install'),
detail: require('./reporters/detail'),
json: require('./reporters/json'),
- quiet: require('./reporters/quiet')
+ quiet: require('./reporters/quiet'),
}
const exitCode = require('./exit-code.js')
@@ -20,20 +20,22 @@ module.exports = Object.assign((data, options = {}) => {
// CLI defaults this to `null` so the defaulting method above doesn't work
const auditLevel = options.auditLevel || 'low'
- if (!data)
+ if (!data) {
throw Object.assign(
new TypeError('ENOAUDITDATA'),
{
code: 'ENOAUDITDATA',
- message: 'missing audit data'
+ message: 'missing audit data',
}
)
+ }
- if (typeof data.toJSON === 'function')
+ if (typeof data.toJSON === 'function') {
data = data.toJSON()
+ }
return {
report: reporters[reporter](data, { color, unicode, indent }),
- exitCode: exitCode(data, auditLevel)
+ exitCode: exitCode(data, auditLevel),
}
}, { reporters })
diff --git a/deps/npm/node_modules/npm-audit-report/lib/reporters/detail.js b/deps/npm/node_modules/npm-audit-report/lib/reporters/detail.js
index 50451f05797..ba2f013836d 100644
--- a/deps/npm/node_modules/npm-audit-report/lib/reporters/detail.js
+++ b/deps/npm/node_modules/npm-audit-report/lib/reporters/detail.js
@@ -6,7 +6,7 @@ const install = require('./install.js')
module.exports = (data, { color }) => {
const summary = install.summary(data, { color })
const none = data.metadata.vulnerabilities.total === 0
- return none ? summary : fullReport(data, {color, summary})
+ return none ? summary : fullReport(data, { color, summary })
}
const fullReport = (data, { color, summary }) => {
@@ -14,10 +14,11 @@ const fullReport = (data, { color, summary }) => {
const output = [c.white('# npm audit report'), '']
const printed = new Set()
- for (const [name, vuln] of Object.entries(data.vulnerabilities)) {
+ for (const [, vuln] of Object.entries(data.vulnerabilities)) {
// only print starting from the top-level advisories
- if (vuln.via.filter(v => typeof v !== 'string').length !== 0)
- output.push(printVuln(vuln, c, data.vulnerabilities))
+ if (vuln.via.filter(v => typeof v !== 'string').length !== 0) {
+ output.push(printVuln(vuln, c, data.vulnerabilities, printed))
+ }
}
output.push(summary)
@@ -25,9 +26,10 @@ const fullReport = (data, { color, summary }) => {
return output.join('\n')
}
-const printVuln = (vuln, c, vulnerabilities, printed = new Set(), indent = '') => {
- if (printed.has(vuln))
+const printVuln = (vuln, c, vulnerabilities, printed, indent = '') => {
+ if (printed.has(vuln)) {
return null
+ }
printed.add(vuln)
const output = []
@@ -59,7 +61,7 @@ const printVuln = (vuln, c, vulnerabilities, printed = new Set(), indent = '') =
`${c.yellow('fix available')} via \`npm audit fix --force\``,
`Will install ${fa.name}@${fa.version}` +
`, which is ${fa.isSemVerMajor ? 'a breaking change' :
- 'outside the stated dependency range' }`
+ 'outside the stated dependency range'}`
)
}
}
@@ -70,10 +72,10 @@ const printVuln = (vuln, c, vulnerabilities, printed = new Set(), indent = '') =
}
for (const effect of vuln.effects) {
- const vuln = vulnerabilities[effect]
- const e = printVuln(vuln, c, vulnerabilities, printed, ' ')
- if (e)
+ const e = printVuln(vulnerabilities[effect], c, vulnerabilities, printed, ' ')
+ if (e) {
output.push(...e.split('\n'))
+ }
}
if (indent === '') {
diff --git a/deps/npm/node_modules/npm-audit-report/lib/reporters/install.js b/deps/npm/node_modules/npm-audit-report/lib/reporters/install.js
index fe53be3adad..cb8a249691e 100644
--- a/deps/npm/node_modules/npm-audit-report/lib/reporters/install.js
+++ b/deps/npm/node_modules/npm-audit-report/lib/reporters/install.js
@@ -3,7 +3,7 @@ const colors = require('../colors.js')
const calculate = (data, { color }) => {
const c = colors(color)
const output = []
- const { metadata: { vulnerabilities }} = data
+ const { metadata: { vulnerabilities } } = data
const vulnCount = vulnerabilities.total
let someFixable = false
@@ -14,7 +14,7 @@ const calculate = (data, { color }) => {
if (vulnCount === 0) {
output.push(`found ${c.green('0')} vulnerabilities`)
} else {
- for (const [name, vuln] of Object.entries(data.vulnerabilities)) {
+ for (const [, vuln] of Object.entries(data.vulnerabilities)) {
const { fixAvailable } = vuln
someFixable = someFixable || fixAvailable === true
someUnfixable = someUnfixable || fixAvailable === false
@@ -45,7 +45,7 @@ const calculate = (data, { color }) => {
if (someFixable) {
output.push('', 'To address ' +
(someForceFixable || someUnfixable ? 'issues that do not require attention'
- : 'all issues') + ', run:\n npm audit fix')
+ : 'all issues') + ', run:\n npm audit fix')
}
if (someForceFixable) {
@@ -66,10 +66,10 @@ const calculate = (data, { color }) => {
return {
summary,
report: vulnCount > 0 ? `${summary}\n\nRun \`npm audit\` for details.`
- : summary
+ : summary,
}
}
module.exports = Object.assign((data, opt) => calculate(data, opt).report, {
- summary: (data, opt) => calculate(data, opt).summary
+ summary: (data, opt) => calculate(data, opt).summary,
})
diff --git a/deps/npm/node_modules/npm-audit-report/package.json b/deps/npm/node_modules/npm-audit-report/package.json
index c819b960841..8749c14582f 100644
--- a/deps/npm/node_modules/npm-audit-report/package.json
+++ b/deps/npm/node_modules/npm-audit-report/package.json
@@ -1,6 +1,6 @@
{
"name": "npm-audit-report",
- "version": "2.1.5",
+ "version": "3.0.0",
"description": "Given a response from the npm security api, render it into a variety of security reports",
"main": "lib/index.js",
"scripts": {
@@ -8,7 +8,12 @@
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags"
+ "prepublishOnly": "git push origin --follow-tags",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force",
+ "lintfix": "npm run lint -- --fix",
+ "posttest": "npm run lint"
},
"tap": {
"check-coverage": true,
@@ -20,14 +25,16 @@
"report",
"audit"
],
- "author": "Adam Baldwin",
+ "author": "GitHub Inc.",
"license": "ISC",
"dependencies": {
"chalk": "^4.0.0"
},
"devDependencies": {
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.1.2",
"require-inject": "^1.4.4",
- "tap": "^14.10.7"
+ "tap": "^16.0.0"
},
"directories": {
"lib": "lib",
@@ -35,18 +42,22 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/npm/npm-audit-report.git"
+ "url": "https://github.com/npm/npm-audit-report.git"
},
"bugs": {
"url": "https://github.com/npm/npm-audit-report/issues"
},
"homepage": "https://github.com/npm/npm-audit-report#readme",
"files": [
- "index.js",
- "lib",
+ "bin/",
+ "lib/",
"reporters"
],
"engines": {
- "node": ">=10"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+ },
+ "templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.1.2"
}
}
diff --git a/deps/npm/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/npm-package-arg/README.md
new file mode 100644
index 00000000000..3f00b61d54d
--- /dev/null
+++ b/deps/npm/node_modules/npm-package-arg/README.md
@@ -0,0 +1,86 @@
+# npm-package-arg
+
+[![Build Status](https://travis-ci.org/npm/npm-package-arg.svg?branch=master)](https://travis-ci.org/npm/npm-package-arg)
+
+Parses package name and specifier passed to commands like `npm install` or
+`npm cache add`, or as found in `package.json` dependency sections.
+
+## EXAMPLES
+
+```javascript
+var assert = require("assert")
+var npa = require("npm-package-arg")
+
+// Pass in the descriptor, and it'll return an object
+try {
+ var parsed = npa("@bar/foo@1.2")
+} catch (ex) {
+ ā€¦
+}
+```
+
+## USING
+
+`var npa = require('npm-package-arg')`
+
+### var result = npa(*arg*[, *where*])
+
+* *arg* - a string that you might pass to `npm install`, like:
+`foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`,
+`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz`,
+`../foo/bar/` or `bar`. If the *arg* you provide doesn't have a specifier
+part, eg `foo` then the specifier will default to `latest`.
+* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()`
+
+**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
+
+### var result = npa.resolve(*name*, *spec*[, *where*])
+
+* *name* - The name of the module you want to install. For example: `foo` or `@bar/foo`.
+* *spec* - The specifier indicating where and how you can get this module. Something like:
+`1.2`, `^1.7.17`, `http://x.com/foo.tgz`, `git+https://github.com/user/foo`,
+`bitbucket:user/foo`, `file:foo.tar.gz` or `file:../foo/bar/`. If not
+included then the default is `latest`.
+* *where* - Optionally the path to resolve file paths relative to. Defaults to `process.cwd()`
+
+**Throws** if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
+
+## RESULT OBJECT
+
+The objects that are returned by npm-package-arg contain the following
+keys:
+
+* `type` - One of the following strings:
+ * `git` - A git repo
+ * `tag` - A tagged version, like `"foo@latest"`
+ * `version` - A specific version number, like `"foo@1.2.3"`
+ * `range` - A version range, like `"foo@2.x"`
+ * `file` - A local `.tar.gz`, `.tar` or `.tgz` file.
+ * `directory` - A local directory.
+ * `remote` - An http url (presumably to a tgz)
+ * `alias` - A specifier with an alias, like `myalias@npm:foo@1.2.3`
+* `registry` - If true this specifier refers to a resource hosted on a
+ registry. This is true for `tag`, `version` and `range` types.
+* `name` - If known, the `name` field expected in the resulting pkg.
+* `scope` - If a name is something like `@org/module` then the `scope`
+ field will be set to `@org`. If it doesn't have a scoped name, then
+ scope is `null`.
+* `escapedName` - A version of `name` escaped to match the npm scoped packages
+ specification. Mostly used when making requests against a registry. When
+ `name` is `null`, `escapedName` will also be `null`.
+* `rawSpec` - The specifier part that was parsed out in calls to `npa(arg)`,
+ or the value of `spec` in calls to `npa.resolve(name, spec).
+* `saveSpec` - The normalized specifier, for saving to package.json files.
+ `null` for registry dependencies.
+* `fetchSpec` - The version of the specifier to be used to fetch this
+ resource. `null` for shortcuts to hosted git dependencies as there isn't
+ just one URL to try with them.
+* `gitRange` - If set, this is a semver specifier to match against git tags with
+* `gitCommittish` - If set, this is the specific committish to use with a git dependency.
+* `hosted` - If `from === 'hosted'` then this will be a `hosted-git-info`
+ object. This property is not included when serializing the object as
+ JSON.
+* `raw` - The original un-modified string that was provided. If called as
+ `npa.resolve(name, spec)` then this will be `name + '@' + spec`.
+* `subSpec` - If `type === 'alias'`, this is a Result Object for parsing the
+ target specifier for the alias.
diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json
index 25356af3739..457f1d8a2f8 100644
--- a/deps/npm/node_modules/npm-package-arg/package.json
+++ b/deps/npm/node_modules/npm-package-arg/package.json
@@ -1,23 +1,24 @@
{
"name": "npm-package-arg",
- "version": "9.0.1",
+ "version": "9.0.2",
"description": "Parse the things that can be arguments to `npm install`",
"main": "./lib/npa.js",
"directories": {
"test": "test"
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"dependencies": {
"hosted-git-info": "^5.0.0",
"semver": "^7.3.5",
- "validate-npm-package-name": "^3.0.0"
+ "validate-npm-package-name": "^4.0.0"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.9.2",
- "tap": "^15.1.6"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.1",
+ "tap": "^16.0.1"
},
"scripts": {
"preversion": "npm test",
@@ -26,16 +27,16 @@
"test": "tap",
"snap": "tap",
"npmclilint": "npmcli-lint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"postsnap": "npm run lintfix --",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force"
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/npm-package-arg"
+ "url": "https://github.com/npm/npm-package-arg.git"
},
"author": "GitHub Inc.",
"license": "ISC",
@@ -44,12 +45,13 @@
},
"homepage": "https://github.com/npm/npm-package-arg",
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"branches": 97
},
"templateOSS": {
- "version": "2.9.2"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.1"
}
}
diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js b/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js
index 872ec8a8886..714513908df 100644
--- a/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js
+++ b/deps/npm/node_modules/npm-registry-fetch/lib/check-response.js
@@ -4,6 +4,7 @@ const errors = require('./errors.js')
const { Response } = require('minipass-fetch')
const defaultOpts = require('./default-opts.js')
const log = require('proc-log')
+const cleanUrl = require('./clean-url.js')
/* eslint-disable-next-line max-len */
const moreInfoUrl = 'https://github.com/npm/cli/wiki/No-auth-for-URI,-but-auth-present-for-scoped-registry'
@@ -45,19 +46,7 @@ function logRequest (method, res, startTime) {
const attemptStr = attempt && attempt > 1 ? ` attempt #${attempt}` : ''
const cacheStatus = res.headers.get('x-local-cache-status')
const cacheStr = cacheStatus ? ` (cache ${cacheStatus})` : ''
-
- let urlStr
- try {
- const { URL } = require('url')
- const url = new URL(res.url)
- if (url.password) {
- url.password = '***'
- }
-
- urlStr = url.toString()
- } catch (er) {
- urlStr = res.url
- }
+ const urlStr = cleanUrl(res.url)
log.http(
'fetch',
diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/clean-url.js b/deps/npm/node_modules/npm-registry-fetch/lib/clean-url.js
new file mode 100644
index 00000000000..ba31dc462f3
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-fetch/lib/clean-url.js
@@ -0,0 +1,24 @@
+const { URL } = require('url')
+
+const replace = '***'
+const tokenRegex = /\bnpm_[a-zA-Z0-9]{36}\b/g
+const guidRegex = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g
+
+const cleanUrl = (str) => {
+ if (typeof str !== 'string' || !str) {
+ return str
+ }
+
+ try {
+ const url = new URL(str)
+ if (url.password) {
+ str = str.replace(url.password, replace)
+ }
+ } catch {}
+
+ return str
+ .replace(tokenRegex, `npm_${replace}`)
+ .replace(guidRegex, `npm_${replace}`)
+}
+
+module.exports = cleanUrl
diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/index.js b/deps/npm/node_modules/npm-registry-fetch/lib/index.js
index 19c921403e5..6c834aa4af5 100644
--- a/deps/npm/node_modules/npm-registry-fetch/lib/index.js
+++ b/deps/npm/node_modules/npm-registry-fetch/lib/index.js
@@ -104,11 +104,11 @@ function regFetch (uri, /* istanbul ignore next */ opts_ = {}) {
opts.preferOnline = true
}
- const doFetch = async body => {
+ const doFetch = async fetchBody => {
const p = fetch(uri, {
agent: opts.agent,
algorithms: opts.algorithms,
- body,
+ body: fetchBody,
cache: getCacheMode(opts),
cachePath: opts.cache,
ca: opts.ca,
@@ -239,3 +239,5 @@ function getHeaders (uri, auth, opts) {
return headers
}
+
+module.exports.cleanUrl = require('./clean-url.js')
diff --git a/deps/npm/node_modules/npm-registry-fetch/lib/silentlog.js b/deps/npm/node_modules/npm-registry-fetch/lib/silentlog.js
deleted file mode 100644
index 483bd44c708..00000000000
--- a/deps/npm/node_modules/npm-registry-fetch/lib/silentlog.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-
-const noop = Function.prototype
-module.exports = {
- error: noop,
- warn: noop,
- notice: noop,
- info: noop,
- verbose: noop,
- silly: noop,
- http: noop,
- pause: noop,
- resume: noop,
-}
diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json
index 75236be2a90..9e15f627cd5 100644
--- a/deps/npm/node_modules/npm-registry-fetch/package.json
+++ b/deps/npm/node_modules/npm-registry-fetch/package.json
@@ -1,15 +1,15 @@
{
"name": "npm-registry-fetch",
- "version": "13.0.1",
+ "version": "13.1.0",
"description": "Fetch-based http client for use with npm registry APIs",
"main": "lib",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"scripts": {
"eslint": "eslint",
- "lint": "eslint '**/*.js'",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
"preversion": "npm test",
@@ -18,11 +18,14 @@
"posttest": "npm run lint",
"npmclilint": "npmcli-lint",
"postsnap": "npm run lintfix --",
- "postlint": "npm-template-check",
+ "postlint": "template-oss-check",
"snap": "tap",
- "template-copy": "npm-template-copy --force"
+ "template-oss-apply": "template-oss-apply --force"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/npm-registry-fetch.git"
},
- "repository": "https://github.com/npm/npm-registry-fetch",
"keywords": [
"npm",
"registry",
@@ -31,17 +34,18 @@
"author": "GitHub Inc.",
"license": "ISC",
"dependencies": {
- "make-fetch-happen": "^10.0.3",
+ "make-fetch-happen": "^10.0.6",
"minipass": "^3.1.6",
- "minipass-fetch": "^2.0.1",
+ "minipass-fetch": "^2.0.3",
"minipass-json-stream": "^1.0.1",
"minizlib": "^2.1.2",
- "npm-package-arg": "^9.0.0",
+ "npm-package-arg": "^9.0.1",
"proc-log": "^2.0.0"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.8.1",
- "cacache": "^15.3.0",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.1.2",
+ "cacache": "^16.0.2",
"nock": "^13.2.4",
"require-inject": "^1.4.4",
"ssri": "^8.0.1",
@@ -52,9 +56,10 @@
"test-ignore": "test[\\\\/](util|cache)[\\\\/]"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.8.1"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.1.2"
}
}
diff --git a/deps/npm/node_modules/parse-conflict-json/package.json b/deps/npm/node_modules/parse-conflict-json/package.json
index bb633e158b5..5dab68d52f7 100644
--- a/deps/npm/node_modules/parse-conflict-json/package.json
+++ b/deps/npm/node_modules/parse-conflict-json/package.json
@@ -1,6 +1,6 @@
{
"name": "parse-conflict-json",
- "version": "2.0.1",
+ "version": "2.0.2",
"description": "Parse a JSON string that has git merge conflicts, resolving if possible",
"author": "GitHub Inc.",
"license": "ISC",
@@ -11,34 +11,39 @@
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"prepublishOnly": "git push origin --follow-tags",
- "posttest": "npm run lint"
+ "posttest": "npm run lint",
+ "template-oss-apply": "template-oss-apply --force"
},
"tap": {
"check-coverage": true
},
"devDependencies": {
- "@npmcli/template-oss": "^2.3.1",
- "tap": "^15.1.5"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.0",
+ "tap": "^16.0.1"
},
"dependencies": {
"json-parse-even-better-errors": "^2.3.1",
"just-diff": "^5.0.1",
- "just-diff-apply": "^4.0.1"
+ "just-diff-apply": "^5.2.0"
},
"repository": {
"type": "git",
- "url": "git+https://github.com/npm/parse-conflict-json.git"
+ "url": "https://github.com/npm/parse-conflict-json.git"
},
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
- "templateVersion": "2.3.1",
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+ },
+ "templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.0"
}
}
diff --git a/deps/npm/node_modules/proc-log/package.json b/deps/npm/node_modules/proc-log/package.json
index 17e9249b7ca..ca2f1c771d8 100644
--- a/deps/npm/node_modules/proc-log/package.json
+++ b/deps/npm/node_modules/proc-log/package.json
@@ -1,13 +1,16 @@
{
"name": "proc-log",
- "version": "2.0.0",
+ "version": "2.0.1",
"files": [
- "bin",
- "lib"
+ "bin/",
+ "lib/"
],
"main": "lib/index.js",
"description": "just emit 'log' events on the process object",
- "repository": "https://github.com/npm/proc-log",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/proc-log.git"
+ },
"author": "GitHub Inc.",
"license": "ISC",
"scripts": {
@@ -18,19 +21,21 @@
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
- "lint": "eslint '**/*.js'",
- "postlint": "npm-template-check",
- "template-copy": "npm-template-copy --force",
- "lintfix": "npm run lint -- --fix"
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
+ "lintfix": "npm run lint -- --fix",
+ "template-oss-apply": "template-oss-apply --force"
},
"devDependencies": {
- "@npmcli/template-oss": "^2.7.1",
- "tap": "^15.1.6"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.0",
+ "tap": "^16.0.1"
},
"engines": {
- "node": "^12.13.0 || ^14.15.0 || >=16"
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"templateOSS": {
- "version": "2.7.1"
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.0"
}
}
diff --git a/deps/npm/node_modules/validate-npm-package-name/index.js b/deps/npm/node_modules/validate-npm-package-name/lib/index.js
index eb43fa25e56..e7e612bfbdf 100644
--- a/deps/npm/node_modules/validate-npm-package-name/index.js
+++ b/deps/npm/node_modules/validate-npm-package-name/lib/index.js
@@ -4,10 +4,10 @@ var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$')
var builtins = require('builtins')
var blacklist = [
'node_modules',
- 'favicon.ico'
+ 'favicon.ico',
]
-var validate = module.exports = function (name) {
+function validate (name) {
var warnings = []
var errors = []
@@ -52,14 +52,12 @@ var validate = module.exports = function (name) {
// Generate warnings for stuff that used to be allowed
// core module names like http, events, util, etc
- builtins.forEach(function (builtin) {
+ builtins({ version: '*' }).forEach(function (builtin) {
if (name.toLowerCase() === builtin) {
warnings.push(builtin + ' is a core module name')
}
})
- // really-long-package-names-------------------------------such--length-----many---wow
- // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
if (name.length > 214) {
warnings.push('name can no longer contain more than 214 characters')
}
@@ -90,16 +88,20 @@ var validate = module.exports = function (name) {
return done(warnings, errors)
}
-validate.scopedPackagePattern = scopedPackagePattern
-
var done = function (warnings, errors) {
var result = {
validForNewPackages: errors.length === 0 && warnings.length === 0,
validForOldPackages: errors.length === 0,
warnings: warnings,
- errors: errors
+ errors: errors,
+ }
+ if (!result.warnings.length) {
+ delete result.warnings
+ }
+ if (!result.errors.length) {
+ delete result.errors
}
- if (!result.warnings.length) delete result.warnings
- if (!result.errors.length) delete result.errors
return result
}
+
+module.exports = validate
diff --git a/deps/npm/node_modules/validate-npm-package-name/package.json b/deps/npm/node_modules/validate-npm-package-name/package.json
index b72e9ef03b0..fa9a6920d41 100644
--- a/deps/npm/node_modules/validate-npm-package-name/package.json
+++ b/deps/npm/node_modules/validate-npm-package-name/package.json
@@ -1,27 +1,37 @@
{
"name": "validate-npm-package-name",
- "version": "3.0.0",
+ "version": "4.0.0",
"description": "Give me a string and I'll tell you if it's a valid npm package name",
- "main": "index.js",
+ "main": "lib/",
"directories": {
"test": "test"
},
"dependencies": {
- "builtins": "^1.0.3"
+ "builtins": "^5.0.0"
},
"devDependencies": {
- "standard": "^8.6.0",
- "tap": "^10.0.0"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.1",
+ "tap": "^16.0.1"
},
"scripts": {
"cov:test": "TAP_FLAGS='--cov' npm run test:code",
"test:code": "tap ${TAP_FLAGS:-'--'} test/*.js",
"test:style": "standard",
- "test": "npm run test:code && npm run test:style"
+ "test": "tap",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
+ "template-oss-apply": "template-oss-apply --force",
+ "lintfix": "npm run lint -- --fix",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "snap": "tap",
+ "posttest": "npm run lint"
},
"repository": {
"type": "git",
- "url": "https://github.com/npm/validate-npm-package-name"
+ "url": "https://github.com/npm/validate-npm-package-name.git"
},
"keywords": [
"npm",
@@ -29,10 +39,26 @@
"names",
"validation"
],
- "author": "zeke",
+ "author": "GitHub Inc.",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/validate-npm-package-name/issues"
},
- "homepage": "https://github.com/npm/validate-npm-package-name"
+ "homepage": "https://github.com/npm/validate-npm-package-name",
+ "files": [
+ "bin/",
+ "lib/"
+ ],
+ "engines": {
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
+ },
+ "templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.1"
+ },
+ "tap": {
+ "statements": 88,
+ "branches": 92,
+ "lines": 88
+ }
}
diff --git a/deps/npm/node_modules/validate-npm-package-name/test/index.js b/deps/npm/node_modules/validate-npm-package-name/test/index.js
deleted file mode 100644
index 1f0bc612350..00000000000
--- a/deps/npm/node_modules/validate-npm-package-name/test/index.js
+++ /dev/null
@@ -1,109 +0,0 @@
-'use strict'
-
-var validate = require('..')
-var test = require('tap').test
-
-test('validate-npm-package-name', function (t) {
- // Traditional
-
- t.deepEqual(validate('some-package'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('example.com'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('under_score'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('period.js'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('123numeric'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('crazy!'), {
- validForNewPackages: false,
- validForOldPackages: true,
- warnings: ['name can no longer contain special characters ("~\'!()*")']
- })
-
- // Scoped (npm 2+)
-
- t.deepEqual(validate('@npm/thingy'), {validForNewPackages: true, validForOldPackages: true})
- t.deepEqual(validate('@npm-zors/money!time.js'), {
- validForNewPackages: false,
- validForOldPackages: true,
- warnings: ['name can no longer contain special characters ("~\'!()*")']
- })
-
- // Invalid
-
- t.deepEqual(validate(''), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name length must be greater than zero']})
-
- t.deepEqual(validate(''), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name length must be greater than zero']})
-
- t.deepEqual(validate('.start-with-period'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name cannot start with a period']})
-
- t.deepEqual(validate('_start-with-underscore'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name cannot start with an underscore']})
-
- t.deepEqual(validate('contain:colons'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name can only contain URL-friendly characters']})
-
- t.deepEqual(validate(' leading-space'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name cannot contain leading or trailing spaces', 'name can only contain URL-friendly characters']})
-
- t.deepEqual(validate('trailing-space '), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name cannot contain leading or trailing spaces', 'name can only contain URL-friendly characters']})
-
- t.deepEqual(validate('s/l/a/s/h/e/s'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['name can only contain URL-friendly characters']})
-
- t.deepEqual(validate('node_modules'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['node_modules is a blacklisted name']})
-
- t.deepEqual(validate('favicon.ico'), {
- validForNewPackages: false,
- validForOldPackages: false,
- errors: ['favicon.ico is a blacklisted name']})
-
- // Node/IO Core
-
- t.deepEqual(validate('http'), {
- validForNewPackages: false,
- validForOldPackages: true,
- warnings: ['http is a core module name']})
-
- // Long Package Names
-
- t.deepEqual(validate('ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou-'), {
- validForNewPackages: false,
- validForOldPackages: true,
- warnings: ['name can no longer contain more than 214 characters']
- })
-
- t.deepEqual(validate('ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou'), {
- validForNewPackages: true,
- validForOldPackages: true
- })
-
- // Legacy Mixed-Case
-
- t.deepEqual(validate('CAPITAL-LETTERS'), {
- validForNewPackages: false,
- validForOldPackages: true,
- warnings: ['name can no longer contain capital letters']})
-
- t.end()
-})
diff --git a/deps/npm/package.json b/deps/npm/package.json
index d51ffcd4dc4..9d4ff2f1de3 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "8.5.5",
+ "version": "8.6.0",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
@@ -55,9 +55,10 @@
},
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
- "@npmcli/arborist": "^5.0.3",
+ "@npmcli/arborist": "^5.0.4",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/config": "^4.0.1",
+ "@npmcli/fs": "^2.1.0",
"@npmcli/map-workspaces": "^2.0.2",
"@npmcli/package-json": "^1.0.1",
"@npmcli/run-script": "^3.0.1",
@@ -65,7 +66,7 @@
"ansicolors": "~0.3.2",
"ansistyles": "~0.1.3",
"archy": "~1.0.0",
- "cacache": "^16.0.2",
+ "cacache": "^16.0.3",
"chalk": "^4.1.2",
"chownr": "^2.0.0",
"cli-columns": "^4.0.0",
@@ -76,7 +77,7 @@
"graceful-fs": "^4.2.9",
"hosted-git-info": "^5.0.0",
"ini": "^2.0.0",
- "init-package-json": "^3.0.1",
+ "init-package-json": "^3.0.2",
"is-cidr": "^4.0.2",
"json-parse-even-better-errors": "^2.3.1",
"libnpmaccess": "^6.0.2",
@@ -90,7 +91,7 @@
"libnpmsearch": "^5.0.2",
"libnpmteam": "^4.0.2",
"libnpmversion": "^3.0.1",
- "make-fetch-happen": "^10.0.6",
+ "make-fetch-happen": "^10.1.1",
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
@@ -98,18 +99,18 @@
"ms": "^2.1.2",
"node-gyp": "^9.0.0",
"nopt": "^5.0.0",
- "npm-audit-report": "^2.1.5",
+ "npm-audit-report": "^3.0.0",
"npm-install-checks": "^4.0.0",
"npm-package-arg": "^9.0.1",
"npm-pick-manifest": "^7.0.0",
"npm-profile": "^6.0.2",
- "npm-registry-fetch": "^13.0.1",
+ "npm-registry-fetch": "^13.1.0",
"npm-user-validate": "^1.0.1",
"npmlog": "^6.0.1",
"opener": "^1.5.2",
"pacote": "^13.0.5",
- "parse-conflict-json": "^2.0.1",
- "proc-log": "^2.0.0",
+ "parse-conflict-json": "^2.0.2",
+ "proc-log": "^2.0.1",
"qrcode-terminal": "^0.12.0",
"read": "~1.0.7",
"read-package-json": "^5.0.0",
@@ -122,7 +123,7 @@
"text-table": "~0.2.0",
"tiny-relative-date": "^1.3.0",
"treeverse": "^1.0.4",
- "validate-npm-package-name": "~3.0.0",
+ "validate-npm-package-name": "^4.0.0",
"which": "^2.0.2",
"write-file-atomic": "^4.0.1"
},
@@ -131,6 +132,7 @@
"@npmcli/arborist",
"@npmcli/ci-detect",
"@npmcli/config",
+ "@npmcli/fs",
"@npmcli/map-workspaces",
"@npmcli/package-json",
"@npmcli/run-script",
@@ -200,13 +202,12 @@
"write-file-atomic"
],
"devDependencies": {
- "@npmcli/eslint-config": "^2.0.0",
- "@npmcli/template-oss": "^2.9.2",
- "eslint": "^8.3.0",
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
"licensee": "^8.2.0",
"nock": "^13.2.4",
"spawk": "^1.7.1",
- "tap": "^15.1.6"
+ "tap": "^15.2.3"
},
"scripts": {
"dumpconf": "env | grep npm | sort | uniq",
@@ -214,19 +215,18 @@
"licenses": "licensee --production --errors-only",
"test": "tap",
"test-all": "npm run test --if-present --workspaces --include-workspace-root",
- "check-coverage": "tap",
"snap": "tap",
"postsnap": "make -s mandocs",
"test:nocleanup": "NO_TEST_CLEANUP=1 npm run test --",
"sudotest": "sudo npm run test --",
"sudotest:nocleanup": "sudo NO_TEST_CLEANUP=1 npm run test --",
"posttest": "npm run lint",
- "eslint": "eslint",
- "lint": "npm run eslint -- bin lib scripts smoke-tests test ./*.js",
+ "lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
+ "lint-all": "npm run lint --if-present --workspaces --include-workspace-root",
"prelint": "rimraf test/npm_cache*",
"resetdeps": "bash scripts/resetdeps.sh",
- "smoke-tests": "tap smoke-tests/index.js"
+ "smoke-tests": "tap smoke-tests/index.js --no-coverage"
},
"tap": {
"test-env": [
@@ -235,28 +235,12 @@
"color": 1,
"files": "test/{lib,bin,index.js}",
"coverage-map": "test/coverage-map.js",
- "check-coverage": true,
"timeout": 600
},
"templateOSS": {
- "applyRootRepoFiles": false,
- "applyWorkspaceRepoFiles": true,
- "applyRootModuleFiles": false,
- "workspaces": [
- "@npmcli/arborist",
- "libnpmaccess",
- "libnpmdiff",
- "libnpmfund",
- "libnpmexec",
- "libnpmorg",
- "libnpmhook",
- "libnpmpack",
- "libnpmpublish",
- "libnpmsearch",
- "libnpmteam",
- "libnpmversion"
- ],
- "version": "2.9.2"
+ "rootRepo": false,
+ "rootModule": false,
+ "version": "3.2.2"
},
"license": "Artistic-2.0",
"engines": {
diff --git a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs
index 4fa3a2179e6..232cfec6697 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs
@@ -44,72 +44,84 @@ exports[`test/lib/commands/completion.js TAP completion double dashes escape fro
Array [
Array [
String(
- ci
- install-ci-test
- install
- install-test
- uninstall
+ access
+ adduser
+ audit
+ bin
+ bugs
cache
+ ci
+ completion
config
- set
- get
- update
- outdated
- prune
- pack
- find-dupes
dedupe
+ deprecate
+ diff
+ dist-tag
+ docs
+ doctor
+ edit
+ exec
+ explain
+ explore
+ find-dupes
+ fund
+ get
+ help
hook
- rebuild
+ init
+ install
+ install-ci-test
+ install-test
link
- publish
- star
- stars
- unstar
- adduser
+ ll
login
logout
- unpublish
- owner
- access
- team
- deprecate
- shrinkwrap
- token
- profile
- audit
- fund
- org
- help
ls
- ll
- search
- view
- init
- version
- edit
- explore
- docs
- repo
- bugs
- root
- prefix
- bin
- whoami
- diff
- dist-tag
+ org
+ outdated
+ owner
+ pack
ping
pkg
- test
- stop
- start
+ prefix
+ profile
+ prune
+ publish
+ rebuild
+ repo
restart
+ root
run-script
+ search
+ set
set-script
- completion
- doctor
- exec
- explain
+ shrinkwrap
+ star
+ stars
+ start
+ stop
+ team
+ test
+ token
+ uninstall
+ unpublish
+ unstar
+ update
+ version
+ view
+ whoami
+ login
+ author
+ home
+ issues
+ info
+ show
+ find
+ add
+ unlink
+ remove
+ rm
+ r
un
rb
list
@@ -150,23 +162,11 @@ Array [
dist-tags
upgrade
udpate
- login
- add-user
- author
- home
- issues
- info
- show
- find
- add
- unlink
- remove
- rm
- r
rum
sit
urn
ogr
+ add-user
),
],
]
@@ -198,12 +198,12 @@ exports[`test/lib/commands/completion.js TAP completion multiple command names >
Array [
Array [
String(
- adduser
access
+ adduser
audit
- add-user
author
add
+ add-user
),
],
]
diff --git a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
index 35c8e616591..8d62c7ff7e1 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
@@ -89,6 +89,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"location": "user",
"lockfile-version": null,
"loglevel": "notice",
+ "logs-dir": null,
"logs-max": 10,
"long": false,
"maxsockets": 15,
@@ -155,6 +156,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"which": null,
"workspace": [],
"workspaces": null,
+ "workspaces-update": true,
"yes": null,
"metrics-registry": "https://registry.npmjs.org/"
}
@@ -241,6 +243,7 @@ local-address = null
location = "user"
lockfile-version = null
loglevel = "notice"
+logs-dir = null
logs-max = 10
; long = false ; overridden by cli
maxsockets = 15
@@ -308,6 +311,7 @@ viewer = "{VIEWER}"
which = null
workspace = []
workspaces = null
+workspaces-update = true
yes = null
; "global" config from {GLOBALPREFIX}/npmrc
diff --git a/deps/npm/tap-snapshots/test/lib/commands/unpublish.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/unpublish.js.test.cjs
deleted file mode 100644
index d84f26f2998..00000000000
--- a/deps/npm/tap-snapshots/test/lib/commands/unpublish.js.test.cjs
+++ /dev/null
@@ -1,14 +0,0 @@
-/* IMPORTANT
- * This snapshot file is auto-generated, but designed for humans.
- * It should be checked into source control and tracked carefully.
- * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
- * Make sure to inspect the output below. Do not ignore changes!
- */
-'use strict'
-exports[`test/lib/commands/unpublish.js TAP workspaces all workspaces --force > should output all workspaces 1`] = `
-- workspace-a- workspace-b- workspace-n
-`
-
-exports[`test/lib/commands/unpublish.js TAP workspaces one workspace --force > should output one workspaces 1`] = `
-- workspace-a
-`
diff --git a/deps/npm/tap-snapshots/test/lib/commands/version.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/version.js.test.cjs
new file mode 100644
index 00000000000..e19f9b8eef1
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/commands/version.js.test.cjs
@@ -0,0 +1,94 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below. Do not ignore changes!
+ */
+'use strict'
+exports[`test/lib/commands/version.js TAP empty versions workspaces with one arg, all workspaces > must match snapshot 1`] = `
+{
+ "name": "workspaces-test",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "workspaces-test",
+ "version": "1.0.0",
+ "workspaces": [
+ "workspace-a",
+ "workspace-b"
+ ]
+ },
+ "node_modules/workspace-a": {
+ "resolved": "workspace-a",
+ "link": true
+ },
+ "node_modules/workspace-b": {
+ "resolved": "workspace-b",
+ "link": true
+ },
+ "workspace-a": {
+ "version": "2.0.0"
+ },
+ "workspace-b": {
+ "version": "2.0.0"
+ }
+ },
+ "dependencies": {
+ "workspace-a": {
+ "version": "file:workspace-a"
+ },
+ "workspace-b": {
+ "version": "file:workspace-b"
+ }
+ }
+}
+
+`
+
+exports[`test/lib/commands/version.js TAP empty versions workspaces with one arg, all workspaces, saves package.json > must match snapshot 1`] = `
+{
+ "name": "workspaces-test",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "workspaces-test",
+ "version": "1.0.0",
+ "workspaces": [
+ "workspace-a",
+ "workspace-b"
+ ],
+ "dependencies": {
+ "workspace-a": "^2.0.0",
+ "workspace-b": "^2.0.0"
+ }
+ },
+ "node_modules/workspace-a": {
+ "resolved": "workspace-a",
+ "link": true
+ },
+ "node_modules/workspace-b": {
+ "resolved": "workspace-b",
+ "link": true
+ },
+ "workspace-a": {
+ "version": "2.0.0"
+ },
+ "workspace-b": {
+ "version": "2.0.0"
+ }
+ },
+ "dependencies": {
+ "workspace-a": {
+ "version": "file:workspace-a"
+ },
+ "workspace-b": {
+ "version": "file:workspace-b"
+ }
+ }
+}
+
+`
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 1ad8aee29f0..0ad87b945fc 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
@@ -6,8 +6,6 @@
*/
'use strict'
exports[`test/lib/load-all-commands.js TAP load each command access > must match snapshot 1`] = `
-npm access
-
Set access level on published packages
Usage:
@@ -28,8 +26,6 @@ Run "npm help access" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command adduser > must match snapshot 1`] = `
-npm adduser
-
Add a registry user account
Usage:
@@ -44,8 +40,6 @@ Run "npm help adduser" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command audit > must match snapshot 1`] = `
-npm audit
-
Run a security audit
Usage:
@@ -63,8 +57,6 @@ Run "npm help audit" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command bin > must match snapshot 1`] = `
-npm bin
-
Display npm bin folder
Usage:
@@ -76,9 +68,16 @@ Options:
Run "npm help bin" for more info
`
-exports[`test/lib/load-all-commands.js TAP load each command bugs > must match snapshot 1`] = `
-npm bugs
+exports[`test/lib/load-all-commands.js TAP load each command birthday > must match snapshot 1`] = `
+Birthday
+
+Usage:
+npm birthday
+Run "npm help birthday" for more info
+`
+
+exports[`test/lib/load-all-commands.js TAP load each command bugs > must match snapshot 1`] = `
Report bugs for a package in a web browser
Usage:
@@ -93,8 +92,6 @@ Run "npm help bugs" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command cache > must match snapshot 1`] = `
-npm cache
-
Manipulates packages cache
Usage:
@@ -114,8 +111,6 @@ Run "npm help cache" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command ci > must match snapshot 1`] = `
-npm ci
-
Install a project with a clean slate
Usage:
@@ -131,8 +126,6 @@ Run "npm help ci" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command completion > must match snapshot 1`] = `
-npm completion
-
Tab Completion for npm
Usage:
@@ -142,8 +135,6 @@ Run "npm help completion" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command config > must match snapshot 1`] = `
-npm config
-
Manage the npm configuration files
Usage:
@@ -163,8 +154,6 @@ Run "npm help config" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command dedupe > must match snapshot 1`] = `
-npm dedupe
-
Reduce duplication in the package tree
Usage:
@@ -184,8 +173,6 @@ Run "npm help dedupe" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command deprecate > must match snapshot 1`] = `
-npm deprecate
-
Deprecate a version of a package
Usage:
@@ -198,8 +185,6 @@ Run "npm help deprecate" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command diff > must match snapshot 1`] = `
-npm diff
-
The registry diff command
Usage:
@@ -217,8 +202,6 @@ Run "npm help diff" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command dist-tag > must match snapshot 1`] = `
-npm dist-tag
-
Modify package distribution tags
Usage:
@@ -236,8 +219,6 @@ Run "npm help dist-tag" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command docs > must match snapshot 1`] = `
-npm docs
-
Open documentation for a package in a web browser
Usage:
@@ -254,8 +235,6 @@ Run "npm help docs" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command doctor > must match snapshot 1`] = `
-npm doctor
-
Check your npm environment
Usage:
@@ -268,8 +247,6 @@ Run "npm help doctor" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command edit > must match snapshot 1`] = `
-npm edit
-
Edit an installed package
Usage:
@@ -282,8 +259,6 @@ Run "npm help edit" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command exec > must match snapshot 1`] = `
-npm exec
-
Run a command from a local or remote npm package
Usage:
@@ -304,8 +279,6 @@ Run "npm help exec" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command explain > must match snapshot 1`] = `
-npm explain
-
Explain installed packages
Usage:
@@ -320,8 +293,6 @@ Run "npm help explain" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command explore > must match snapshot 1`] = `
-npm explore
-
Browse an installed package
Usage:
@@ -334,8 +305,6 @@ Run "npm help explore" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command find-dupes > must match snapshot 1`] = `
-npm find-dupes
-
Find duplication in the package tree
Usage:
@@ -352,8 +321,6 @@ Run "npm help find-dupes" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command fund > must match snapshot 1`] = `
-npm fund
-
Retrieve funding information
Usage:
@@ -368,8 +335,6 @@ Run "npm help fund" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command get > must match snapshot 1`] = `
-npm get
-
Get a value from the npm configuration
Usage:
@@ -379,8 +344,6 @@ Run "npm help get" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command help > must match snapshot 1`] = `
-npm help
-
Get help on npm
Usage:
@@ -394,9 +357,19 @@ alias: hlep
Run "npm help help" for more info
`
-exports[`test/lib/load-all-commands.js TAP load each command hook > must match snapshot 1`] = `
-npm hook
+exports[`test/lib/load-all-commands.js TAP load each command help-search > must match snapshot 1`] = `
+Search npm help documentation
+Usage:
+npm help-search <text>
+
+Options:
+[-l|--long]
+
+Run "npm help help-search" for more info
+`
+
+exports[`test/lib/load-all-commands.js TAP load each command hook > must match snapshot 1`] = `
Manage registry hooks
Usage:
@@ -412,8 +385,6 @@ Run "npm help hook" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command init > must match snapshot 1`] = `
-npm init
-
Create a package.json file
Usage:
@@ -432,8 +403,6 @@ Run "npm help init" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command install > must match snapshot 1`] = `
-npm install
-
Install a package
Usage:
@@ -457,14 +426,12 @@ Options:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
-aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add
+aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
Run "npm help install" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command install-ci-test > must match snapshot 1`] = `
-npm install-ci-test
-
Install a project with a clean slate and run tests
Usage:
@@ -480,8 +447,6 @@ Run "npm help install-ci-test" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command install-test > must match snapshot 1`] = `
-npm install-test
-
Install package(s) and run tests
Usage:
@@ -511,8 +476,6 @@ Run "npm help install-test" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command link > must match snapshot 1`] = `
-npm link
-
Symlink a package folder
Usage:
@@ -534,8 +497,6 @@ Run "npm help link" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command ll > must match snapshot 1`] = `
-npm ll
-
List installed packages
Usage:
@@ -554,8 +515,6 @@ Run "npm help ll" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command login > must match snapshot 1`] = `
-npm adduser
-
Add a registry user account
Usage:
@@ -570,8 +529,6 @@ Run "npm help adduser" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command logout > must match snapshot 1`] = `
-npm logout
-
Log out of the registry
Usage:
@@ -584,8 +541,6 @@ Run "npm help logout" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command ls > must match snapshot 1`] = `
-npm ls
-
List installed packages
Usage:
@@ -604,8 +559,6 @@ Run "npm help ls" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command org > must match snapshot 1`] = `
-npm org
-
Manage orgs
Usage:
@@ -622,8 +575,6 @@ Run "npm help org" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command outdated > must match snapshot 1`] = `
-npm outdated
-
Check for outdated packages
Usage:
@@ -637,8 +588,6 @@ Run "npm help outdated" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command owner > must match snapshot 1`] = `
-npm owner
-
Manage package owners
Usage:
@@ -655,8 +604,6 @@ Run "npm help owner" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command pack > must match snapshot 1`] = `
-npm pack
-
Create a tarball from a package
Usage:
@@ -671,8 +618,6 @@ Run "npm help pack" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command ping > must match snapshot 1`] = `
-npm ping
-
Ping npm registry
Usage:
@@ -685,8 +630,6 @@ Run "npm help ping" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command pkg > must match snapshot 1`] = `
-npm pkg
-
Manages your package.json
Usage:
@@ -705,8 +648,6 @@ Run "npm help pkg" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command prefix > must match snapshot 1`] = `
-npm prefix
-
Display prefix
Usage:
@@ -719,8 +660,6 @@ Run "npm help prefix" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command profile > must match snapshot 1`] = `
-npm profile
-
Change settings on your registry profile
Usage:
@@ -736,8 +675,6 @@ Run "npm help profile" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command prune > must match snapshot 1`] = `
-npm prune
-
Remove extraneous packages
Usage:
@@ -753,8 +690,6 @@ Run "npm help prune" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command publish > must match snapshot 1`] = `
-npm publish
-
Publish a package
Usage:
@@ -769,8 +704,6 @@ Run "npm help publish" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command rebuild > must match snapshot 1`] = `
-npm rebuild
-
Rebuild a package
Usage:
@@ -787,8 +720,6 @@ Run "npm help rebuild" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command repo > must match snapshot 1`] = `
-npm repo
-
Open package repository page in the browser
Usage:
@@ -803,8 +734,6 @@ Run "npm help repo" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command restart > must match snapshot 1`] = `
-npm restart
-
Restart a package
Usage:
@@ -817,8 +746,6 @@ Run "npm help restart" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command root > must match snapshot 1`] = `
-npm root
-
Display npm root
Usage:
@@ -831,8 +758,6 @@ Run "npm help root" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command run-script > must match snapshot 1`] = `
-npm run-script
-
Run arbitrary package scripts
Usage:
@@ -849,8 +774,6 @@ Run "npm help run-script" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command search > must match snapshot 1`] = `
-npm search
-
Search for packages
Usage:
@@ -861,14 +784,12 @@ Options:
[--no-description] [--searchopts <searchopts>] [--searchexclude <searchexclude>]
[--registry <registry>] [--prefer-online] [--prefer-offline] [--offline]
-aliases: s, se, find
+aliases: find, s, se
Run "npm help search" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command set > must match snapshot 1`] = `
-npm set
-
Set a value in the npm configuration
Usage:
@@ -878,8 +799,6 @@ Run "npm help set" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command set-script > must match snapshot 1`] = `
-npm set-script
-
Set tasks in the scripts section of package.json
Usage:
@@ -893,8 +812,6 @@ Run "npm help set-script" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command shrinkwrap > must match snapshot 1`] = `
-npm shrinkwrap
-
Lock down dependency versions for publication
Usage:
@@ -904,8 +821,6 @@ Run "npm help shrinkwrap" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command star > must match snapshot 1`] = `
-npm star
-
Mark your favorite packages
Usage:
@@ -918,8 +833,6 @@ Run "npm help star" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command stars > must match snapshot 1`] = `
-npm stars
-
View packages marked as favorites
Usage:
@@ -932,8 +845,6 @@ Run "npm help stars" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command start > must match snapshot 1`] = `
-npm start
-
Start a package
Usage:
@@ -946,8 +857,6 @@ Run "npm help start" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command stop > must match snapshot 1`] = `
-npm stop
-
Stop a package
Usage:
@@ -960,8 +869,6 @@ Run "npm help stop" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command team > must match snapshot 1`] = `
-npm team
-
Manage organization teams and team memberships
Usage:
@@ -978,8 +885,6 @@ Run "npm help team" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command test > must match snapshot 1`] = `
-npm test
-
Test a package
Usage:
@@ -994,8 +899,6 @@ Run "npm help test" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command token > must match snapshot 1`] = `
-npm token
-
Manage your authentication tokens
Usage:
@@ -1011,8 +914,6 @@ Run "npm help token" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command uninstall > must match snapshot 1`] = `
-npm uninstall
-
Remove a package
Usage:
@@ -1023,14 +924,12 @@ Options:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
-aliases: un, unlink, remove, rm, r
+aliases: unlink, remove, rm, r, un
Run "npm help uninstall" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command unpublish > must match snapshot 1`] = `
-npm unpublish
-
Remove a package from the registry
Usage:
@@ -1045,8 +944,6 @@ Run "npm help unpublish" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command unstar > must match snapshot 1`] = `
-npm unstar
-
Remove an item from your favorite packages
Usage:
@@ -1059,8 +956,6 @@ Run "npm help unstar" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command update > must match snapshot 1`] = `
-npm update
-
Update packages
Usage:
@@ -1081,8 +976,6 @@ Run "npm help update" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command version > must match snapshot 1`] = `
-npm version
-
Bump a package version
Usage:
@@ -1092,7 +985,7 @@ Options:
[--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json]
[--preid prerelease-id] [--sign-git-tag]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
+[-ws|--workspaces] [--no-workspaces-update] [--include-workspace-root]
alias: verison
@@ -1100,8 +993,6 @@ Run "npm help version" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command view > must match snapshot 1`] = `
-npm view
-
View registry info
Usage:
@@ -1111,14 +1002,12 @@ Options:
[--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
-aliases: v, info, show
+aliases: info, show, v
Run "npm help view" for more info
`
exports[`test/lib/load-all-commands.js TAP load each command whoami > must match snapshot 1`] = `
-npm whoami
-
Display npm username
Usage:
diff --git a/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
index f842e689f16..9413f8e9a6d 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs
@@ -7,43 +7,348 @@
'use strict'
exports[`test/lib/utils/cmd-list.js TAP > must match snapshot 1`] = `
Object {
- "affordances": Object {
- "add": "install",
- "add-user": "adduser",
- "author": "owner",
- "dist-tags": "dist-tag",
- "find": "search",
- "hlep": "help",
- "home": "docs",
- "ic": "ci",
- "in": "install",
- "info": "view",
- "innit": "init",
- "ins": "install",
- "inst": "install",
- "insta": "install",
- "instal": "install",
- "install-clean": "ci",
- "isnt": "install",
- "isnta": "install",
- "isntal": "install",
- "isntall": "install",
- "isntall-clean": "ci",
- "issues": "bugs",
- "la": "ll",
- "login": "adduser",
- "ogr": "org",
- "r": "uninstall",
- "remove": "uninstall",
- "rm": "uninstall",
- "rum": "run-script",
- "show": "view",
- "sit": "cit",
- "udpate": "update",
- "unlink": "uninstall",
- "upgrade": "update",
- "urn": "run-script",
- "verison": "version",
+ "abbrevs": Object {
+ "ac": "access",
+ "acc": "access",
+ "acce": "access",
+ "acces": "access",
+ "access": "access",
+ "add": "add",
+ "add-": "add-user",
+ "add-u": "add-user",
+ "add-us": "add-user",
+ "add-use": "add-user",
+ "add-user": "add-user",
+ "addu": "adduser",
+ "addus": "adduser",
+ "adduse": "adduser",
+ "adduser": "adduser",
+ "aud": "audit",
+ "audi": "audit",
+ "audit": "audit",
+ "aut": "author",
+ "auth": "author",
+ "autho": "author",
+ "author": "author",
+ "bi": "bin",
+ "bin": "bin",
+ "bu": "bugs",
+ "bug": "bugs",
+ "bugs": "bugs",
+ "c": "c",
+ "ca": "cache",
+ "cac": "cache",
+ "cach": "cache",
+ "cache": "cache",
+ "ci": "ci",
+ "cit": "cit",
+ "clean-install": "clean-install",
+ "clean-install-": "clean-install-test",
+ "clean-install-t": "clean-install-test",
+ "clean-install-te": "clean-install-test",
+ "clean-install-tes": "clean-install-test",
+ "clean-install-test": "clean-install-test",
+ "com": "completion",
+ "comp": "completion",
+ "compl": "completion",
+ "comple": "completion",
+ "complet": "completion",
+ "completi": "completion",
+ "completio": "completion",
+ "completion": "completion",
+ "con": "config",
+ "conf": "config",
+ "confi": "config",
+ "config": "config",
+ "cr": "create",
+ "cre": "create",
+ "crea": "create",
+ "creat": "create",
+ "create": "create",
+ "dd": "ddp",
+ "ddp": "ddp",
+ "ded": "dedupe",
+ "dedu": "dedupe",
+ "dedup": "dedupe",
+ "dedupe": "dedupe",
+ "dep": "deprecate",
+ "depr": "deprecate",
+ "depre": "deprecate",
+ "deprec": "deprecate",
+ "depreca": "deprecate",
+ "deprecat": "deprecate",
+ "deprecate": "deprecate",
+ "dif": "diff",
+ "diff": "diff",
+ "dist-tag": "dist-tag",
+ "dist-tags": "dist-tags",
+ "docs": "docs",
+ "doct": "doctor",
+ "docto": "doctor",
+ "doctor": "doctor",
+ "ed": "edit",
+ "edi": "edit",
+ "edit": "edit",
+ "exe": "exec",
+ "exec": "exec",
+ "expla": "explain",
+ "explai": "explain",
+ "explain": "explain",
+ "explo": "explore",
+ "explor": "explore",
+ "explore": "explore",
+ "find": "find",
+ "find-": "find-dupes",
+ "find-d": "find-dupes",
+ "find-du": "find-dupes",
+ "find-dup": "find-dupes",
+ "find-dupe": "find-dupes",
+ "find-dupes": "find-dupes",
+ "fu": "fund",
+ "fun": "fund",
+ "fund": "fund",
+ "g": "get",
+ "ge": "get",
+ "get": "get",
+ "he": "help",
+ "hel": "help",
+ "help": "help",
+ "hl": "hlep",
+ "hle": "hlep",
+ "hlep": "hlep",
+ "hom": "home",
+ "home": "home",
+ "hoo": "hook",
+ "hook": "hook",
+ "i": "i",
+ "ic": "ic",
+ "in": "in",
+ "inf": "info",
+ "info": "info",
+ "ini": "init",
+ "init": "init",
+ "inn": "innit",
+ "inni": "innit",
+ "innit": "innit",
+ "ins": "ins",
+ "inst": "inst",
+ "insta": "insta",
+ "instal": "instal",
+ "install": "install",
+ "install-ci": "install-ci-test",
+ "install-ci-": "install-ci-test",
+ "install-ci-t": "install-ci-test",
+ "install-ci-te": "install-ci-test",
+ "install-ci-tes": "install-ci-test",
+ "install-ci-test": "install-ci-test",
+ "install-cl": "install-clean",
+ "install-cle": "install-clean",
+ "install-clea": "install-clean",
+ "install-clean": "install-clean",
+ "install-t": "install-test",
+ "install-te": "install-test",
+ "install-tes": "install-test",
+ "install-test": "install-test",
+ "isnt": "isnt",
+ "isnta": "isnta",
+ "isntal": "isntal",
+ "isntall": "isntall",
+ "isntall-": "isntall-clean",
+ "isntall-c": "isntall-clean",
+ "isntall-cl": "isntall-clean",
+ "isntall-cle": "isntall-clean",
+ "isntall-clea": "isntall-clean",
+ "isntall-clean": "isntall-clean",
+ "iss": "issues",
+ "issu": "issues",
+ "issue": "issues",
+ "issues": "issues",
+ "it": "it",
+ "la": "la",
+ "lin": "link",
+ "link": "link",
+ "lis": "list",
+ "list": "list",
+ "ll": "ll",
+ "ln": "ln",
+ "logi": "login",
+ "login": "login",
+ "logo": "logout",
+ "logou": "logout",
+ "logout": "logout",
+ "ls": "ls",
+ "og": "ogr",
+ "ogr": "ogr",
+ "or": "org",
+ "org": "org",
+ "ou": "outdated",
+ "out": "outdated",
+ "outd": "outdated",
+ "outda": "outdated",
+ "outdat": "outdated",
+ "outdate": "outdated",
+ "outdated": "outdated",
+ "ow": "owner",
+ "own": "owner",
+ "owne": "owner",
+ "owner": "owner",
+ "pa": "pack",
+ "pac": "pack",
+ "pack": "pack",
+ "pi": "ping",
+ "pin": "ping",
+ "ping": "ping",
+ "pk": "pkg",
+ "pkg": "pkg",
+ "pre": "prefix",
+ "pref": "prefix",
+ "prefi": "prefix",
+ "prefix": "prefix",
+ "pro": "profile",
+ "prof": "profile",
+ "profi": "profile",
+ "profil": "profile",
+ "profile": "profile",
+ "pru": "prune",
+ "prun": "prune",
+ "prune": "prune",
+ "pu": "publish",
+ "pub": "publish",
+ "publ": "publish",
+ "publi": "publish",
+ "publis": "publish",
+ "publish": "publish",
+ "r": "r",
+ "rb": "rb",
+ "reb": "rebuild",
+ "rebu": "rebuild",
+ "rebui": "rebuild",
+ "rebuil": "rebuild",
+ "rebuild": "rebuild",
+ "rem": "remove",
+ "remo": "remove",
+ "remov": "remove",
+ "remove": "remove",
+ "rep": "repo",
+ "repo": "repo",
+ "res": "restart",
+ "rest": "restart",
+ "resta": "restart",
+ "restar": "restart",
+ "restart": "restart",
+ "rm": "rm",
+ "ro": "root",
+ "roo": "root",
+ "root": "root",
+ "rum": "rum",
+ "run": "run",
+ "run-": "run-script",
+ "run-s": "run-script",
+ "run-sc": "run-script",
+ "run-scr": "run-script",
+ "run-scri": "run-script",
+ "run-scrip": "run-script",
+ "run-script": "run-script",
+ "s": "s",
+ "se": "se",
+ "sea": "search",
+ "sear": "search",
+ "searc": "search",
+ "search": "search",
+ "set": "set",
+ "set-": "set-script",
+ "set-s": "set-script",
+ "set-sc": "set-script",
+ "set-scr": "set-script",
+ "set-scri": "set-script",
+ "set-scrip": "set-script",
+ "set-script": "set-script",
+ "sho": "show",
+ "show": "show",
+ "shr": "shrinkwrap",
+ "shri": "shrinkwrap",
+ "shrin": "shrinkwrap",
+ "shrink": "shrinkwrap",
+ "shrinkw": "shrinkwrap",
+ "shrinkwr": "shrinkwrap",
+ "shrinkwra": "shrinkwrap",
+ "shrinkwrap": "shrinkwrap",
+ "si": "sit",
+ "sit": "sit",
+ "star": "star",
+ "stars": "stars",
+ "start": "start",
+ "sto": "stop",
+ "stop": "stop",
+ "t": "t",
+ "tea": "team",
+ "team": "team",
+ "tes": "test",
+ "test": "test",
+ "to": "token",
+ "tok": "token",
+ "toke": "token",
+ "token": "token",
+ "ts": "tst",
+ "tst": "tst",
+ "ud": "udpate",
+ "udp": "udpate",
+ "udpa": "udpate",
+ "udpat": "udpate",
+ "udpate": "udpate",
+ "un": "un",
+ "uni": "uninstall",
+ "unin": "uninstall",
+ "unins": "uninstall",
+ "uninst": "uninstall",
+ "uninsta": "uninstall",
+ "uninstal": "uninstall",
+ "uninstall": "uninstall",
+ "unl": "unlink",
+ "unli": "unlink",
+ "unlin": "unlink",
+ "unlink": "unlink",
+ "unp": "unpublish",
+ "unpu": "unpublish",
+ "unpub": "unpublish",
+ "unpubl": "unpublish",
+ "unpubli": "unpublish",
+ "unpublis": "unpublish",
+ "unpublish": "unpublish",
+ "uns": "unstar",
+ "unst": "unstar",
+ "unsta": "unstar",
+ "unstar": "unstar",
+ "up": "up",
+ "upd": "update",
+ "upda": "update",
+ "updat": "update",
+ "update": "update",
+ "upg": "upgrade",
+ "upgr": "upgrade",
+ "upgra": "upgrade",
+ "upgrad": "upgrade",
+ "upgrade": "upgrade",
+ "ur": "urn",
+ "urn": "urn",
+ "v": "v",
+ "veri": "verison",
+ "veris": "verison",
+ "veriso": "verison",
+ "verison": "verison",
+ "vers": "version",
+ "versi": "version",
+ "versio": "version",
+ "version": "version",
+ "vi": "view",
+ "vie": "view",
+ "view": "view",
+ "who": "whoami",
+ "whoa": "whoami",
+ "whoam": "whoami",
+ "whoami": "whoami",
+ "why": "why",
+ "x": "x",
},
"aliases": Object {
"add": "install",
@@ -105,108 +410,76 @@ Object {
"x": "exec",
},
"cmdList": Array [
- "ci",
- "install-ci-test",
- "install",
- "install-test",
- "uninstall",
+ "access",
+ "adduser",
+ "audit",
+ "bin",
+ "bugs",
"cache",
+ "ci",
+ "completion",
"config",
- "set",
- "get",
- "update",
- "outdated",
- "prune",
- "pack",
- "find-dupes",
"dedupe",
+ "deprecate",
+ "diff",
+ "dist-tag",
+ "docs",
+ "doctor",
+ "edit",
+ "exec",
+ "explain",
+ "explore",
+ "find-dupes",
+ "fund",
+ "get",
+ "help",
"hook",
- "rebuild",
+ "init",
+ "install",
+ "install-ci-test",
+ "install-test",
"link",
- "publish",
- "star",
- "stars",
- "unstar",
- "adduser",
+ "ll",
"login",
"logout",
- "unpublish",
- "owner",
- "access",
- "team",
- "deprecate",
- "shrinkwrap",
- "token",
- "profile",
- "audit",
- "fund",
- "org",
- "help",
"ls",
- "ll",
- "search",
- "view",
- "init",
- "version",
- "edit",
- "explore",
- "docs",
- "repo",
- "bugs",
- "root",
- "prefix",
- "bin",
- "whoami",
- "diff",
- "dist-tag",
+ "org",
+ "outdated",
+ "owner",
+ "pack",
"ping",
"pkg",
- "test",
- "stop",
- "start",
+ "prefix",
+ "profile",
+ "prune",
+ "publish",
+ "rebuild",
+ "repo",
"restart",
+ "root",
"run-script",
+ "search",
+ "set",
"set-script",
- "completion",
- "doctor",
- "exec",
- "explain",
+ "shrinkwrap",
+ "star",
+ "stars",
+ "start",
+ "stop",
+ "team",
+ "test",
+ "token",
+ "uninstall",
+ "unpublish",
+ "unstar",
+ "update",
+ "version",
+ "view",
+ "whoami",
],
"plumbing": Array [
"birthday",
"help-search",
],
- "shellouts": Array [
- "exec",
- "run-script",
- "test",
- "start",
- "stop",
- "restart",
- "birthday",
- ],
- "shorthands": Object {
- "c": "config",
- "cit": "install-ci-test",
- "clean-install": "ci",
- "clean-install-test": "cit",
- "create": "init",
- "ddp": "dedupe",
- "i": "install",
- "it": "install-test",
- "list": "ls",
- "ln": "link",
- "rb": "rebuild",
- "run": "run-script",
- "s": "search",
- "se": "search",
- "t": "test",
- "tst": "test",
- "un": "uninstall",
- "up": "update",
- "v": "view",
- "why": "explain",
- "x": "exec",
- },
}
`
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 373f094a59a..d7c43080298 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
@@ -85,6 +85,7 @@ Array [
"location",
"lockfile-version",
"loglevel",
+ "logs-dir",
"logs-max",
"long",
"maxsockets",
@@ -151,6 +152,7 @@ Array [
"which",
"workspace",
"workspaces",
+ "workspaces-update",
"yes",
]
`
@@ -1098,6 +1100,16 @@ Any logs of a higher level than the setting are shown. The default is
See also the \`foreground-scripts\` config.
`
+exports[`test/lib/utils/config/definitions.js TAP > config description for logs-dir 1`] = `
+#### \`logs-dir\`
+
+* Default: A directory named \`_logs\` inside the cache
+* Type: null or Path
+
+The location of npm's log directory. See [\`npm logging\`](/using-npm/logging)
+for more information.
+`
+
exports[`test/lib/utils/config/definitions.js TAP > config description for logs-max 1`] = `
#### \`logs-max\`
@@ -1105,6 +1117,8 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for logs-
* Type: Number
The maximum number of log files to store.
+
+If set to 0, no log files will be written for the current run.
`
exports[`test/lib/utils/config/definitions.js TAP > config description for long 1`] = `
@@ -1720,9 +1734,9 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for timin
* Default: false
* Type: Boolean
-If true, writes an \`npm-debug\` log to \`_logs\` and timing information to
-\`_timing.json\`, both in your cache, even if the command completes
-successfully. \`_timing.json\` is a newline delimited list of JSON objects.
+If true, writes a debug log to \`logs-dir\` and timing information to
+\`_timing.json\` in the cache, even if the command completes successfully.
+\`_timing.json\` is a newline delimited list of JSON objects.
You can quickly view it with this [json](https://npm.im/json) command line:
\`npm exec -- json -g < ~/.npm/_timing.json\`.
@@ -1915,6 +1929,16 @@ _unless_ one or more workspaces are specified in the \`workspace\` config.
This value is not exported to the environment for child processes.
`
+exports[`test/lib/utils/config/definitions.js TAP > config description for workspaces-update 1`] = `
+#### \`workspaces-update\`
+
+* Default: true
+* Type: Boolean
+
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the \`node_modules\` folder.
+`
+
exports[`test/lib/utils/config/definitions.js TAP > config description for yes 1`] = `
#### \`yes\`
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 3a7d90db01b..2647bc31bcd 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
@@ -901,6 +901,17 @@ See also the \`foreground-scripts\` config.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
+#### \`logs-dir\`
+
+* Default: A directory named \`_logs\` inside the cache
+* Type: null or Path
+
+The location of npm's log directory. See [\`npm logging\`](/using-npm/logging)
+for more information.
+
+<!-- automatically generated, do not edit manually -->
+<!-- see lib/utils/config/definitions.js -->
+
#### \`logs-max\`
* Default: 10
@@ -908,6 +919,8 @@ See also the \`foreground-scripts\` config.
The maximum number of log files to store.
+If set to 0, no log files will be written for the current run.
+
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
@@ -1502,9 +1515,9 @@ particular, use care when overriding this setting for public packages.
* Default: false
* Type: Boolean
-If true, writes an \`npm-debug\` log to \`_logs\` and timing information to
-\`_timing.json\`, both in your cache, even if the command completes
-successfully. \`_timing.json\` is a newline delimited list of JSON objects.
+If true, writes a debug log to \`logs-dir\` and timing information to
+\`_timing.json\` in the cache, even if the command completes successfully.
+\`_timing.json\` is a newline delimited list of JSON objects.
You can quickly view it with this [json](https://npm.im/json) command line:
\`npm exec -- json -g < ~/.npm/_timing.json\`.
@@ -1697,6 +1710,17 @@ This value is not exported to the environment for child processes.
<!-- automatically generated, do not edit manually -->
<!-- see lib/utils/config/definitions.js -->
+#### \`workspaces-update\`
+
+* Default: true
+* Type: Boolean
+
+If set to true, the npm cli will run an update after operations that may
+possibly change the workspaces installed to the \`node_modules\` folder.
+
+<!-- automatically generated, do not edit manually -->
+<!-- see lib/utils/config/definitions.js -->
+
#### \`yes\`
* Default: null
diff --git a/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs
index 8c6a17ad2f9..312c814ea72 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs
@@ -500,6 +500,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":false,"cacheDest":false} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-false-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-false-/cache/_logs/{DATE}-debug-0.log",
],
@@ -528,6 +540,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-true-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-false-cacheDest-true-/cache/_logs/{DATE}-debug-0.log",
],
@@ -559,6 +583,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":true,"cacheDest":false} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-false-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-false-/cache/_logs/{DATE}-debug-0.log",
],
@@ -590,6 +626,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":false,"loaded":true,"cachePath":true,"cacheDest":true} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-true-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-false-loaded-true-cachePath-true-cacheDest-true-/cache/_logs/{DATE}-debug-0.log",
],
@@ -768,6 +816,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":false,"cacheDest":false} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-false-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-false-/cache/_logs/{DATE}-debug-0.log",
],
@@ -807,6 +867,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":false,"cacheDest":true} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-true-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-false-cacheDest-true-/cache/_logs/{DATE}-debug-0.log",
],
@@ -846,6 +918,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":false} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-false-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-false-/cache/_logs/{DATE}-debug-0.log",
],
@@ -885,6 +969,18 @@ Object {
exports[`test/lib/utils/error-message.js TAP eacces/eperm {"windows":true,"loaded":true,"cachePath":true,"cacheDest":true} > must match snapshot 2`] = `
Array [
Array [
+ "title",
+ "npm",
+ ],
+ Array [
+ "argv",
+ "",
+ ],
+ Array [
+ "logfile",
+ "logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-true-/cache/_logs",
+ ],
+ Array [
"logfile",
"{CWD}/test/lib/utils/tap-testdir-error-message-eacces-eperm--windows-true-loaded-true-cachePath-true-cacheDest-true-/cache/_logs/{DATE}-debug-0.log",
],
diff --git a/deps/npm/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs
index 0aaf235fd14..e19a2571d64 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/exit-handler.js.test.cjs
@@ -9,44 +9,54 @@ exports[`test/lib/utils/exit-handler.js TAP handles unknown error with logs and
0 timing npm:load:whichnode Completed in {TIME}ms
15 timing config:load Completed in {TIME}ms
16 timing npm:load:configload Completed in {TIME}ms
-17 timing npm:load:setTitle Completed in {TIME}ms
-19 timing npm:load:display Completed in {TIME}ms
-20 verbose logfile {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log
-21 timing npm:load:logFile Completed in {TIME}ms
-22 timing npm:load:timers Completed in {TIME}ms
-23 timing npm:load:configScope Completed in {TIME}ms
-24 timing npm:load Completed in {TIME}ms
-25 verbose stack Error: Unknown error
-26 verbose cwd {CWD}
-27 verbose Foo 1.0.0
-28 verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js"
-29 verbose node v1.0.0
-30 verbose npm v1.0.0
-31 error code ECODE
-32 error ERR SUMMARY Unknown error
-33 error ERR DETAIL Unknown error
-34 verbose exit 1
-36 timing npm Completed in {TIME}ms
-37 verbose code 1
-38 error A complete log of this run can be found in:
-38 error {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log
+17 timing npm:load:mkdirpcache Completed in {TIME}ms
+18 timing npm:load:mkdirplogs Completed in {TIME}ms
+19 verbose title npm
+20 verbose argv
+21 timing npm:load:setTitle Completed in {TIME}ms
+23 timing npm:load:display Completed in {TIME}ms
+24 verbose logfile logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs
+25 verbose logfile {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log
+26 timing npm:load:logFile Completed in {TIME}ms
+27 timing npm:load:timers Completed in {TIME}ms
+28 timing npm:load:configScope Completed in {TIME}ms
+29 timing npm:load Completed in {TIME}ms
+30 silly logfile done cleaning log files
+31 verbose stack Error: Unknown error
+32 verbose cwd {CWD}
+33 verbose Foo 1.0.0
+34 verbose node v1.0.0
+35 verbose npm v1.0.0
+36 error code ECODE
+37 error ERR SUMMARY Unknown error
+38 error ERR DETAIL Unknown error
+39 verbose exit 1
+41 timing npm Completed in {TIME}ms
+42 verbose code 1
+43 error A complete log of this run can be found in:
+43 error {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log
`
exports[`test/lib/utils/exit-handler.js TAP handles unknown error with logs and debug file > logs 1`] = `
timing npm:load:whichnode Completed in {TIME}ms
timing config:load Completed in {TIME}ms
timing npm:load:configload Completed in {TIME}ms
+timing npm:load:mkdirpcache Completed in {TIME}ms
+timing npm:load:mkdirplogs Completed in {TIME}ms
+verbose title npm
+verbose argv
timing npm:load:setTitle Completed in {TIME}ms
timing npm:load:display Completed in {TIME}ms
+verbose logfile logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs
verbose logfile {CWD}/test/lib/utils/tap-testdir-exit-handler-handles-unknown-error-with-logs-and-debug-file/cache/_logs/{DATE}-debug-0.log
timing npm:load:logFile Completed in {TIME}ms
timing npm:load:timers Completed in {TIME}ms
timing npm:load:configScope Completed in {TIME}ms
timing npm:load Completed in {TIME}ms
+silly logfile done cleaning log files
verbose stack Error: Unknown error
verbose cwd {CWD}
verbose Foo 1.0.0
-verbose argv "/node" "{CWD}/test/lib/utils/exit-handler.js"
verbose node v1.0.0
verbose npm v1.0.0
error code ECODE
diff --git a/deps/npm/tap-snapshots/test/lib/utils/log-file.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/log-file.js.test.cjs
index ecce9eafcc9..7a391849390 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/log-file.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/log-file.js.test.cjs
@@ -6,63 +6,65 @@
*/
'use strict'
exports[`test/lib/utils/log-file.js TAP snapshot > must match snapshot 1`] = `
-0 error no prefix
-1 error prefix with prefix
-2 error prefix 1 2 3
-3 verbose { obj: { with: { many: [Object] } } }
-4 verbose {"obj":{"with":{"many":{"props":1}}}}
-5 verbose {
-5 verbose "obj": {
-5 verbose "with": {
-5 verbose "many": {
-5 verbose "props": 1
-5 verbose }
-5 verbose }
-5 verbose }
-5 verbose }
-6 verbose [ 'test', 'with', 'an', 'array' ]
-7 verbose ["test","with","an","array"]
-8 verbose [
-8 verbose "test",
-8 verbose "with",
-8 verbose "an",
-8 verbose "array"
-8 verbose ]
-9 verbose [ 'test', [ 'with', [ 'an', [Array] ] ] ]
-10 verbose ["test",["with",["an",["array"]]]]
-11 verbose [
-11 verbose "test",
-11 verbose [
-11 verbose "with",
-11 verbose [
-11 verbose "an",
-11 verbose [
-11 verbose "array"
-11 verbose ]
-11 verbose ]
-11 verbose ]
-11 verbose ]
-12 error pre has many errors Error: message
-12 error pre at stack trace line 0
-12 error pre at stack trace line 1
-12 error pre at stack trace line 2
-12 error pre at stack trace line 3
-12 error pre at stack trace line 4
-12 error pre at stack trace line 5
-12 error pre at stack trace line 6
-12 error pre at stack trace line 7
-12 error pre at stack trace line 8
-12 error pre at stack trace line 9 Error: message2
-12 error pre at stack trace line 0
-12 error pre at stack trace line 1
-12 error pre at stack trace line 2
-12 error pre at stack trace line 3
-12 error pre at stack trace line 4
-12 error pre at stack trace line 5
-12 error pre at stack trace line 6
-12 error pre at stack trace line 7
-12 error pre at stack trace line 8
-12 error pre at stack trace line 9
-13 error nostack [Error: message]
+0 verbose logfile logs-max:10 dir:{CWD}/test/lib/utils/tap-testdir-log-file-snapshot
+1 silly logfile done cleaning log files
+2 error no prefix
+3 error prefix with prefix
+4 error prefix 1 2 3
+5 verbose { obj: { with: { many: [Object] } } }
+6 verbose {"obj":{"with":{"many":{"props":1}}}}
+7 verbose {
+7 verbose "obj": {
+7 verbose "with": {
+7 verbose "many": {
+7 verbose "props": 1
+7 verbose }
+7 verbose }
+7 verbose }
+7 verbose }
+8 verbose [ 'test', 'with', 'an', 'array' ]
+9 verbose ["test","with","an","array"]
+10 verbose [
+10 verbose "test",
+10 verbose "with",
+10 verbose "an",
+10 verbose "array"
+10 verbose ]
+11 verbose [ 'test', [ 'with', [ 'an', [Array] ] ] ]
+12 verbose ["test",["with",["an",["array"]]]]
+13 verbose [
+13 verbose "test",
+13 verbose [
+13 verbose "with",
+13 verbose [
+13 verbose "an",
+13 verbose [
+13 verbose "array"
+13 verbose ]
+13 verbose ]
+13 verbose ]
+13 verbose ]
+14 error pre has many errors Error: message
+14 error pre at stack trace line 0
+14 error pre at stack trace line 1
+14 error pre at stack trace line 2
+14 error pre at stack trace line 3
+14 error pre at stack trace line 4
+14 error pre at stack trace line 5
+14 error pre at stack trace line 6
+14 error pre at stack trace line 7
+14 error pre at stack trace line 8
+14 error pre at stack trace line 9 Error: message2
+14 error pre at stack trace line 0
+14 error pre at stack trace line 1
+14 error pre at stack trace line 2
+14 error pre at stack trace line 3
+14 error pre at stack trace line 4
+14 error pre at stack trace line 5
+14 error pre at stack trace line 6
+14 error pre at stack trace line 7
+14 error pre at stack trace line 8
+14 error pre at stack trace line 9
+15 error nostack [Error: message]
`
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 2db10df46e2..d1de45413a9 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
@@ -165,9 +165,7 @@ npm help npm more involved overview
All commands:
- access npm access
-
- Set access level on published packages
+ access Set access level on published packages
Usage:
npm access public [<package>]
@@ -185,9 +183,7 @@ All commands:
Run "npm help access" for more info
- adduser npm adduser
-
- Add a registry user account
+ adduser Add a registry user account
Usage:
npm adduser
@@ -199,9 +195,7 @@ All commands:
Run "npm help adduser" for more info
- audit npm audit
-
- Run a security audit
+ audit Run a security audit
Usage:
npm audit [fix]
@@ -216,9 +210,7 @@ All commands:
Run "npm help audit" for more info
- bin npm bin
-
- Display npm bin folder
+ bin Display npm bin folder
Usage:
npm bin
@@ -228,9 +220,7 @@ All commands:
Run "npm help bin" for more info
- bugs npm bugs
-
- Report bugs for a package in a web browser
+ bugs Report bugs for a package in a web browser
Usage:
npm bugs [<pkgname>]
@@ -242,9 +232,7 @@ All commands:
Run "npm help bugs" for more info
- cache npm cache
-
- Manipulates packages cache
+ cache Manipulates packages cache
Usage:
npm cache add <tarball file>
@@ -261,9 +249,7 @@ All commands:
Run "npm help cache" for more info
- ci npm ci
-
- Install a project with a clean slate
+ ci Install a project with a clean slate
Usage:
npm ci
@@ -276,18 +262,14 @@ All commands:
Run "npm help ci" for more info
- completion npm completion
-
- Tab Completion for npm
+ completion Tab Completion for npm
Usage:
npm completion
Run "npm help completion" for more info
- config npm config
-
- Manage the npm configuration files
+ config Manage the npm configuration files
Usage:
npm config set <key>=<value> [<key>=<value> ...]
@@ -304,9 +286,7 @@ All commands:
Run "npm help config" for more info
- dedupe npm dedupe
-
- Reduce duplication in the package tree
+ dedupe Reduce duplication in the package tree
Usage:
npm dedupe
@@ -323,9 +303,7 @@ All commands:
Run "npm help dedupe" for more info
- deprecate npm deprecate
-
- Deprecate a version of a package
+ deprecate Deprecate a version of a package
Usage:
npm deprecate <pkg>[@<version>] <message>
@@ -335,9 +313,7 @@ All commands:
Run "npm help deprecate" for more info
- diff npm diff
-
- The registry diff command
+ diff The registry diff command
Usage:
npm diff [...<paths>]
@@ -352,9 +328,7 @@ All commands:
Run "npm help diff" for more info
- dist-tag npm dist-tag
-
- Modify package distribution tags
+ dist-tag Modify package distribution tags
Usage:
npm dist-tag add <pkg>@<version> [<tag>]
@@ -369,9 +343,7 @@ All commands:
Run "npm help dist-tag" for more info
- docs npm docs
-
- Open documentation for a package in a web browser
+ docs Open documentation for a package in a web browser
Usage:
npm docs [<pkgname> [<pkgname> ...]]
@@ -385,9 +357,7 @@ All commands:
Run "npm help docs" for more info
- doctor npm doctor
-
- Check your npm environment
+ doctor Check your npm environment
Usage:
npm doctor
@@ -397,9 +367,7 @@ All commands:
Run "npm help doctor" for more info
- edit npm edit
-
- Edit an installed package
+ edit Edit an installed package
Usage:
npm edit <pkg>[/<subpkg>...]
@@ -409,9 +377,7 @@ All commands:
Run "npm help edit" for more info
- exec npm exec
-
- Run a command from a local or remote npm package
+ exec Run a command from a local or remote npm package
Usage:
npm exec -- <pkg>[@<version>] [args...]
@@ -429,9 +395,7 @@ All commands:
Run "npm help exec" for more info
- explain npm explain
-
- Explain installed packages
+ explain Explain installed packages
Usage:
npm explain <folder | specifier>
@@ -443,9 +407,7 @@ All commands:
Run "npm help explain" for more info
- explore npm explore
-
- Browse an installed package
+ explore Browse an installed package
Usage:
npm explore <pkg> [ -- <command>]
@@ -455,9 +417,7 @@ All commands:
Run "npm help explore" for more info
- find-dupes npm find-dupes
-
- Find duplication in the package tree
+ find-dupes Find duplication in the package tree
Usage:
npm find-dupes
@@ -471,9 +431,7 @@ All commands:
Run "npm help find-dupes" for more info
- fund npm fund
-
- Retrieve funding information
+ fund Retrieve funding information
Usage:
npm fund [[<@scope>/]<pkg>]
@@ -485,18 +443,14 @@ All commands:
Run "npm help fund" for more info
- get npm get
-
- Get a value from the npm configuration
+ get Get a value from the npm configuration
Usage:
npm get [<key> ...] (See \`npm config\`)
Run "npm help get" for more info
- help npm help
-
- Get help on npm
+ help Get help on npm
Usage:
npm help <term> [<terms..>]
@@ -508,9 +462,7 @@ All commands:
Run "npm help help" for more info
- hook npm hook
-
- Manage registry hooks
+ hook Manage registry hooks
Usage:
npm hook add <pkg> <url> <secret> [--type=<type>]
@@ -523,9 +475,7 @@ All commands:
Run "npm help hook" for more info
- init npm init
-
- Create a package.json file
+ init Create a package.json file
Usage:
npm init [--force|-f|--yes|-y|--scope]
@@ -541,9 +491,7 @@ All commands:
Run "npm help init" for more info
- install npm install
-
- Install a package
+ install Install a package
Usage:
npm install [<@scope>/]<pkg>
@@ -566,13 +514,11 @@ All commands:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
- aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add
+ aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
Run "npm help install" for more info
- install-ci-test npm install-ci-test
-
- Install a project with a clean slate and run tests
+ install-ci-test Install a project with a clean slate and run tests
Usage:
npm install-ci-test
@@ -585,9 +531,7 @@ All commands:
Run "npm help install-ci-test" for more info
- install-test npm install-test
-
- Install package(s) and run tests
+ install-test Install package(s) and run tests
Usage:
npm install-test [<@scope>/]<pkg>
@@ -614,9 +558,7 @@ All commands:
Run "npm help install-test" for more info
- link npm link
-
- Symlink a package folder
+ link Symlink a package folder
Usage:
npm link (in package dir)
@@ -635,9 +577,7 @@ All commands:
Run "npm help link" for more info
- ll npm ll
-
- List installed packages
+ ll List installed packages
Usage:
npm ll [[<@scope>/]<pkg> ...]
@@ -653,9 +593,7 @@ All commands:
Run "npm help ll" for more info
- login npm adduser
-
- Add a registry user account
+ login Add a registry user account
Usage:
npm adduser
@@ -667,9 +605,7 @@ All commands:
Run "npm help adduser" for more info
- logout npm logout
-
- Log out of the registry
+ logout Log out of the registry
Usage:
npm logout
@@ -679,9 +615,7 @@ All commands:
Run "npm help logout" for more info
- ls npm ls
-
- List installed packages
+ ls List installed packages
Usage:
npm ls [[<@scope>/]<pkg> ...]
@@ -697,9 +631,7 @@ All commands:
Run "npm help ls" for more info
- org npm org
-
- Manage orgs
+ org Manage orgs
Usage:
npm org set orgname username [developer | admin | owner]
@@ -713,9 +645,7 @@ All commands:
Run "npm help org" for more info
- outdated npm outdated
-
- Check for outdated packages
+ outdated Check for outdated packages
Usage:
npm outdated [[<@scope>/]<pkg> ...]
@@ -726,9 +656,7 @@ All commands:
Run "npm help outdated" for more info
- owner npm owner
-
- Manage package owners
+ owner Manage package owners
Usage:
npm owner add <user> [<@scope>/]<pkg>
@@ -742,9 +670,7 @@ All commands:
Run "npm help owner" for more info
- pack npm pack
-
- Create a tarball from a package
+ pack Create a tarball from a package
Usage:
npm pack [[<@scope>/]<pkg>...]
@@ -756,9 +682,7 @@ All commands:
Run "npm help pack" for more info
- ping npm ping
-
- Ping npm registry
+ ping Ping npm registry
Usage:
npm ping
@@ -768,9 +692,7 @@ All commands:
Run "npm help ping" for more info
- pkg npm pkg
-
- Manages your package.json
+ pkg Manages your package.json
Usage:
npm pkg set <key>=<value> [<key>=<value> ...]
@@ -786,9 +708,7 @@ All commands:
Run "npm help pkg" for more info
- prefix npm prefix
-
- Display prefix
+ prefix Display prefix
Usage:
npm prefix [-g]
@@ -798,9 +718,7 @@ All commands:
Run "npm help prefix" for more info
- profile npm profile
-
- Change settings on your registry profile
+ profile Change settings on your registry profile
Usage:
npm profile enable-2fa [auth-only|auth-and-writes]
@@ -813,9 +731,7 @@ All commands:
Run "npm help profile" for more info
- prune npm prune
-
- Remove extraneous packages
+ prune Remove extraneous packages
Usage:
npm prune [[<@scope>/]<pkg>...]
@@ -828,9 +744,7 @@ All commands:
Run "npm help prune" for more info
- publish npm publish
-
- Publish a package
+ publish Publish a package
Usage:
npm publish [<folder>]
@@ -842,9 +756,7 @@ All commands:
Run "npm help publish" for more info
- rebuild npm rebuild
-
- Rebuild a package
+ rebuild Rebuild a package
Usage:
npm rebuild [[<@scope>/]<name>[@<version>] ...]
@@ -858,9 +770,7 @@ All commands:
Run "npm help rebuild" for more info
- repo npm repo
-
- Open package repository page in the browser
+ repo Open package repository page in the browser
Usage:
npm repo [<pkgname> [<pkgname> ...]]
@@ -872,9 +782,7 @@ All commands:
Run "npm help repo" for more info
- restart npm restart
-
- Restart a package
+ restart Restart a package
Usage:
npm restart [-- <args>]
@@ -884,9 +792,7 @@ All commands:
Run "npm help restart" for more info
- root npm root
-
- Display npm root
+ root Display npm root
Usage:
npm root
@@ -896,9 +802,7 @@ All commands:
Run "npm help root" for more info
- run-script npm run-script
-
- Run arbitrary package scripts
+ run-script Run arbitrary package scripts
Usage:
npm run-script <command> [-- <args>]
@@ -912,9 +816,7 @@ All commands:
Run "npm help run-script" for more info
- search npm search
-
- Search for packages
+ search Search for packages
Usage:
npm search [search terms ...]
@@ -924,22 +826,18 @@ All commands:
[--no-description] [--searchopts <searchopts>] [--searchexclude <searchexclude>]
[--registry <registry>] [--prefer-online] [--prefer-offline] [--offline]
- aliases: s, se, find
+ aliases: find, s, se
Run "npm help search" for more info
- set npm set
-
- Set a value in the npm configuration
+ set Set a value in the npm configuration
Usage:
npm set <key>=<value> [<key>=<value> ...] (See \`npm config\`)
Run "npm help set" for more info
- set-script npm set-script
-
- Set tasks in the scripts section of package.json
+ set-script Set tasks in the scripts section of package.json
Usage:
npm set-script [<script>] [<command>]
@@ -950,18 +848,14 @@ All commands:
Run "npm help set-script" for more info
- shrinkwrap npm shrinkwrap
-
- Lock down dependency versions for publication
+ shrinkwrap Lock down dependency versions for publication
Usage:
npm shrinkwrap
Run "npm help shrinkwrap" for more info
- star npm star
-
- Mark your favorite packages
+ star Mark your favorite packages
Usage:
npm star [<pkg>...]
@@ -971,9 +865,7 @@ All commands:
Run "npm help star" for more info
- stars npm stars
-
- View packages marked as favorites
+ stars View packages marked as favorites
Usage:
npm stars [<user>]
@@ -983,9 +875,7 @@ All commands:
Run "npm help stars" for more info
- start npm start
-
- Start a package
+ start Start a package
Usage:
npm start [-- <args>]
@@ -995,9 +885,7 @@ All commands:
Run "npm help start" for more info
- stop npm stop
-
- Stop a package
+ stop Stop a package
Usage:
npm stop [-- <args>]
@@ -1007,9 +895,7 @@ All commands:
Run "npm help stop" for more info
- team npm team
-
- Manage organization teams and team memberships
+ team Manage organization teams and team memberships
Usage:
npm team create <scope:team> [--otp <otpcode>]
@@ -1023,9 +909,7 @@ All commands:
Run "npm help team" for more info
- test npm test
-
- Test a package
+ test Test a package
Usage:
npm test [-- <args>]
@@ -1037,9 +921,7 @@ All commands:
Run "npm help test" for more info
- token npm token
-
- Manage your authentication tokens
+ token Manage your authentication tokens
Usage:
npm token list
@@ -1052,9 +934,7 @@ All commands:
Run "npm help token" for more info
- uninstall npm uninstall
-
- Remove a package
+ uninstall Remove a package
Usage:
npm uninstall [<@scope>/]<pkg>...
@@ -1064,13 +944,11 @@ All commands:
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
- aliases: un, unlink, remove, rm, r
+ aliases: unlink, remove, rm, r, un
Run "npm help uninstall" for more info
- unpublish npm unpublish
-
- Remove a package from the registry
+ unpublish Remove a package from the registry
Usage:
npm unpublish [<@scope>/]<pkg>[@<version>]
@@ -1082,9 +960,7 @@ All commands:
Run "npm help unpublish" for more info
- unstar npm unstar
-
- Remove an item from your favorite packages
+ unstar Remove an item from your favorite packages
Usage:
npm unstar [<pkg>...]
@@ -1094,9 +970,7 @@ All commands:
Run "npm help unstar" for more info
- update npm update
-
- Update packages
+ update Update packages
Usage:
npm update [<pkg>...]
@@ -1114,9 +988,7 @@ All commands:
Run "npm help update" for more info
- version npm version
-
- Bump a package version
+ version Bump a package version
Usage:
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
@@ -1125,15 +997,13 @@ All commands:
[--allow-same-version] [--no-commit-hooks] [--no-git-tag-version] [--json]
[--preid prerelease-id] [--sign-git-tag]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
- [-ws|--workspaces] [--include-workspace-root]
+ [-ws|--workspaces] [--no-workspaces-update] [--include-workspace-root]
alias: verison
Run "npm help version" for more info
- view npm view
-
- View registry info
+ view View registry info
Usage:
npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]
@@ -1142,13 +1012,11 @@ All commands:
[--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root]
- aliases: v, info, show
+ aliases: info, show, v
Run "npm help view" for more info
- whoami npm whoami
-
- Display npm username
+ whoami Display npm username
Usage:
npm whoami
diff --git a/deps/npm/test/coverage-map.js b/deps/npm/test/coverage-map.js
index b29fcd86185..0ea90981860 100644
--- a/deps/npm/test/coverage-map.js
+++ b/deps/npm/test/coverage-map.js
@@ -1,17 +1,22 @@
-const full = process.env.npm_lifecycle_event === 'check-coverage'
const coverageMap = (filename) => {
- if (full && /load-all.js$/.test(filename)) {
- const glob = require('glob')
- const { resolve, relative } = require('path')
- const dir = resolve(__dirname, '../lib')
- return glob.sync(`${dir}/**/*.js`)
- .map(f => relative(process.cwd(), f))
+ const { basename } = require('path')
+ const testbase = basename(filename)
+ if (filename === 'test/index.js') {
+ return ['index.js']
}
- if (/windows-shims\.js$/.test(filename)) {
- // this one doesn't provide any coverage nyc can track
- return []
+ if (testbase === 'load-all-commands.js') {
+ const { cmdList } = require('../lib/utils/cmd-list.js')
+ return cmdList.map(cmd => `lib/${cmd}.js`)
+ .concat('lib/base-command.js')
}
- if (/^test\/(lib\/|bin\/|index\.js$)/.test(filename)) {
+ if (/^test\/lib\/commands/.test(filename) || filename === 'test/lib/npm.js') {
+ return [
+ filename.replace(/^test\//, ''),
+ 'lib/base-command.js',
+ 'lib/exec/get-workspace-location-msg.js',
+ ]
+ }
+ if (/^test\/(lib|bin)\//.test(filename)) {
return filename.replace(/^test\//, '')
}
return []
diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js
index ea608d66444..13f8a0ea01c 100644
--- a/deps/npm/test/fixtures/mock-npm.js
+++ b/deps/npm/test/fixtures/mock-npm.js
@@ -4,15 +4,18 @@ const path = require('path')
const mockLogs = require('./mock-logs')
const mockGlobals = require('./mock-globals')
const log = require('../../lib/utils/log-shim')
+const envConfigKeys = Object.keys(require('../../lib/utils/config/definitions.js'))
const RealMockNpm = (t, otherMocks = {}) => {
const mock = {
...mockLogs(otherMocks),
outputs: [],
+ outputErrors: [],
joinedOutput: () => mock.outputs.map(o => o.join(' ')).join('\n'),
}
const Npm = t.mock('../../lib/npm.js', {
+ '../../lib/utils/update-notifier.js': async () => {},
...otherMocks,
...mock.logMocks,
})
@@ -23,9 +26,17 @@ const RealMockNpm = (t, otherMocks = {}) => {
super.output(...args)
}
+ originalOutputError (...args) {
+ super.outputError(...args)
+ }
+
output (...args) {
mock.outputs.push(args)
}
+
+ outputError (...args) {
+ mock.outputErrors.push(args)
+ }
}
return mock
@@ -88,19 +99,30 @@ const LoadMockNpm = async (t, {
// XXX: remove this for a solution where cache argv is passed in
mockGlobals(t, {
'process.env.npm_config_cache': cache,
+ ...(globals ? result(globals, { prefix, cache }) : {}),
+ // Some configs don't work because they can't be set via npm.config.set until
+ // config is loaded. But some config items are needed before that. So this is
+ // an explicit set of configs that must be loaded as env vars.
+ // XXX(npm9): make this possible by passing in argv directly to npm/config
+ ...Object.entries(config)
+ .filter(([k]) => envConfigKeys.includes(k))
+ .reduce((acc, [k, v]) => {
+ acc[`process.env.npm_config_${k.replace(/-/g, '_')}`] = v.toString()
+ return acc
+ }, {}),
})
- if (globals) {
- mockGlobals(t, result(globals, { prefix, cache }))
- }
-
const npm = init ? new Npm() : null
t.teardown(() => npm && npm.unload())
if (load) {
await npm.load()
for (const [k, v] of Object.entries(result(config, { npm, prefix, cache }))) {
- npm.config.set(k, v)
+ if (typeof v === 'object' && v.value && v.where) {
+ npm.config.set(k, v.value, v.where)
+ } else {
+ npm.config.set(k, v)
+ }
}
// Set global loglevel *again* since it possibly got reset during load
// XXX: remove with npmlog
@@ -115,6 +137,7 @@ const LoadMockNpm = async (t, {
Npm,
npm,
prefix,
+ globalPrefix,
testdir: dir,
cache,
debugFile: async () => {
diff --git a/deps/npm/test/fixtures/sandbox.js b/deps/npm/test/fixtures/sandbox.js
index d51281d41d1..7e57468e0c5 100644
--- a/deps/npm/test/fixtures/sandbox.js
+++ b/deps/npm/test/fixtures/sandbox.js
@@ -264,6 +264,7 @@ class Sandbox extends EventEmitter {
const mockedLogs = mockLogs(this[_mocks])
this[_logs] = mockedLogs.logs
const Npm = this[_test].mock('../../lib/npm.js', {
+ '../../lib/utils/update-notifier.js': async () => {},
...this[_mocks],
...mockedLogs.logMocks,
})
@@ -314,6 +315,7 @@ class Sandbox extends EventEmitter {
const mockedLogs = mockLogs(this[_mocks])
this[_logs] = mockedLogs.logs
const Npm = this[_test].mock('../../lib/npm.js', {
+ '../../lib/utils/update-notifier.js': async () => {},
...this[_mocks],
...mockedLogs.logMocks,
})
diff --git a/deps/npm/test/fixtures/tnock.js b/deps/npm/test/fixtures/tnock.js
index c5acec51054..8e236733fce 100644
--- a/deps/npm/test/fixtures/tnock.js
+++ b/deps/npm/test/fixtures/tnock.js
@@ -2,13 +2,15 @@
const nock = require('nock')
-// TODO (other tests actually make network calls today, which is bad)
-// nock.disableNetConnect()
+// Uncomment this to find requests that aren't matching
+// nock.emitter.on('no match', req => console.log(req.options))
module.exports = tnock
-function tnock (t, host) {
- const server = nock(host)
+function tnock (t, host, opts) {
+ nock.disableNetConnect()
+ const server = nock(host, opts)
t.teardown(function () {
+ nock.enableNetConnect()
server.done()
})
return server
diff --git a/deps/npm/test/fixtures/tspawk.js b/deps/npm/test/fixtures/tspawk.js
new file mode 100644
index 00000000000..554a9d402c3
--- /dev/null
+++ b/deps/npm/test/fixtures/tspawk.js
@@ -0,0 +1,16 @@
+'use strict'
+
+const spawk = require('spawk')
+
+module.exports = tspawk
+
+function tspawk (t) {
+ spawk.preventUnmatched()
+ t.teardown(function () {
+ spawk.unload()
+ })
+ t.afterEach(function () {
+ spawk.done()
+ })
+ return spawk
+}
diff --git a/deps/npm/test/lib/cli.js b/deps/npm/test/lib/cli.js
index f02c57d8cf7..d36048cd918 100644
--- a/deps/npm/test/lib/cli.js
+++ b/deps/npm/test/lib/cli.js
@@ -1,9 +1,8 @@
const t = require('tap')
-const mockGlobals = require('../fixtures/mock-globals.js')
const { load: loadMockNpm } = require('../fixtures/mock-npm.js')
-const cliMock = async (t, mocks) => {
+const cliMock = async (t, opts) => {
let exitHandlerArgs = null
let npm = null
const exitHandlerMock = (...args) => {
@@ -12,14 +11,9 @@ const cliMock = async (t, mocks) => {
}
exitHandlerMock.setNpm = _npm => npm = _npm
- const { Npm, outputs, logMocks, logs } = await loadMockNpm(t, { mocks, init: false })
+ const { Npm, outputs, logMocks, logs } = await loadMockNpm(t, { ...opts, init: false })
const cli = t.mock('../../lib/cli.js', {
'../../lib/npm.js': Npm,
- '../../lib/utils/update-notifier.js': async () => null,
- '../../lib/utils/unsupported.js': {
- checkForBrokenNode: () => {},
- checkForUnsupportedNode: () => {},
- },
'../../lib/utils/exit-handler.js': exitHandlerMock,
...logMocks,
})
@@ -31,6 +25,7 @@ const cliMock = async (t, mocks) => {
exitHandlerCalled: () => exitHandlerArgs,
exitHandlerNpm: () => npm,
logs,
+ logsBy: (title) => logs.verbose.filter(([p]) => p === title).map(([p, ...rest]) => rest),
}
}
@@ -39,17 +34,15 @@ t.afterEach(() => {
})
t.test('print the version, and treat npm_g as npm -g', async t => {
- mockGlobals(t, {
- 'process.argv': ['node', 'npm_g', '-v'],
+ const { logsBy, logs, cli, Npm, outputs, exitHandlerCalled } = await cliMock(t, {
+ globals: { 'process.argv': ['node', 'npm_g', '-v'] },
})
-
- const { logs, cli, Npm, outputs, exitHandlerCalled } = await cliMock(t)
await cli(process)
t.strictSame(process.argv, ['node', 'npm', '-g', '-v'], 'system process.argv was rewritten')
- t.strictSame(logs.verbose.filter(([p]) => p !== 'logfile'), [
- ['cli', process.argv],
- ])
+ t.strictSame(logsBy('cli'), [['node npm']])
+ t.strictSame(logsBy('title'), [['npm']])
+ t.strictSame(logsBy('argv'), [['"--global" "--version"']])
t.strictSame(logs.info, [
['using', 'npm@%s', Npm.version],
['using', 'node@%s', process.version],
@@ -59,68 +52,82 @@ t.test('print the version, and treat npm_g as npm -g', async t => {
})
t.test('calling with --versions calls npm version with no args', async t => {
- t.plan(6)
- mockGlobals(t, {
- 'process.argv': ['node', 'npm', 'install', 'or', 'whatever', '--versions'],
- })
- const { logs, cli, Npm, outputs, exitHandlerCalled } = await cliMock(t, {
- '../../lib/commands/version.js': class Version {
- async exec (args) {
- t.strictSame(args, [])
- }
+ const { logsBy, cli, outputs, exitHandlerCalled } = await cliMock(t, {
+ mocks: {
+ '../../lib/commands/version.js': class Version {
+ async exec (args) {
+ t.strictSame(args, [])
+ }
+ },
+ },
+ globals: {
+ 'process.argv': ['node', 'npm', 'install', 'or', 'whatever', '--versions'],
},
})
-
await cli(process)
- t.equal(process.title, 'npm install or whatever')
- t.strictSame(logs.verbose.filter(([p]) => p !== 'logfile'), [
- ['cli', process.argv],
- ])
- t.strictSame(logs.info, [
- ['using', 'npm@%s', Npm.version],
- ['using', 'node@%s', process.version],
- ])
+ t.equal(process.title, 'npm install or whatever')
+ t.strictSame(logsBy('cli'), [['node npm']])
+ t.strictSame(logsBy('title'), [['npm install or whatever']])
+ t.strictSame(logsBy('argv'), [['"install" "or" "whatever" "--versions"']])
t.strictSame(outputs, [])
t.strictSame(exitHandlerCalled(), [])
})
t.test('logged argv is sanitized', async t => {
- mockGlobals(t, {
- 'process.argv': [
- 'node',
- 'npm',
- 'version',
- 'https://username:password@npmjs.org/test_url_with_a_password',
- ],
- })
- const { logs, cli, Npm } = await cliMock(t, {
- '../../lib/commands/version.js': class Version {
- async exec (args) {}
+ const { logsBy, cli } = await cliMock(t, {
+ mocks: {
+ '../../lib/commands/version.js': class Version {
+ async exec () {}
+ },
+ },
+ globals: {
+ 'process.argv': [
+ 'node',
+ 'npm',
+ 'version',
+ '--registry',
+ 'https://u:password@npmjs.org/password',
+ ],
},
})
await cli(process)
- t.ok(process.title.startsWith('npm version https://username:***@npmjs.org'))
- t.strictSame(logs.verbose.filter(([p]) => p !== 'logfile'), [
- [
- 'cli',
- ['node', 'npm', 'version', 'https://username:***@npmjs.org/test_url_with_a_password'],
- ],
- ])
- t.strictSame(logs.info, [
- ['using', 'npm@%s', Npm.version],
- ['using', 'node@%s', process.version],
- ])
+ t.equal(process.title, 'npm version')
+ t.strictSame(logsBy('cli'), [['node npm']])
+ t.strictSame(logsBy('title'), [['npm version']])
+ t.strictSame(logsBy('argv'), [['"version" "--registry" "https://u:***@npmjs.org/password"']])
})
-t.test('print usage if no params provided', async t => {
- mockGlobals(t, {
- 'process.argv': ['node', 'npm'],
+t.test('logged argv is sanitized with equals', async t => {
+ const { logsBy, cli } = await cliMock(t, {
+ mocks: {
+ '../../lib/commands/version.js': class Version {
+ async exec () {}
+ },
+ },
+ globals: {
+ 'process.argv': [
+ 'node',
+ 'npm',
+ 'version',
+ '--registry=https://u:password@npmjs.org',
+ ],
+ },
})
+ await cli(process)
- const { cli, outputs, exitHandlerCalled, exitHandlerNpm } = await cliMock(t)
+ t.strictSame(logsBy('argv'), [['"version" "--registry" "https://u:***@npmjs.org"']])
+})
+
+t.test('print usage if no params provided', async t => {
+ const { cli, outputs, exitHandlerCalled, exitHandlerNpm } = await cliMock(t, {
+ globals: {
+ 'process.argv': ['node', 'npm'],
+ },
+ })
await cli(process)
+
t.match(outputs[0][0], 'Usage:', 'outputs npm usage')
t.match(exitHandlerCalled(), [], 'should call exitHandler with no args')
t.ok(exitHandlerNpm(), 'exitHandler npm is set')
@@ -128,12 +135,13 @@ t.test('print usage if no params provided', async t => {
})
t.test('print usage if non-command param provided', async t => {
- mockGlobals(t, {
- 'process.argv': ['node', 'npm', 'tset'],
+ const { cli, outputs, exitHandlerCalled, exitHandlerNpm } = await cliMock(t, {
+ globals: {
+ 'process.argv': ['node', 'npm', 'tset'],
+ },
})
-
- const { cli, outputs, exitHandlerCalled, exitHandlerNpm } = await cliMock(t)
await cli(process)
+
t.match(outputs[0][0], 'Unknown command: "tset"')
t.match(outputs[0][0], 'Did you mean this?')
t.match(exitHandlerCalled(), [], 'should call exitHandler with no args')
@@ -142,23 +150,59 @@ t.test('print usage if non-command param provided', async t => {
})
t.test('load error calls error handler', async t => {
- mockGlobals(t, {
- 'process.argv': ['node', 'npm', 'asdf'],
- })
-
const err = new Error('test load error')
const { cli, exitHandlerCalled } = await cliMock(t, {
- '../../lib/utils/config/index.js': {
- definitions: null,
- flatten: null,
- shorthands: null,
+ mocks: {
+ '../../lib/utils/config/index.js': {
+ definitions: null,
+ flatten: null,
+ shorthands: null,
+ },
+ '@npmcli/config': class BadConfig {
+ async load () {
+ throw err
+ }
+ },
},
- '@npmcli/config': class BadConfig {
- async load () {
- throw err
- }
+ globals: {
+ 'process.argv': ['node', 'npm', 'asdf'],
},
})
await cli(process)
t.strictSame(exitHandlerCalled(), [err])
})
+
+t.test('known broken node version', async t => {
+ const errors = []
+ let exitCode
+ const { cli } = await cliMock(t, {
+ globals: {
+ 'console.error': (msg) => errors.push(msg),
+ 'process.version': '6.0.0',
+ 'process.exit': e => exitCode = e,
+ },
+ })
+ await cli(process)
+ t.match(errors, [
+ 'ERROR: npm is known not to run on Node.js 6.0.0',
+ 'You\'ll need to upgrade to a newer Node.js version in order to use this',
+ 'version of npm. You can find the latest version at https://nodejs.org/',
+ ])
+ t.match(exitCode, 1)
+})
+
+t.test('unsupported node version', async t => {
+ const errors = []
+ const { cli } = await cliMock(t, {
+ globals: {
+ 'console.error': (msg) => errors.push(msg),
+ 'process.version': '12.6.0',
+ },
+ })
+ await cli(process)
+ t.match(errors, [
+ 'npm does not support Node.js 12.6.0',
+ 'You should probably upgrade to a newer version of node as we',
+ 'can\'t make any promises that npm will work with this version.',
+ ])
+})
diff --git a/deps/npm/test/lib/commands/access.js b/deps/npm/test/lib/commands/access.js
index 81e29146b61..f89b53e9690 100644
--- a/deps/npm/test/lib/commands/access.js
+++ b/deps/npm/test/lib/commands/access.js
@@ -45,7 +45,7 @@ t.test('unrecognized subcommand', async t => {
const { npm } = await loadMockNpm(t)
await t.rejects(
npm.exec('access', ['blerg']),
- /Usage: blerg is not a recognized subcommand/,
+ /blerg is not a recognized subcommand/,
'should throw EUSAGE on missing subcommand'
)
})
@@ -69,7 +69,7 @@ t.test('access public on unscoped package', async t => {
})
await t.rejects(
npm.exec('access', ['public']),
- /Usage: This command is only available for scoped packages/,
+ /This command is only available for scoped packages/,
'should throw scoped-restricted error'
)
})
@@ -131,7 +131,7 @@ t.test('access restricted on unscoped package', async t => {
})
await t.rejects(
npm.exec('access', ['public']),
- /Usage: This command is only available for scoped packages/,
+ /This command is only available for scoped packages/,
'should throw scoped-restricted error'
)
})
@@ -262,7 +262,7 @@ t.test('access grant others', async t => {
'myorg:myteam',
'@scoped/another',
]),
- /Usage: First argument must be either `read-only` or `read-write`./,
+ /First argument must be either `read-only` or `read-write`./,
'should throw unrecognized argument error'
)
})
@@ -276,7 +276,7 @@ t.test('access grant missing team args', async t => {
undefined,
'@scoped/another',
]),
- /Usage: `<scope:team>` argument is required./,
+ /`<scope:team>` argument is required./,
'should throw missing argument error'
)
})
@@ -290,7 +290,7 @@ t.test('access grant malformed team arg', async t => {
'foo',
'@scoped/another',
]),
- /Usage: Second argument used incorrect format.\n/,
+ /Second argument used incorrect format.\n/,
'should throw malformed arg error'
)
})
@@ -343,7 +343,7 @@ t.test('access revoke missing team args', async t => {
undefined,
'@scoped/another',
]),
- /Usage: `<scope:team>` argument is required./,
+ /`<scope:team>` argument is required./,
'should throw missing argument error'
)
})
@@ -356,7 +356,7 @@ t.test('access revoke malformed team arg', async t => {
'foo',
'@scoped/another',
]),
- /Usage: First argument used incorrect format.\n/,
+ /First argument used incorrect format.\n/,
'should throw malformed arg error'
)
})
diff --git a/deps/npm/test/lib/commands/bin.js b/deps/npm/test/lib/commands/bin.js
index 4de5a923b3e..46170e765de 100644
--- a/deps/npm/test/lib/commands/bin.js
+++ b/deps/npm/test/lib/commands/bin.js
@@ -1,76 +1,32 @@
const t = require('tap')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
-
-t.test('bin', async t => {
- t.plan(2)
- const dir = '/bin/dir'
-
- const Bin = require('../../../lib/commands/bin.js')
-
- const npm = mockNpm({
- bin: dir,
- config: { global: false },
- output: (output) => {
- t.equal(output, dir, 'prints the correct directory')
- },
- })
- const bin = new Bin(npm)
- t.match(bin.usage, 'bin', 'usage has command name in it')
-
- await bin.exec([])
+const { load: loadMockNpm } = require('../../fixtures/mock-npm')
+const mockGlobals = require('../../fixtures/mock-globals')
+
+t.test('bin not global', async t => {
+ const { npm, joinedOutput, logs } = await loadMockNpm(t)
+ await npm.exec('bin', [])
+ t.match(joinedOutput(), npm.localBin)
+ t.match(logs.error, [])
})
-t.test('bin -g', async t => {
- t.plan(1)
- const consoleError = console.error
- t.teardown(() => {
- console.error = consoleError
- })
-
- console.error = (output) => {
- t.fail('should not have printed to console.error')
- }
- const dir = '/bin/dir'
-
- const Bin = t.mock('../../../lib/commands/bin.js', {
- '../../../lib/utils/path.js': [dir],
- })
-
- const npm = mockNpm({
- bin: dir,
+t.test('bin global in env.path', async t => {
+ const { npm, joinedOutput, logs } = await loadMockNpm(t, {
config: { global: true },
- output: (output) => {
- t.equal(output, dir, 'prints the correct directory')
- },
})
- const bin = new Bin(npm)
-
- await bin.exec([])
-})
-t.test('bin -g (not in path)', async t => {
- t.plan(2)
- const consoleError = console.error
- t.teardown(() => {
- console.error = consoleError
+ mockGlobals(t, {
+ 'process.env': { path: npm.globalBin },
})
+ await npm.exec('bin', [])
+ t.match(joinedOutput(), npm.globalBin)
+ t.match(logs.error, [])
+})
- console.error = (output) => {
- t.equal(output, '(not in PATH env variable)', 'prints env warning')
- }
- const dir = '/bin/dir'
-
- const Bin = t.mock('../../../lib/commands/bin.js', {
- '../../../lib/utils/path.js': ['/not/my/dir'],
- })
- const npm = mockNpm({
- bin: dir,
+t.test('bin not in path', async t => {
+ const { npm, joinedOutput, logs } = await loadMockNpm(t, {
config: { global: true },
- output: (output) => {
- t.equal(output, dir, 'prints the correct directory')
- },
})
- const bin = new Bin(npm)
-
- await bin.exec([])
+ await npm.exec('bin', [])
+ t.match(joinedOutput(), npm.globalBin)
+ t.match(logs.error, [['bin', '(not in PATH env variable)']])
})
diff --git a/deps/npm/test/lib/commands/cache.js b/deps/npm/test/lib/commands/cache.js
index fc92facff71..60231276910 100644
--- a/deps/npm/test/lib/commands/cache.js
+++ b/deps/npm/test/lib/commands/cache.js
@@ -196,7 +196,7 @@ t.test('cache add no arg', async t => {
cache.exec(['add']),
{
code: 'EUSAGE',
- message: 'Usage: First argument to `add` is required',
+ message: 'First argument to `add` is required',
},
'throws usage error'
)
diff --git a/deps/npm/test/lib/commands/completion.js b/deps/npm/test/lib/commands/completion.js
index 045054b74ec..d4e6f1199c4 100644
--- a/deps/npm/test/lib/commands/completion.js
+++ b/deps/npm/test/lib/commands/completion.js
@@ -17,7 +17,7 @@ const loadMockCompletion = async (t, o = {}) => {
}
const res = await _loadMockNpm(t, {
mocks: {
- '../../lib/utils/is-windows-shell.js': !!windows,
+ '../../lib/utils/is-windows.js': { isWindowsShell: !!windows },
...options.mocks,
},
...options,
diff --git a/deps/npm/test/lib/commands/config.js b/deps/npm/test/lib/commands/config.js
index 8217131479f..42df8b52d8e 100644
--- a/deps/npm/test/lib/commands/config.js
+++ b/deps/npm/test/lib/commands/config.js
@@ -1,10 +1,10 @@
const { join } = require('path')
const { promisify } = require('util')
const fs = require('fs')
-const spawk = require('spawk')
+const tspawk = require('../../fixtures/tspawk')
const t = require('tap')
-spawk.preventUnmatched()
+const spawk = tspawk(t)
const readFile = promisify(fs.readFile)
@@ -369,10 +369,6 @@ t.test('config edit', async t => {
'.npmrc': 'foo=bar\nbar=baz',
})
- t.teardown(() => {
- spawk.clean()
- })
-
const EDITOR = 'vim'
const editor = spawk.spawn(EDITOR).exit(0)
@@ -394,10 +390,6 @@ t.test('config edit', async t => {
})
t.test('config edit - editor exits non-0', async t => {
- t.teardown(() => {
- spawk.clean()
- })
-
const EDITOR = 'vim'
const editor = spawk.spawn(EDITOR).exit(1)
diff --git a/deps/npm/test/lib/commands/diff.js b/deps/npm/test/lib/commands/diff.js
index ed0702e3784..c2b1a935da8 100644
--- a/deps/npm/test/lib/commands/diff.js
+++ b/deps/npm/test/lib/commands/diff.js
@@ -34,7 +34,6 @@ const mocks = {
'proc-log': { info: noop, verbose: noop },
libnpmdiff: (...args) => libnpmdiff(...args),
'npm-registry-fetch': async () => ({}),
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
t.afterEach(() => {
diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js
index 5badab99a1d..620d908d303 100644
--- a/deps/npm/test/lib/commands/doctor.js
+++ b/deps/npm/test/lib/commands/doctor.js
@@ -52,17 +52,7 @@ const dirs = {
},
}
-let consoleError = false
-t.afterEach(() => {
- consoleError = false
-})
-
const globals = {
- console: {
- error: () => {
- consoleError = true
- },
- },
process: {
platform: 'test-not-windows',
version: 'v1.0.0',
@@ -104,7 +94,6 @@ t.test('all clear', async t => {
.get('/dist/index.json').reply(200, nodeVersions)
await npm.exec('doctor', [])
t.matchSnapshot(joinedOutput(), 'output')
- t.notOk(consoleError, 'console.error not called')
t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
@@ -122,7 +111,6 @@ t.test('all clear in color', async t => {
npm.config.set('color', 'always')
await npm.exec('doctor', [])
t.matchSnapshot(joinedOutput(), 'everything is ok in color')
- t.notOk(consoleError, 'console.error not called')
t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
@@ -142,7 +130,6 @@ t.test('silent', async t => {
.get('/dist/index.json').reply(200, nodeVersions)
await npm.exec('doctor', [])
t.matchSnapshot(joinedOutput(), 'output')
- t.notOk(consoleError, 'console.error not called')
t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
@@ -159,7 +146,6 @@ t.test('ping 404', async t => {
.get('/dist/index.json').reply(200, nodeVersions)
await t.rejects(npm.exec('doctor', []))
t.matchSnapshot(joinedOutput(), 'ping 404')
- t.ok(consoleError, 'console.error called')
t.matchSnapshot({ info: logs.info, warn: logs.warn, error: logs.error }, 'logs')
})
diff --git a/deps/npm/test/lib/commands/edit.js b/deps/npm/test/lib/commands/edit.js
index 92754f28232..1943e8c5fb4 100644
--- a/deps/npm/test/lib/commands/edit.js
+++ b/deps/npm/test/lib/commands/edit.js
@@ -1,138 +1,137 @@
const t = require('tap')
-const { resolve } = require('path')
-const { EventEmitter } = require('events')
+const path = require('path')
+const tspawk = require('../../fixtures/tspawk')
+const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-let editorBin = null
-let editorArgs = null
-let editorOpts = null
-let EDITOR_CODE = 0
-const childProcess = {
- spawn: (bin, args, opts) => {
- // save for assertions
- editorBin = bin
- editorArgs = args
- editorOpts = opts
+const spawk = tspawk(t)
- const editorEvents = new EventEmitter()
- process.nextTick(() => {
- editorEvents.emit('exit', EDITOR_CODE)
- })
- return editorEvents
- },
-}
+// TODO this ... smells. npm "script-shell" config mentions defaults but those
+// are handled by run-script, not npm. So for now we have to tie tests to some
+// pretty specific internals of runScript
+const makeSpawnArgs = require('@npmcli/run-script/lib/make-spawn-args.js')
-let rebuildArgs = null
-let rebuildFail = null
-let EDITOR = 'vim'
-const npm = {
+const npmConfig = {
config: {
- get: () => EDITOR,
+ 'ignore-scripts': false,
+ editor: 'testeditor',
},
- dir: resolve(__dirname, '../../../node_modules'),
- exec: async (cmd, args) => {
- rebuildArgs = args
- if (rebuildFail) {
- throw rebuildFail
- }
+ prefixDir: {
+ node_modules: {
+ semver: {
+ 'package.json': JSON.stringify({
+ scripts: {
+ install: 'testinstall',
+ },
+ }),
+ node_modules: {
+ abbrev: {},
+ },
+ },
+ '@npmcli': {
+ 'scoped-package': {},
+ },
+ },
},
}
-const gracefulFs = require('graceful-fs')
-const Edit = t.mock('../../../lib/commands/edit.js', {
- child_process: childProcess,
- 'graceful-fs': gracefulFs,
-})
-const edit = new Edit(npm)
-
t.test('npm edit', async t => {
- t.teardown(() => {
- rebuildArgs = null
- editorBin = null
- editorArgs = null
- editorOpts = null
- })
+ const { npm, joinedOutput } = await loadMockNpm(t, npmConfig)
- await edit.exec(['semver'])
- const path = resolve(__dirname, '../../../node_modules/semver')
- t.strictSame(editorBin, EDITOR, 'used the correct editor')
- t.strictSame(editorArgs, [path], 'edited the correct directory')
- t.strictSame(editorOpts, { stdio: 'inherit' }, 'passed the correct opts')
- t.strictSame(rebuildArgs, [path], 'passed the correct path to rebuild')
+ const semverPath = path.resolve(npm.prefix, 'node_modules', 'semver')
+ const [scriptShell] = makeSpawnArgs({
+ event: 'install',
+ path: npm.prefix,
+ })
+ spawk.spawn('testeditor', [semverPath])
+ spawk.spawn(
+ scriptShell,
+ args => args.includes('testinstall'),
+ { cwd: semverPath }
+ )
+ await npm.exec('edit', ['semver'])
+ t.match(joinedOutput(), 'rebuilt dependencies successfully')
})
-t.test('rebuild fails', async t => {
- t.teardown(() => {
- rebuildFail = null
- rebuildArgs = null
- editorBin = null
- editorArgs = null
- editorOpts = null
+t.test('rebuild failure', async t => {
+ const { npm } = await loadMockNpm(t, npmConfig)
+ const semverPath = path.resolve(npm.prefix, 'node_modules', 'semver')
+ const [scriptShell] = makeSpawnArgs({
+ event: 'install',
+ path: npm.prefix,
})
+ spawk.spawn('testeditor', [semverPath])
+ spawk.spawn(
+ scriptShell,
+ args => args.includes('testinstall'),
+ { cwd: semverPath }
+ ).exit(1).stdout('test error')
+ await t.rejects(
+ npm.exec('edit', ['semver']),
+ { message: 'command failed' }
+ )
+})
- rebuildFail = new Error('test error')
+t.test('editor failure', async t => {
+ const { npm } = await loadMockNpm(t, npmConfig)
+ const semverPath = path.resolve(npm.prefix, 'node_modules', 'semver')
+ spawk.spawn('testeditor', [semverPath]).exit(1).stdout('test editor failure')
await t.rejects(
- edit.exec(['semver']),
- { message: 'test error' }
+ npm.exec('edit', ['semver']),
+ { message: 'editor process exited with code: 1' }
)
- const path = resolve(__dirname, '../../../node_modules/semver')
- t.strictSame(editorBin, EDITOR, 'used the correct editor')
- t.strictSame(editorArgs, [path], 'edited the correct directory')
- t.strictSame(editorOpts, { stdio: 'inherit' }, 'passed the correct opts')
- t.strictSame(rebuildArgs, [path], 'passed the correct path to rebuild')
})
t.test('npm edit editor has flags', async t => {
- EDITOR = 'code -w'
- t.teardown(() => {
- rebuildArgs = null
- editorBin = null
- editorArgs = null
- editorOpts = null
- EDITOR = 'vim'
+ const { npm } = await loadMockNpm(t, {
+ ...npmConfig,
+ config: {
+ ...npmConfig.config,
+ editor: 'testeditor --flag',
+ },
})
- await edit.exec(['semver'])
-
- const path = resolve(__dirname, '../../../node_modules/semver')
- t.strictSame(editorBin, 'code', 'used the correct editor')
- t.strictSame(editorArgs, ['-w', path], 'edited the correct directory, keeping flags')
- t.strictSame(editorOpts, { stdio: 'inherit' }, 'passed the correct opts')
- t.strictSame(rebuildArgs, [path], 'passed the correct path to rebuild')
+ const semverPath = path.resolve(npm.prefix, 'node_modules', 'semver')
+ const [scriptShell] = makeSpawnArgs({
+ event: 'install',
+ path: npm.prefix,
+ })
+ spawk.spawn('testeditor', ['--flag', semverPath])
+ spawk.spawn(
+ scriptShell,
+ args => args.includes('testinstall'),
+ { cwd: semverPath }
+ )
+ await npm.exec('edit', ['semver'])
})
t.test('npm edit no args', async t => {
+ const { npm } = await loadMockNpm(t)
await t.rejects(
- edit.exec([]),
- /npm edit/,
+ npm.exec('edit', []),
+ { code: 'EUSAGE' },
'throws usage error'
)
})
-t.test('npm edit lstat error propagates', async t => {
- const _lstat = gracefulFs.lstat
- gracefulFs.lstat = (dir, cb) => {
- return cb(new Error('lstat failed'))
- }
- t.teardown(() => {
- gracefulFs.lstat = _lstat
- })
+t.test('npm edit nonexistent package', async t => {
+ const { npm } = await loadMockNpm(t, npmConfig)
await t.rejects(
- edit.exec(['semver']),
- /lstat failed/,
- 'user received correct error'
+ npm.exec('edit', ['abbrev']),
+ /lstat/
)
})
-t.test('npm edit editor exit code error propagates', async t => {
- EDITOR_CODE = 137
- t.teardown(() => {
- EDITOR_CODE = 0
- })
+t.test('scoped package', async t => {
+ const { npm } = await loadMockNpm(t, npmConfig)
+ const scopedPath = path.resolve(npm.prefix, 'node_modules', '@npmcli', 'scoped-package')
+ spawk.spawn('testeditor', [scopedPath])
+ await npm.exec('edit', ['@npmcli/scoped-package'])
+})
- await t.rejects(
- edit.exec(['semver']),
- /exited with code: 137/,
- 'user received correct error'
- )
+t.test('subdependency', async t => {
+ const { npm } = await loadMockNpm(t, npmConfig)
+ const subdepPath = path.resolve(npm.prefix, 'node_modules', 'semver', 'node_modules', 'abbrev')
+ spawk.spawn('testeditor', [subdepPath])
+ await npm.exec('edit', ['semver/abbrev'])
})
diff --git a/deps/npm/test/lib/commands/exec.js b/deps/npm/test/lib/commands/exec.js
index 3c75c1d8d82..1f7230d25b6 100644
--- a/deps/npm/test/lib/commands/exec.js
+++ b/deps/npm/test/lib/commands/exec.js
@@ -72,8 +72,6 @@ const read = (options, cb) => {
process.nextTick(() => cb(READ_ERROR, READ_RESULT))
}
-const PATH = require('../../../lib/utils/path.js')
-
let CI_NAME = 'travis-ci'
const log = {
@@ -154,7 +152,7 @@ t.test('npx foo, bin already exists locally', async t => {
stdioString: true,
event: 'npx',
env: {
- PATH: [npm.localBin, ...PATH].join(delimiter),
+ PATH: [npm.localBin, process.env.PATH].join(delimiter),
},
stdio: 'inherit',
},
@@ -183,7 +181,7 @@ t.test('npx foo, bin already exists globally', async t => {
stdioString: true,
event: 'npx',
env: {
- PATH: [npm.globalBin, ...PATH].join(delimiter),
+ PATH: [npm.globalBin, process.env.PATH].join(delimiter),
},
stdio: 'inherit',
},
@@ -1175,7 +1173,7 @@ t.test('workspaces', t => {
stdioString: true,
event: 'npx',
env: {
- PATH: [npm.localBin, ...PATH].join(delimiter),
+ PATH: [npm.localBin, process.env.PATH].join(delimiter),
},
stdio: 'inherit',
},
diff --git a/deps/npm/test/lib/commands/explore.js b/deps/npm/test/lib/commands/explore.js
index d1355d76712..5bb211e4503 100644
--- a/deps/npm/test/lib/commands/explore.js
+++ b/deps/npm/test/lib/commands/explore.js
@@ -47,7 +47,6 @@ const output = []
const logs = []
const getExplore = (windows) => {
const Explore = t.mock('../../../lib/commands/explore.js', {
- '../../../lib/utils/is-windows.js': windows,
path: require('path')[windows ? 'win32' : 'posix'],
'read-package-json-fast': mockRPJ,
'@npmcli/run-script': mockRunScript,
diff --git a/deps/npm/test/lib/commands/help.js b/deps/npm/test/lib/commands/help.js
index b76234d9966..f84f94ad2f8 100644
--- a/deps/npm/test/lib/commands/help.js
+++ b/deps/npm/test/lib/commands/help.js
@@ -310,3 +310,41 @@ t.test('npm help with complex installation path finds proper help file', async t
t.match(openUrlArg, /commands(\/|\\)npm-install.html$/, 'attempts to open the correct url')
})
+
+t.test('npm help - prefers npm help pages', async t => {
+ // Unusual ordering is to get full test coverage of all branches inside the
+ // sort function.
+ globResult = [
+ '/root/man/man6/npm-install.6',
+ '/root/man/man1/install.1',
+ '/root/man/man5/npm-install.5',
+ ]
+ t.teardown(() => {
+ globResult = globDefaults
+ spawnBin = null
+ spawnArgs = null
+ })
+ await help.exec(['install'])
+
+ t.equal(spawnBin, 'man', 'calls man by default')
+ t.strictSame(spawnArgs, ['/root/man/man5/npm-install.5'], 'passes the correct arguments')
+})
+
+t.test('npm help - works in the presence of strange man pages', async t => {
+ // Unusual ordering is to get full test coverage of all branches inside the
+ // sort function.
+ globResult = [
+ '/root/man/man6/config.6strange',
+ '/root/man/man1/config.1',
+ '/root/man/man5/config.5ssl',
+ ]
+ t.teardown(() => {
+ globResult = globDefaults
+ spawnBin = null
+ spawnArgs = null
+ })
+ await help.exec(['config'])
+
+ t.equal(spawnBin, 'man', 'calls man by default')
+ t.strictSame(spawnArgs, ['/root/man/man1/config.1'], 'passes the correct arguments')
+})
diff --git a/deps/npm/test/lib/commands/init.js b/deps/npm/test/lib/commands/init.js
index 215ebc58118..82e7e0524ce 100644
--- a/deps/npm/test/lib/commands/init.js
+++ b/deps/npm/test/lib/commands/init.js
@@ -17,7 +17,6 @@ const npm = mockNpm({
config,
})
const mocks = {
- '../../../lib/utils/usage.js': () => 'usage instructions',
npmlog: {
disableProgress: () => null,
enableProgress: () => null,
diff --git a/deps/npm/test/lib/commands/owner.js b/deps/npm/test/lib/commands/owner.js
index b5d4d158428..83f4d880f74 100644
--- a/deps/npm/test/lib/commands/owner.js
+++ b/deps/npm/test/lib/commands/owner.js
@@ -26,7 +26,6 @@ const mocks = {
readPackageNamePrefix = prefix
return readPackageNameResponse
},
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
const npmcliMaintainers = [
diff --git a/deps/npm/test/lib/commands/profile.js b/deps/npm/test/lib/commands/profile.js
index 3d55a37ddb8..82ac4954209 100644
--- a/deps/npm/test/lib/commands/profile.js
+++ b/deps/npm/test/lib/commands/profile.js
@@ -45,7 +45,6 @@ const mocks = {
withPromise: async a => a,
},
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
- '../../../lib/utils/usage.js': () => 'usage instructions',
'../../../lib/utils/read-user-info.js': {
async password () {},
async otp () {},
diff --git a/deps/npm/test/lib/commands/restart.js b/deps/npm/test/lib/commands/restart.js
index 83773eae954..84bd93d8c99 100644
--- a/deps/npm/test/lib/commands/restart.js
+++ b/deps/npm/test/lib/commands/restart.js
@@ -1,11 +1,8 @@
const t = require('tap')
-const spawk = require('spawk')
+const tspawk = require('../../fixtures/tspawk')
const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-spawk.preventUnmatched()
-t.teardown(() => {
- spawk.unload()
-})
+const spawk = tspawk(t)
// TODO this ... smells. npm "script-shell" config mentions defaults but those
// are handled by run-script, not npm. So for now we have to tie tests to some
diff --git a/deps/npm/test/lib/commands/run-script.js b/deps/npm/test/lib/commands/run-script.js
index 834b61e7474..440c8dbad07 100644
--- a/deps/npm/test/lib/commands/run-script.js
+++ b/deps/npm/test/lib/commands/run-script.js
@@ -62,7 +62,7 @@ const getRS = windows => {
}
),
'proc-log': log,
- '../../../lib/utils/is-windows-shell.js': windows,
+ '../../../lib/utils/is-windows.js': { isWindowsShell: windows },
})
return new RunScript(npm)
}
@@ -859,7 +859,7 @@ t.test('workspaces', t => {
throw new Error('err')
},
'proc-log': log,
- '../../../lib/utils/is-windows-shell.js': false,
+ '../../../lib/utils/is-windows.js': { isWindowsShell: false },
})
const runScript = new RunScript(npm)
@@ -877,7 +877,7 @@ t.test('workspaces', t => {
RUN_SCRIPTS.push(opts)
},
'proc-log': log,
- '../../../lib/utils/is-windows-shell.js': false,
+ '../../../lib/utils/is-windows.js': { isWindowsShell: false },
})
const runScript = new RunScript(npm)
diff --git a/deps/npm/test/lib/commands/search.js b/deps/npm/test/lib/commands/search.js
index c8dbc1b3b79..d2462b1aed4 100644
--- a/deps/npm/test/lib/commands/search.js
+++ b/deps/npm/test/lib/commands/search.js
@@ -33,7 +33,6 @@ const libnpmsearch = {
const mocks = {
npmlog,
libnpmsearch,
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
t.afterEach(() => {
diff --git a/deps/npm/test/lib/commands/star.js b/deps/npm/test/lib/commands/star.js
index 4d19b32e1d2..5b79c077696 100644
--- a/deps/npm/test/lib/commands/star.js
+++ b/deps/npm/test/lib/commands/star.js
@@ -20,7 +20,6 @@ const mocks = {
'proc-log': log,
'npm-registry-fetch': npmFetch,
'../../../lib/utils/get-identity.js': async () => 'foo',
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
const Star = t.mock('../../../lib/commands/star.js', mocks)
@@ -36,8 +35,8 @@ t.afterEach(() => {
t.test('no args', async t => {
await t.rejects(
star.exec([]),
- /usage instructions/,
- 'should throw usage instructions'
+ { code: 'EUSAGE' },
+ 'should throw usage error'
)
})
diff --git a/deps/npm/test/lib/commands/stars.js b/deps/npm/test/lib/commands/stars.js
index 959739653da..094b530d8c6 100644
--- a/deps/npm/test/lib/commands/stars.js
+++ b/deps/npm/test/lib/commands/stars.js
@@ -16,7 +16,6 @@ const mocks = {
'proc-log': log,
'npm-registry-fetch': npmFetch,
'../../../lib/utils/get-identity.js': async () => 'foo',
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
const Stars = t.mock('../../../lib/commands/stars.js', mocks)
diff --git a/deps/npm/test/lib/commands/start.js b/deps/npm/test/lib/commands/start.js
index c9312c8e2ad..8fc73493d20 100644
--- a/deps/npm/test/lib/commands/start.js
+++ b/deps/npm/test/lib/commands/start.js
@@ -1,11 +1,8 @@
const t = require('tap')
-const spawk = require('spawk')
+const tspawk = require('../../fixtures/tspawk')
const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-spawk.preventUnmatched()
-t.teardown(() => {
- spawk.unload()
-})
+const spawk = tspawk(t)
// TODO this ... smells. npm "script-shell" config mentions defaults but those
// are handled by run-script, not npm. So for now we have to tie tests to some
diff --git a/deps/npm/test/lib/commands/stop.js b/deps/npm/test/lib/commands/stop.js
index f5db4a047d3..f2aef21899f 100644
--- a/deps/npm/test/lib/commands/stop.js
+++ b/deps/npm/test/lib/commands/stop.js
@@ -1,11 +1,8 @@
const t = require('tap')
-const spawk = require('spawk')
+const tspawk = require('../../fixtures/tspawk')
const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-spawk.preventUnmatched()
-t.teardown(() => {
- spawk.unload()
-})
+const spawk = tspawk(t)
// TODO this ... smells. npm "script-shell" config mentions defaults but those
// are handled by run-script, not npm. So for now we have to tie tests to some
diff --git a/deps/npm/test/lib/commands/team.js b/deps/npm/test/lib/commands/team.js
index 0d5378b5306..592dbc3a0ec 100644
--- a/deps/npm/test/lib/commands/team.js
+++ b/deps/npm/test/lib/commands/team.js
@@ -23,7 +23,6 @@ const mocks = {
libnpmteam,
'cli-columns': a => a.join(' '),
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
t.afterEach(() => {
diff --git a/deps/npm/test/lib/commands/test.js b/deps/npm/test/lib/commands/test.js
index 665df7148a0..e9ea0a3c834 100644
--- a/deps/npm/test/lib/commands/test.js
+++ b/deps/npm/test/lib/commands/test.js
@@ -1,11 +1,8 @@
const t = require('tap')
-const spawk = require('spawk')
+const tspawk = require('../../fixtures/tspawk')
const { load: loadMockNpm } = require('../../fixtures/mock-npm')
-spawk.preventUnmatched()
-t.teardown(() => {
- spawk.unload()
-})
+const spawk = tspawk(t)
// TODO this ... smells. npm "script-shell" config mentions defaults but those
// are handled by run-script, not npm. So for now we have to tie tests to some
diff --git a/deps/npm/test/lib/commands/unpublish.js b/deps/npm/test/lib/commands/unpublish.js
index b9c94e5d526..71be4a5d690 100644
--- a/deps/npm/test/lib/commands/unpublish.js
+++ b/deps/npm/test/lib/commands/unpublish.js
@@ -1,262 +1,219 @@
const t = require('tap')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
+const { load: loadMockNpm } = require('../../fixtures/mock-npm')
+const tnock = require('../../fixtures/tnock.js')
-let result = ''
-const noop = () => null
-const versions = async () => {
+const pkgManifest = (name, version = '1.0.0') => {
return {
+ _id: `${name}@${version}`,
+ _rev: '00-testdeadbeef',
+ name,
versions: {
- '1.0.0': {},
- '1.0.1': {},
+ '1.0.0': {
+ name,
+ version: '1.0.0',
+ dist: {
+ tarball: `https://registry.npmjs.org/${name}/-/${name}-1.0.0.tgz`,
+ },
+ },
+ [version]: {
+ name,
+ version: version,
+ dist: {
+ tarball: `https://registry.npmjs.org/${name}/-/${name}-${version}.tgz`,
+ },
+ },
},
- }
-}
-
-const singleVersion = async () => {
- return {
- versions: {
- '1.0.0': {},
+ time: {
+ '1.0.0': new Date(),
+ [version]: new Date(),
},
+ 'dist-tags': { latest: version },
}
}
-const config = {
- force: false,
-}
-
-const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'pkg',
- version: '1.0.0',
- }, null, 2),
-})
-
-const npm = mockNpm({
- localPrefix: testDir,
- config,
- output: (...msg) => {
- result += msg.join('\n')
- },
-})
-
-const mocks = {
- libnpmaccess: { lsPackages: noop },
- libnpmpublish: { unpublish: noop },
- 'npm-registry-fetch': { json: versions },
- '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
- '../../../lib/utils/get-identity.js': async () => 'foo',
- 'proc-log': { silly () {}, verbose () {} },
-}
-
-t.afterEach(() => {
- npm.localPrefix = testDir
- result = ''
- config['dry-run'] = false
- config.force = false
- npm.config.set('loglevel', 'info')
-})
+const user = 'test-user'
+const pkg = 'test-package'
+const auth = { '//registry.npmjs.org/:_authToken': 'test-auth-token' }
-t.test('no args --force', async t => {
- config.force = true
-
- const log = {
- silly (title) {
- t.equal(title, 'unpublish', 'should silly log args')
- },
- verbose (title, msg) {
- t.equal(title, 'unpublish', 'should have expected title')
- t.match(
- msg,
- { name: 'pkg', version: '1.0.0' },
- 'should have msg printing package.json contents'
- )
+t.test('no args --force success', async t => {
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ ...auth,
},
- }
-
- const libnpmpublish = {
- unpublish (spec, opts) {
- t.equal(spec.raw, 'pkg@1.0.0', 'should unpublish expected spec')
- t.match(
- opts,
- {
- publishConfig: undefined,
- },
- 'should unpublish with expected opts'
- )
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ version: '1.0.0',
+ }, null, 2),
},
- }
-
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmpublish,
- 'proc-log': log,
})
- const unpublish = new Unpublish(npm)
-
- await unpublish.exec([])
+ const manifest = pkgManifest(pkg)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
+ .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201)
- t.equal(
- result,
- '- pkg@1.0.0',
- 'should output removed pkg@version on success'
- )
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- test-package@1.0.0')
})
t.test('no args --force missing package.json', async t => {
- config.force = true
-
- const testDir = t.testdir({})
- npm.localPrefix = testDir
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ },
})
- const unpublish = new Unpublish(npm)
await t.rejects(
- unpublish.exec([]),
- /Usage: npm unpublish/,
+ npm.exec('unpublish', []),
+ { code: 'EUSAGE' },
'should throw usage instructions on missing package.json'
)
})
-t.test('no args --force unknown error reading package.json', async t => {
- config.force = true
-
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- 'read-package-json': (path, cb) => cb(new Error('ERR')),
+t.test('no args --force error reading package.json', async t => {
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ },
+ prefixDir: {
+ 'package.json': '{ not valid json ]',
+ },
})
- const unpublish = new Unpublish(npm)
await t.rejects(
- unpublish.exec([]),
- /ERR/,
- 'should throw unknown error from reading package.json'
+ npm.exec('unpublish', []),
+ /Failed to parse json/,
+ 'should throw error from reading package.json'
)
})
-t.test('no args', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- })
- const unpublish = new Unpublish(npm)
+t.test('no args entire project', async t => {
+ const { npm } = await loadMockNpm(t)
await t.rejects(
- unpublish.exec([]),
- /Refusing to delete entire project/,
- 'should throw --force required error on no args'
+ npm.exec('unpublish', []),
+ /Refusing to delete entire project/
)
})
t.test('too many args', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- })
- const unpublish = new Unpublish(npm)
+ const { npm } = await loadMockNpm(t)
await t.rejects(
- unpublish.exec(['a', 'b']),
- /Usage: npm unpublish/,
+ npm.exec('unpublish', ['a', 'b']),
+ { code: 'EUSAGE' },
'should throw usage instructions if too many args'
)
})
-t.test('unpublish <pkg>@version', async t => {
- const log = {
- silly (title, key, value) {
- t.equal(title, 'unpublish', 'should silly log args')
- if (key === 'spec') {
- t.match(value, { name: 'pkg', rawSpec: '1.0.0' })
- } else {
- t.equal(value, 'pkg@1.0.0', 'should log originally passed arg')
- }
+t.test('unpublish <pkg>@version not the last version', async t => {
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ ...auth,
},
- }
+ })
+ const manifest = pkgManifest(pkg, '1.0.1')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).times(3).reply(200, manifest)
+ .put(`/${pkg}/-rev/${manifest._rev}`, body => {
+ // sets latest and deletes version 1.0.1
+ return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined
+ }).reply(201)
+ .intercept(`/${pkg}/-/${pkg}-1.0.1.tgz/-rev/${manifest._rev}`, 'DELETE').reply(201)
+
+ await npm.exec('unpublish', ['test-package@1.0.1'])
+ t.equal(joinedOutput(), '- test-package@1.0.1')
+})
- const libnpmpublish = {
- unpublish (spec, opts) {
- t.equal(spec.raw, 'pkg@1.0.0', 'should unpublish expected parsed spec')
+t.test('unpublish <pkg>@version last version', async t => {
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ ...auth,
},
- }
-
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmpublish,
- 'proc-log': log,
})
- const unpublish = new Unpublish(npm)
+ const manifest = pkgManifest(pkg)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
- await unpublish.exec(['pkg@1.0.0'])
-
- t.equal(
- result,
- '- pkg@1.0.0',
- 'should output removed pkg@version on success'
+ await t.rejects(
+ npm.exec('unpublish', ['test-package@1.0.0']),
+ /Refusing to delete the last version of the package/
)
})
t.test('no version found in package.json', async t => {
- config.force = true
-
- const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'pkg',
- }, null, 2),
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ ...auth,
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ }, null, 2),
+ },
})
- npm.localPrefix = testDir
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- })
- const unpublish = new Unpublish(npm)
+ const manifest = pkgManifest(pkg)
- await unpublish.exec([])
- t.equal(
- result,
- '- pkg',
- 'should output removed pkg on success'
- )
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
+ .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201)
+
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- test-package')
})
t.test('unpublish <pkg> --force no version set', async t => {
- config.force = true
-
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ ...auth,
+ },
})
- const unpublish = new Unpublish(npm)
-
- await unpublish.exec(['pkg'])
-
- t.equal(
- result,
- '- pkg',
- 'should output pkg removed'
- )
+ const manifest = pkgManifest(pkg)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).times(2).reply(200, manifest)
+ .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201)
+
+ await npm.exec('unpublish', ['test-package'])
+ t.equal(joinedOutput(), '- test-package')
})
t.test('silent', async t => {
- npm.config.set('loglevel', 'silent')
-
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ loglevel: 'silent',
+ ...auth,
+ },
})
- const unpublish = new Unpublish(npm)
-
- await unpublish.exec(['pkg@1.0.0'])
-
- t.equal(
- result,
- '',
- 'should have no output'
- )
+ const manifest = pkgManifest(pkg, '1.0.1')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).times(3).reply(200, manifest)
+ .put(`/${pkg}/-rev/${manifest._rev}`, body => {
+ // sets latest and deletes version 1.0.1
+ return body['dist-tags'].latest === '1.0.0' && body.versions['1.0.1'] === undefined
+ }).reply(201)
+ .delete(`/${pkg}/-/${pkg}-1.0.1.tgz/-rev/${manifest._rev}`).reply(201)
+
+ await npm.exec('unpublish', ['test-package@1.0.1'])
+ t.equal(joinedOutput(), '')
})
t.test('workspaces', async t => {
- const testDir = t.testdir({
+ const prefixDir = {
'package.json': JSON.stringify({
- name: 'my-cool-pkg',
+ name: pkg,
version: '1.0.0',
workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
}, null, 2),
@@ -280,75 +237,168 @@ t.test('workspaces', async t => {
version: '1.2.3-n',
}),
},
- })
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- })
- const unpublish = new Unpublish(npm)
+ }
t.test('no force', async t => {
- npm.localPrefix = testDir
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ workspaces: true,
+ },
+ prefixDir,
+ })
await t.rejects(
- unpublish.execWorkspaces([], []),
- /--force/,
- 'should require force'
+ npm.exec('unpublish', []),
+ /Refusing to delete entire project/
)
})
t.test('all workspaces --force', async t => {
- npm.localPrefix = testDir
- config.force = true
- await unpublish.execWorkspaces([], [])
- t.matchSnapshot(result, 'should output all workspaces')
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ workspaces: true,
+ force: true,
+ ...auth,
+ },
+ prefixDir,
+ })
+ const manifestA = pkgManifest('workspace-a')
+ const manifestB = pkgManifest('workspace-b')
+ const manifestN = pkgManifest('workspace-n')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/workspace-a?write=true').times(2).reply(200, manifestA)
+ .delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201)
+ .get('/workspace-b?write=true').times(2).reply(200, manifestB)
+ .delete(`/workspace-b/-rev/${manifestB._rev}`).reply(201)
+ .get('/workspace-n?write=true').times(2).reply(200, manifestN)
+ .delete(`/workspace-n/-rev/${manifestN._rev}`).reply(201)
+
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- workspace-a\n- workspace-b\n- workspace-n')
})
t.test('one workspace --force', async t => {
- npm.localPrefix = testDir
- config.force = true
- await unpublish.execWorkspaces([], ['workspace-a'])
- t.matchSnapshot(result, 'should output one workspaces')
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ workspace: ['workspace-a'],
+ force: true,
+ ...auth,
+ },
+ prefixDir,
+ })
+ const manifestA = pkgManifest('workspace-a')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/workspace-a?write=true').times(2).reply(200, manifestA)
+ .delete(`/workspace-a/-rev/${manifestA._rev}`).reply(201)
+
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- workspace-a')
})
})
t.test('dryRun with spec', async t => {
- config['dry-run'] = true
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmpublish: { unpublish: () => {
- throw new Error('should not be called')
- } },
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ 'dry-run': true,
+ ...auth,
+ },
})
- const unpublish = new Unpublish(npm)
- await unpublish.exec(['pkg@1.0.0'])
- t.equal(
- result,
- '- pkg@1.0.0',
- 'should output removed pkg@version on success'
- )
+ const manifest = pkgManifest(pkg, '1.0.1')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
+
+ await npm.exec('unpublish', ['test-package@1.0.1'])
+ t.equal(joinedOutput(), '- test-package@1.0.1')
})
-t.test('dryRun with local package', async t => {
- config['dry-run'] = true
- config.force = true
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmpublish: { unpublish: () => {
- throw new Error('should not be called')
- } },
+t.test('dryRun with no args', async t => {
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ 'dry-run': true,
+ ...auth,
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ version: '1.0.0',
+ }, null, 2),
+ },
})
- const unpublish = new Unpublish(npm)
- await unpublish.exec([])
- t.equal(
- result,
- '- pkg@1.0.0',
- 'should output removed pkg@1.0.0 on success'
- )
+
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- test-package@1.0.0')
+})
+
+t.test('publishConfig no spec', async t => {
+ const alternateRegistry = 'https://other.registry.npmjs.org'
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ 'fetch-retries': 0,
+ '//other.registry.npmjs.org/:_authToken': 'test-other-token',
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ version: '1.0.0',
+ publishConfig: {
+ registry: alternateRegistry,
+ },
+ }, null, 2),
+ },
+ })
+
+ const manifest = pkgManifest(pkg)
+ tnock(t, alternateRegistry,
+ { reqheaders: { authorization: 'Bearer test-other-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
+ .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201)
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- test-package@1.0.0')
+})
+
+t.test('publishConfig with spec', async t => {
+ const alternateRegistry = 'https://other.registry.npmjs.org'
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ 'fetch-retries': 0,
+ '//other.registry.npmjs.org/:_authToken': 'test-other-token',
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ version: '1.0.0',
+ publishConfig: {
+ registry: alternateRegistry,
+ },
+ }, null, 2),
+ },
+ })
+
+ const manifest = pkgManifest(pkg)
+ tnock(t, alternateRegistry,
+ { reqheaders: { authorization: 'Bearer test-other-token' } })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
+ .delete(`/${pkg}/-rev/${manifest._rev}`).reply(201)
+ await npm.exec('unpublish', ['test-package'])
+ t.equal(joinedOutput(), '- test-package')
})
t.test('completion', async t => {
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ ...auth,
+ },
+ })
+
+ const unpublish = await npm.cmd('unpublish')
const testComp =
- async (t, { unpublish, argv, partialWord, expect, title }) => {
+ async (t, { argv, partialWord, expect, title }) => {
const res = await unpublish.completion(
{ conf: { argv: { remain: argv } }, partialWord }
)
@@ -356,114 +406,70 @@ t.test('completion', async t => {
}
t.test('completing with multiple versions from the registry', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return {
- pkg: 'write',
- bar: 'write',
- }
- },
- },
- 'npm-registry-fetch': {
- async json () {
- return {
- versions: {
- '1.0.0': {},
- '1.0.1': {},
- '2.0.0': {},
- },
- }
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ const manifest = pkgManifest(pkg, '1.0.1')
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write' })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
- partialWord: 'pkg',
+ partialWord: 'test-package',
expect: [
- 'pkg@1.0.0',
- 'pkg@1.0.1',
- 'pkg@2.0.0',
+ 'test-package@1.0.0',
+ 'test-package@1.0.1',
],
})
})
t.test('no versions retrieved', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return {
- pkg: 'write',
- bar: 'write',
- }
- },
- },
- 'npm-registry-fetch': {
- async json () {
- return {
- versions: {},
- }
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ const manifest = pkgManifest(pkg)
+ manifest.versions = {}
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, { [pkg]: 'write' })
+ .get(`/${pkg}?write=true`).reply(200, manifest)
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
- partialWord: 'pkg',
+ partialWord: pkg,
expect: [
- 'pkg',
+ pkg,
],
title: 'should autocomplete package name only',
})
})
t.test('packages starting with same letters', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return {
- pkg: 'write',
- pkga: 'write',
- pkgb: 'write',
- }
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, {
+ [pkg]: 'write',
+ [`${pkg}a`]: 'write',
+ [`${pkg}b`]: 'write',
+ })
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
- partialWord: 'pkg',
+ partialWord: pkg,
expect: [
- 'pkg',
- 'pkga',
- 'pkgb',
+ pkg,
+ `${pkg}a`,
+ `${pkg}b`,
],
})
})
t.test('no packages retrieved', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return {}
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, {})
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
partialWord: 'pkg',
expect: [],
@@ -472,101 +478,53 @@ t.test('completion', async t => {
})
t.test('no pkg name to complete', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return {
- pkg: {},
- bar: {},
- }
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, {
+ [pkg]: 'write',
+ [`${pkg}a`]: 'write',
+ })
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
partialWord: undefined,
- expect: ['pkg', 'bar'],
+ expect: [pkg, `${pkg}a`],
title: 'should autocomplete with available package names from user',
})
})
t.test('no pkg names retrieved from user account', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- libnpmaccess: {
- async lsPackages () {
- return null
- },
- },
- })
- const unpublish = new Unpublish(npm)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(200, { username: user })
+ .get('/-/org/test-user/package?format=cli').reply(200, null)
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
- partialWord: 'pkg',
+ partialWord: pkg,
expect: [],
title: 'should have no autocomplete',
})
})
t.test('logged out user', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- '../../../lib/utils/get-identity.js': () => Promise.reject(new Error('ERR')),
- })
- const unpublish = new Unpublish(npm)
+ tnock(t, npm.config.get('registry'),
+ { reqheaders: { authorization: 'Bearer test-auth-token' } })
+ .get('/-/whoami').reply(404)
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish'],
- partialWord: 'pkg',
+ partialWord: pkg,
expect: [],
})
})
t.test('too many args', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', mocks)
- const unpublish = new Unpublish(npm)
-
await testComp(t, {
- unpublish,
argv: ['npm', 'unpublish', 'foo'],
partialWord: undefined,
expect: [],
})
})
})
-
-t.test('show error on unpublish <pkg>@version with package.json and the last version', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- 'npm-registry-fetch': { json: singleVersion },
- path: { resolve: () => testDir, join: () => testDir + '/package.json' },
- })
- const unpublish = new Unpublish(npm)
- await t.rejects(
- unpublish.exec(['pkg@1.0.0']),
- 'Refusing to delete the last version of the package. ' +
- 'It will block from republishing a new version for 24 hours.\n' +
- 'Run with --force to do this.'
- )
-})
-
-t.test('show error on unpublish <pkg>@version when the last version', async t => {
- const Unpublish = t.mock('../../../lib/commands/unpublish.js', {
- ...mocks,
- 'npm-registry-fetch': { json: singleVersion },
- })
- const unpublish = new Unpublish(npm)
- await t.rejects(
- unpublish.exec(['pkg@1.0.0']),
- 'Refusing to delete the last version of the package. ' +
- 'It will block from republishing a new version for 24 hours.\n' +
- 'Run with --force to do this.'
- )
-})
diff --git a/deps/npm/test/lib/commands/update.js b/deps/npm/test/lib/commands/update.js
index ae937646612..fe52554c95f 100644
--- a/deps/npm/test/lib/commands/update.js
+++ b/deps/npm/test/lib/commands/update.js
@@ -17,7 +17,6 @@ const mocks = {
reify () {}
},
'../../../lib/utils/reify-finish.js': noop,
- '../../../lib/utils/usage.js': () => 'usage instructions',
}
t.afterEach(() => {
diff --git a/deps/npm/test/lib/commands/version.js b/deps/npm/test/lib/commands/version.js
index 980353897c2..154f6a6f833 100644
--- a/deps/npm/test/lib/commands/version.js
+++ b/deps/npm/test/lib/commands/version.js
@@ -1,3 +1,5 @@
+const { readFileSync, statSync } = require('fs')
+const { resolve } = require('path')
const t = require('tap')
const { fake: mockNpm } = require('../../fixtures/mock-npm')
const mockGlobals = require('../../fixtures/mock-globals.js')
@@ -10,8 +12,13 @@ const config = {
'tag-version-prefix': 'v',
json: false,
}
+const flatOptions = {
+ workspacesUpdate: true,
+}
const npm = mockNpm({
config,
+ flatOptions,
+ localPrefix: '',
prefix: '',
version: '1.0.0',
output: (...msg) => {
@@ -21,14 +28,16 @@ const npm = mockNpm({
},
})
const mocks = {
- libnpmversion: noop,
+ '../../../lib/utils/reify-finish.js': noop,
}
const Version = t.mock('../../../lib/commands/version.js', mocks)
const version = new Version(npm)
t.afterEach(() => {
+ flatOptions.workspacesUpdate = true
config.json = false
+ npm.localPrefix = ''
npm.prefix = ''
result = []
})
@@ -120,7 +129,7 @@ t.test('empty versions', t => {
...mocks,
libnpmversion: (arg, opts) => {
t.equal(arg, 'major', 'should forward expected value')
- t.same(
+ t.match(
opts,
{
path: '',
@@ -271,7 +280,6 @@ t.test('empty versions', t => {
})
t.test('with one arg, all workspaces', async t => {
- const libNpmVersionArgs = []
const testDir = t.testdir({
'package.json': JSON.stringify(
{
@@ -296,12 +304,54 @@ t.test('empty versions', t => {
},
})
const Version = t.mock('../../../lib/commands/version.js', {
- ...mocks,
- libnpmversion: (arg, opts) => {
- libNpmVersionArgs.push([arg, opts])
- return '2.0.0'
+ '../../../lib/utils/reify-finish.js': noop,
+ })
+ npm.localPrefix = testDir
+ npm.prefix = testDir
+ const version = new Version(npm)
+
+ await version.execWorkspaces(['major'], [])
+ t.same(
+ result,
+ ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
+ 'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
+ )
+
+ t.matchSnapshot(readFileSync(resolve(testDir, 'package-lock.json'), 'utf8'))
+ })
+
+ t.test('with one arg, all workspaces, saves package.json', async t => {
+ const testDir = t.testdir({
+ 'package.json': JSON.stringify(
+ {
+ name: 'workspaces-test',
+ version: '1.0.0',
+ workspaces: ['workspace-a', 'workspace-b'],
+ dependencies: {
+ 'workspace-a': '^1.0.0',
+ 'workspace-b': '^1.0.0',
+ },
+ },
+ null,
+ 2
+ ),
+ 'workspace-a': {
+ 'package.json': JSON.stringify({
+ name: 'workspace-a',
+ version: '1.0.0',
+ }),
},
+ 'workspace-b': {
+ 'package.json': JSON.stringify({
+ name: 'workspace-b',
+ version: '1.0.0',
+ }),
+ },
+ })
+ const Version = t.mock('../../../lib/commands/version.js', {
+ '../../../lib/utils/reify-finish.js': noop,
})
+ config.save = true
npm.localPrefix = testDir
npm.prefix = testDir
const version = new Version(npm)
@@ -312,6 +362,8 @@ t.test('empty versions', t => {
['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
)
+
+ t.matchSnapshot(readFileSync(resolve(testDir, 'package-lock.json'), 'utf8'))
})
t.test('too many args', async t => {
@@ -321,6 +373,57 @@ t.test('empty versions', t => {
'should throw usage instructions error'
)
})
+
+ t.test('no workspaces-update', async t => {
+ flatOptions.workspacesUpdate = false
+
+ const libNpmVersionArgs = []
+ const testDir = t.testdir({
+ 'package.json': JSON.stringify(
+ {
+ name: 'workspaces-test',
+ version: '1.0.0',
+ workspaces: ['workspace-a', 'workspace-b'],
+ },
+ null,
+ 2
+ ),
+ 'workspace-a': {
+ 'package.json': JSON.stringify({
+ name: 'workspace-a',
+ version: '1.0.0',
+ }),
+ },
+ 'workspace-b': {
+ 'package.json': JSON.stringify({
+ name: 'workspace-b',
+ version: '1.0.0',
+ }),
+ },
+ })
+ const Version = t.mock('../../../lib/commands/version.js', {
+ ...mocks,
+ libnpmversion: (arg, opts) => {
+ libNpmVersionArgs.push([arg, opts])
+ return '2.0.0'
+ },
+ })
+ npm.localPrefix = testDir
+ npm.prefix = testDir
+ const version = new Version(npm)
+
+ await version.execWorkspaces(['major'], [])
+ t.same(
+ result,
+ ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'],
+ 'outputs the new version for only the workspaces prefixed by the tagVersionPrefix'
+ )
+
+ t.throws(
+ () => statSync(resolve(testDir, 'package-lock.json')),
+ 'should not have a lockfile since have not reified'
+ )
+ })
})
t.end()
diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js
index ec19575291d..34773bba046 100644
--- a/deps/npm/test/lib/load-all-commands.js
+++ b/deps/npm/test/lib/load-all-commands.js
@@ -5,11 +5,12 @@
const t = require('tap')
const util = require('util')
const { load: loadMockNpm } = require('../fixtures/mock-npm.js')
-const { cmdList } = require('../../lib/utils/cmd-list.js')
+const { cmdList, plumbing } = require('../../lib/utils/cmd-list.js')
+const allCmds = [...cmdList, ...plumbing]
t.test('load each command', async t => {
- t.plan(cmdList.length)
- for (const cmd of cmdList.sort((a, b) => a.localeCompare(b, 'en'))) {
+ t.plan(allCmds.length)
+ for (const cmd of allCmds.sort((a, b) => a.localeCompare(b, 'en'))) {
t.test(cmd, async t => {
const { npm, outputs } = await loadMockNpm(t, {
config: { usage: true },
diff --git a/deps/npm/test/lib/load-all.js b/deps/npm/test/lib/load-all.js
deleted file mode 100644
index e5d7b558c2a..00000000000
--- a/deps/npm/test/lib/load-all.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const t = require('tap')
-const glob = require('glob')
-const { resolve } = require('path')
-const { load: loadMockNpm } = require('../fixtures/mock-npm')
-
-const full = process.env.npm_lifecycle_event === 'check-coverage'
-
-if (!full) {
- t.pass('nothing to do here, not checking for full coverage')
-} else {
- t.test('load all', async (t) => {
- const { npm } = await loadMockNpm(t, { })
-
- t.teardown(() => {
- const exitHandler = require('../../lib/utils/exit-handler.js')
- exitHandler.setNpm(npm)
- exitHandler()
- })
-
- t.test('load all the files', t => {
- // just load all the files so we measure coverage for the missing tests
- const dir = resolve(__dirname, '../../lib')
- for (const f of glob.sync(`${dir}/**/*.js`)) {
- require(f)
- t.pass('loaded ' + f)
- }
- t.pass('loaded all files')
- t.end()
- })
- })
-}
diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js
index 3ae2af35c28..998e96314d2 100644
--- a/deps/npm/test/lib/npm.js
+++ b/deps/npm/test/lib/npm.js
@@ -43,7 +43,6 @@ t.test('not yet loaded', async t => {
set: Function,
},
version: String,
- shelloutCommands: Array,
})
t.throws(() => npm.config.set('foo', 'bar'))
t.throws(() => npm.config.get('foo'))
@@ -139,10 +138,11 @@ t.test('npm.load', async t => {
})
t.test('forceful loading', async t => {
- mockGlobals(t, {
- 'process.argv': [...process.argv, '--force', '--color', 'always'],
+ const { logs } = await loadMockNpm(t, {
+ globals: {
+ 'process.argv': [...process.argv, '--force', '--color', 'always'],
+ },
})
- const { logs } = await loadMockNpm(t)
t.match(logs.warn, [
[
'using --force',
@@ -153,23 +153,21 @@ t.test('npm.load', async t => {
t.test('node is a symlink', async t => {
const node = process.platform === 'win32' ? 'node.exe' : 'node'
- mockGlobals(t, {
- 'process.argv': [
- node,
- process.argv[1],
- '--usage',
- '--scope=foo',
- 'token',
- 'revoke',
- 'blergggg',
- ],
- })
const { npm, logs, outputs, prefix } = await loadMockNpm(t, {
prefixDir: {
bin: t.fixture('symlink', dirname(process.execPath)),
},
globals: ({ prefix }) => ({
'process.env.PATH': resolve(prefix, 'bin'),
+ 'process.argv': [
+ node,
+ process.argv[1],
+ '--usage',
+ '--scope=foo',
+ 'token',
+ 'revoke',
+ 'blergggg',
+ ],
}),
})
@@ -181,6 +179,9 @@ t.test('npm.load', async t => {
], [
['npm:load:whichnode', /Completed in [0-9.]+ms/],
['node symlink', resolve(prefix, 'bin', node)],
+ ['title', 'npm token revoke blergggg'],
+ ['argv', '"--usage" "--scope" "foo" "token" "revoke" "blergggg"'],
+ ['logfile', /logs-max:\d+ dir:.*/],
['logfile', /.*-debug-0.log/],
['npm:load', /Completed in [0-9.]+ms/],
])
@@ -226,15 +227,6 @@ t.test('npm.load', async t => {
})
t.test('--no-workspaces with --workspace', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color', 'false',
- '--workspaces', 'false',
- '--workspace', 'a',
- ],
- })
const { npm } = await loadMockNpm(t, {
load: false,
prefixDir: {
@@ -253,6 +245,15 @@ t.test('npm.load', async t => {
workspaces: ['./packages/*'],
}),
},
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color', 'false',
+ '--workspaces', 'false',
+ '--workspace', 'a',
+ ],
+ },
})
await t.rejects(
npm.exec('run', []),
@@ -261,14 +262,6 @@ t.test('npm.load', async t => {
})
t.test('workspace-aware configs and commands', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color', 'false',
- '--workspaces', 'true',
- ],
- })
const { npm, outputs } = await loadMockNpm(t, {
prefixDir: {
packages: {
@@ -293,6 +286,14 @@ t.test('npm.load', async t => {
workspaces: ['./packages/*'],
}),
},
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color', 'false',
+ '--workspaces', 'true',
+ ],
+ },
})
// verify that calling the command with a short name still sets
@@ -317,17 +318,6 @@ t.test('npm.load', async t => {
})
t.test('workspaces in global mode', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color',
- 'false',
- '--workspaces',
- '--global',
- 'true',
- ],
- })
const { npm } = await loadMockNpm(t, {
prefixDir: {
packages: {
@@ -352,6 +342,17 @@ t.test('npm.load', async t => {
workspaces: ['./packages/*'],
}),
},
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color',
+ 'false',
+ '--workspaces',
+ '--global',
+ 'true',
+ ],
+ },
})
// verify that calling the command with a short name still sets
// the npm.command property to the full canonical name of the cmd.
@@ -365,68 +366,93 @@ t.test('npm.load', async t => {
t.test('set process.title', async t => {
t.test('basic title setting', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--usage',
- '--scope=foo',
- 'ls',
- ],
+ const { npm } = await loadMockNpm(t, {
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--usage',
+ '--scope=foo',
+ 'ls',
+ ],
+ },
})
- const { npm } = await loadMockNpm(t)
t.equal(npm.title, 'npm ls')
t.equal(process.title, 'npm ls')
})
t.test('do not expose token being revoked', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--usage',
- '--scope=foo',
- 'token',
- 'revoke',
- 'deadbeefcafebad',
- ],
+ const { npm } = await loadMockNpm(t, {
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--usage',
+ '--scope=foo',
+ 'token',
+ 'revoke',
+ `npm_${'a'.repeat(36)}`,
+ ],
+ },
})
- const { npm } = await loadMockNpm(t)
- t.equal(npm.title, 'npm token revoke ***')
- t.equal(process.title, 'npm token revoke ***')
+ t.equal(npm.title, 'npm token revoke npm_***')
+ t.equal(process.title, 'npm token revoke npm_***')
})
t.test('do show *** unless a token is actually being revoked', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--usage',
- '--scope=foo',
- 'token',
- 'revoke',
- ],
+ const { npm } = await loadMockNpm(t, {
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--usage',
+ '--scope=foo',
+ 'token',
+ 'revoke',
+ 'notatoken',
+ ],
+ },
})
- const { npm } = await loadMockNpm(t)
- t.equal(npm.title, 'npm token revoke')
- t.equal(process.title, 'npm token revoke')
+ t.equal(npm.title, 'npm token revoke notatoken')
+ t.equal(process.title, 'npm token revoke notatoken')
})
})
-t.test('debug-log', async t => {
- const { npm, debugFile } = await loadMockNpm(t, { load: false })
+t.test('debug log', async t => {
+ t.test('writes log file', async t => {
+ const { npm, debugFile } = await loadMockNpm(t, { load: false })
+
+ const log1 = ['silly', 'test', 'before load']
+ const log2 = ['silly', 'test', 'after load']
- const log1 = ['silly', 'test', 'before load']
- const log2 = ['silly', 'test', 'after load']
+ process.emit('log', ...log1)
+ await npm.load()
+ process.emit('log', ...log2)
- process.emit('log', ...log1)
- await npm.load()
- process.emit('log', ...log2)
+ const debug = await debugFile()
+ t.equal(npm.logFiles.length, 1, 'one debug file')
+ t.match(debug, log1.join(' '), 'before load appears')
+ t.match(debug, log2.join(' '), 'after load log appears')
+ })
- const debug = await debugFile()
- t.equal(npm.logFiles.length, 1, 'one debug file')
- t.match(debug, log1.join(' '), 'before load appears')
- t.match(debug, log2.join(' '), 'after load log appears')
+ t.test('with bad dir', async t => {
+ const { npm } = await loadMockNpm(t, {
+ config: {
+ 'logs-dir': 'LOGS_DIR',
+ },
+ mocks: {
+ '@npmcli/fs': {
+ mkdir: async (dir) => {
+ if (dir.includes('LOGS_DIR')) {
+ throw new Error('err')
+ }
+ },
+ },
+ },
+ })
+
+ t.equal(npm.logFiles.length, 0, 'no log file')
+ })
})
t.test('timings', async t => {
@@ -458,13 +484,14 @@ t.test('timings', async t => {
})
t.test('writes timings file', async t => {
- const { npm, timingFile } = await loadMockNpm(t, {
+ const { npm, cache, timingFile } = await loadMockNpm(t, {
config: { timing: true },
})
process.emit('time', 'foo')
process.emit('timeEnd', 'foo')
process.emit('time', 'bar')
- npm.unload()
+ npm.writeTimingFile()
+ t.equal(npm.timingFile, join(cache, '_timing.json'))
const timings = await timingFile()
t.match(timings, {
command: [],
@@ -484,21 +511,16 @@ t.test('timings', async t => {
const { npm, timingFile } = await loadMockNpm(t, {
config: { false: true },
})
- npm.unload()
+ npm.writeTimingFile()
await t.rejects(() => timingFile())
})
})
t.test('output clears progress and console.logs the message', async t => {
- t.plan(2)
+ t.plan(4)
let showingProgress = true
const logs = []
- mockGlobals(t, {
- 'console.log': (...args) => {
- t.equal(showingProgress, false, 'should not be showing progress right now')
- logs.push(args)
- },
- })
+ const errors = []
const { npm } = await loadMockNpm(t, {
load: false,
mocks: {
@@ -507,29 +529,36 @@ t.test('output clears progress and console.logs the message', async t => {
showProgress: () => showingProgress = true,
},
},
+ globals: {
+ 'console.log': (...args) => {
+ t.equal(showingProgress, false, 'should not be showing progress right now')
+ logs.push(args)
+ },
+ 'console.error': (...args) => {
+ t.equal(showingProgress, false, 'should not be showing progress right now')
+ errors.push(args)
+ },
+ },
})
npm.originalOutput('hello')
+ npm.originalOutputError('error')
+
t.match(logs, [['hello']])
+ t.match(errors, [['error']])
t.end()
})
-t.test('unknown command', async t => {
+t.test('aliases and typos', async t => {
const { npm } = await loadMockNpm(t, { load: false })
- await t.rejects(
- npm.cmd('thisisnotacommand'),
- { code: 'EUNKNOWNCOMMAND' }
- )
+ await t.rejects(npm.cmd('thisisnotacommand'), { code: 'EUNKNOWNCOMMAND' })
+ await t.rejects(npm.cmd(''), { code: 'EUNKNOWNCOMMAND' })
+ await t.rejects(npm.cmd('birt'), { code: 'EUNKNOWNCOMMAND' })
+ await t.resolves(npm.cmd('it'), { name: 'install-test' })
+ await t.resolves(npm.cmd('installTe'), { name: 'install-test' })
+ await t.resolves(npm.cmd('birthday'), { name: 'birthday' })
})
t.test('explicit workspace rejection', async t => {
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color', 'false',
- '--workspace', './packages/a',
- ],
- })
const mock = await loadMockNpm(t, {
prefixDir: {
packages: {
@@ -547,6 +576,14 @@ t.test('explicit workspace rejection', async t => {
workspaces: ['./packages/a'],
}),
},
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color', 'false',
+ '--workspace', './packages/a',
+ ],
+ },
})
await t.rejects(
mock.npm.exec('ping', []),
@@ -572,15 +609,17 @@ t.test('implicit workspace rejection', async t => {
workspaces: ['./packages/a'],
}),
},
- })
- const cwd = join(mock.npm.config.localPrefix, 'packages', 'a')
- mock.npm.config.set('workspace', [cwd], 'default')
- mockGlobals(t, {
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color', 'false',
- ],
+ globals: {
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color', 'false',
+ '--workspace', './packages/a',
+ ],
+ },
+ config: ({ prefix }) => ({
+ workspace: { value: [join(prefix, 'packages', 'a')], where: 'default' },
+ }),
})
await t.rejects(
mock.npm.exec('owner', []),
@@ -606,19 +645,17 @@ t.test('implicit workspace accept', async t => {
workspaces: ['./packages/a'],
}),
},
+ globals: ({ prefix }) => ({
+ 'process.cwd': () => prefix,
+ 'process.argv': [
+ process.execPath,
+ process.argv[1],
+ '--color', 'false',
+ ],
+ }),
+ config: ({ prefix }) => ({
+ workspace: { value: [join(prefix, 'packages', 'a')], where: 'default' },
+ }),
})
- const cwd = join(mock.npm.config.localPrefix, 'packages', 'a')
- mock.npm.config.set('workspace', [cwd], 'default')
- mockGlobals(t, {
- 'process.cwd': () => mock.npm.config.cwd,
- 'process.argv': [
- process.execPath,
- process.argv[1],
- '--color', 'false',
- ],
- })
- await t.rejects(
- mock.npm.exec('org', []),
- /.*Usage/
- )
+ await t.rejects(mock.npm.exec('org', []), /.*Usage/)
})
diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js
index a5b34a7499f..b387835df55 100644
--- a/deps/npm/test/lib/utils/config/definitions.js
+++ b/deps/npm/test/lib/utils/config/definitions.js
@@ -53,11 +53,11 @@ t.test('editor', t => {
t.test('has neither EDITOR nor VISUAL, system specific', t => {
mockGlobals(t, { 'process.env': { EDITOR: undefined, VISUAL: undefined } })
const defsWin = t.mock(defpath, {
- [isWin]: true,
+ [isWin]: { isWindows: true },
})
t.equal(defsWin.editor.default, 'notepad.exe')
const defsNix = t.mock(defpath, {
- [isWin]: false,
+ [isWin]: { isWindows: false },
})
t.equal(defsNix.editor.default, 'vi')
t.end()
@@ -69,12 +69,12 @@ t.test('shell', t => {
t.test('windows, env.ComSpec then cmd.exe', t => {
mockGlobals(t, { 'process.env.ComSpec': 'command.com' })
const defsComSpec = t.mock(defpath, {
- [isWin]: true,
+ [isWin]: { isWindows: true },
})
t.equal(defsComSpec.shell.default, 'command.com')
mockGlobals(t, { 'process.env.ComSpec': undefined })
const defsNoComSpec = t.mock(defpath, {
- [isWin]: true,
+ [isWin]: { isWindows: true },
})
t.equal(defsNoComSpec.shell.default, 'cmd')
t.end()
@@ -83,12 +83,12 @@ t.test('shell', t => {
t.test('nix, SHELL then sh', t => {
mockGlobals(t, { 'process.env.SHELL': '/usr/local/bin/bash' })
const defsShell = t.mock(defpath, {
- [isWin]: false,
+ [isWin]: { isWindows: false },
})
t.equal(defsShell.shell.default, '/usr/local/bin/bash')
mockGlobals(t, { 'process.env.SHELL': undefined })
const defsNoShell = t.mock(defpath, {
- [isWin]: false,
+ [isWin]: { isWindows: false },
})
t.equal(defsNoShell.shell.default, 'sh')
t.end()
@@ -158,18 +158,18 @@ t.test('unicode allowed?', t => {
t.test('cache', t => {
mockGlobals(t, { 'process.env.LOCALAPPDATA': 'app/data/local' })
const defsWinLocalAppData = t.mock(defpath, {
- [isWin]: true,
+ [isWin]: { isWindows: true },
})
t.equal(defsWinLocalAppData.cache.default, 'app/data/local/npm-cache')
mockGlobals(t, { 'process.env.LOCALAPPDATA': undefined })
const defsWinNoLocalAppData = t.mock(defpath, {
- [isWin]: true,
+ [isWin]: { isWindows: true },
})
t.equal(defsWinNoLocalAppData.cache.default, '~/npm-cache')
const defsNix = t.mock(defpath, {
- [isWin]: false,
+ [isWin]: { isWindows: false },
})
t.equal(defsNix.cache.default, '~/.npm')
diff --git a/deps/npm/test/lib/utils/deref-command.js b/deps/npm/test/lib/utils/deref-command.js
deleted file mode 100644
index 474488c58c2..00000000000
--- a/deps/npm/test/lib/utils/deref-command.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const t = require('tap')
-const deref = require('../../../lib/utils/deref-command.js')
-
-t.equal(deref(null), '')
-t.equal(deref(8), '')
-t.equal(deref('it'), 'install-test')
-t.equal(deref('installTe'), 'install-test')
-t.equal(deref('birthday'), 'birthday')
-t.equal(deref('birt'), '')
diff --git a/deps/npm/test/lib/utils/exit-handler.js b/deps/npm/test/lib/utils/exit-handler.js
index 6a96d92ddb2..23942cca1c0 100644
--- a/deps/npm/test/lib/utils/exit-handler.js
+++ b/deps/npm/test/lib/utils/exit-handler.js
@@ -21,9 +21,10 @@ t.formatSnapshot = (obj) => {
}
t.cleanSnapshot = (path) => cleanDate(cleanCwd(path))
-// Config loading is dependent on env so strip those from snapshots
+ // Config loading is dependent on env so strip those from snapshots
.replace(/.*timing config:load:.*\n/gm, '')
.replace(/(Completed in )\d+(ms)/g, '$1{TIME}$2')
+ .replace(/(removing )\d+( files)/g, '$1${NUM}2')
// cut off process from script so that it won't quit the test runner
// while trying to run through the myriad of cases. need to make it
@@ -31,7 +32,7 @@ t.cleanSnapshot = (path) => cleanDate(cleanCwd(path))
// nerf itself, thinking global.process is broken or gone.
mockGlobals(t, {
process: Object.assign(new EventEmitter(), {
- ...pick(process, 'execPath', 'stdout', 'stderr', 'cwd', 'env'),
+ ...pick(process, 'execPath', 'stdout', 'stderr', 'cwd', 'env', 'umask'),
argv: ['/node', ...process.argv.slice(1)],
version: 'v1.0.0',
kill: () => {},
@@ -44,9 +45,8 @@ mockGlobals(t, {
}),
}, { replace: true })
-const mockExitHandler = async (t, { init, load, testdir, config } = {}) => {
+const mockExitHandler = async (t, { init, load, testdir, config, globals, mocks } = {}) => {
const errors = []
- mockGlobals(t, { 'console.error': (err) => errors.push(err) })
const { npm, logMocks, ...rest } = await loadMockNpm(t, {
init,
@@ -56,11 +56,15 @@ const mockExitHandler = async (t, { init, load, testdir, config } = {}) => {
'../../package.json': {
version: '1.0.0',
},
+ ...mocks,
},
config: {
loglevel: 'notice',
...config,
},
+ globals: {
+ 'console.error': (err) => errors.push(err),
+ },
})
const exitHandler = t.mock('../../../lib/utils/exit-handler.js', {
@@ -74,6 +78,7 @@ const mockExitHandler = async (t, { init, load, testdir, config } = {}) => {
release: () => '1.0.0',
},
...logMocks,
+ ...mocks,
})
if (npm) {
@@ -89,13 +94,14 @@ const mockExitHandler = async (t, { init, load, testdir, config } = {}) => {
...rest,
errors,
npm,
- // Make it async to make testing ergonomics a little
- // easier so we dont need to t.plan() every test to
- // make sure we get process.exit called
- exitHandler: (...args) => new Promise(resolve => {
+ // Make it async to make testing ergonomics a little easier so we dont need
+ // to t.plan() every test to make sure we get process.exit called. Also
+ // introduce a small artificial delay so the logs are consistently finished
+ // by the time the exit handler forces process.exit
+ exitHandler: (...args) => new Promise(resolve => setTimeout(() => {
process.once('exit', resolve)
exitHandler(...args)
- }),
+ }, 50)),
}
}
@@ -199,17 +205,15 @@ t.test('exit handler called - no npm with error without stack', async (t) => {
})
t.test('console.log output using --json', async (t) => {
- const { exitHandler, errors } = await mockExitHandler(t, {
- config: {
- json: true,
- },
+ const { exitHandler, outputErrors } = await mockExitHandler(t, {
+ config: { json: true },
})
await exitHandler(err('Error: EBADTHING Something happened'))
t.equal(process.exitCode, 1)
t.same(
- JSON.parse(errors[0]),
+ JSON.parse(outputErrors[0]),
{
error: {
code: 'EBADTHING', // should default error code to E[A-Z]+
@@ -273,11 +277,43 @@ t.test('npm.config not ready', async (t) => {
], 'should exit with config error msg')
})
-t.test('timing with no error', async (t) => {
- const { exitHandler, timingFile, npm, logs } = await mockExitHandler(t, {
+t.test('no logs dir', async (t) => {
+ const { exitHandler, logs } = await mockExitHandler(t, {
+ config: { 'logs-max': 0 },
+ })
+
+ await exitHandler(new Error())
+
+ t.match(logs.error.filter(([t]) => t === ''), [
+ ['', 'Log files were not written due to the config logs-max=0'],
+ ])
+})
+
+t.test('log file error', async (t) => {
+ const { exitHandler, logs } = await mockExitHandler(t, {
config: {
+ 'logs-dir': 'LOGS_DIR',
timing: true,
},
+ mocks: {
+ '@npmcli/fs': {
+ mkdir: async (dir) => {
+ if (dir.includes('LOGS_DIR')) {
+ throw new Error('err')
+ }
+ },
+ },
+ },
+ })
+
+ await exitHandler(new Error())
+
+ t.match(logs.error.filter(([t]) => t === ''), [['', `error writing to the directory`]])
+})
+
+t.test('timing with no error', async (t) => {
+ const { exitHandler, timingFile, npm, logs } = await mockExitHandler(t, {
+ config: { timing: true },
})
await exitHandler()
@@ -285,9 +321,9 @@ t.test('timing with no error', async (t) => {
t.equal(process.exitCode, 0)
- t.match(logs.error, [
- ['', /A complete log of this run can be found in:[\s\S]*-debug-\d\.log/],
- ])
+ const msg = logs.info.filter(([t]) => t === '')[0][1]
+ t.match(msg, /A complete log of this run can be found in:/)
+ t.match(msg, /Timing info written to:/)
t.match(
timingFileData,
@@ -308,9 +344,7 @@ t.test('timing with no error', async (t) => {
t.test('unfinished timers', async (t) => {
const { exitHandler, timingFile, npm } = await mockExitHandler(t, {
- config: {
- timing: true,
- },
+ config: { timing: true },
})
process.emit('time', 'foo')
@@ -376,7 +410,7 @@ t.test('verbose logs replace info on err props', async t => {
await exitHandler(err('Error with code type number', properties))
t.equal(process.exitCode, 1)
t.match(
- logs.verbose.filter(([p]) => p !== 'logfile'),
+ logs.verbose.filter(([p]) => !['logfile', 'title', 'argv'].includes(p)),
keys.map((k) => [k, `${k}-https://user:***@registry.npmjs.org/`]),
'all special keys get replaced'
)
@@ -416,7 +450,10 @@ t.test('exits uncleanly when only emitting exit event', async (t) => {
t.test('do no fancy handling for shellouts', async t => {
const { exitHandler, npm, logs } = await mockExitHandler(t)
+ const exec = await npm.cmd('exec')
+
npm.command = 'exec'
+ npm.commandInstance = exec
const loudNoises = () =>
logs.filter(([level]) => ['warn', 'error'].includes(level))
diff --git a/deps/npm/test/lib/utils/is-windows-bash.js b/deps/npm/test/lib/utils/is-windows-bash.js
deleted file mode 100644
index 0fbebdf8e3d..00000000000
--- a/deps/npm/test/lib/utils/is-windows-bash.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const t = require('tap')
-const mockGlobal = require('../../fixtures/mock-globals.js')
-
-const isWindowsBash = () => {
- delete require.cache[require.resolve('../../../lib/utils/is-windows-bash.js')]
- delete require.cache[require.resolve('../../../lib/utils/is-windows.js')]
- return require('../../../lib/utils/is-windows-bash.js')
-}
-
-t.test('posix', (t) => {
- mockGlobal(t, { 'process.platform': 'posix' })
- t.equal(isWindowsBash(), false, 'false when not windows')
-
- t.end()
-})
-
-t.test('win32', (t) => {
- mockGlobal(t, { 'process.platform': 'win32' })
-
- mockGlobal(t, { 'process.env': { TERM: 'dumb', MSYSTEM: undefined } })
- t.equal(isWindowsBash(), false, 'false when not mingw or cygwin')
-
- mockGlobal(t, { 'process.env.TERM': 'cygwin' })
- t.equal(isWindowsBash(), true, 'true when cygwin')
-
- mockGlobal(t, { 'process.env': { TERM: 'dumb', MSYSTEM: 'MINGW64' } })
- t.equal(isWindowsBash(), true, 'true when mingw')
-
- t.end()
-})
diff --git a/deps/npm/test/lib/utils/is-windows-shell.js b/deps/npm/test/lib/utils/is-windows-shell.js
deleted file mode 100644
index 95519925c97..00000000000
--- a/deps/npm/test/lib/utils/is-windows-shell.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const t = require('tap')
-Object.defineProperty(process, 'platform', {
- value: 'win32',
-})
-const isWindows = require('../../../lib/utils/is-windows.js')
-const isWindowsBash = require('../../../lib/utils/is-windows-bash.js')
-const isWindowsShell = require('../../../lib/utils/is-windows-shell.js')
-t.equal(isWindowsShell, isWindows && !isWindowsBash)
diff --git a/deps/npm/test/lib/utils/is-windows.js b/deps/npm/test/lib/utils/is-windows.js
index f8f2999c994..a1d520f0629 100644
--- a/deps/npm/test/lib/utils/is-windows.js
+++ b/deps/npm/test/lib/utils/is-windows.js
@@ -1,8 +1,39 @@
const t = require('tap')
-const actuallyWindows = process.platform === 'win32'
-t.equal(actuallyWindows, require('../../../lib/utils/is-windows.js'))
-Object.defineProperty(process, 'platform', {
- value: actuallyWindows ? 'posix' : 'win32',
+
+const mockGlobals = require('../../fixtures/mock-globals')
+
+t.test('is not windows', async t => {
+ mockGlobals(t, { 'process.platform': 'posix' })
+ t.match({
+ isWindows: false,
+ isWindowsShell: false,
+ }, t.mock('../../../lib/utils/is-windows.js'))
+})
+
+t.test('is windows, shell', async t => {
+ mockGlobals(t, {
+ 'process.platform': 'win32',
+ 'process.env': {
+ MSYSTEM: 'notmingw',
+ TERM: 'notcygwin',
+ },
+ })
+ t.match({
+ isWindows: true,
+ isWindowsShell: true,
+ }, t.mock('../../../lib/utils/is-windows.js'))
+})
+
+t.test('is windows, not shell', async t => {
+ mockGlobals(t, {
+ 'process.platform': 'win32',
+ 'process.env': {
+ MSYSTEM: 'MINGW32',
+ TERM: 'cygwin',
+ },
+ })
+ t.match({
+ isWindows: true,
+ isWindowsShell: false,
+ }, t.mock('../../../lib/utils/is-windows.js'))
})
-delete require.cache[require.resolve('../../../lib/utils/is-windows.js')]
-t.equal(!actuallyWindows, require('../../../lib/utils/is-windows.js'))
diff --git a/deps/npm/test/lib/utils/log-file.js b/deps/npm/test/lib/utils/log-file.js
index 007ce221b09..ce6f0bf4cf5 100644
--- a/deps/npm/test/lib/utils/log-file.js
+++ b/deps/npm/test/lib/utils/log-file.js
@@ -116,12 +116,12 @@ t.test('max files per process', async t => {
}
for (const i of range(5)) {
- logFile.log('verbose', `log ${i}`)
+ logFile.log('verbose', `ignored after maxlogs hit ${i}`)
}
const logs = await readLogs()
t.equal(logs.length, maxFilesPerProcess, 'total log files')
- t.equal(last(last(logs).logs), '49 error log 49')
+ t.match(last(last(logs).logs), /49 error log \d+/)
})
t.test('stream error', async t => {
@@ -182,8 +182,7 @@ t.test('turns off', async t => {
logFile.load()
const logs = await readLogs()
- t.equal(logs.length, 1)
- t.equal(logs[0].logs[0], '0 error test')
+ t.match(last(last(logs).logs), /^\d+ error test$/)
})
t.test('cleans logs', async t => {
@@ -198,7 +197,7 @@ t.test('cleans logs', async t => {
})
t.test('doesnt clean current log by default', async t => {
- const logsMax = 0
+ const logsMax = 1
const { readLogs, logFile } = await loadLogFile(t, {
logsMax,
testdir: makeOldLogs(10),
@@ -207,7 +206,6 @@ t.test('doesnt clean current log by default', async t => {
logFile.log('error', 'test')
const logs = await readLogs()
- t.equal(logs.length, 1)
t.match(last(logs).content, /\d+ error test/)
})
@@ -221,8 +219,7 @@ t.test('negative logs max', async t => {
logFile.log('error', 'test')
const logs = await readLogs()
- t.equal(logs.length, 1)
- t.match(last(logs).content, /\d+ error test/)
+ t.equal(logs.length, 0)
})
t.test('doesnt need to clean', async t => {
@@ -257,7 +254,7 @@ t.test('cleans old style logs too', async t => {
const oldLogs = 10
const { readLogs } = await loadLogFile(t, {
logsMax,
- testdir: makeOldLogs(oldLogs, false),
+ testdir: makeOldLogs(oldLogs, true),
})
const logs = await readLogs()
@@ -304,7 +301,7 @@ t.test('delete log file while open', async t => {
})
t.test('snapshot', async t => {
- const { logFile, readLogs } = await loadLogFile(t)
+ const { logFile, readLogs } = await loadLogFile(t, { logsMax: 10 })
logFile.log('error', '', 'no prefix')
logFile.log('error', 'prefix', 'with prefix')
diff --git a/deps/npm/test/lib/utils/otplease.js b/deps/npm/test/lib/utils/otplease.js
index b3711965c2c..025084ab4f2 100644
--- a/deps/npm/test/lib/utils/otplease.js
+++ b/deps/npm/test/lib/utils/otplease.js
@@ -1,4 +1,5 @@
const t = require('tap')
+const mockGlobals = require('../../fixtures/mock-globals')
const readUserInfo = {
otp: async () => '1234',
@@ -8,6 +9,27 @@ const otplease = t.mock('../../../lib/utils/otplease.js', {
'../../../lib/utils/read-user-info.js': readUserInfo,
})
+t.test('returns function results on success', async (t) => {
+ const fn = () => 'test string'
+ const result = await otplease({}, fn)
+ t.equal('test string', result)
+})
+
+t.test('returns function results on otp success', async (t) => {
+ mockGlobals(t, {
+ 'process.stdin': { isTTY: true },
+ 'process.stdout': { isTTY: true },
+ })
+ const fn = ({ otp }) => {
+ if (otp) {
+ return 'success'
+ }
+ throw Object.assign(new Error('nope'), { code: 'EOTP' })
+ }
+ const result = await otplease({}, fn)
+ t.equal('success', result)
+})
+
t.test('prompts for otp for EOTP', async (t) => {
const stdinTTY = process.stdin.isTTY
const stdoutTTY = process.stdout.isTTY
diff --git a/deps/npm/test/lib/utils/path.js b/deps/npm/test/lib/utils/path.js
deleted file mode 100644
index 0a7846d94bc..00000000000
--- a/deps/npm/test/lib/utils/path.js
+++ /dev/null
@@ -1,12 +0,0 @@
-const t = require('tap')
-const mod = '../../../lib/utils/path.js'
-const delim = require('../../../lib/utils/is-windows.js') ? ';' : ':'
-Object.defineProperty(process, 'env', {
- value: {},
-})
-process.env.path = ['foo', 'bar', 'baz'].join(delim)
-t.strictSame(t.mock(mod), ['foo', 'bar', 'baz'])
-process.env.Path = ['a', 'b', 'c'].join(delim)
-t.strictSame(t.mock(mod), ['a', 'b', 'c'])
-process.env.PATH = ['x', 'y', 'z'].join(delim)
-t.strictSame(t.mock(mod), ['x', 'y', 'z'])
diff --git a/deps/npm/test/lib/utils/replace-info.js b/deps/npm/test/lib/utils/replace-info.js
index e4b83783a55..c7fffdb5440 100644
--- a/deps/npm/test/lib/utils/replace-info.js
+++ b/deps/npm/test/lib/utils/replace-info.js
@@ -20,12 +20,30 @@ t.equal(
)
t.equal(
+ replaceInfo(' == = = '),
+ ' == = = ',
+ 'should return same string with only separators'
+)
+
+t.equal(
+ replaceInfo(''),
+ '',
+ 'should return empty string'
+)
+
+t.equal(
replaceInfo('https://user:pass@registry.npmjs.org/'),
'https://user:***@registry.npmjs.org/',
'should replace single item'
)
t.equal(
+ replaceInfo(`https://registry.npmjs.org/path/npm_${'a'.repeat('36')}`),
+ 'https://registry.npmjs.org/path/npm_***',
+ 'should replace single item token'
+)
+
+t.equal(
replaceInfo('https://example.npmjs.org'),
'https://example.npmjs.org',
'should not replace single item with no password'
@@ -49,6 +67,12 @@ t.equal(
'should replace single item within a phrase'
)
+t.equal(
+ replaceInfo('Something --x=https://user:pass@registry.npmjs.org/ foo bar'),
+ 'Something --x=https://user:***@registry.npmjs.org/ foo bar',
+ 'should replace single item within a phrase separated by ='
+)
+
t.same(
replaceInfo([
'Something https://user:pass@registry.npmjs.org/ foo bar',
@@ -60,7 +84,21 @@ t.same(
'http://foo:***@registry.npmjs.org',
'http://example.npmjs.org',
],
- 'should replace single item within a phrase'
+ 'should replace items in an array'
+)
+
+t.same(
+ replaceInfo([
+ 'Something --x=https://user:pass@registry.npmjs.org/ foo bar',
+ '--url=http://foo:bar@registry.npmjs.org',
+ '--url=http://example.npmjs.org',
+ ]),
+ [
+ 'Something --x=https://user:***@registry.npmjs.org/ foo bar',
+ '--url=http://foo:***@registry.npmjs.org',
+ '--url=http://example.npmjs.org',
+ ],
+ 'should replace items in an array with equals'
)
t.same(
diff --git a/deps/npm/test/lib/utils/split-package-names.js b/deps/npm/test/lib/utils/split-package-names.js
deleted file mode 100644
index 5fe1e6cd8dd..00000000000
--- a/deps/npm/test/lib/utils/split-package-names.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-const t = require('tap')
-const splitPackageNames = require('../../../lib/utils/split-package-names.js')
-
-t.test('splitPackageNames', t => {
- const assertions = [
- ['semver', 'semver'],
- ['read-pkg/semver', 'read-pkg/node_modules/semver'],
- ['@npmcli/one/@npmcli/two', '@npmcli/one/node_modules/@npmcli/two'],
- ['@npmcli/one/semver', '@npmcli/one/node_modules/semver'],
- ]
-
- for (const [input, expected] of assertions) {
- t.equal(splitPackageNames(input), expected, `split ${input} correctly`)
- }
- t.end()
-})
diff --git a/deps/npm/test/lib/utils/timers.js b/deps/npm/test/lib/utils/timers.js
index 6127f346b17..30e54700c63 100644
--- a/deps/npm/test/lib/utils/timers.js
+++ b/deps/npm/test/lib/utils/timers.js
@@ -1,5 +1,5 @@
const t = require('tap')
-const { resolve } = require('path')
+const { resolve, join } = require('path')
const fs = require('graceful-fs')
const mockLogs = require('../../fixtures/mock-logs')
@@ -31,6 +31,17 @@ t.test('listens/stops on process', async (t) => {
t.notOk(timers.unfinished.get('baz'))
})
+t.test('convenience time method', async (t) => {
+ const { timers } = mockTimers(t)
+
+ const end = timers.time('later')
+ timers.time('sync', () => {})
+ await timers.time('async', () => new Promise(r => setTimeout(r, 10)))
+ end()
+
+ t.match(timers.finished, { later: Number, sync: Number, async: Number })
+})
+
t.test('initial timer', async (t) => {
const { timers } = mockTimers(t, { start: 'foo' })
process.emit('timeEnd', 'foo')
@@ -75,8 +86,21 @@ t.test('writes file', async (t) => {
t.test('fails to write file', async (t) => {
const { logs, timers } = mockTimers(t)
+ const dir = t.testdir()
+
+ timers.load({ dir: join(dir, 'does', 'not', 'exist') })
+ timers.writeFile()
+
+ t.match(logs.warn, [['timing', 'could not write timing file']])
+ t.equal(timers.file, null)
+})
+
+t.test('no dir and no file', async (t) => {
+ const { logs, timers } = mockTimers(t)
+
+ timers.load()
timers.writeFile()
- t.match(logs.warn, [
- ['timing', 'could not write timing file', Error],
- ])
+
+ t.strictSame(logs, [])
+ t.equal(timers.file, null)
})
diff --git a/deps/npm/test/lib/utils/unsupported.js b/deps/npm/test/lib/utils/unsupported.js
deleted file mode 100644
index 2703044a227..00000000000
--- a/deps/npm/test/lib/utils/unsupported.js
+++ /dev/null
@@ -1,102 +0,0 @@
-const t = require('tap')
-const unsupported = require('../../../lib/utils/unsupported.js')
-const mockGlobals = require('../../fixtures/mock-globals.js')
-
-const versions = [
- // broken unsupported
- ['v0.1.103', true, true],
- ['v0.2.0', true, true],
- ['v0.3.5', true, true],
- ['v0.4.7', true, true],
- ['v0.5.3', true, true],
- ['v0.6.17', true, true],
- ['v0.7.8', true, true],
- ['v0.8.28', true, true],
- ['v0.9.6', true, true],
- ['v0.10.48', true, true],
- ['v0.11.16', true, true],
- ['v0.12.9', true, true],
- ['v1.0.1', true, true],
- ['v1.6.0', true, true],
- ['v2.3.1', true, true],
- ['v3.0.0', true, true],
- ['v4.5.0', true, true],
- ['v4.8.4', true, true],
- ['v5.7.1', true, true],
- ['v6.8.1', false, true],
- ['v7.0.0-beta23', false, true],
- ['v7.2.3', false, true],
- ['v8.4.0', false, true],
- ['v9.3.0', false, true],
- ['v10.0.0-0', false, true],
- ['v11.0.0-0', false, true],
- ['v12.0.0-0', false, true],
- ['v12.13.0-0', false, false],
- ['v13.0.0-0', false, true],
- ['v14.0.0-0', false, true],
- ['v14.15.0-0', false, false],
- ['v15.0.0-0', false, true],
- ['v16.0.0-0', false, false],
-]
-
-t.test('versions', function (t) {
- t.plan(versions.length * 2)
- versions.forEach(function (verinfo) {
- const version = verinfo[0]
- const broken = verinfo[1]
- const unsupp = verinfo[2]
- const nodejs = unsupported.checkVersion(version)
- t.equal(nodejs.broken, broken, version + ' ' + (broken ? '' : 'not ') + 'broken')
- t.equal(nodejs.unsupported, unsupp, version + ' ' + (unsupp ? 'unsupported' : 'supported'))
- })
- t.end()
-})
-
-t.test('checkForBrokenNode', t => {
- // run it once to not fail
- unsupported.checkForBrokenNode()
-
- const logs = []
- const expectLogs = [
- 'ERROR: npm is known not to run on Node.js 1.2.3',
- "You'll need to upgrade to a newer Node.js version in order to use this",
- 'version of npm. You can find the latest version at https://nodejs.org/',
- ]
-
- // then make it a thing that fails
- mockGlobals(t, {
- 'console.error': msg => logs.push(msg),
- 'process.version': '1.2.3',
- 'process.exit': (code) => {
- t.equal(code, 1)
- t.strictSame(logs, expectLogs)
- t.end()
- },
- })
-
- unsupported.checkForBrokenNode()
-})
-
-t.test('checkForUnsupportedNode', t => {
- // run it once to not fail or warn
- unsupported.checkForUnsupportedNode()
-
- const logs = []
- const expectLogs = [
- 'npm does not support Node.js 8.0.0',
- 'You should probably upgrade to a newer version of node as we',
- "can't make any promises that npm will work with this version.",
- 'You can find the latest version at https://nodejs.org/',
- ]
-
- // then make it a thing that fails
- mockGlobals(t, {
- 'console.error': msg => logs.push(msg),
- 'process.version': '8.0.0',
- })
-
- unsupported.checkForUnsupportedNode()
-
- t.strictSame(logs, expectLogs)
- t.end()
-})
diff --git a/deps/npm/test/lib/utils/update-notifier.js b/deps/npm/test/lib/utils/update-notifier.js
index fa4af29476f..a35886c6ef2 100644
--- a/deps/npm/test/lib/utils/update-notifier.js
+++ b/deps/npm/test/lib/utils/update-notifier.js
@@ -85,12 +85,11 @@ t.afterEach(() => {
const runUpdateNotifier = async ({ color = true, ...npmOptions } = {}) => {
const _npm = { ...defaultNpm, ...npmOptions, logColor: color }
- await t.mock('../../../lib/utils/update-notifier.js', {
+ return t.mock('../../../lib/utils/update-notifier.js', {
'@npmcli/ci-detect': () => ciMock,
pacote,
fs,
})(_npm)
- return _npm.updateNotification
}
t.test('situations in which we do not notify', t => {