summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm team <ops+robot@npmjs.com>2021-11-18 20:58:02 +0000
committerMichaël Zasso <targos@protonmail.com>2021-11-26 15:36:32 +0100
commit90f35fc3292e35a6c6cfb6124c9a97d528a28cee (patch)
tree50ccf3f64efa09aa9b5beebc133cc818f3018507
parent1482c4415f8c862bccdbf506ed850da383087cb2 (diff)
downloadnode-new-90f35fc3292e35a6c6cfb6124c9a97d528a28cee.tar.gz
deps: upgrade npm to 8.1.4
PR-URL: https://github.com/nodejs/node/pull/40865 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
-rwxr-xr-xdeps/npm/bin/npx-cli.js15
-rw-r--r--deps/npm/docs/content/commands/npm-install.md2
-rw-r--r--deps/npm/docs/content/using-npm/developers.md2
-rw-r--r--deps/npm/docs/output/commands/npm-access.html11
-rw-r--r--deps/npm/docs/output/commands/npm-adduser.html7
-rw-r--r--deps/npm/docs/output/commands/npm-audit.html27
-rw-r--r--deps/npm/docs/output/commands/npm-bin.html5
-rw-r--r--deps/npm/docs/output/commands/npm-bugs.html7
-rw-r--r--deps/npm/docs/output/commands/npm-cache.html11
-rw-r--r--deps/npm/docs/output/commands/npm-ci.html13
-rw-r--r--deps/npm/docs/output/commands/npm-completion.html5
-rw-r--r--deps/npm/docs/output/commands/npm-config.html15
-rw-r--r--deps/npm/docs/output/commands/npm-dedupe.html23
-rw-r--r--deps/npm/docs/output/commands/npm-deprecate.html7
-rw-r--r--deps/npm/docs/output/commands/npm-diff.html25
-rw-r--r--deps/npm/docs/output/commands/npm-dist-tag.html3
-rw-r--r--deps/npm/docs/output/commands/npm-docs.html7
-rw-r--r--deps/npm/docs/output/commands/npm-doctor.html39
-rw-r--r--deps/npm/docs/output/commands/npm-edit.html11
-rw-r--r--deps/npm/docs/output/commands/npm-exec.html13
-rw-r--r--deps/npm/docs/output/commands/npm-explain.html5
-rw-r--r--deps/npm/docs/output/commands/npm-explore.html5
-rw-r--r--deps/npm/docs/output/commands/npm-find-dupes.html17
-rw-r--r--deps/npm/docs/output/commands/npm-fund.html7
-rw-r--r--deps/npm/docs/output/commands/npm-help-search.html3
-rw-r--r--deps/npm/docs/output/commands/npm-help.html5
-rw-r--r--deps/npm/docs/output/commands/npm-hook.html11
-rw-r--r--deps/npm/docs/output/commands/npm-init.html15
-rw-r--r--deps/npm/docs/output/commands/npm-install-ci-test.html7
-rw-r--r--deps/npm/docs/output/commands/npm-install-test.html23
-rw-r--r--deps/npm/docs/output/commands/npm-install.html41
-rw-r--r--deps/npm/docs/output/commands/npm-link.html31
-rw-r--r--deps/npm/docs/output/commands/npm-logout.html11
-rw-r--r--deps/npm/docs/output/commands/npm-ls.html21
-rw-r--r--deps/npm/docs/output/commands/npm-org.html7
-rw-r--r--deps/npm/docs/output/commands/npm-outdated.html25
-rw-r--r--deps/npm/docs/output/commands/npm-owner.html11
-rw-r--r--deps/npm/docs/output/commands/npm-pack.html9
-rw-r--r--deps/npm/docs/output/commands/npm-ping.html5
-rw-r--r--deps/npm/docs/output/commands/npm-pkg.html13
-rw-r--r--deps/npm/docs/output/commands/npm-prefix.html5
-rw-r--r--deps/npm/docs/output/commands/npm-profile.html11
-rw-r--r--deps/npm/docs/output/commands/npm-prune.html19
-rw-r--r--deps/npm/docs/output/commands/npm-publish.html25
-rw-r--r--deps/npm/docs/output/commands/npm-rebuild.html7
-rw-r--r--deps/npm/docs/output/commands/npm-repo.html5
-rw-r--r--deps/npm/docs/output/commands/npm-restart.html5
-rw-r--r--deps/npm/docs/output/commands/npm-root.html5
-rw-r--r--deps/npm/docs/output/commands/npm-run-script.html27
-rw-r--r--deps/npm/docs/output/commands/npm-search.html15
-rw-r--r--deps/npm/docs/output/commands/npm-set-script.html3
-rw-r--r--deps/npm/docs/output/commands/npm-shrinkwrap.html3
-rw-r--r--deps/npm/docs/output/commands/npm-star.html15
-rw-r--r--deps/npm/docs/output/commands/npm-stars.html7
-rw-r--r--deps/npm/docs/output/commands/npm-start.html9
-rw-r--r--deps/npm/docs/output/commands/npm-stop.html9
-rw-r--r--deps/npm/docs/output/commands/npm-team.html15
-rw-r--r--deps/npm/docs/output/commands/npm-test.html7
-rw-r--r--deps/npm/docs/output/commands/npm-token.html7
-rw-r--r--deps/npm/docs/output/commands/npm-uninstall.html3
-rw-r--r--deps/npm/docs/output/commands/npm-unpublish.html9
-rw-r--r--deps/npm/docs/output/commands/npm-unstar.html13
-rw-r--r--deps/npm/docs/output/commands/npm-update.html27
-rw-r--r--deps/npm/docs/output/commands/npm-version.html7
-rw-r--r--deps/npm/docs/output/commands/npm-view.html5
-rw-r--r--deps/npm/docs/output/commands/npm-whoami.html5
-rw-r--r--deps/npm/docs/output/commands/npm.html27
-rw-r--r--deps/npm/docs/output/commands/npx.html7
-rw-r--r--deps/npm/docs/output/configuring-npm/folders.html45
-rw-r--r--deps/npm/docs/output/configuring-npm/install.html7
-rw-r--r--deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html5
-rw-r--r--deps/npm/docs/output/configuring-npm/npmrc.html11
-rw-r--r--deps/npm/docs/output/configuring-npm/package-json.html131
-rw-r--r--deps/npm/docs/output/configuring-npm/package-lock-json.html21
-rw-r--r--deps/npm/docs/output/using-npm/config.html223
-rw-r--r--deps/npm/docs/output/using-npm/developers.html49
-rw-r--r--deps/npm/docs/output/using-npm/orgs.html3
-rw-r--r--deps/npm/docs/output/using-npm/registry.html21
-rw-r--r--deps/npm/docs/output/using-npm/removal.html11
-rw-r--r--deps/npm/docs/output/using-npm/scope.html5
-rw-r--r--deps/npm/docs/output/using-npm/scripts.html45
-rw-r--r--deps/npm/docs/output/using-npm/workspaces.html15
-rw-r--r--deps/npm/index.js5
-rw-r--r--deps/npm/lib/arborist-cmd.js13
-rw-r--r--deps/npm/lib/auth/legacy.js15
-rw-r--r--deps/npm/lib/auth/sso.js12
-rw-r--r--deps/npm/lib/base-command.js30
-rw-r--r--deps/npm/lib/cli.js13
-rw-r--r--deps/npm/lib/commands/access.js85
-rw-r--r--deps/npm/lib/commands/adduser.js29
-rw-r--r--deps/npm/lib/commands/audit.js47
-rw-r--r--deps/npm/lib/commands/bin.js17
-rw-r--r--deps/npm/lib/commands/birthday.js5
-rw-r--r--deps/npm/lib/commands/bugs.js35
-rw-r--r--deps/npm/lib/commands/cache.js85
-rw-r--r--deps/npm/lib/commands/ci.js25
-rw-r--r--deps/npm/lib/commands/completion.js71
-rw-r--r--deps/npm/lib/commands/config.js86
-rw-r--r--deps/npm/lib/commands/dedupe.js41
-rw-r--r--deps/npm/lib/commands/deprecate.js37
-rw-r--r--deps/npm/lib/commands/diff.js100
-rw-r--r--deps/npm/lib/commands/dist-tag.js72
-rw-r--r--deps/npm/lib/commands/docs.js45
-rw-r--r--deps/npm/lib/commands/doctor.js202
-rw-r--r--deps/npm/lib/commands/edit.js34
-rw-r--r--deps/npm/lib/commands/exec.js53
-rw-r--r--deps/npm/lib/commands/explain.js66
-rw-r--r--deps/npm/lib/commands/explore.js37
-rw-r--r--deps/npm/lib/commands/find-dupes.js39
-rw-r--r--deps/npm/lib/commands/fund.js94
-rw-r--r--deps/npm/lib/commands/get.js20
-rw-r--r--deps/npm/lib/commands/help-search.js48
-rw-r--r--deps/npm/lib/commands/help.js48
-rw-r--r--deps/npm/lib/commands/hook.js69
-rw-r--r--deps/npm/lib/commands/init.js51
-rw-r--r--deps/npm/lib/commands/install-ci-test.js10
-rw-r--r--deps/npm/lib/commands/install-test.js10
-rw-r--r--deps/npm/lib/commands/install.js139
-rw-r--r--deps/npm/lib/commands/link.js66
-rw-r--r--deps/npm/lib/commands/ll.js11
-rw-r--r--deps/npm/lib/commands/logout.js30
-rw-r--r--deps/npm/lib/commands/ls.js119
-rw-r--r--deps/npm/lib/commands/org.js145
-rw-r--r--deps/npm/lib/commands/outdated.js91
-rw-r--r--deps/npm/lib/commands/owner.js94
-rw-r--r--deps/npm/lib/commands/pack.js47
-rw-r--r--deps/npm/lib/commands/ping.js20
-rw-r--r--deps/npm/lib/commands/pkg.js64
-rw-r--r--deps/npm/lib/commands/prefix.js23
-rw-r--r--deps/npm/lib/commands/profile.js105
-rw-r--r--deps/npm/lib/commands/prune.js23
-rw-r--r--deps/npm/lib/commands/publish.js75
-rw-r--r--deps/npm/lib/commands/rebuild.js53
-rw-r--r--deps/npm/lib/commands/repo.js29
-rw-r--r--deps/npm/lib/commands/restart.js23
-rw-r--r--deps/npm/lib/commands/root.js17
-rw-r--r--deps/npm/lib/commands/run-script.js118
-rw-r--r--deps/npm/lib/commands/search.js65
-rw-r--r--deps/npm/lib/commands/set-script.js35
-rw-r--r--deps/npm/lib/commands/set.js22
-rw-r--r--deps/npm/lib/commands/shrinkwrap.js22
-rw-r--r--deps/npm/lib/commands/star.js34
-rw-r--r--deps/npm/lib/commands/stars.js37
-rw-r--r--deps/npm/lib/commands/start.js23
-rw-r--r--deps/npm/lib/commands/stop.js23
-rw-r--r--deps/npm/lib/commands/team.js88
-rw-r--r--deps/npm/lib/commands/test.js23
-rw-r--r--deps/npm/lib/commands/token.js173
-rw-r--r--deps/npm/lib/commands/uninstall.js34
-rw-r--r--deps/npm/lib/commands/unpublish.js59
-rw-r--r--deps/npm/lib/commands/unstar.js25
-rw-r--r--deps/npm/lib/commands/update.js55
-rw-r--r--deps/npm/lib/commands/version.js70
-rw-r--r--deps/npm/lib/commands/view.js139
-rw-r--r--deps/npm/lib/commands/whoami.js17
-rw-r--r--deps/npm/lib/lifecycle-cmd.js4
-rw-r--r--deps/npm/lib/npm.js60
-rw-r--r--deps/npm/lib/search/format-package-stream.js6
-rw-r--r--deps/npm/lib/search/package-filter.js6
-rw-r--r--deps/npm/lib/utils/audit-error.js9
-rw-r--r--deps/npm/lib/utils/cleanup-log-files.js15
-rw-r--r--deps/npm/lib/utils/completion/installed-deep.js6
-rw-r--r--deps/npm/lib/utils/completion/installed-shallow.js3
-rw-r--r--deps/npm/lib/utils/config/definition.js127
-rw-r--r--deps/npm/lib/utils/config/definitions.js89
-rw-r--r--deps/npm/lib/utils/config/describe-all.js2
-rw-r--r--deps/npm/lib/utils/config/flatten.js5
-rw-r--r--deps/npm/lib/utils/config/index.js8
-rw-r--r--deps/npm/lib/utils/deref-command.js12
-rw-r--r--deps/npm/lib/utils/did-you-mean.js16
-rw-r--r--deps/npm/lib/utils/error-message.js153
-rw-r--r--deps/npm/lib/utils/exit-handler.js78
-rw-r--r--deps/npm/lib/utils/explain-dep.js24
-rw-r--r--deps/npm/lib/utils/explain-eresolve.js12
-rw-r--r--deps/npm/lib/utils/format-bytes.js15
-rw-r--r--deps/npm/lib/utils/get-identity.js7
-rw-r--r--deps/npm/lib/utils/get-project-scope.js6
-rw-r--r--deps/npm/lib/utils/npm-usage.js7
-rw-r--r--deps/npm/lib/utils/open-url.js22
-rw-r--r--deps/npm/lib/utils/otplease.js6
-rw-r--r--deps/npm/lib/utils/queryable.js117
-rw-r--r--deps/npm/lib/utils/read-user-info.js16
-rw-r--r--deps/npm/lib/utils/reify-finish.js11
-rw-r--r--deps/npm/lib/utils/reify-output.js36
-rw-r--r--deps/npm/lib/utils/replace-info.js6
-rw-r--r--deps/npm/lib/utils/setup-log.js20
-rw-r--r--deps/npm/lib/utils/split-package-names.js8
-rw-r--r--deps/npm/lib/utils/tar.js77
-rw-r--r--deps/npm/lib/utils/update-notifier.js18
-rw-r--r--deps/npm/lib/utils/usage.js9
-rw-r--r--deps/npm/lib/workspaces/get-workspaces.js9
-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.12
-rw-r--r--deps/npm/man/man7/developers.74
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/LICENSE22
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/LICENSE.md20
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/README.md2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/bin/prune.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/bin/reify.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js6
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js12
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js56
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js8
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js8
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js14
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js16
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js6
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js4
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/diff.js14
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/from-path.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/link.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/node.js12
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/printable.js4
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/relpath.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js8
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js4
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/vuln.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js4
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/package.json30
-rw-r--r--deps/npm/node_modules/@npmcli/node-gyp/package.json6
-rw-r--r--deps/npm/node_modules/gauge/LICENSE13
-rw-r--r--deps/npm/node_modules/gauge/LICENSE.md20
-rw-r--r--deps/npm/node_modules/gauge/lib/base-theme.js (renamed from deps/npm/node_modules/gauge/base-theme.js)10
-rw-r--r--deps/npm/node_modules/gauge/lib/demo.js45
-rw-r--r--deps/npm/node_modules/gauge/lib/error.js (renamed from deps/npm/node_modules/gauge/error.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/has-color.js (renamed from deps/npm/node_modules/gauge/has-color.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/index.js (renamed from deps/npm/node_modules/gauge/index.js)121
-rw-r--r--deps/npm/node_modules/gauge/lib/plumbing.js (renamed from deps/npm/node_modules/gauge/plumbing.js)4
-rw-r--r--deps/npm/node_modules/gauge/lib/process.js (renamed from deps/npm/node_modules/gauge/process.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/progress-bar.js (renamed from deps/npm/node_modules/gauge/progress-bar.js)16
-rw-r--r--deps/npm/node_modules/gauge/lib/render-template.js (renamed from deps/npm/node_modules/gauge/render-template.js)92
-rw-r--r--deps/npm/node_modules/gauge/lib/set-immediate.js (renamed from deps/npm/node_modules/gauge/set-immediate.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/set-interval.js (renamed from deps/npm/node_modules/gauge/set-interval.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/spin.js (renamed from deps/npm/node_modules/gauge/spin.js)0
-rw-r--r--deps/npm/node_modules/gauge/lib/template-item.js (renamed from deps/npm/node_modules/gauge/template-item.js)27
-rw-r--r--deps/npm/node_modules/gauge/lib/theme-set.js (renamed from deps/npm/node_modules/gauge/theme-set.js)54
-rw-r--r--deps/npm/node_modules/gauge/lib/themes.js (renamed from deps/npm/node_modules/gauge/themes.js)26
-rw-r--r--deps/npm/node_modules/gauge/lib/wide-truncate.js (renamed from deps/npm/node_modules/gauge/wide-truncate.js)12
-rw-r--r--deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts37
-rw-r--r--deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js10
-rw-r--r--deps/npm/node_modules/gauge/node_modules/ansi-regex/license9
-rw-r--r--deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json55
-rw-r--r--deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts17
-rw-r--r--deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js50
-rw-r--r--deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license9
-rw-r--r--deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json42
-rw-r--r--deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts29
-rw-r--r--deps/npm/node_modules/gauge/node_modules/string-width/index.js47
-rw-r--r--deps/npm/node_modules/gauge/node_modules/string-width/license9
-rw-r--r--deps/npm/node_modules/gauge/node_modules/string-width/package.json56
-rw-r--r--deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts17
-rw-r--r--deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js4
-rw-r--r--deps/npm/node_modules/gauge/node_modules/strip-ansi/license9
-rw-r--r--deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json54
-rw-r--r--deps/npm/node_modules/gauge/package.json66
-rw-r--r--deps/npm/node_modules/libnpmdiff/index.js3
-rw-r--r--deps/npm/node_modules/libnpmdiff/lib/format-diff.js14
-rw-r--r--deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js3
-rw-r--r--deps/npm/node_modules/libnpmdiff/lib/tarball.js3
-rw-r--r--deps/npm/node_modules/libnpmdiff/package.json6
-rw-r--r--deps/npm/node_modules/node-gyp/.github/workflows/visual-studio.yml25
-rw-r--r--deps/npm/node_modules/node-gyp/CHANGELOG.md8
-rw-r--r--deps/npm/node_modules/node-gyp/README.md17
-rw-r--r--deps/npm/node_modules/node-gyp/lib/configure.js12
-rw-r--r--deps/npm/node_modules/node-gyp/lib/create-config-gypi.js49
-rw-r--r--deps/npm/node_modules/node-gyp/lib/find-visualstudio.js14
-rw-r--r--deps/npm/node_modules/node-gyp/lib/node-gyp.js3
-rw-r--r--deps/npm/node_modules/node-gyp/package.json2
-rw-r--r--deps/npm/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi6
-rw-r--r--deps/npm/node_modules/node-gyp/test/test-configure-python.js5
-rw-r--r--deps/npm/node_modules/node-gyp/test/test-create-config-gypi.js47
-rw-r--r--deps/npm/node_modules/npmlog/LICENSE15
-rw-r--r--deps/npm/node_modules/npmlog/LICENSE.md20
-rw-r--r--deps/npm/node_modules/npmlog/lib/log.js (renamed from deps/npm/node_modules/npmlog/log.js)18
-rw-r--r--deps/npm/node_modules/npmlog/package.json35
-rw-r--r--deps/npm/node_modules/signal-exit/index.js297
-rw-r--r--deps/npm/node_modules/signal-exit/package.json20
-rw-r--r--deps/npm/package.json21
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs239
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs136
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/pack.js.test.cjs78
-rw-r--r--deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs19
-rw-r--r--deps/npm/test/bin/npx-cli.js14
-rw-r--r--deps/npm/test/bin/windows-shims.js4
-rw-r--r--deps/npm/test/coverage-map.js3
-rw-r--r--deps/npm/test/fixtures/mock-npm.js19
-rw-r--r--deps/npm/test/fixtures/sandbox.js12
-rw-r--r--deps/npm/test/lib/auth/legacy.js3
-rw-r--r--deps/npm/test/lib/auth/sso.js4
-rw-r--r--deps/npm/test/lib/cli.js42
-rw-r--r--deps/npm/test/lib/commands/access.js2
-rw-r--r--deps/npm/test/lib/commands/adduser.js9
-rw-r--r--deps/npm/test/lib/commands/audit.js226
-rw-r--r--deps/npm/test/lib/commands/birthday.js30
-rw-r--r--deps/npm/test/lib/commands/bugs.js4
-rw-r--r--deps/npm/test/lib/commands/cache.js22
-rw-r--r--deps/npm/test/lib/commands/ci.js9
-rw-r--r--deps/npm/test/lib/commands/completion.js690
-rw-r--r--deps/npm/test/lib/commands/config.js147
-rw-r--r--deps/npm/test/lib/commands/diff.js211
-rw-r--r--deps/npm/test/lib/commands/dist-tag.js6
-rw-r--r--deps/npm/test/lib/commands/docs.js4
-rw-r--r--deps/npm/test/lib/commands/doctor.js432
-rw-r--r--deps/npm/test/lib/commands/edit.js3
-rw-r--r--deps/npm/test/lib/commands/exec.js825
-rw-r--r--deps/npm/test/lib/commands/explore.js5
-rw-r--r--deps/npm/test/lib/commands/fund.js78
-rw-r--r--deps/npm/test/lib/commands/help-search.js22
-rw-r--r--deps/npm/test/lib/commands/help.js62
-rw-r--r--deps/npm/test/lib/commands/hook.js489
-rw-r--r--deps/npm/test/lib/commands/install-ci-test.js3
-rw-r--r--deps/npm/test/lib/commands/install-test.js3
-rw-r--r--deps/npm/test/lib/commands/install.js370
-rw-r--r--deps/npm/test/lib/commands/link.js3
-rw-r--r--deps/npm/test/lib/commands/ll.js3
-rw-r--r--deps/npm/test/lib/commands/logout.js29
-rw-r--r--deps/npm/test/lib/commands/ls.js437
-rw-r--r--deps/npm/test/lib/commands/org.js416
-rw-r--r--deps/npm/test/lib/commands/outdated.js3
-rw-r--r--deps/npm/test/lib/commands/owner.js45
-rw-r--r--deps/npm/test/lib/commands/pack.js448
-rw-r--r--deps/npm/test/lib/commands/profile.js208
-rw-r--r--deps/npm/test/lib/commands/publish.js499
-rw-r--r--deps/npm/test/lib/commands/repo.js4
-rw-r--r--deps/npm/test/lib/commands/run-script.js277
-rw-r--r--deps/npm/test/lib/commands/search.js6
-rw-r--r--deps/npm/test/lib/commands/set-script.js10
-rw-r--r--deps/npm/test/lib/commands/set.js26
-rw-r--r--deps/npm/test/lib/commands/shrinkwrap.js251
-rw-r--r--deps/npm/test/lib/commands/team.js4
-rw-r--r--deps/npm/test/lib/commands/token.js335
-rw-r--r--deps/npm/test/lib/commands/unpublish.js7
-rw-r--r--deps/npm/test/lib/commands/version.js157
-rw-r--r--deps/npm/test/lib/commands/view.js16
-rw-r--r--deps/npm/test/lib/load-all-commands.js9
-rw-r--r--deps/npm/test/lib/load-all.js4
-rw-r--r--deps/npm/test/lib/npm.js6
-rw-r--r--deps/npm/test/lib/utils/config/definitions.js91
-rw-r--r--deps/npm/test/lib/utils/error-message.js12
-rw-r--r--deps/npm/test/lib/utils/exit-handler.js12
-rw-r--r--deps/npm/test/lib/utils/open-url.js60
-rw-r--r--deps/npm/test/lib/utils/otplease.js3
-rw-r--r--deps/npm/test/lib/utils/pulse-till-done.js3
-rw-r--r--deps/npm/test/lib/utils/read-user-info.js6
-rw-r--r--deps/npm/test/lib/utils/reify-finish.js7
-rw-r--r--deps/npm/test/lib/utils/reify-output.js21
-rw-r--r--deps/npm/test/lib/utils/split-package-names.js3
-rw-r--r--deps/npm/test/lib/utils/update-notifier.js111
-rw-r--r--deps/npm/test/lib/workspaces/get-workspaces.js3
353 files changed, 8547 insertions, 7424 deletions
diff --git a/deps/npm/bin/npx-cli.js b/deps/npm/bin/npx-cli.js
index 7a3fb39837..cb05e1cb70 100755
--- a/deps/npm/bin/npx-cli.js
+++ b/deps/npm/bin/npx-cli.js
@@ -26,7 +26,7 @@ const removed = new Set([
const { definitions, shorthands } = require('../lib/utils/config/index.js')
const npmSwitches = Object.entries(definitions)
- .filter(([key, {type}]) => type === Boolean ||
+ .filter(([key, { type }]) => type === Boolean ||
(Array.isArray(type) && type.includes(Boolean)))
.map(([key]) => key)
@@ -65,9 +65,9 @@ let i
let sawRemovedFlags = false
for (i = 3; i < process.argv.length; i++) {
const arg = process.argv[i]
- if (arg === '--')
+ if (arg === '--') {
break
- else if (/^-/.test(arg)) {
+ } else if (/^-/.test(arg)) {
const [key, ...v] = arg.replace(/^-+/, '').split('=')
switch (key) {
@@ -87,8 +87,9 @@ for (i = 3; i < process.argv.length; i++) {
// resolve shorthands and run again
if (shorthands[key] && !removed.has(key)) {
const a = [...shorthands[key]]
- if (v.length)
+ if (v.length) {
a.push(v.join('='))
+ }
process.argv.splice(i, 1, ...a)
i--
continue
@@ -109,8 +110,9 @@ for (i = 3; i < process.argv.length; i++) {
if (removed.has(key)) {
// also remove the value for the cut key.
process.argv.splice(i + 1, 1)
- } else
+ } else {
i++
+ }
}
} else {
// found a positional arg, put -- in front of it, and we're done
@@ -119,7 +121,8 @@ for (i = 3; i < process.argv.length; i++) {
}
}
-if (sawRemovedFlags)
+if (sawRemovedFlags) {
console.error('See `npm help exec` for more information')
+}
cli(process)
diff --git a/deps/npm/docs/content/commands/npm-install.md b/deps/npm/docs/content/commands/npm-install.md
index a103845d1a..83b9af1e4d 100644
--- a/deps/npm/docs/content/commands/npm-install.md
+++ b/deps/npm/docs/content/commands/npm-install.md
@@ -58,7 +58,7 @@ into a tarball (b).
* `npm install` (in a package directory, no arguments):
- Install the dependencies in the local `node_modules` folder.
+ Install the dependencies to the local `node_modules` folder.
In global mode (ie, with `-g` or `--global` appended to the command),
it installs the current package context (ie, the current working
diff --git a/deps/npm/docs/content/using-npm/developers.md b/deps/npm/docs/content/using-npm/developers.md
index a76808ca67..5fc2e5876e 100644
--- a/deps/npm/docs/content/using-npm/developers.md
+++ b/deps/npm/docs/content/using-npm/developers.md
@@ -119,7 +119,9 @@ need to add them to `.npmignore` explicitly:
* `._*`
* `.DS_Store`
* `.git`
+* `.gitignore`
* `.hg`
+* `.npmignore`
* `.npmrc`
* `.lock-wscript`
* `.svn`
diff --git a/deps/npm/docs/output/commands/npm-access.html b/deps/npm/docs/output/commands/npm-access.html
index bfece57cd7..cfadcce10c 100644
--- a/deps/npm/docs/output/commands/npm-access.html
+++ b/deps/npm/docs/output/commands/npm-access.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-access</title>
<style>
body {
@@ -181,7 +182,7 @@ authentication enabled on their account.</p>
<li>
<p>ls-packages:
Show all of the packages a user or a team is able to access, along with the
-access level, except for read-only public packages (it won’t print the whole
+access level, except for read-only public packages (it won't print the whole
registry listing)</p>
</li>
<li>
@@ -209,7 +210,7 @@ public using <code>npm publish --access=public</code>, or set their access as pu
<li>You have been given read-write privileges for a package, either as a member
of a team or directly as an owner.</li>
</ul>
-<p>If you have two-factor authentication enabled then you’ll be prompted to
+<p>If you have two-factor authentication enabled then you'll be prompted to
provide an otp token, or may use the <code>--otp=...</code> option to specify it on
the command line.</p>
<p>If your account is not paid, then attempts to publish scoped packages will
@@ -222,7 +223,7 @@ fail with an HTTP 402 status code (logically enough), unless you use
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -233,7 +234,7 @@ fail with an HTTP 402 status code (logically enough), unless you use
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-adduser.html b/deps/npm/docs/output/commands/npm-adduser.html
index 99cf7d373b..7d7d606b0f 100644
--- a/deps/npm/docs/output/commands/npm-adduser.html
+++ b/deps/npm/docs/output/commands/npm-adduser.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-adduser</title>
<style>
body {
@@ -168,7 +169,7 @@ your existing record.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -176,7 +177,7 @@ your existing record.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
-<li>Default: the scope of the current project, if any, or “”</li>
+<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html
index 570638420f..95167a3c32 100644
--- a/deps/npm/docs/output/commands/npm-audit.html
+++ b/deps/npm/docs/output/commands/npm-audit.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-audit</title>
<style>
body {
@@ -159,13 +160,13 @@ provided, then remediations will be applied to the package tree.</p>
<p>The command will exit with a 0 exit code if no vulnerabilities were found.</p>
<p>Note that some vulnerabilities cannot be fixed automatically and will
require manual intervention or review. Also note that since <code>npm audit fix</code> runs a full-fledged <code>npm install</code> under the hood, all configs that
-apply to the installer will also apply to <code>npm install</code> – so things like
+apply to the installer will also apply to <code>npm install</code> -- so things like
<code>npm audit fix --package-lock-only</code> will work as expected.</p>
<p>By default, the audit command will exit with a non-zero code if any
vulnerability is found. It may be useful in CI environments to include the
<code>--audit-level</code> parameter to specify the minimum vulnerability level that
will cause the command to fail. This option does not filter the report
-output, it simply changes the command’s failure threshold.</p>
+output, it simply changes the command's failure threshold.</p>
<h3 id="audit-endpoints">Audit Endpoints</h3>
<p>There are two audit endpoints that npm may use to fetch vulnerability
information: the <code>Bulk Advisory</code> endpoint and the <code>Quick Audit</code> endpoint.</p>
@@ -203,7 +204,7 @@ with the following pieces of additional metadata:</p>
<p>All packages in the tree are submitted to the Quick Audit endpoint.
Omitted dependency types are skipped when generating the report.</p>
<h4 id="scrubbing">Scrubbing</h4>
-<p>Out of an abundance of caution, npm versions 5 and 6 would “scrub” any
+<p>Out of an abundance of caution, npm versions 5 and 6 would "scrub" any
packages from the submitted report if their name contained a <code>/</code> character,
so as to avoid leaking the names of potentially private packages or git
URLs.</p>
@@ -215,12 +216,12 @@ in package trees that used git dependencies or private modules.</p>
<h4 id="calculating-meta-vulnerabilities-and-remediations">Calculating Meta-Vulnerabilities and Remediations</h4>
<p>npm uses the
<a href="http://npm.im/@npmcli/metavuln-calculator"><code>@npmcli/metavuln-calculator</code></a>
-module to turn a set of security advisories into a set of “vulnerability”
-objects. A “meta-vulnerability” is a dependency that is vulnerable by
+module to turn a set of security advisories into a set of "vulnerability"
+objects. A "meta-vulnerability" is a dependency that is vulnerable by
virtue of dependence on vulnerable versions of a vulnerable package.</p>
<p>For example, if the package <code>foo</code> is vulnerable in the range <code>&gt;=1.0.2 &lt;2.0.0</code>, and the package <code>bar</code> depends on <code>foo@^1.1.0</code>, then that version
of <code>bar</code> can only be installed by installing a vulnerable version of <code>foo</code>.
-In this case, <code>bar</code> is a “metavulnerability”.</p>
+In this case, <code>bar</code> is a "metavulnerability".</p>
<p>Once metavulnerabilities for a given package are calculated, they are
cached in the <code>~/.npm</code> folder and only re-evaluated if the advisory range
changes, or a new version of the package is published (in which case, the
@@ -275,7 +276,7 @@ fixing anything:</p>
<h4 id="audit-level"><code>audit-level</code></h4>
<ul>
<li>Default: null</li>
-<li>Type: null, “info”, “low”, “moderate”, “high”, “critical”, or “none”</li>
+<li>Type: null, "info", "low", "moderate", "high", "critical", or "none"</li>
</ul>
<p>The minimum level of vulnerability for <code>npm audit</code> to exit with a non-zero
exit code.</p>
@@ -286,7 +287,7 @@ exit code.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -316,7 +317,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
-<p>If you don’t have a clear idea of what you want to do, it is strongly
+<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -348,9 +349,9 @@ instead of checking <code>node_modules</code> and downloading dependencies.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
diff --git a/deps/npm/docs/output/commands/npm-bin.html b/deps/npm/docs/output/commands/npm-bin.html
index 073b26d46d..3bf26a23f8 100644
--- a/deps/npm/docs/output/commands/npm-bin.html
+++ b/deps/npm/docs/output/commands/npm-bin.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-bin</title>
<style>
body {
@@ -159,7 +160,7 @@ npm command-line interface
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
diff --git a/deps/npm/docs/output/commands/npm-bugs.html b/deps/npm/docs/output/commands/npm-bugs.html
index e9e40aecec..5f19271570 100644
--- a/deps/npm/docs/output/commands/npm-bugs.html
+++ b/deps/npm/docs/output/commands/npm-bugs.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-bugs</title>
<style>
body {
@@ -150,7 +151,7 @@ npm command-line interface
aliases: issues
</code></pre>
<h3 id="description">Description</h3>
-<p>This command tries to guess at the likely location of a package’s bug
+<p>This command tries to guess at the likely location of a package's bug
tracker URL or the <code>mailto</code> URL of the support email, and then tries to
open it using the <code>--browser</code> config param. If no package name is provided, it
will search for a <code>package.json</code> in the current folder and use the <code>name</code> property.</p>
@@ -171,7 +172,7 @@ terminal.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-cache.html b/deps/npm/docs/output/commands/npm-cache.html
index a8c2ed8e7d..88ccd2facd 100644
--- a/deps/npm/docs/output/commands/npm-cache.html
+++ b/deps/npm/docs/output/commands/npm-cache.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-cache</title>
<style>
body {
@@ -141,7 +142,7 @@ npm command-line interface
<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
-<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#details">Details</a></li><li><a href="#a-note-about-the-caches-design">A note about the cache’s design</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#cache"><code>cache</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
+<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#details">Details</a></li><li><a href="#a-note-about-the-caches-design">A note about the cache's design</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#cache"><code>cache</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
</section>
<div id="_content"><h3 id="synopsis">Synopsis</h3>
@@ -168,7 +169,7 @@ add data to the local installation cache explicitly.</p>
<li>
<p>clean:
Delete all data out of the cache folder. Note that this is typically
-unnecessary, as npm’s cache is self-healing and resistant to data
+unnecessary, as npm's cache is self-healing and resistant to data
corruption issues.</p>
</li>
<li>
@@ -195,7 +196,7 @@ manage the contents of this cache. In order to access it, <code>cacache</code> m
used directly.</p>
<p>npm will not remove data by itself: the cache will grow as new packages are
installed.</p>
-<h3 id="a-note-about-the-caches-design">A note about the cache’s design</h3>
+<h3 id="a-note-about-the-caches-design">A note about the cache's design</h3>
<p>The npm cache is strictly a cache: it should not be relied upon as a
persistent and reliable data store for package data. npm makes no guarantee
that a previously-cached piece of data will be available later, and will
@@ -212,7 +213,7 @@ data that was inserted.</p>
<li>Default: Windows: <code>%LocalAppData%\npm-cache</code>, Posix: <code>~/.npm</code></li>
<li>Type: Path</li>
</ul>
-<p>The location of npm’s cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
+<p>The location of npm's cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-ci.html b/deps/npm/docs/output/commands/npm-ci.html
index e52cf55e9e..d2beab0364 100644
--- a/deps/npm/docs/output/commands/npm-ci.html
+++ b/deps/npm/docs/output/commands/npm-ci.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-ci</title>
<style>
body {
@@ -149,9 +150,9 @@ npm command-line interface
</code></pre>
<h3 id="description">Description</h3>
<p>This command is similar to <a href="../commands/npm-install.html"><code>npm install</code></a>, except
-it’s meant to be used in automated environments such as test platforms,
-continuous integration, and deployment – or any situation where you want
-to make sure you’re doing a clean install of your dependencies.</p>
+it's meant to be used in automated environments such as test platforms,
+continuous integration, and deployment -- or any situation where you want
+to make sure you're doing a clean install of your dependencies.</p>
<p><code>npm ci</code> will be significantly faster when:</p>
<ul>
<li>There is a <code>package-lock.json</code> or <code>npm-shrinkwrap.json</code> file.</li>
@@ -199,7 +200,7 @@ cache:
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -219,7 +220,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-completion.html b/deps/npm/docs/output/commands/npm-completion.html
index b99d52b420..a8351c874b 100644
--- a/deps/npm/docs/output/commands/npm-completion.html
+++ b/deps/npm/docs/output/commands/npm-completion.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-completion</title>
<style>
body {
@@ -162,7 +163,7 @@ such as <code>/usr/local/etc/bash_completion.d/npm</code> or
<code>/etc/bash_completion.d/npm</code> if you have a system that will read
that file for you.</p>
<p>When <code>COMP_CWORD</code>, <code>COMP_LINE</code>, and <code>COMP_POINT</code> are defined in the
-environment, <code>npm completion</code> acts in “plumbing mode”, and outputs
+environment, <code>npm completion</code> acts in "plumbing mode", and outputs
completions based on the arguments.</p>
<h3 id="see-also">See Also</h3>
<ul>
diff --git a/deps/npm/docs/output/commands/npm-config.html b/deps/npm/docs/output/commands/npm-config.html
index cbf13aff8d..9f1e1f2b37 100644
--- a/deps/npm/docs/output/commands/npm-config.html
+++ b/deps/npm/docs/output/commands/npm-config.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-config</title>
<style>
body {
@@ -219,7 +220,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -232,8 +233,8 @@ of the current working directory.</li>
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
-<li>Default: The EDITOR or VISUAL environment variables, or ‘notepad.exe’ on
-Windows, or ‘vim’ on Unix systems</li>
+<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
+Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>
@@ -241,9 +242,9 @@ Windows, or ‘vim’ on Unix systems</li>
<!-- raw HTML omitted -->
<h4 id="location"><code>location</code></h4>
<ul>
-<li>Default: “user” unless <code>--global</code> is passed, which will also set this value
-to “global”</li>
-<li>Type: “global”, “user”, or “project”</li>
+<li>Default: "user" unless <code>--global</code> is passed, which will also set this value
+to "global"</li>
+<li>Type: "global", "user", or "project"</li>
</ul>
<p>When passed to <code>npm config</code> this refers to which config file to use.</p>
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-dedupe.html b/deps/npm/docs/output/commands/npm-dedupe.html
index 6541cb0b24..ea811c28e9 100644
--- a/deps/npm/docs/output/commands/npm-dedupe.html
+++ b/deps/npm/docs/output/commands/npm-dedupe.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-dedupe</title>
<style>
body {
@@ -167,7 +168,7 @@ be more effectively shared by multiple dependent packages.</p>
+-- d
`-- c@1.0.10
</code></pre>
-<p>Because of the hierarchical nature of node’s module lookup, b and d
+<p>Because of the hierarchical nature of node's module lookup, b and d
will both get their dependency met by the single c package at the root
level of the tree.</p>
<p>In some cases, you may have a dependency graph like this:</p>
@@ -178,7 +179,7 @@ level of the tree.</p>
`-- c@1.9.9
</code></pre>
<p>During the installation process, the <code>c@1.0.3</code> dependency for <code>b</code> was
-placed in the root of the tree. Though <code>d</code>’s dependency on <code>c@1.x</code> could
+placed in the root of the tree. Though <code>d</code>'s dependency on <code>c@1.x</code> could
have been satisfied by <code>c@1.0.3</code>, the newer <code>c@1.9.0</code> dependency was used,
because npm favors updates by default, even when doing so causes
duplication.</p>
@@ -231,7 +232,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -251,9 +252,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -282,7 +283,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -296,7 +297,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -305,7 +306,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -314,7 +315,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-deprecate.html b/deps/npm/docs/output/commands/npm-deprecate.html
index 5ed7165983..e95ecf85ab 100644
--- a/deps/npm/docs/output/commands/npm-deprecate.html
+++ b/deps/npm/docs/output/commands/npm-deprecate.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-deprecate</title>
<style>
body {
@@ -171,7 +172,7 @@ format an empty string.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -182,7 +183,7 @@ format an empty string.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-diff.html b/deps/npm/docs/output/commands/npm-diff.html
index 1f674ec563..171113201e 100644
--- a/deps/npm/docs/output/commands/npm-diff.html
+++ b/deps/npm/docs/output/commands/npm-diff.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-diff</title>
<style>
body {
@@ -158,13 +159,13 @@ of files for packages published to the npm registry.</p>
<li>
<p><code>npm diff --diff=&lt;spec-a&gt; --diff=&lt;spec-b&gt;</code></p>
<p>Compares two package versions using their registry specifiers, e.g:
-<code>npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0</code>. It’s also possible to
+<code>npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0</code>. It's also possible to
compare across forks of any package,
e.g: <code>npm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0</code>.</p>
-<p>Any valid spec can be used, so that it’s also possible to compare
+<p>Any valid spec can be used, so that it's also possible to compare
directories or git repositories,
e.g: <code>npm diff --diff=pkg@latest --diff=./packages/pkg</code></p>
-<p>Here’s an example comparing two different versions of a package named
+<p>Here's an example comparing two different versions of a package named
<code>abbrev</code> from the registry:</p>
<pre lang="bash"><code>npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1
</code></pre>
@@ -220,7 +221,7 @@ newer one if the version numbers are not the same.</p>
</li>
<li>
<p><code>npm diff --diff=&lt;spec-a&gt;</code> (in a package directory):</p>
-<p>Similar to using only a single package name, it’s also possible to declare
+<p>Similar to using only a single package name, it's also possible to declare
a full registry specifier version if you wish to compare the local version
of an installed package with the specific version/tag/semver-range provided
in <code>&lt;spec-a&gt;</code>.</p>
@@ -240,7 +241,7 @@ to compare different versions of the current package.</p>
<code>npm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1</code>.</p>
<p>If only a single argument <code>&lt;version-a&gt;</code> is provided, then the current local
file system is going to be compared against that version.</p>
-<p>Here’s an example comparing two specific versions (published to the
+<p>Here's an example comparing two specific versions (published to the
configured registry) of the current project directory:</p>
<pre lang="bash"><code>npm diff --diff=1.0.0 --diff=1.1.0
</code></pre>
@@ -249,7 +250,7 @@ configured registry) of the current project directory:</p>
<p>Note that tag names are not valid <code>--diff</code> argument values, if you wish to
compare to a published tag, you must use the <code>pkg@tagname</code> syntax.</p>
<h4 id="filtering-files">Filtering files</h4>
-<p>It’s possible to also specify positional arguments using file names or globs
+<p>It's possible to also specify positional arguments using file names or globs
pattern matching in order to limit the result of diff patches to only a subset
of files for a given package, e.g:</p>
<pre lang="bash"><code>npm diff --diff=pkg@2 ./lib/ CHANGELOG.md
@@ -305,7 +306,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<!-- raw HTML omitted -->
<h4 id="diff-src-prefix"><code>diff-src-prefix</code></h4>
<ul>
-<li>Default: “a/”</li>
+<li>Default: "a/"</li>
<li>Type: String</li>
</ul>
<p>Source prefix to be used in <code>npm diff</code> output.</p>
@@ -313,7 +314,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<!-- raw HTML omitted -->
<h4 id="diff-dst-prefix"><code>diff-dst-prefix</code></h4>
<ul>
-<li>Default: “b/”</li>
+<li>Default: "b/"</li>
<li>Type: String</li>
</ul>
<p>Destination prefix to be used in <code>npm diff</code> output.</p>
@@ -332,7 +333,7 @@ located within the folder <code>./lib/</code> and changed lines of code within t
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -345,10 +346,10 @@ of the current working directory.</li>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
-<li>Default: “latest”</li>
+<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
-<p>If you ask npm to install a package and don’t tell it a specific version,
+<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>
diff --git a/deps/npm/docs/output/commands/npm-dist-tag.html b/deps/npm/docs/output/commands/npm-dist-tag.html
index 0d0fa47272..9448432a78 100644
--- a/deps/npm/docs/output/commands/npm-dist-tag.html
+++ b/deps/npm/docs/output/commands/npm-dist-tag.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-dist-tag</title>
<style>
body {
diff --git a/deps/npm/docs/output/commands/npm-docs.html b/deps/npm/docs/output/commands/npm-docs.html
index ffa95f892b..01094eba1d 100644
--- a/deps/npm/docs/output/commands/npm-docs.html
+++ b/deps/npm/docs/output/commands/npm-docs.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-docs</title>
<style>
body {
@@ -150,7 +151,7 @@ npm command-line interface
aliases: home
</code></pre>
<h3 id="description">Description</h3>
-<p>This command tries to guess at the likely location of a package’s
+<p>This command tries to guess at the likely location of a package's
documentation URL, and then tries to open it using the <code>--browser</code> config
param. You can pass multiple package names at once. If no package name is
provided, it will search for a <code>package.json</code> in the current folder and use
@@ -172,7 +173,7 @@ terminal.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-doctor.html b/deps/npm/docs/output/commands/npm-doctor.html
index 9f81f5c83d..2f42a6238e 100644
--- a/deps/npm/docs/output/commands/npm-doctor.html
+++ b/deps/npm/docs/output/commands/npm-doctor.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-doctor</title>
<style>
body {
@@ -158,10 +159,10 @@ standalone tool, but it does have some basic requirements that must be met:</p>
uses the registry API, is available.</li>
<li>The directories that npm uses, <code>node_modules</code> (both locally and
globally), exist and can be written by the current user.</li>
-<li>The npm cache exists, and the package tarballs within it aren’t corrupt.</li>
+<li>The npm cache exists, and the package tarballs within it aren't corrupt.</li>
</ul>
<p>Without all of these working properly, npm may not work properly. Many
-issues are often attributable to things that are outside npm’s code base,
+issues are often attributable to things that are outside npm's code base,
so <code>npm doctor</code> confirms that the npm installation is in a good state.</p>
<p>Also, in addition to this, there are also very many issue reports due to
using old versions of npm. Since npm is constantly improving, running
@@ -174,48 +175,48 @@ are any recommended changes, it will display them.</p>
registry. This can also be checked with <code>npm ping</code>. If this check fails,
you may be using a proxy that needs to be configured, or may need to talk
to your IT staff to get access over HTTPS to <code>registry.npmjs.org</code>.</p>
-<p>This check is done against whichever registry you’ve configured (you can
-see what that is by running <code>npm config get registry</code>), and if you’re using
-a private registry that doesn’t support the <code>/whoami</code> endpoint supported by
+<p>This check is done against whichever registry you've configured (you can
+see what that is by running <code>npm config get registry</code>), and if you're using
+a private registry that doesn't support the <code>/whoami</code> endpoint supported by
the primary registry, this check may fail.</p>
<h4 id="npm--v"><code>npm -v</code></h4>
-<p>While Node.js may come bundled with a particular version of npm, it’s the
+<p>While Node.js may come bundled with a particular version of npm, it's the
policy of the CLI team that we recommend all users run <code>npm@latest</code> if they
can. As the CLI is maintained by a small team of contributors, there are
-only resources for a single line of development, so npm’s own long-term
+only resources for a single line of development, so npm's own long-term
support releases typically only receive critical security and regression
fixes. The team believes that the latest tested version of npm is almost
always likely to be the most functional and defect-free version of npm.</p>
<h4 id="node--v"><code>node -v</code></h4>
<p>For most users, in most circumstances, the best version of Node will be the
latest long-term support (LTS) release. Those of you who want access to new
-ECMAscript features or bleeding-edge changes to Node’s standard library may
+ECMAscript features or bleeding-edge changes to Node's standard library may
be running a newer version, and some may be required to run an older
-version of Node because of enterprise change control policies. That’s OK!
+version of Node because of enterprise change control policies. That's OK!
But in general, the npm team recommends that most users run Node.js LTS.</p>
<h4 id="npm-config-get-registry"><code>npm config get registry</code></h4>
<p>You may be installing from private package registries for your project or
-company. That’s great! Others may be following tutorials or StackOverflow
+company. That's great! Others may be following tutorials or StackOverflow
questions in an effort to troubleshoot problems you may be having.
-Sometimes, this may entail changing the registry you’re pointing at. This
-part of <code>npm doctor</code> just lets you, and maybe whoever’s helping you with
-support, know that you’re not using the default registry.</p>
+Sometimes, this may entail changing the registry you're pointing at. This
+part of <code>npm doctor</code> just lets you, and maybe whoever's helping you with
+support, know that you're not using the default registry.</p>
<h4 id="which-git"><code>which git</code></h4>
-<p>While it’s documented in the README, it may not be obvious that npm needs
+<p>While it's documented in the README, it may not be obvious that npm needs
Git installed to do many of the things that it does. Also, in some cases
-–&nbsp;especially on Windows –&nbsp;you may have Git set up in such a way that it’s
+–&nbsp;especially on Windows –&nbsp;you may have Git set up in such a way that it's
not accessible via your <code>PATH</code> so that npm can find it. This check ensures
that Git is available.</p>
<h4 id="permissions-checks">Permissions checks</h4>
<ul>
<li>Your cache must be readable and writable by the user running npm.</li>
<li>Global package binaries must be writable by the user running npm.</li>
-<li>Your local <code>node_modules</code> path, if you’re running <code>npm doctor</code> with a
+<li>Your local <code>node_modules</code> path, if you're running <code>npm doctor</code> with a
project directory, must be readable and writable by the user running npm.</li>
</ul>
<h4 id="validate-the-checksums-of-cached-packages">Validate the checksums of cached packages</h4>
<p>When an npm package is published, the publishing process generates a
-checksum that npm uses at install time to verify that the package didn’t
+checksum that npm uses at install time to verify that the package didn't
get corrupted in transit. <code>npm doctor</code> uses these checksums to validate the
package tarballs in your local cache (you can see where that cache is
located with <code>npm config get cache</code>). In the event that there are corrupt
@@ -227,7 +228,7 @@ reset the cache.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-edit.html b/deps/npm/docs/output/commands/npm-edit.html
index 5adf831eab..7b5cf1ca36 100644
--- a/deps/npm/docs/output/commands/npm-edit.html
+++ b/deps/npm/docs/output/commands/npm-edit.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-edit</title>
<style>
body {
@@ -150,8 +151,8 @@ npm command-line interface
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>Selects a dependency in the current project and opens the package folder in
-the default editor (or whatever you’ve configured as the npm <code>editor</code>
-config – see <a href="npm-config"><code>npm-config</code></a>.)</p>
+the default editor (or whatever you've configured as the npm <code>editor</code>
+config -- see <a href="npm-config"><code>npm-config</code></a>.)</p>
<p>After it has been edited, the package is rebuilt so as to pick up any
changes in compiled packages.</p>
<p>For instance, you can do <code>npm install connect</code> to install connect
@@ -163,8 +164,8 @@ changes to your locally installed copy.</p>
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
-<li>Default: The EDITOR or VISUAL environment variables, or ‘notepad.exe’ on
-Windows, or ‘vim’ on Unix systems</li>
+<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
+Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-exec.html b/deps/npm/docs/output/commands/npm-exec.html
index 2325a1e11d..eeb8946b7d 100644
--- a/deps/npm/docs/output/commands/npm-exec.html
+++ b/deps/npm/docs/output/commands/npm-exec.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-exec</title>
<style>
body {
@@ -207,7 +208,7 @@ the first command argument.</p>
<h3 id="npx-vs-npm-exec"><code>npx</code> vs <code>npm exec</code></h3>
<p>When run via the <code>npx</code> binary, all flags and options <em>must</em> be set prior to
any positional arguments. When run via <code>npm exec</code>, a double-hyphen <code>--</code>
-flag can be used to suppress npm’s parsing of switches and options that
+flag can be used to suppress npm's parsing of switches and options that
should be sent to the executed command.</p>
<p>For example:</p>
<pre><code>$ npx foo@latest bar --package=@npmcli/foo
@@ -218,7 +219,7 @@ following command:</p>
</code></pre>
<p>Since the <code>--package</code> option comes <em>after</em> the positional arguments, it is
treated as an argument to the executed command.</p>
-<p>In contrast, due to npm’s argument parsing logic, running this command is
+<p>In contrast, due to npm's argument parsing logic, running this command is
different:</p>
<pre><code>$ npm exec foo@latest bar --package=@npmcli/foo
</code></pre>
@@ -246,7 +247,7 @@ thus be equivalent to the <code>npx</code> command above:</p>
<!-- raw HTML omitted -->
<h4 id="call"><code>call</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Optional companion option for <code>npm exec</code>, <code>npx</code> that allows for specifying a
@@ -348,12 +349,12 @@ at a time.</p>
</code></pre>
<p>You can execute an arbitrary command from a package in the context of each of
the configured workspaces when using the <code>workspaces</code> configuration options,
-in this example we’re using <strong>eslint</strong> to lint any js file found within each
+in this example we're using <strong>eslint</strong> to lint any js file found within each
workspace folder:</p>
<pre><code>npm exec --ws -- eslint ./*.js
</code></pre>
<h4 id="filtering-workspaces">Filtering workspaces</h4>
-<p>It’s also possible to execute a command in a single workspace using the
+<p>It's also possible to execute a command in a single workspace using the
<code>workspace</code> config along with a name or directory path:</p>
<pre><code>npm exec --workspace=a -- eslint ./*.js
</code></pre>
diff --git a/deps/npm/docs/output/commands/npm-explain.html b/deps/npm/docs/output/commands/npm-explain.html
index 8032ccf3a9..4c0ef6dc80 100644
--- a/deps/npm/docs/output/commands/npm-explain.html
+++ b/deps/npm/docs/output/commands/npm-explain.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-explain</title>
<style>
body {
@@ -155,7 +156,7 @@ to be installed in the current project.</p>
<p>Positional arguments can be either folders within <code>node_modules</code>, or
<code>name@version-range</code> specifiers, which will select the dependency
relationships to explain.</p>
-<p>For example, running <code>npm explain glob</code> within npm’s source tree will show:</p>
+<p>For example, running <code>npm explain glob</code> within npm's source tree will show:</p>
<pre lang="bash"><code>glob@7.1.6
node_modules/glob
glob@"^7.1.4" from the root project
diff --git a/deps/npm/docs/output/commands/npm-explore.html b/deps/npm/docs/output/commands/npm-explore.html
index b5c2d1e870..5082ce5bac 100644
--- a/deps/npm/docs/output/commands/npm-explore.html
+++ b/deps/npm/docs/output/commands/npm-explore.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-explore</title>
<style>
body {
@@ -164,7 +165,7 @@ sure to use <code>npm rebuild &lt;pkg&gt;</code> if you make any changes.</p>
<!-- raw HTML omitted -->
<h4 id="shell"><code>shell</code></h4>
<ul>
-<li>Default: SHELL environment variable, or “bash” on Posix, or “cmd.exe” on
+<li>Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on
Windows</li>
<li>Type: String</li>
</ul>
diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html
index ef4953c899..8625c3d098 100644
--- a/deps/npm/docs/output/commands/npm-find-dupes.html
+++ b/deps/npm/docs/output/commands/npm-find-dupes.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-find-dupes</title>
<style>
body {
@@ -190,7 +191,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -210,9 +211,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -241,7 +242,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -255,7 +256,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -264,7 +265,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-fund.html b/deps/npm/docs/output/commands/npm-fund.html
index 68ef6d8c90..af7991b542 100644
--- a/deps/npm/docs/output/commands/npm-fund.html
+++ b/deps/npm/docs/output/commands/npm-fund.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-fund</title>
<style>
body {
@@ -161,10 +162,10 @@ share the same url as a single entry. Thus, the list does not have the same
shape of the output from <code>npm ls</code>.</p>
<h4 id="example">Example</h4>
<h3 id="workspaces-support">Workspaces support</h3>
-<p>It’s possible to filter the results to only include a single workspace and its
+<p>It's possible to filter the results to only include a single workspace and its
dependencies using the <code>workspace</code> config option.</p>
<h4 id="example2">Example:</h4>
-<p>Here’s an example running <code>npm fund</code> in a project with a configured
+<p>Here's an example running <code>npm fund</code> in a project with a configured
workspace <code>a</code>:</p>
<pre lang="bash"><code>$ npm fund
test-workspaces-fund@1.0.0
diff --git a/deps/npm/docs/output/commands/npm-help-search.html b/deps/npm/docs/output/commands/npm-help-search.html
index 1bef039df2..ae74307085 100644
--- a/deps/npm/docs/output/commands/npm-help-search.html
+++ b/deps/npm/docs/output/commands/npm-help-search.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-help-search</title>
<style>
body {
diff --git a/deps/npm/docs/output/commands/npm-help.html b/deps/npm/docs/output/commands/npm-help.html
index c171cb8ba0..83d02736e5 100644
--- a/deps/npm/docs/output/commands/npm-help.html
+++ b/deps/npm/docs/output/commands/npm-help.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-help</title>
<style>
body {
@@ -160,7 +161,7 @@ topic, so unique matches are equivalent to specifying a topic name.</p>
<!-- raw HTML omitted -->
<h4 id="viewer"><code>viewer</code></h4>
<ul>
-<li>Default: “man” on Posix, “browser” on Windows</li>
+<li>Default: "man" on Posix, "browser" on Windows</li>
<li>Type: String</li>
</ul>
<p>The program to use to view help content.</p>
diff --git a/deps/npm/docs/output/commands/npm-hook.html b/deps/npm/docs/output/commands/npm-hook.html
index a247dacf0a..79e5c8719c 100644
--- a/deps/npm/docs/output/commands/npm-hook.html
+++ b/deps/npm/docs/output/commands/npm-hook.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-hook</title>
<style>
body {
@@ -183,7 +184,7 @@ the request came from your own configured hook.</p>
<p>List your active hooks for the <code>lodash</code> package:</p>
<pre lang="bash"><code>$ npm hook ls lodash
</code></pre>
-<p>Update an existing hook’s url:</p>
+<p>Update an existing hook's url:</p>
<pre lang="bash"><code>$ npm hook update id-deadbeef https://my-new-website.here/
</code></pre>
<p>Remove a hook:</p>
@@ -195,7 +196,7 @@ the request came from your own configured hook.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -206,7 +207,7 @@ the request came from your own configured hook.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
@@ -215,7 +216,7 @@ password, npm will prompt on the command line for one.</p>
<!-- raw HTML omitted -->
<h3 id="see-also">See Also</h3>
<ul>
-<li><a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">“Introducing Hooks” blog post</a></li>
+<li><a href="https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm">"Introducing Hooks" blog post</a></li>
</ul>
</div>
diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html
index b6cc14c8c6..530e75fcd0 100644
--- a/deps/npm/docs/output/commands/npm-init.html
+++ b/deps/npm/docs/output/commands/npm-init.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-init</title>
<style>
body {
@@ -155,7 +156,7 @@ npm init [-w &lt;dir&gt;] [args...]
package.</p>
<p><code>initializer</code> in this case is an npm package named <code>create-&lt;initializer&gt;</code>,
which will be installed by <a href="../commands/npm-exec.html"><code>npm-exec</code></a>, and then have its
-main bin executed – presumably creating or updating <code>package.json</code> and
+main bin executed -- presumably creating or updating <code>package.json</code> and
running any other initialization-related operations.</p>
<p>The init command is transformed to a corresponding <code>npm exec</code> operation as
follows:</p>
@@ -173,7 +174,7 @@ set. You can also use <code>-y</code>/<code>--yes</code> to skip the questionnai
you pass <code>--scope</code>, it will create a scoped package.</p>
<h4 id="forwarding-additional-options">Forwarding additional options</h4>
<p>Any additional options will be passed directly to the command, so <code>npm init foo -- --hello</code> will map to <code>npm exec -- create-foo --hello</code>.</p>
-<p>To better illustrate how options are forwarded, here’s a more evolved
+<p>To better illustrate how options are forwarded, here's a more evolved
example showing options passed to both the <strong>npm cli</strong> and a create package,
both following commands are equivalent:</p>
<ul>
@@ -199,7 +200,7 @@ $ npm init
<pre lang="bash"><code>$ npm init -y
</code></pre>
<h3 id="workspaces-support">Workspaces support</h3>
-<p>It’s possible to create a new workspace within your project by using the
+<p>It's possible to create a new workspace within your project by using the
<code>workspace</code> config option. When using <code>npm init -w &lt;dir&gt;</code> the cli will
create the folders and boilerplate expected while also adding a reference
to your project <code>package.json</code> <code>"workspaces": []</code> property in order to make
@@ -230,7 +231,7 @@ project and configure your <code>package.json</code> to recognize it as such:</p
</code></pre>
<p>This will make sure to generate your react app as expected, one important
consideration to have in mind is that <code>npm exec</code> is going to be run in the
-context of the newly created folder for that workspace, and that’s the reason
+context of the newly created folder for that workspace, and that's the reason
why in this example the initializer uses the initializer name followed with a
dot to represent the current directory in that context, e.g: <code>react-app .</code>:</p>
<pre><code>.
@@ -252,7 +253,7 @@ dot to represent the current directory in that context, e.g: <code>react-app .</
<li>Default: null</li>
<li>Type: null or Boolean</li>
</ul>
-<p>Automatically answer “yes” to any prompts that npm might print on the
+<p>Automatically answer "yes" to any prompts that npm might print on the
command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -278,7 +279,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
-<p>If you don’t have a clear idea of what you want to do, it is strongly
+<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-install-ci-test.html b/deps/npm/docs/output/commands/npm-install-ci-test.html
index 46446a2e5b..1c9fea51e1 100644
--- a/deps/npm/docs/output/commands/npm-install-ci-test.html
+++ b/deps/npm/docs/output/commands/npm-install-ci-test.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-install-ci-test</title>
<style>
body {
@@ -160,7 +161,7 @@ alias: npm cit
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -180,7 +181,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-install-test.html b/deps/npm/docs/output/commands/npm-install-test.html
index 06e45ea1d7..833e285542 100644
--- a/deps/npm/docs/output/commands/npm-install-test.html
+++ b/deps/npm/docs/output/commands/npm-install-test.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-install-test</title>
<style>
body {
@@ -180,7 +181,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
-rather than using npm’s default semver range operator.</p>
+rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@@ -188,7 +189,7 @@ rather than using npm’s default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -235,7 +236,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -255,9 +256,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -286,7 +287,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -300,7 +301,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -309,7 +310,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -318,7 +319,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html
index 3efebc033a..657e13ad02 100644
--- a/deps/npm/docs/output/commands/npm-install.html
+++ b/deps/npm/docs/output/commands/npm-install.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-install</title>
<style>
body {
@@ -182,7 +183,7 @@ following order of precedence:</p>
<a href="../using-npm/registry.html"><code>registry</code></a>) with (c)</li>
<li>e) a <code>&lt;name&gt;@&lt;tag&gt;</code> (see <a href="../commands/npm-dist-tag.html"><code>npm dist-tag</code></a>) that
points to (d)</li>
-<li>f) a <code>&lt;name&gt;</code> that has a “latest” tag satisfying (e)</li>
+<li>f) a <code>&lt;name&gt;</code> that has a "latest" tag satisfying (e)</li>
<li>g) a <code>&lt;git remote url&gt;</code> that resolves to (a)</li>
</ul>
<p>Even if you never publish your package, you can still get a lot of benefits
@@ -192,7 +193,7 @@ into a tarball (b).</p>
<ul>
<li>
<p><code>npm install</code> (in a package directory, no arguments):</p>
-<p>Install the dependencies in the local <code>node_modules</code> folder.</p>
+<p>Install the dependencies to the local <code>node_modules</code> folder.</p>
<p>In global mode (ie, with <code>-g</code> or <code>--global</code> appended to the command),
it installs the current package context (ie, the current working
directory) as a global package.</p>
@@ -211,7 +212,7 @@ dependency to a project.</p>
<li>
<p><code>npm install &lt;folder&gt;</code>:</p>
<p>Install the package in the directory as a symlink in the current
-project. Its dependencies will be installed before it’s linked. If
+project. Its dependencies will be installed before it's linked. If
<code>&lt;folder&gt;</code> sits inside the root of your project, its dependencies may
be hoisted to the top-level <code>node_modules</code> as they would for other
types of dependencies.</p>
@@ -238,15 +239,15 @@ when installing the package (an equivalent of <code>tar x --strip-components=1</
<li>
<p><code>npm install &lt;tarball url&gt;</code>:</p>
<p>Fetch the tarball url, and then install it. In order to distinguish between
-this and other options, the argument must start with “http://” or “https://”</p>
+this and other options, the argument must start with "http://" or "https://"</p>
<p>Example:</p>
<pre lang="bash"><code>npm install https://github.com/indexzero/forever/tarball/v0.5.6
</code></pre>
</li>
<li>
<p><code>npm install [&lt;@scope&gt;/]&lt;name&gt;</code>:</p>
-<p>Do a <code>&lt;name&gt;@&lt;tag&gt;</code> install, where <code>&lt;tag&gt;</code> is the “tag” config. (See
-<a href="../using-npm/config.html"><code>config</code></a>. The config’s default value is <code>latest</code>.)</p>
+<p>Do a <code>&lt;name&gt;@&lt;tag&gt;</code> install, where <code>&lt;tag&gt;</code> is the "tag" config. (See
+<a href="../using-npm/config.html"><code>config</code></a>. The config's default value is <code>latest</code>.)</p>
<p>In most cases, this will install the version of the modules tagged as
<code>latest</code> on the npm registry.</p>
<p>Example:</p>
@@ -276,7 +277,7 @@ package.json, there are two additional, optional flags:</p>
<ul>
<li>
<p><code>-E, --save-exact</code>: Saved dependencies will be configured with an
-exact version rather than using npm’s default semver range operator.</p>
+exact version rather than using npm's default semver range operator.</p>
</li>
<li>
<p><code>-B, --save-bundle</code>: Saved dependencies will also be added to your
@@ -480,7 +481,7 @@ even if a local copy exists on disk.</p>
</code></pre>
<h3 id="configuration">Configuration</h3>
<p>See the <a href="../using-npm/config.html"><code>config</code></a> help doc. Many of the configuration
-params have some effect on installation, since that’s most of what npm
+params have some effect on installation, since that's most of what npm
does.</p>
<p>These are some of the most common options related to installation.</p>
<!-- raw HTML omitted -->
@@ -502,7 +503,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
-rather than using npm’s default semver range operator.</p>
+rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@@ -510,7 +511,7 @@ rather than using npm’s default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -557,7 +558,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -577,9 +578,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -608,7 +609,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -622,7 +623,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -631,7 +632,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -640,7 +641,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -717,7 +718,7 @@ level because nothing conflicts with it.</p>
`-- D@2
+-- D@1
</code></pre>
-<p>Because B’s D@1 will be installed in the top-level, C now has to install
+<p>Because B's D@1 will be installed in the top-level, C now has to install
D@2 privately for itself. This algorithm is deterministic, but different
trees may be produced if two dependencies are requested for installation in
a different order.</p>
diff --git a/deps/npm/docs/output/commands/npm-link.html b/deps/npm/docs/output/commands/npm-link.html
index cff52fc7fe..a3776c9bb5 100644
--- a/deps/npm/docs/output/commands/npm-link.html
+++ b/deps/npm/docs/output/commands/npm-link.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-link</title>
<style>
body {
@@ -168,7 +169,7 @@ directory name.</p>
<a href="../using-npm/scope.html"><code>scope</code></a>. The scope must be preceded by an @-symbol and
followed by a slash.</p>
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
-“snapshotted” to their current state by resolving the symbolic links, if
+"snapshotted" to their current state by resolving the symbolic links, if
they are included in <code>bundleDependencies</code>.</p>
<p>For example:</p>
<pre lang="bash"><code>cd ~/projects/node-redis # go into the package directory
@@ -189,7 +190,7 @@ npm link ../node-redis # link the dir of your dependency
npm link redis
</code></pre>
<p>That is, it first creates a global link, and then links the global
-installation target into your project’s <code>node_modules</code> folder.</p>
+installation target into your project's <code>node_modules</code> folder.</p>
<p>Note that in this case, you are referring to the directory name,
<code>node-redis</code>, rather than the package name <code>redis</code>.</p>
<p>If your linked package is scoped (see <a href="../using-npm/scope.html"><code>scope</code></a>) your
@@ -202,7 +203,7 @@ link command must include that scope, e.g.</p>
a link stand in for a regular non-link dependency. Otherwise, for example,
if you depend on <code>redis@^3.0.1</code>, and ran <code>npm link redis</code>, it would replace
the <code>^3.0.1</code> dependency with <code>file:../path/to/node-redis</code>, which you
-probably don’t want! Additionally, other users or developers on your
+probably don't want! Additionally, other users or developers on your
project would run into issues if they do not have their folders set up
exactly the same as yours.</p>
<p>If you are adding a <em>new</em> dependency as a link, you should add it to the
@@ -212,7 +213,7 @@ relevant metadata by running <code>npm install &lt;dep&gt; --package-lock-only</
<h3 id="workspace-usage">Workspace Usage</h3>
<p><code>npm link &lt;pkg&gt; --workspace &lt;name&gt;</code> will link the relevant package as a
dependency of the specified workspace(s). Note that It may actually be
-linked into the parent project’s <code>node_modules</code> folder, if there are no
+linked into the parent project's <code>node_modules</code> folder, if there are no
conflicting dependencies.</p>
<p><code>npm link --workspace &lt;name&gt;</code> will create a global link to the specified
workspace(s).</p>
@@ -236,7 +237,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
-rather than using npm’s default semver range operator.</p>
+rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="global"><code>global</code></h4>
@@ -244,7 +245,7 @@ rather than using npm’s default semver range operator.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -291,7 +292,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -311,9 +312,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -342,7 +343,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -356,7 +357,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -365,7 +366,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -374,7 +375,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-logout.html b/deps/npm/docs/output/commands/npm-logout.html
index ace122674d..21c92ab6cc 100644
--- a/deps/npm/docs/output/commands/npm-logout.html
+++ b/deps/npm/docs/output/commands/npm-logout.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-logout</title>
<style>
body {
@@ -150,8 +151,8 @@ npm command-line interface
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
<p>When logged into a registry that supports token-based authentication, tell
-the server to end this token’s session. This will invalidate the token
-everywhere you’re using it, not just for the current environment.</p>
+the server to end this token's session. This will invalidate the token
+everywhere you're using it, not just for the current environment.</p>
<p>When logged into a legacy registry that uses username and password
authentication, this will clear the credentials in your user configuration.
In this case, it will <em>only</em> affect the current environment.</p>
@@ -163,7 +164,7 @@ connected to that scope, if set.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -171,7 +172,7 @@ connected to that scope, if set.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
-<li>Default: the scope of the current project, if any, or “”</li>
+<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html
index 5969fb08d7..e344845a34 100644
--- a/deps/npm/docs/output/commands/npm-ls.html
+++ b/deps/npm/docs/output/commands/npm-ls.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-ls</title>
<style>
body {
@@ -153,13 +154,13 @@ aliases: list, la, ll
<p>This command will print to stdout all the versions of packages that are
installed, as well as their dependencies when <code>--all</code> is specified, in a
tree structure.</p>
-<p>Note: to get a “bottoms up” view of why a given package is included in the
+<p>Note: to get a "bottoms up" view of why a given package is included in the
tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code></a>.</p>
<p>Positional arguments are <code>name@version-range</code> identifiers, which will limit
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
-example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
-<pre lang="bash"><code>npm@8.1.3 /path/to/npm
+example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
+<pre lang="bash"><code>npm@8.1.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
@@ -171,7 +172,7 @@ recognize potential forks of a project.</p>
dependencies, not the physical layout of your <code>node_modules</code> folder.</p>
<p>When run as <code>ll</code> or <code>la</code>, it shows extended information by default.</p>
<h3 id="note-design-changes-pending">Note: Design Changes Pending</h3>
-<p>The <code>npm ls</code> command’s output and behavior made a <em>ton</em> of sense when npm
+<p>The <code>npm ls</code> command's output and behavior made a <em>ton</em> of sense when npm
created a <code>node_modules</code> folder that naively nested every dependency. In
such a case, the logical dependency graph and physical tree of packages on
disk would be roughly identical.</p>
@@ -182,7 +183,7 @@ However, without using <code>npm ls -l</code>, it became impossible show <em>whe
package was actually installed much of the time!</p>
<p>With the advent of automatic installation of <code>peerDependencies</code> in npm v7,
this gets even more curious, as <code>peerDependencies</code> are logically
-“underneath” their dependents in the dependency graph, but are always
+"underneath" their dependents in the dependency graph, but are always
physically at or above their location on disk.</p>
<p>Also, in the years since npm got an <code>ls</code> command (in version 0.0.2!),
dependency graphs have gotten much larger as a general rule. Therefore, in
@@ -240,7 +241,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -263,9 +264,9 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
diff --git a/deps/npm/docs/output/commands/npm-org.html b/deps/npm/docs/output/commands/npm-org.html
index 7bf7228cb9..634a485c26 100644
--- a/deps/npm/docs/output/commands/npm-org.html
+++ b/deps/npm/docs/output/commands/npm-org.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-org</title>
<style>
body {
@@ -179,7 +180,7 @@ listing them, and finding specific ones and their roles.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -190,7 +191,7 @@ listing them, and finding specific ones and their roles.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-outdated.html b/deps/npm/docs/output/commands/npm-outdated.html
index a7edb858c4..2ef2b60a4b 100644
--- a/deps/npm/docs/output/commands/npm-outdated.html
+++ b/deps/npm/docs/output/commands/npm-outdated.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-outdated</title>
<style>
body {
@@ -156,15 +157,15 @@ Use <code>--all</code> to find all outdated meta-dependencies as well.</p>
<p>In the output:</p>
<ul>
<li><code>wanted</code> is the maximum version of the package that satisfies the semver
-range specified in <code>package.json</code>. If there’s no available semver range
-(i.e. you’re running <code>npm outdated --global</code>, or the package isn’t
+range specified in <code>package.json</code>. If there's no available semver range
+(i.e. you're running <code>npm outdated --global</code>, or the package isn't
included in <code>package.json</code>), then <code>wanted</code> shows the currently-installed
version.</li>
<li><code>latest</code> is the version of the package tagged as latest in the registry.
Running <code>npm publish</code> with no special configuration will publish the
package with a dist-tag of <code>latest</code>. This may or may not be the maximum
version of the package, or the most-recently published version of the
-package, depending on how the package’s developer manages the latest
+package, depending on how the package's developer manages the latest
<a href="../commands/npm-dist-tag.html">dist-tag</a>.</li>
<li><code>location</code> is where in the physical tree the package is located.</li>
<li><code>depended by</code> shows which package depends on the displayed dependency</li>
@@ -172,10 +173,10 @@ package, depending on how the package’s developer manages the latest
package is a <code>dependency</code> or a dev/peer/optional dependency. Packages not
included in <code>package.json</code> are always marked <code>dependencies</code>.</li>
<li><code>homepage</code> (when using <code>--long</code> / <code>-l</code>) is the <code>homepage</code> value contained
-in the package’s packument</li>
-<li>Red means there’s a newer version matching your semver requirements, so
+in the package's packument</li>
+<li>Red means there's a newer version matching your semver requirements, so
you should update now.</li>
-<li>Yellow indicates that there’s a newer version <em>above</em> your semver
+<li>Yellow indicates that there's a newer version <em>above</em> your semver
requirements (usually new major, or new 0.x minor) so proceed with
caution.</li>
</ul>
@@ -200,16 +201,16 @@ once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-pack
<ul>
<li><code>glob</code> requires <code>^5</code>, which prevents npm from installing <code>glob@6</code>, which
is outside the semver range.</li>
-<li>Git dependencies will always be reinstalled, because of how they’re
+<li>Git dependencies will always be reinstalled, because of how they're
specified. The installed committish might satisfy the dependency
-specifier (if it’s something immutable, like a commit SHA), or it might
+specifier (if it's something immutable, like a commit SHA), or it might
not, so <code>npm outdated</code> and <code>npm update</code> have to fetch Git repos to check.
This is why currently doing a reinstall of a Git dependency always forces
a new clone and install.</li>
-<li><code>npm@3.5.2</code> is marked as “wanted”, but “latest” is <code>npm@3.5.1</code> because
+<li><code>npm@3.5.2</code> is marked as "wanted", but "latest" is <code>npm@3.5.1</code> because
npm uses dist-tags to manage its <code>latest</code> and <code>next</code> release channels.
<code>npm update</code> will install the <em>newest</em> version, but <code>npm install npm</code>
-(with no semver range) will install whatever’s tagged as <code>latest</code>.</li>
+(with no semver range) will install whatever's tagged as <code>latest</code>.</li>
<li><code>once</code> is just plain out of date. Reinstalling <code>node_modules</code> from
scratch or running <code>npm update</code> will bring it up to spec.</li>
</ul>
@@ -262,7 +263,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
diff --git a/deps/npm/docs/output/commands/npm-owner.html b/deps/npm/docs/output/commands/npm-owner.html
index f12e9deb53..7aae72bad0 100644
--- a/deps/npm/docs/output/commands/npm-owner.html
+++ b/deps/npm/docs/output/commands/npm-owner.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-owner</title>
<style>
body {
@@ -163,10 +164,10 @@ to modify metadata, publish new versions, and add other owners.</li>
their privileges.</li>
</ul>
<p>Note that there is only one level of access. Either you can modify a package,
-or you can’t. Future versions may contain more fine-grained access levels, but
+or you can't. Future versions may contain more fine-grained access levels, but
that is not implemented at this time.</p>
<p>If you have two-factor authentication enabled with <code>auth-and-writes</code> (see
-<a href="../commands/npm-profile.html"><code>npm-profile</code></a>) then you’ll need to include an otp
+<a href="../commands/npm-profile.html"><code>npm-profile</code></a>) then you'll need to include an otp
on the command line when changing ownership with <code>--otp</code>.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@@ -174,7 +175,7 @@ on the command line when changing ownership with <code>--otp</code>.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -185,7 +186,7 @@ on the command line when changing ownership with <code>--otp</code>.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-pack.html b/deps/npm/docs/output/commands/npm-pack.html
index a5a3bf3116..6338e47711 100644
--- a/deps/npm/docs/output/commands/npm-pack.html
+++ b/deps/npm/docs/output/commands/npm-pack.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-pack</title>
<style>
body {
@@ -156,7 +157,7 @@ npm command-line interface
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -179,7 +180,7 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="pack-destination"><code>pack-destination</code></h4>
<ul>
-<li>Default: “.”</li>
+<li>Default: "."</li>
<li>Type: String</li>
</ul>
<p>Directory in which <code>npm pack</code> will save tarballs.</p>
@@ -237,7 +238,7 @@ the specified workspaces, and not on the root project.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h3 id="description">Description</h3>
-<p>For anything that’s installable (that is, a package folder, tarball,
+<p>For anything that's installable (that is, a package folder, tarball,
tarball url, git url, name@tag, name@version, name, or scoped name), this
command will fetch it to the cache, copy the tarball to the current working
directory as <code>&lt;name&gt;-&lt;version&gt;.tgz</code>, and then write the filenames out to
diff --git a/deps/npm/docs/output/commands/npm-ping.html b/deps/npm/docs/output/commands/npm-ping.html
index 95f3c5968c..38ffb34043 100644
--- a/deps/npm/docs/output/commands/npm-ping.html
+++ b/deps/npm/docs/output/commands/npm-ping.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-ping</title>
<style>
body {
@@ -162,7 +163,7 @@ If it works it will output something like:</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-pkg.html b/deps/npm/docs/output/commands/npm-pkg.html
index 5de2e71927..1ec7b0922e 100644
--- a/deps/npm/docs/output/commands/npm-pkg.html
+++ b/deps/npm/docs/output/commands/npm-pkg.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-pkg</title>
<style>
body {
@@ -154,7 +155,7 @@ npm pkg delete &lt;field&gt; [.&lt;subfield&gt; ...]
<code>npm pkg</code> provide 3 different sub commands that allow you to modify or retrieve
values for given object keys in your <code>package.json</code>.</p>
<p>The syntax to retrieve and set fields is a dot separated representation of
-the nested object properties to be found within your <code>package.json</code>, it’s the
+the nested object properties to be found within your <code>package.json</code>, it's the
same notation used in <a href="../commands/npm-view.html"><code>npm view</code></a> to retrieve information
from the registry manifest, below you can find more examples on how to use it.</p>
<p>Returned values are always in <strong>json</strong> format.</p>
@@ -166,7 +167,7 @@ from the registry manifest, below you can find more examples on how to use it.</
can run:</p>
<pre lang="bash"><code>npm pkg get name
</code></pre>
-<p>It’s also possible to retrieve multiple values at once:</p>
+<p>It's also possible to retrieve multiple values at once:</p>
<pre lang="bash"><code>npm pkg get name version
</code></pre>
<p>You can view child fields by separating them with a period. To retrieve
@@ -202,7 +203,7 @@ to a file <code>cli.js</code>:</p>
<p>Setting multiple fields at once is also possible:</p>
<pre lang="bash"><code>npm pkg set description='Awesome package' engines.node='&gt;=10'
</code></pre>
-<p>It’s also possible to add to array values, for example to add a new
+<p>It's also possible to add to array values, for example to add a new
contributor entry:</p>
<pre lang="bash"><code>npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca'
</code></pre>
@@ -210,7 +211,7 @@ contributor entry:</p>
empty bracket notation:</p>
<pre lang="bash"><code>npm pkg set contributors[].name='Foo' contributors[].name='Bar'
</code></pre>
-<p>It’s also possible to parse values as json prior to saving them to your
+<p>It's also possible to parse values as json prior to saving them to your
<code>package.json</code> file, for example in order to set a <code>"private": true</code>
property:</p>
<pre lang="bash"><code>npm pkg set private=true --json
@@ -278,7 +279,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
-<p>If you don’t have a clear idea of what you want to do, it is strongly
+<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-prefix.html b/deps/npm/docs/output/commands/npm-prefix.html
index 63db456817..458f24789f 100644
--- a/deps/npm/docs/output/commands/npm-prefix.html
+++ b/deps/npm/docs/output/commands/npm-prefix.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-prefix</title>
<style>
body {
@@ -170,7 +171,7 @@ also specified.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
diff --git a/deps/npm/docs/output/commands/npm-profile.html b/deps/npm/docs/output/commands/npm-profile.html
index 84bbd362f6..92a92f92a7 100644
--- a/deps/npm/docs/output/commands/npm-profile.html
+++ b/deps/npm/docs/output/commands/npm-profile.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-profile</title>
<style>
body {
@@ -190,7 +191,7 @@ homepage, freenode, twitter, github</p>
</li>
<li>
<p><code>npm profile set password</code>: Change your password. This is interactive,
-you’ll be prompted for your current password and a new password. You’ll
+you'll be prompted for your current password and a new password. You'll
also be prompted for an OTP if you have two-factor authentication
enabled.</p>
</li>
@@ -199,7 +200,7 @@ enabled.</p>
authentication. Defaults to <code>auth-and-writes</code> mode. Modes are:</p>
<ul>
<li><code>auth-only</code>: Require an OTP when logging in or making changes to your
-account’s authentication. The OTP will be required on both the website
+account's authentication. The OTP will be required on both the website
and the command line.</li>
<li><code>auth-and-writes</code>: Requires an OTP at all the times <code>auth-only</code> does,
and also requires one when publishing a module, setting the <code>latest</code>
@@ -218,7 +219,7 @@ dist-tag, or changing access via <code>npm access</code> and <code>npm owner</co
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -251,7 +252,7 @@ saving them to your <code>package.json</code>.</li>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-prune.html b/deps/npm/docs/output/commands/npm-prune.html
index 0f7ee019d5..42de1b6ab0 100644
--- a/deps/npm/docs/output/commands/npm-prune.html
+++ b/deps/npm/docs/output/commands/npm-prune.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-prune</title>
<style>
body {
@@ -148,10 +149,10 @@ npm command-line interface
<pre lang="bash"><code>npm prune [[&lt;@scope&gt;/]&lt;pkg&gt;...] [--production] [--dry-run] [--json]
</code></pre>
<h3 id="description">Description</h3>
-<p>This command removes “extraneous” packages. If a package name is provided,
+<p>This command removes "extraneous" packages. If a package name is provided,
then only packages matching one of the supplied names are removed.</p>
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
-not listed as any package’s dependency list.</p>
+not listed as any package's dependency list.</p>
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
variable is set to <code>production</code>, this command will remove the packages
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
@@ -159,9 +160,9 @@ specified in your <code>devDependencies</code>. Setting <code>--no-production</c
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
have made with <code>--dry-run</code>) are printed as a JSON object.</p>
-<p>In normal operation, extraneous modules are pruned automatically, so you’ll
+<p>In normal operation, extraneous modules are pruned automatically, so you'll
only need this command with the <code>--production</code> flag. However, in the real
-world, operation is not always “normal”. When crashes or mistakes happen,
+world, operation is not always "normal". When crashes or mistakes happen,
this command can help clean up any resulting garbage.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@@ -169,9 +170,9 @@ this command can help clean up any resulting garbage.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -188,7 +189,7 @@ variable will be set to <code>'production'</code> for all lifecycle scripts.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-publish.html b/deps/npm/docs/output/commands/npm-publish.html
index e757b36719..60f35fb615 100644
--- a/deps/npm/docs/output/commands/npm-publish.html
+++ b/deps/npm/docs/output/commands/npm-publish.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-publish</title>
<style>
body {
@@ -173,15 +174,15 @@ that <code>npm install &lt;name&gt;@&lt;tag&gt;</code> will install this version
<li>
<p><code>[--access &lt;public|restricted&gt;]</code>: Tells the registry whether this package
should be published as public or restricted. Only applies to scoped
-packages, which default to <code>restricted</code>. If you don’t have a paid
+packages, which default to <code>restricted</code>. If you don't have a paid
account, you must publish with <code>--access public</code> to publish scoped
packages.</p>
</li>
<li>
<p><code>[--otp &lt;otpcode&gt;]</code>: If you have two-factor authentication enabled in
<code>auth-and-writes</code> mode then you can provide a code from your
-authenticator with this. If you don’t include this and you’re running
-from a TTY then you’ll be prompted.</p>
+authenticator with this. If you don't include this and you're running
+from a TTY then you'll be prompted.</p>
</li>
<li>
<p><code>[--dry-run]</code>: As of <code>npm@6</code>, does everything publish would do except
@@ -219,7 +220,7 @@ are always included. For example, <code>package.json</code>, <code>README.md</c
<code>LICENSE</code>, and so on.</p>
</li>
<li>
-<p>If there is a “files” list in
+<p>If there is a "files" list in
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>, then only the files
specified will be included. (If directories are specified, then they
will be walked recursively and their contents included, subject to the
@@ -243,7 +244,7 @@ un-ignored with a <code>!</code> rule in a <code>.npmignore</code> or <code>.git
<p>Symbolic links are never included in npm packages.</p>
</li>
</ul>
-<p>See <a href="../using-npm/developers.html"><code>developers</code></a> for full details on what’s
+<p>See <a href="../using-npm/developers.html"><code>developers</code></a> for full details on what's
included in the published package, as well as details on how the package is
built.</p>
<h3 id="configuration">Configuration</h3>
@@ -252,10 +253,10 @@ built.</p>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
-<li>Default: “latest”</li>
+<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
-<p>If you ask npm to install a package and don’t tell it a specific version,
+<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>
@@ -265,8 +266,8 @@ tarball that will be compared with the local files by default.</p>
<!-- raw HTML omitted -->
<h4 id="access"><code>access</code></h4>
<ul>
-<li>Default: ‘restricted’ for scoped packages, ‘public’ for unscoped packages</li>
-<li>Type: null, “restricted”, or “public”</li>
+<li>Default: 'restricted' for scoped packages, 'public' for unscoped packages</li>
+<li>Type: null, "restricted", or "public"</li>
</ul>
<p>When publishing scoped packages, the access level defaults to <code>restricted</code>.
If you want your scoped package to be publicly viewable (and installable)
@@ -284,7 +285,7 @@ initial publish use <code>npm access</code>.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -297,7 +298,7 @@ commands that modify your local installation, eg, <code>install</code>, <code>up
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-rebuild.html b/deps/npm/docs/output/commands/npm-rebuild.html
index 571256e0a7..425751dd72 100644
--- a/deps/npm/docs/output/commands/npm-rebuild.html
+++ b/deps/npm/docs/output/commands/npm-rebuild.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-rebuild</title>
<style>
body {
@@ -167,7 +168,7 @@ will be rebuilt.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -186,7 +187,7 @@ of the current working directory.</li>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-repo.html b/deps/npm/docs/output/commands/npm-repo.html
index 2d623c5ce1..3585570237 100644
--- a/deps/npm/docs/output/commands/npm-repo.html
+++ b/deps/npm/docs/output/commands/npm-repo.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-repo</title>
<style>
body {
@@ -148,7 +149,7 @@ npm command-line interface
<pre lang="bash"><code>npm repo [&lt;pkgname&gt; [&lt;pkgname&gt; ...]]
</code></pre>
<h3 id="description">Description</h3>
-<p>This command tries to guess at the likely location of a package’s
+<p>This command tries to guess at the likely location of a package's
repository URL, and then tries to open it using the <code>--browser</code> config
param. If no package name is provided, it will search for a <code>package.json</code>
in the current folder and use the <code>repository</code> property.</p>
diff --git a/deps/npm/docs/output/commands/npm-restart.html b/deps/npm/docs/output/commands/npm-restart.html
index bebf3aa891..135611a54e 100644
--- a/deps/npm/docs/output/commands/npm-restart.html
+++ b/deps/npm/docs/output/commands/npm-restart.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-restart</title>
<style>
body {
@@ -186,7 +187,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-root.html b/deps/npm/docs/output/commands/npm-root.html
index 57d40a3a05..58e5f0e4f4 100644
--- a/deps/npm/docs/output/commands/npm-root.html
+++ b/deps/npm/docs/output/commands/npm-root.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-root</title>
<style>
body {
@@ -164,7 +165,7 @@ echo "Global packages installed in: ${global_node_modules}"
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html
index e8e862b768..18d5fe74ec 100644
--- a/deps/npm/docs/output/commands/npm-run-script.html
+++ b/deps/npm/docs/output/commands/npm-run-script.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-run-script</title>
<style>
body {
@@ -152,11 +153,11 @@ npm run-script &lt;command&gt; [--workspaces]
aliases: run, rum, urn
</code></pre>
<h3 id="description">Description</h3>
-<p>This runs an arbitrary command from a package’s <code>"scripts"</code> object. If no
+<p>This runs an arbitrary command from a package's <code>"scripts"</code> object. If no
<code>"command"</code> is provided, it will list the available scripts.</p>
<p><code>run[-script]</code> is used by the test, start, restart, and stop commands, but
can be called directly, as well. When the scripts in the package are
-printed out, they’re separated into lifecycle (test, start, restart) and
+printed out, they're separated into lifecycle (test, start, restart) and
directly-run scripts.</p>
<p>Any positional arguments are passed to the specified script. Use <code>--</code> to
pass <code>-</code>-prefixed flags and options which would otherwise be parsed by npm.</p>
@@ -167,9 +168,9 @@ pass <code>-</code>-prefixed flags and options which would otherwise be parsed b
and not to any <code>pre</code> or <code>post</code> script.</p>
<p>The <code>env</code> script is a special built-in command that can be used to list
environment variables that will be available to the script at runtime. If an
-“env” command is defined in your package, it will take precedence over the
+"env" command is defined in your package, it will take precedence over the
built-in.</p>
-<p>In addition to the shell’s pre-existing <code>PATH</code>, <code>npm run</code> adds
+<p>In addition to the shell's pre-existing <code>PATH</code>, <code>npm run</code> adds
<code>node_modules/.bin</code> to the <code>PATH</code> provided to scripts. Any binaries
provided by locally-installed dependencies can be used without the
<code>node_modules/.bin</code> prefix. For example, if there is a <code>devDependency</code> on
@@ -186,17 +187,17 @@ The actual shell referred to by <code>/bin/sh</code> also depends on the system.
You can customize the shell with the <code>script-shell</code> configuration.</p>
<p>Scripts are run from the root of the package folder, regardless of what the
current working directory is when <code>npm run</code> is called. If you want your
-script to use different behavior based on what subdirectory you’re in, you
+script to use different behavior based on what subdirectory you're in, you
can use the <code>INIT_CWD</code> environment variable, which holds the full path you
were in when you ran <code>npm run</code>.</p>
<p><code>npm run</code> sets the <code>NODE</code> environment variable to the <code>node</code> executable
with which <code>npm</code> is executed.</p>
<p>If you try to run a script without having a <code>node_modules</code> directory and it
-fails, you will be given a warning to run <code>npm install</code>, just in case you’ve
+fails, you will be given a warning to run <code>npm install</code>, just in case you've
forgotten.</p>
<h3 id="workspaces-support">Workspaces support</h3>
<p>You may use the <code>workspace</code> or <code>workspaces</code> configs in order to run an
-arbitrary command from a package’s <code>"scripts"</code> object in the context of the
+arbitrary command from a package's <code>"scripts"</code> object in the context of the
specified workspaces. If no <code>"command"</code> is provided, it will list the available
scripts for each of these configured workspaces.</p>
<p>Given a project with configured workspaces, e.g:</p>
@@ -221,7 +222,7 @@ we can run tests in all of them using the <code>workspaces</code> config:</p>
<pre><code>npm test --workspaces
</code></pre>
<h4 id="filtering-workspaces">Filtering workspaces</h4>
-<p>It’s also possible to run a script in a single workspace using the <code>workspace</code>
+<p>It's also possible to run a script in a single workspace using the <code>workspace</code>
config along with a name or directory path:</p>
<pre><code>npm test --workspace=a
</code></pre>
@@ -293,9 +294,9 @@ the specified workspaces, and not on the root project.</p>
<li>Type: Boolean</li>
</ul>
<p>If true, npm will not exit with an error code when <code>run-script</code> is invoked
-for a script that isn’t defined in the <code>scripts</code> section of <code>package.json</code>.
-This option can be used when it’s desirable to optionally run a script when
-it’s present and fail if the script fails. This is useful, for example, when
+for a script that isn't defined in the <code>scripts</code> section of <code>package.json</code>.
+This option can be used when it's desirable to optionally run a script when
+it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.</p>
<!-- raw HTML omitted -->
@@ -314,7 +315,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-search.html b/deps/npm/docs/output/commands/npm-search.html
index 00b77dd612..34c4cebfd1 100644
--- a/deps/npm/docs/output/commands/npm-search.html
+++ b/deps/npm/docs/output/commands/npm-search.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-search</title>
<style>
body {
@@ -164,7 +165,7 @@ use them more fine-grained filtering. Additionally, you can add both of
these to your config to change default search filtering behavior.</p>
<p>Search also allows targeting of maintainers in search results, by prefixing
their npm username with <code>=</code>.</p>
-<p>If a term starts with <code>/</code>, then it’s interpreted as a regular expression
+<p>If a term starts with <code>/</code>, then it's interpreted as a regular expression
and supports standard JavaScript RegExp syntax. In this case search will
ignore a trailing <code>/</code> . (Note you must escape or quote many regular
expression characters in most shells.)</p>
@@ -195,8 +196,8 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="color"><code>color</code></h4>
<ul>
-<li>Default: true unless the NO_COLOR environ is set to something other than ‘0’</li>
-<li>Type: “always” or Boolean</li>
+<li>Default: true unless the NO_COLOR environ is set to something other than '0'</li>
+<li>Type: "always" or Boolean</li>
</ul>
<p>If false, never shows colors. If <code>"always"</code> then always shows colors. If
true, then only prints color codes for tty file descriptors.</p>
@@ -221,7 +222,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="searchopts"><code>searchopts</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that are always passed to search.</p>
@@ -229,7 +230,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="searchexclude"><code>searchexclude</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that limit the results from search.</p>
@@ -237,7 +238,7 @@ true, then only prints color codes for tty file descriptors.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-set-script.html b/deps/npm/docs/output/commands/npm-set-script.html
index b877ec0baf..9391ba9e38 100644
--- a/deps/npm/docs/output/commands/npm-set-script.html
+++ b/deps/npm/docs/output/commands/npm-set-script.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-set-script</title>
<style>
body {
diff --git a/deps/npm/docs/output/commands/npm-shrinkwrap.html b/deps/npm/docs/output/commands/npm-shrinkwrap.html
index e2c09e8176..ff2926fe4b 100644
--- a/deps/npm/docs/output/commands/npm-shrinkwrap.html
+++ b/deps/npm/docs/output/commands/npm-shrinkwrap.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-shrinkwrap</title>
<style>
body {
diff --git a/deps/npm/docs/output/commands/npm-star.html b/deps/npm/docs/output/commands/npm-star.html
index 8b41c7d583..de968318b4 100644
--- a/deps/npm/docs/output/commands/npm-star.html
+++ b/deps/npm/docs/output/commands/npm-star.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-star</title>
<style>
body {
@@ -149,14 +150,14 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
-<p>“Starring” a package means that you have some interest in it. It’s
+<p>"Starring" a package means that you have some interest in it. It's
a vaguely positive way to show that you care.</p>
-<p>It’s a boolean thing. Starring repeatedly has no additional effect.</p>
+<p>It's a boolean thing. Starring repeatedly has no additional effect.</p>
<h3 id="more">More</h3>
-<p>There’s also these extra commands to help you manage your favorite packages:</p>
+<p>There's also these extra commands to help you manage your favorite packages:</p>
<h4 id="unstar">Unstar</h4>
-<p>You can also “unstar” a package using <a href="../commands/npm-unstar.html"><code>npm unstar</code></a></p>
-<p>“Unstarring” is the same thing, but in reverse.</p>
+<p>You can also "unstar" a package using <a href="../commands/npm-unstar.html"><code>npm unstar</code></a></p>
+<p>"Unstarring" is the same thing, but in reverse.</p>
<h4 id="listing-stars">Listing stars</h4>
<p>You can see all your starred packages using <a href="../commands/npm-stars.html"><code>npm stars</code></a></p>
<h3 id="configuration">Configuration</h3>
@@ -165,7 +166,7 @@ a vaguely positive way to show that you care.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-stars.html b/deps/npm/docs/output/commands/npm-stars.html
index 8603cbd45a..c91ffa23a3 100644
--- a/deps/npm/docs/output/commands/npm-stars.html
+++ b/deps/npm/docs/output/commands/npm-stars.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-stars</title>
<style>
body {
@@ -151,7 +152,7 @@ npm command-line interface
<h3 id="description">Description</h3>
<p>If you have starred a lot of neat things and want to find them again
quickly this command lets you do just that.</p>
-<p>You may also want to see your friend’s favorite packages, in this case
+<p>You may also want to see your friend's favorite packages, in this case
you will most certainly enjoy this command.</p>
<h3 id="configuration">Configuration</h3>
<!-- raw HTML omitted -->
@@ -159,7 +160,7 @@ you will most certainly enjoy this command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm-start.html b/deps/npm/docs/output/commands/npm-start.html
index 2ba0468943..14554ca458 100644
--- a/deps/npm/docs/output/commands/npm-start.html
+++ b/deps/npm/docs/output/commands/npm-start.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-start</title>
<style>
body {
@@ -149,11 +150,11 @@ npm command-line interface
</code></pre>
<h3 id="description">Description</h3>
<p>This runs a predefined command specified in the <code>"start"</code> property of
-a package’s <code>"scripts"</code> object.</p>
+a package's <code>"scripts"</code> object.</p>
<p>If the <code>"scripts"</code> object does not define a <code>"start"</code> property, npm
will run <code>node server.js</code>.</p>
<p>Note that this is different from the default node behavior of running
-the file specified in a package’s <code>"main"</code> attribute when evoking with
+the file specified in a package's <code>"main"</code> attribute when evoking with
<code>node .</code></p>
<p>As of <a href="https://blog.npmjs.org/post/98131109725/npm-2-0-0"><code>npm@2.0.0</code></a>, you can
use custom arguments when executing scripts. Refer to <a href="../commands/npm-run-script.html"><code>npm run-script</code></a> for more details.</p>
@@ -190,7 +191,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-stop.html b/deps/npm/docs/output/commands/npm-stop.html
index dc2b689579..ff119ac865 100644
--- a/deps/npm/docs/output/commands/npm-stop.html
+++ b/deps/npm/docs/output/commands/npm-stop.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-stop</title>
<style>
body {
@@ -148,8 +149,8 @@ npm command-line interface
<pre lang="bash"><code>npm stop [-- &lt;args&gt;]
</code></pre>
<h3 id="description">Description</h3>
-<p>This runs a predefined command specified in the “stop” property of a
-package’s “scripts” object.</p>
+<p>This runs a predefined command specified in the "stop" property of a
+package's "scripts" object.</p>
<p>Unlike with <a href="../commands/npm-start.html">npm start</a>, there is no default script
that will run if the <code>"stop"</code> property is not defined.</p>
<h3 id="example">Example</h3>
@@ -185,7 +186,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-team.html b/deps/npm/docs/output/commands/npm-team.html
index cc08477379..2ee0b2369b 100644
--- a/deps/npm/docs/output/commands/npm-team.html
+++ b/deps/npm/docs/output/commands/npm-team.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-team</title>
<style>
body {
@@ -163,13 +164,13 @@ when operating on them, separated by a colon (<code>:</code>). That is, if you h
as <code>@org:newteam</code> in these commands.</p>
<p>If you have two-factor authentication enabled in <code>auth-and-writes</code> mode, then
you can provide a code from your authenticator with <code>[--otp &lt;otpcode&gt;]</code>.
-If you don’t include this then you will be prompted.</p>
+If you don't include this then you will be prompted.</p>
<ul>
<li>
<p>create / destroy:
Create a new team, or destroy an existing one. Note: You cannot remove the
<code>developers</code> team, <!-- raw HTML omitted -->learn more.<!-- raw HTML omitted --></p>
-<p>Here’s how to create a new team <code>newteam</code> under the <code>org</code> org:</p>
+<p>Here's how to create a new team <code>newteam</code> under the <code>org</code> org:</p>
<pre lang="bash"><code>npm team create @org:newteam
</code></pre>
<p>You should see a confirming message such as: <code>+@org:newteam</code> once the new
@@ -186,7 +187,7 @@ Add a user to an existing team.</p>
<li>
<p>rm:
Using <code>npm team rm</code> you can also remove users from a team they belong to.</p>
-<p>Here’s an example removing user <code>username</code> from <code>newteam</code> team
+<p>Here's an example removing user <code>username</code> from <code>newteam</code> team
in <code>org</code> organization:</p>
<pre lang="bash"><code>npm team rm @org:newteam username
</code></pre>
@@ -198,7 +199,7 @@ in <code>org</code> organization:</p>
If performed on an organization name, will return a list of existing teams
under that organization. If performed on a team, it will instead return a list
of all users belonging to that particular team.</p>
-<p>Here’s an example of how to list all teams from an org named <code>org</code>:</p>
+<p>Here's an example of how to list all teams from an org named <code>org</code>:</p>
<pre lang="bash"><code>npm team ls @org
</code></pre>
<p>Example listing all members of a team named <code>newteam</code>:</p>
@@ -222,7 +223,7 @@ use the <code>npm access</code> command to grant or revoke the appropriate permi
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -233,7 +234,7 @@ use the <code>npm access</code> command to grant or revoke the appropriate permi
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-test.html b/deps/npm/docs/output/commands/npm-test.html
index 9d0590fc30..8cbd417c31 100644
--- a/deps/npm/docs/output/commands/npm-test.html
+++ b/deps/npm/docs/output/commands/npm-test.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-test</title>
<style>
body {
@@ -151,7 +152,7 @@ aliases: t, tst
</code></pre>
<h3 id="description">Description</h3>
<p>This runs a predefined command specified in the <code>"test"</code> property of
-a package’s <code>"scripts"</code> object.</p>
+a package's <code>"scripts"</code> object.</p>
<h3 id="example">Example</h3>
<pre lang="json"><code>{
"scripts": {
@@ -183,7 +184,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
diff --git a/deps/npm/docs/output/commands/npm-token.html b/deps/npm/docs/output/commands/npm-token.html
index 57842ff50a..a0ec36c457 100644
--- a/deps/npm/docs/output/commands/npm-token.html
+++ b/deps/npm/docs/output/commands/npm-token.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-token</title>
<style>
body {
@@ -233,7 +234,7 @@ tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -244,7 +245,7 @@ tokens with the <code>npm token create</code> command.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-uninstall.html b/deps/npm/docs/output/commands/npm-uninstall.html
index 725b13cf76..cec9937e91 100644
--- a/deps/npm/docs/output/commands/npm-uninstall.html
+++ b/deps/npm/docs/output/commands/npm-uninstall.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-uninstall</title>
<style>
body {
diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html
index fab757362e..857a08d721 100644
--- a/deps/npm/docs/output/commands/npm-unpublish.html
+++ b/deps/npm/docs/output/commands/npm-unpublish.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-unpublish</title>
<style>
body {
@@ -161,7 +162,7 @@ want to maintain a package.</p>
removing the tarball.</p>
<p>The npm registry will return an error if you are not <a href="../commands/npm-adduser.html">logged
in</a>.</p>
-<p>If you do not specify a version or if you remove all of a package’s
+<p>If you do not specify a version or if you remove all of a package's
versions then the registry will remove the root package entry entirely.</p>
<p>Even if you unpublish a package version, that specific name and version
combination can never be reused. In order to publish the package again,
@@ -177,7 +178,7 @@ passed.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -207,7 +208,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
-<p>If you don’t have a clear idea of what you want to do, it is strongly
+<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-unstar.html b/deps/npm/docs/output/commands/npm-unstar.html
index 15b7821743..83bed9707b 100644
--- a/deps/npm/docs/output/commands/npm-unstar.html
+++ b/deps/npm/docs/output/commands/npm-unstar.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-unstar</title>
<style>
body {
@@ -149,12 +150,12 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="description">Description</h3>
-<p>“Unstarring” a package is the opposite of <a href="../commands/npm-star.html"><code>npm star</code></a>,
+<p>"Unstarring" a package is the opposite of <a href="../commands/npm-star.html"><code>npm star</code></a>,
it removes an item from your list of favorite packages.</p>
<h3 id="more">More</h3>
-<p>There’s also these extra commands to help you manage your favorite packages:</p>
+<p>There's also these extra commands to help you manage your favorite packages:</p>
<h4 id="star">Star</h4>
-<p>You can “star” a package using <a href="../commands/npm-star.html"><code>npm star</code></a></p>
+<p>You can "star" a package using <a href="../commands/npm-star.html"><code>npm star</code></a></p>
<h4 id="listing-stars">Listing stars</h4>
<p>You can see all your starred packages using <a href="../commands/npm-stars.html"><code>npm stars</code></a></p>
<h3 id="configuration">Configuration</h3>
@@ -163,7 +164,7 @@ it removes an item from your list of favorite packages.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -184,7 +185,7 @@ false, it uses ascii characters instead of unicode glyphs.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
diff --git a/deps/npm/docs/output/commands/npm-update.html b/deps/npm/docs/output/commands/npm-update.html
index 8f832e8bb5..065feee3eb 100644
--- a/deps/npm/docs/output/commands/npm-update.html
+++ b/deps/npm/docs/output/commands/npm-update.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-update</title>
<style>
body {
@@ -179,7 +180,7 @@ are:</p>
}
</code></pre>
<h4 id="caret-dependencies">Caret Dependencies</h4>
-<p>If <code>app</code>’s <code>package.json</code> contains:</p>
+<p>If <code>app</code>'s <code>package.json</code> contains:</p>
<pre lang="json"><code>"dependencies": {
"dep1": "^1.1.1"
}
@@ -187,7 +188,7 @@ are:</p>
<p>Then <code>npm update</code> will install <code>dep1@1.2.2</code>, because <code>1.2.2</code> is <code>latest</code> and
<code>1.2.2</code> satisfies <code>^1.1.1</code>.</p>
<h4 id="tilde-dependencies">Tilde Dependencies</h4>
-<p>However, if <code>app</code>’s <code>package.json</code> contains:</p>
+<p>However, if <code>app</code>'s <code>package.json</code> contains:</p>
<pre lang="json"><code>"dependencies": {
"dep1": "~1.1.1"
}
@@ -237,7 +238,7 @@ In this case if you really did need your package to use a newer version
you would need to use <code>npm install</code>.</p>
<h4 id="updating-globally-installed-packages">Updating Globally-Installed Packages</h4>
<p><code>npm update -g</code> will apply the <code>update</code> action to each globally installed
-package that is <code>outdated</code> – that is, has a version that is different from
+package that is <code>outdated</code> -- that is, has a version that is different from
<code>wanted</code>.</p>
<p>Note: Globally installed packages are treated as if they are installed with a
caret semver range specified. So if you require to update to <code>latest</code> you may
@@ -253,7 +254,7 @@ be <em>downgraded</em>.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -300,7 +301,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -320,9 +321,9 @@ package-locks disabled use <code>npm prune</code>.</p>
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -351,7 +352,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -365,7 +366,7 @@ submitted.</p>
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -374,7 +375,7 @@ systems.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -383,7 +384,7 @@ acknowledging the number of dependencies looking for funding. See <a href="../co
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html
index 016a4bb9de..8c9521dcea 100644
--- a/deps/npm/docs/output/commands/npm-version.html
+++ b/deps/npm/docs/output/commands/npm-version.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-version</title>
<style>
body {
@@ -195,10 +196,10 @@ saving them to your <code>package.json</code>.</li>
<!-- raw HTML omitted -->
<h4 id="preid"><code>preid</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
-<p>The “prerelease identifier” to use as a prefix for the “prerelease” part of
+<p>The "prerelease identifier" to use as a prefix for the "prerelease" part of
a semver. Like the <code>rc</code> in <code>1.2.0-rc.8</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html
index e82ff4b627..991376ccf0 100644
--- a/deps/npm/docs/output/commands/npm-view.html
+++ b/deps/npm/docs/output/commands/npm-view.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-view</title>
<style>
body {
@@ -184,7 +185,7 @@ For example, to get all the contributor names and email addresses, you
can do this:</p>
<pre lang="bash"><code>npm view express contributors.name contributors.email
</code></pre>
-<p>“Person” fields are shown as a string if they would be shown as an
+<p>"Person" fields are shown as a string if they would be shown as an
object. So, for example, this will show the list of <code>npm</code> contributors in
the shortened string format. (See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for more on this.)</p>
<pre lang="bash"><code>npm view npm contributors
diff --git a/deps/npm/docs/output/commands/npm-whoami.html b/deps/npm/docs/output/commands/npm-whoami.html
index 7850627325..f112f5e0c3 100644
--- a/deps/npm/docs/output/commands/npm-whoami.html
+++ b/deps/npm/docs/output/commands/npm-whoami.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-whoami</title>
<style>
body {
@@ -161,7 +162,7 @@ associated with the token, and print to standard output.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index 96e98b5277..dd111c40be 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm</title>
<style>
body {
@@ -148,7 +149,7 @@ npm command-line interface
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
-<p>8.1.3</p>
+<p>8.1.4</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
@@ -158,22 +159,22 @@ commonly, you use it to publish, discover, install, and develop node
programs.</p>
<p>Run <code>npm help</code> to get a list of available commands.</p>
<h3 id="important">Important</h3>
-<p>npm comes preconfigured to use npm’s public registry at
+<p>npm comes preconfigured to use npm's public registry at
<a href="https://registry.npmjs.org">https://registry.npmjs.org</a> by default. Use of the npm public registry is
subject to terms of use available at
<a href="https://docs.npmjs.com/policies/terms">https://docs.npmjs.com/policies/terms</a>.</p>
<p>You can configure npm to use any compatible registry you like, and even
-run your own registry. Use of someone else’s registry is governed by
+run your own registry. Use of someone else's registry is governed by
their terms of use.</p>
<h3 id="introduction">Introduction</h3>
<p>You probably got npm because you want to install stuff.</p>
<p>The very first thing you will most likely want to run in any node
program is <code>npm install</code> to install its dependencies.</p>
<p>You can also run <code>npm install blerg</code> to install the latest version of
-“blerg”. Check out <a href="../commands/npm-install.html"><code>npm install</code></a> for more
+"blerg". Check out <a href="../commands/npm-install.html"><code>npm install</code></a> for more
info. It can do a lot of stuff.</p>
-<p>Use the <code>npm search</code> command to show everything that’s available in the
-public registry. Use <code>npm ls</code> to show everything you’ve installed.</p>
+<p>Use the <code>npm search</code> command to show everything that's available in the
+public registry. Use <code>npm ls</code> to show everything you've installed.</p>
<h3 id="dependencies">Dependencies</h3>
<p>If a package lists a dependency using a git URL, npm will install that
dependency using the <a href="https://github.com/git-guides/install-git"><code>git</code></a>
@@ -203,17 +204,17 @@ npm installs packages into the install prefix at
<p>Local mode is the default. Use <code>-g</code> or <code>--global</code> on any command to
run in global mode instead.</p>
<h3 id="developer-usage">Developer Usage</h3>
-<p>If you’re using npm to develop and publish your code, check out the
+<p>If you're using npm to develop and publish your code, check out the
following help topics:</p>
<ul>
<li>json:
Make a package.json file. See
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>.</li>
<li>link:
-Links your current working code into Node’s path, so that you don’t
+Links your current working code into Node's path, so that you don't
have to reinstall every time you make a change. Use <a href="../commands/npm-link.html"><code>npm link</code></a> to do this.</li>
<li>install:
-It’s a good idea to install things if you don’t need the symbolic
+It's a good idea to install things if you don't need the symbolic
link. Especially, installing other peoples code from the registry is
done via <a href="../commands/npm-install.html"><code>npm install</code></a></li>
<li>adduser:
@@ -229,7 +230,7 @@ code to the registry.</li>
<ul>
<li>Command line switches:
Set a config with <code>--key val</code>. All keys take a value, even if they
-are booleans (the config parser doesn’t know what the options are at
+are booleans (the config parser doesn't know what the options are at
the time of parsing). If you do not provide a value (<code>--key</code>) then
the option is set to boolean <code>true</code>.</li>
<li>Environment Variables:
@@ -245,13 +246,13 @@ parsed if it is found. See <a href="../commands/npm-prefix.html"><code>npm pref
more info on the global prefix. If the <code>globalconfig</code> option is set
in the cli, env, or user config, then that file is parsed instead.</li>
<li>Defaults:
-npm’s default configuration options are defined in
+npm's default configuration options are defined in
lib/utils/config-defs.js. These must not be changed.</li>
</ul>
<p>See <a href="../using-npm/config.html"><code>config</code></a> for much much more information.</p>
<h3 id="contributions">Contributions</h3>
<p>Patches welcome!</p>
-<p>If you would like to help, but don’t know what to work on, read the
+<p>If you would like to help, but don't know what to work on, read the
<a href="https://github.com/npm/cli/blob/latest/CONTRIBUTING.md">contributing
guidelines</a> and
check the issues list.</p>
diff --git a/deps/npm/docs/output/commands/npx.html b/deps/npm/docs/output/commands/npx.html
index 36aad9f701..cd7fe02dd7 100644
--- a/deps/npm/docs/output/commands/npx.html
+++ b/deps/npm/docs/output/commands/npx.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npx</title>
<style>
body {
@@ -200,7 +201,7 @@ the first command argument.</p>
<h3 id="npx-vs-npm-exec"><code>npx</code> vs <code>npm exec</code></h3>
<p>When run via the <code>npx</code> binary, all flags and options <em>must</em> be set prior to
any positional arguments. When run via <code>npm exec</code>, a double-hyphen <code>--</code>
-flag can be used to suppress npm’s parsing of switches and options that
+flag can be used to suppress npm's parsing of switches and options that
should be sent to the executed command.</p>
<p>For example:</p>
<pre><code>$ npx foo@latest bar --package=@npmcli/foo
@@ -211,7 +212,7 @@ following command:</p>
</code></pre>
<p>Since the <code>--package</code> option comes <em>after</em> the positional arguments, it is
treated as an argument to the executed command.</p>
-<p>In contrast, due to npm’s argument parsing logic, running this command is
+<p>In contrast, due to npm's argument parsing logic, running this command is
different:</p>
<pre><code>$ npm exec foo@latest bar --package=@npmcli/foo
</code></pre>
diff --git a/deps/npm/docs/output/configuring-npm/folders.html b/deps/npm/docs/output/configuring-npm/folders.html
index 929bfe1f77..6d722466c5 100644
--- a/deps/npm/docs/output/configuring-npm/folders.html
+++ b/deps/npm/docs/output/configuring-npm/folders.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>folders</title>
<style>
body {
@@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
-<p>npm puts various things on your computer. That’s its job.</p>
+<p>npm puts various things on your computer. That's its job.</p>
<p>This document will tell you what it puts where.</p>
<h4 id="tldr">tl;dr</h4>
<ul>
@@ -153,14 +154,14 @@ npm command-line interface
package root.</li>
<li>Global install (with <code>-g</code>): puts stuff in /usr/local or wherever node
is installed.</li>
-<li>Install it <strong>locally</strong> if you’re going to <code>require()</code> it.</li>
-<li>Install it <strong>globally</strong> if you’re going to run it on the command line.</li>
+<li>Install it <strong>locally</strong> if you're going to <code>require()</code> it.</li>
+<li>Install it <strong>globally</strong> if you're going to run it on the command line.</li>
<li>If you need both, then install it in both places, or use <code>npm link</code>.</li>
</ul>
<h4 id="prefix-configuration">prefix Configuration</h4>
<p>The <code>prefix</code> config defaults to the location where node is installed.
-On most systems, this is <code>/usr/local</code>. On Windows, it’s <code>%AppData%\npm</code>.
-On Unix systems, it’s one level up, since node is typically installed at
+On most systems, this is <code>/usr/local</code>. On Windows, it's <code>%AppData%\npm</code>.
+On Unix systems, it's one level up, since node is typically installed at
<code>{prefix}/bin/node</code> rather than <code>{prefix}/node.exe</code>.</p>
<p>When the <code>global</code> flag is set, npm installs things into this prefix.
When it is not set, it uses the root of the current package, or the
@@ -182,7 +183,7 @@ the package in <code>{prefix}/node_modules/@myorg/package</code>. See
<h4 id="executables">Executables</h4>
<p>When in global mode, executables are linked into <code>{prefix}/bin</code> on Unix,
or directly into <code>{prefix}</code> on Windows. Ensure that path is in your
-terminal’s <code>PATH</code> environment to run them.</p>
+terminal's <code>PATH</code> environment to run them.</p>
<p>When in local mode, executables are linked into
<code>./node_modules/.bin</code> so that they can be made available to scripts run
through npm. (For example, so that a test runner will be in the path
@@ -209,41 +210,41 @@ into some other folder.</p>
<p>Starting at the $PWD, npm will walk up the folder tree checking for a
folder that contains either a <code>package.json</code> file, or a <code>node_modules</code>
folder. If such a thing is found, then that is treated as the effective
-“current directory” for the purpose of running npm commands. (This
-behavior is inspired by and similar to git’s .git-folder seeking
+"current directory" for the purpose of running npm commands. (This
+behavior is inspired by and similar to git's .git-folder seeking
logic when running git commands in a working dir.)</p>
<p>If no package root is found, then the current folder is used.</p>
<p>When you run <code>npm install foo@1.2.3</code>, then the package is loaded into
the cache, and then unpacked into <code>./node_modules/foo</code>. Then, any of
-foo’s dependencies are similarly unpacked into
+foo's dependencies are similarly unpacked into
<code>./node_modules/foo/node_modules/...</code>.</p>
<p>Any bin files are symlinked to <code>./node_modules/.bin/</code>, so that they may
be found by npm scripts when necessary.</p>
<h4 id="global-installation">Global Installation</h4>
<p>If the <code>global</code> configuration is set to true, then npm will
-install packages “globally”.</p>
+install packages "globally".</p>
<p>For global installation, packages are installed roughly the same way,
but using the folders described above.</p>
<h4 id="cycles-conflicts-and-folder-parsimony">Cycles, Conflicts, and Folder Parsimony</h4>
-<p>Cycles are handled using the property of node’s module system that it
+<p>Cycles are handled using the property of node's module system that it
walks up the directories looking for <code>node_modules</code> folders. So, at every
stage, if a package is already installed in an ancestor <code>node_modules</code>
folder, then it is not installed at the current location.</p>
<p>Consider the case above, where <code>foo -&gt; bar -&gt; baz</code>. Imagine if, in
-addition to that, baz depended on bar, so you’d have:
+addition to that, baz depended on bar, so you'd have:
<code>foo -&gt; bar -&gt; baz -&gt; bar -&gt; baz ...</code>. However, since the folder
-structure is: <code>foo/node_modules/bar/node_modules/baz</code>, there’s no need to
+structure is: <code>foo/node_modules/bar/node_modules/baz</code>, there's no need to
put another copy of bar into <code>.../baz/node_modules</code>, since when it calls
-require(“bar”), it will get the copy that is installed in
+require("bar"), it will get the copy that is installed in
<code>foo/node_modules/bar</code>.</p>
<p>This shortcut is only used if the exact same
version would be installed in multiple nested <code>node_modules</code> folders. It
is still possible to have <code>a/node_modules/b/node_modules/a</code> if the two
-“a” packages are different versions. However, without repeating the
+"a" packages are different versions. However, without repeating the
exact same package multiple times, an infinite regress will always be
prevented.</p>
<p>Another optimization can be made by installing dependencies at the
-highest level possible, below the localized “target” folder.</p>
+highest level possible, below the localized "target" folder.</p>
<h4 id="example">Example</h4>
<p>Consider this dependency graph:</p>
<pre lang="bash"><code>foo
@@ -273,19 +274,19 @@ highest level possible, below the localized “target” folder.</p>
`-- quux (3.2.0) &lt;---[E]
</code></pre>
<p>Since foo depends directly on <code>bar@1.2.3</code> and <code>baz@1.2.3</code>, those are
-installed in foo’s <code>node_modules</code> folder.</p>
+installed in foo's <code>node_modules</code> folder.</p>
<p>Even though the latest copy of blerg is 1.3.7, foo has a specific
dependency on version 1.2.5. So, that gets installed at [A]. Since the
-parent installation of blerg satisfies bar’s dependency on <code>blerg@1.x</code>,
+parent installation of blerg satisfies bar's dependency on <code>blerg@1.x</code>,
it does not install another copy under [B].</p>
<p>Bar [B] also has dependencies on baz and asdf, so those are installed in
-bar’s <code>node_modules</code> folder. Because it depends on <code>baz@2.x</code>, it cannot
+bar's <code>node_modules</code> folder. Because it depends on <code>baz@2.x</code>, it cannot
re-use the <code>baz@1.2.3</code> installed in the parent <code>node_modules</code> folder [D],
and must install its own copy [C].</p>
<p>Underneath bar, the <code>baz -&gt; quux -&gt; bar</code> dependency creates a cycle.
-However, because bar is already in quux’s ancestry [B], it does not
+However, because bar is already in quux's ancestry [B], it does not
unpack another copy of bar into that folder.</p>
-<p>Underneath <code>foo -&gt; baz</code> [D], quux’s [E] folder tree is empty, because its
+<p>Underneath <code>foo -&gt; baz</code> [D], quux's [E] folder tree is empty, because its
dependency on bar is satisfied by the parent folder copy installed at [B].</p>
<p>For a graphical breakdown of what is installed where, use <code>npm ls</code>.</p>
<h4 id="publishing">Publishing</h4>
diff --git a/deps/npm/docs/output/configuring-npm/install.html b/deps/npm/docs/output/configuring-npm/install.html
index 0950fadc17..6e24402031 100644
--- a/deps/npm/docs/output/configuring-npm/install.html
+++ b/deps/npm/docs/output/configuring-npm/install.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>install</title>
<style>
body {
@@ -191,12 +192,12 @@ installer to install both Node.js and npm on your system.</p>
you use Linux, we recommend that you use a NodeSource installer.</li>
</ul>
<h4 id="os-x-or-windows-node-installers">OS X or Windows Node installers</h4>
-<p>If you’re using OS X or Windows, use one of the installers from the
+<p>If you're using OS X or Windows, use one of the installers from the
<a href="https://nodejs.org/en/download/">Node.js download page</a>. Be sure to
install the version labeled <strong>LTS</strong>. Other versions have not yet been
tested with npm.</p>
<h4 id="linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</h4>
-<p>If you’re using Linux or another operating system, use one of the following
+<p>If you're using Linux or another operating system, use one of the following
installers:</p>
<ul>
<li><a href="https://github.com/nodesource/distributions">NodeSource installer</a>
diff --git a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html
index d0de6a1470..ce0de6d5fa 100644
--- a/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html
+++ b/deps/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npm-shrinkwrap.json</title>
<style>
body {
@@ -150,7 +151,7 @@ npm command-line interface
<code>npm-shrinkwrap.json</code> may be included when publishing a package.</p>
<p>The recommended use-case for <code>npm-shrinkwrap.json</code> is applications deployed
through the publishing process on the registry: for example, daemons and
-command-line tools intended as global installs or <code>devDependencies</code>. It’s
+command-line tools intended as global installs or <code>devDependencies</code>. It's
strongly discouraged for library authors to publish this file, since that
would prevent end users from having control over transitive dependency
updates.</p>
diff --git a/deps/npm/docs/output/configuring-npm/npmrc.html b/deps/npm/docs/output/configuring-npm/npmrc.html
index a2cc579cb7..1f158d8e08 100644
--- a/deps/npm/docs/output/configuring-npm/npmrc.html
+++ b/deps/npm/docs/output/configuring-npm/npmrc.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>npmrc</title>
<style>
body {
@@ -167,7 +168,7 @@ example:</p>
<p>Each of these files is loaded, and config options are resolved in priority
order. For example, a setting in the userconfig file would override the
setting in the globalconfig file.</p>
-<p>Array values are specified by adding “[]” after the key name. For example:</p>
+<p>Array values are specified by adding "[]" after the key name. For example:</p>
<pre lang="bash"><code>key[] = "first value"
key[] = "second value"
</code></pre>
@@ -184,9 +185,9 @@ key[] = "second value"
<p>When working locally in a project, a <code>.npmrc</code> file in the root of the
project (ie, a sibling of <code>node_modules</code> and <code>package.json</code>) will set
config values specific to this project.</p>
-<p>Note that this only applies to the root of the project that you’re running
+<p>Note that this only applies to the root of the project that you're running
npm in. It has no effect when your module is published. For example, you
-can’t publish a module that forces itself to install globally, or in a
+can't publish a module that forces itself to install globally, or in a
different location.</p>
<p>Additionally, this file is not read in global mode, such as when running
<code>npm install -g</code>.</p>
@@ -199,7 +200,7 @@ is an ini-file formatted list of <code>key = value</code> parameters. Environme
variables can be replaced as above.</p>
<h4 id="built-in-config-file">Built-in config file</h4>
<p><code>path/to/npm/itself/npmrc</code></p>
-<p>This is an unchangeable “builtin” configuration file that npm keeps
+<p>This is an unchangeable "builtin" configuration file that npm keeps
consistent across updates. Set fields in here using the <code>./configure</code>
script that comes with npm. This is primarily for distribution maintainers
to override default configs in a standard and consistent manner.</p>
diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html
index 9c1bb63efe..33957dae49 100644
--- a/deps/npm/docs/output/configuring-npm/package-json.html
+++ b/deps/npm/docs/output/configuring-npm/package-json.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>package.json</title>
<style>
body {
@@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
-<p>This document is all you need to know about what’s required in your
+<p>This document is all you need to know about what's required in your
package.json file. It must be actual JSON, not just a JavaScript object
literal.</p>
<p>A lot of the behavior described in this document is affected by the config
@@ -155,7 +156,7 @@ settings described in <a href="../using-npm/config.html"><code>config</code></a>
package.json are the name and version fields as they will be required. The
name and version together form an identifier that is assumed to be
completely unique. Changes to the package should come along with changes
-to the version. If you don’t plan to publish your package, the name and
+to the version. If you don't plan to publish your package, the name and
version fields are optional.</p>
<p>The name is what your thing is called.</p>
<p>Some rules:</p>
@@ -166,18 +167,18 @@ scope for scoped packages.</li>
is not permitted without a scope.</li>
<li>New packages must not have uppercase letters in the name.</li>
<li>The name ends up being part of a URL, an argument on the command line,
-and a folder name. Therefore, the name can’t contain any non-URL-safe
+and a folder name. Therefore, the name can't contain any non-URL-safe
characters.</li>
</ul>
<p>Some tips:</p>
<ul>
-<li>Don’t use the same name as a core Node module.</li>
-<li>Don’t put “js” or “node” in the name. It’s assumed that it’s js, since
-you’re writing a package.json file, and you can specify the engine using
-the “engines” field. (See below.)</li>
+<li>Don't use the same name as a core Node module.</li>
+<li>Don't put "js" or "node" in the name. It's assumed that it's js, since
+you're writing a package.json file, and you can specify the engine using
+the "engines" field. (See below.)</li>
<li>The name will probably be passed as an argument to require(), so it
should be something short, but also reasonably descriptive.</li>
-<li>You may want to check the npm registry to see if there’s something by
+<li>You may want to check the npm registry to see if there's something by
that name already, before you get too attached to it.
<a href="https://www.npmjs.com/">https://www.npmjs.com/</a></li>
</ul>
@@ -188,24 +189,24 @@ that name already, before you get too attached to it.
package.json are the name and version fields as they will be required. The
name and version together form an identifier that is assumed to be
completely unique. Changes to the package should come along with changes
-to the version. If you don’t plan to publish your package, the name and
+to the version. If you don't plan to publish your package, the name and
version fields are optional.</p>
<p>Version must be parseable by
<a href="https://github.com/npm/node-semver">node-semver</a>, which is bundled with
npm as a dependency. (<code>npm install semver</code> to use it yourself.)</p>
<h3 id="description2">description</h3>
-<p>Put a description in it. It’s a string. This helps people discover your
-package, as it’s listed in <code>npm search</code>.</p>
+<p>Put a description in it. It's a string. This helps people discover your
+package, as it's listed in <code>npm search</code>.</p>
<h3 id="keywords">keywords</h3>
-<p>Put keywords in it. It’s an array of strings. This helps people discover
-your package as it’s listed in <code>npm search</code>.</p>
+<p>Put keywords in it. It's an array of strings. This helps people discover
+your package as it's listed in <code>npm search</code>.</p>
<h3 id="homepage">homepage</h3>
<p>The url to the project homepage.</p>
<p>Example:</p>
<pre lang="json"><code>"homepage": "https://github.com/owner/project#readme"
</code></pre>
<h3 id="bugs">bugs</h3>
-<p>The url to your project’s issue tracker and / or the email address to which
+<p>The url to your project's issue tracker and / or the email address to which
issues should be reported. These are helpful for people who encounter
issues with your package.</p>
<p>It should look like this:</p>
@@ -215,14 +216,14 @@ issues with your package.</p>
}
</code></pre>
<p>You can specify either one or both values. If you want to provide only a
-url, you can specify the value for “bugs” as a simple string instead of an
+url, you can specify the value for "bugs" as a simple string instead of an
object.</p>
<p>If a url is provided, it will be used by the <code>npm bugs</code> command.</p>
<h3 id="license">license</h3>
<p>You should specify a license for your package so that people know how they
-are permitted to use it, and any restrictions you’re placing on it.</p>
-<p>If you’re using a common license such as BSD-2-Clause or MIT, add a current
-SPDX license identifier for the license you’re using, like this:</p>
+are permitted to use it, and any restrictions you're placing on it.</p>
+<p>If you're using a common license such as BSD-2-Clause or MIT, add a current
+SPDX license identifier for the license you're using, like this:</p>
<pre lang="json"><code>{
"license" : "BSD-3-Clause"
}
@@ -237,14 +238,14 @@ string</a>, like this:</p>
"license" : "(ISC OR GPL-3.0)"
}
</code></pre>
-<p>If you are using a license that hasn’t been assigned an SPDX identifier, or if
+<p>If you are using a license that hasn't been assigned an SPDX identifier, or if
you are using a custom license, use a string value like this one:</p>
<pre lang="json"><code>{
"license" : "SEE LICENSE IN &lt;filename&gt;"
}
</code></pre>
<p>Then include a file named <code>&lt;filename&gt;</code> at the top level of the package.</p>
-<p>Some old packages used license objects or a “licenses” property containing
+<p>Some old packages used license objects or a "licenses" property containing
an array of license objects:</p>
<pre lang="json"><code>// Not valid metadata
{
@@ -285,8 +286,8 @@ unpublished package under any terms:</p>
</code></pre>
<p>Consider also setting <code>"private": true</code> to prevent accidental publication.</p>
<h3 id="people-fields-author-contributors">people fields: author, contributors</h3>
-<p>The “author” is one person. “contributors” is an array of people. A
-“person” is an object with a “name” field and optionally “url” and “email”,
+<p>The "author" is one person. "contributors" is an array of people. A
+"person" is an object with a "name" field and optionally "url" and "email",
like this:</p>
<pre lang="json"><code>{
"name" : "Barney Rubble",
@@ -301,7 +302,7 @@ you:</p>
}
</code></pre>
<p>Both email and url are optional either way.</p>
-<p>npm also sets a top-level “maintainers” field with your npm user info.</p>
+<p>npm also sets a top-level "maintainers" field with your npm user info.</p>
<h3 id="funding">funding</h3>
<p>You can specify an object containing an URL that provides up-to-date
information about ways to help fund development of your package, or a
@@ -342,24 +343,24 @@ be visited)</p>
entries to be included when your package is installed as a dependency. File
patterns follow a similar syntax to <code>.gitignore</code>, but reversed: including a
file, directory, or glob pattern (<code>*</code>, <code>**/*</code>, and such) will make it so
-that file is included in the tarball when it’s packed. Omitting the field
+that file is included in the tarball when it's packed. Omitting the field
will make it default to <code>["*"]</code>, which means it will include all files.</p>
<p>Some special files and directories are also included or excluded regardless
of whether they exist in the <code>files</code> array (see below).</p>
<p>You can also provide a <code>.npmignore</code> file in the root of your package or in
subdirectories, which will keep files from being included. At the root of
-your package it will not override the “files” field, but in subdirectories
+your package it will not override the "files" field, but in subdirectories
it will. The <code>.npmignore</code> file works just like a <code>.gitignore</code>. If there is
-a <code>.gitignore</code> file, and <code>.npmignore</code> is missing, <code>.gitignore</code>’s contents
+a <code>.gitignore</code> file, and <code>.npmignore</code> is missing, <code>.gitignore</code>'s contents
will be used instead.</p>
-<p>Files included with the “package.json#files” field <em>cannot</em> be excluded
+<p>Files included with the "package.json#files" field <em>cannot</em> be excluded
through <code>.npmignore</code> or <code>.gitignore</code>.</p>
<p>Certain files are always included, regardless of settings:</p>
<ul>
<li><code>package.json</code></li>
<li><code>README</code></li>
<li><code>LICENSE</code> / <code>LICENCE</code></li>
-<li>The file in the “main” field</li>
+<li>The file in the "main" field</li>
</ul>
<p><code>README</code> &amp; <code>LICENSE</code> can have any case and extension.</p>
<p>Conversely, some files are always ignored:</p>
@@ -385,7 +386,7 @@ it to be published)</li>
<h3 id="main">main</h3>
<p>The main field is a module ID that is the primary entry point to your
program. That is, if your package is named <code>foo</code>, and a user installs it,
-and then does <code>require("foo")</code>, then your main module’s exports object will
+and then does <code>require("foo")</code>, then your main module's exports object will
be returned.</p>
<p>This should be a module relative to the root of your package folder.</p>
<p>For most modules, it makes the most sense to have a main script and often
@@ -394,12 +395,12 @@ not much else.</p>
<h3 id="browser">browser</h3>
<p>If your module is meant to be used client-side the browser field should be
used instead of the main field. This is helpful to hint users that it might
-rely on primitives that aren’t available in Node.js modules. (e.g.
+rely on primitives that aren't available in Node.js modules. (e.g.
<code>window</code>)</p>
<h3 id="bin">bin</h3>
-<p>A lot of packages have one or more executable files that they’d like to
+<p>A lot of packages have one or more executable files that they'd like to
install into the PATH. npm makes this pretty easy (in fact, it uses this
-feature to install the “npm” executable.)</p>
+feature to install the "npm" executable.)</p>
<p>To use this, supply a <code>bin</code> field in your package.json which is a map of
command name to local file name. When this package is installed
globally, that file will be linked where global bins go so it is
@@ -414,7 +415,7 @@ scripts when invoking them via <code>npm run-script</code>.</p>
}
}
</code></pre>
-<p>So, when you install myapp, it’ll create a symlink from the <code>cli.js</code> script
+<p>So, when you install myapp, it'll create a symlink from the <code>cli.js</code> script
to <code>/usr/local/bin/myapp</code>.</p>
<p>If you have a single executable, and its name should be the name of the
package, then you can just supply it as a string. For example:</p>
@@ -442,7 +443,7 @@ executables.</p>
<h3 id="man">man</h3>
<p>Specify either a single file or an array of filenames to put in place for
the <code>man</code> program to find.</p>
-<p>If only a single file is provided, then it’s installed such that it is the
+<p>If only a single file is provided, then it's installed such that it is the
result from <code>man &lt;pkgname&gt;</code>, regardless of its actual filename. For
example:</p>
<pre lang="json"><code>{
@@ -454,7 +455,7 @@ example:</p>
}
</code></pre>
<p>would link the <code>./man/doc.1</code> file in such that it is the target for <code>man foo</code></p>
-<p>If the filename doesn’t start with the package name, then it’s prefixed.
+<p>If the filename doesn't start with the package name, then it's prefixed.
So, this:</p>
<pre lang="json"><code>{
"name": "foo",
@@ -486,8 +487,8 @@ into.</p>
<h3 id="directories">directories</h3>
<p>The CommonJS <a href="http://wiki.commonjs.org/wiki/Packages/1.0">Packages</a> spec
details a few ways that you can indicate the structure of your package
-using a <code>directories</code> object. If you look at <a href="https://registry.npmjs.org/npm/latest">npm’s
-package.json</a>, you’ll see that it
+using a <code>directories</code> object. If you look at <a href="https://registry.npmjs.org/npm/latest">npm's
+package.json</a>, you'll see that it
has directories for doc, lib, and man.</p>
<p>In the future, this information may be used in other creative ways.</p>
<h4 id="directoriesbin">directories.bin</h4>
@@ -498,7 +499,7 @@ and setting <code>directories.bin</code> is an error. If you want to specify
individual files, use <code>bin</code>, and for all the files in an existing <code>bin</code>
directory, use <code>directories.bin</code>.</p>
<h4 id="directoriesman">directories.man</h4>
-<p>A folder that is full of man pages. Sugar to generate a “man” array by
+<p>A folder that is full of man pages. Sugar to generate a "man" array by
walking the folder.</p>
<h3 id="repository">repository</h3>
<p>Specify the place where your code lives. This is helpful for people who
@@ -514,7 +515,7 @@ command will be able to find you.</p>
</code></pre>
<p>The URL should be a publicly available (perhaps read-only) url that can be
handed directly to a VCS program without any modification. It should not
-be a url to an html project page that you put in your browser. It’s for
+be a url to an html project page that you put in your browser. It's for
computers.</p>
<p>For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the
same shortcut syntax you use for <code>npm install</code>:</p>
@@ -542,13 +543,13 @@ which it lives:</p>
}
</code></pre>
<h3 id="scripts">scripts</h3>
-<p>The “scripts” property is a dictionary containing script commands that are
+<p>The "scripts" property is a dictionary containing script commands that are
run at various times in the lifecycle of your package. The key is the
lifecycle event, and the value is the command to run at that point.</p>
<p>See <a href="../using-npm/scripts.html"><code>scripts</code></a> to find out more about writing package
scripts.</p>
<h3 id="config">config</h3>
-<p>A “config” object can be used to set configuration parameters used in
+<p>A "config" object can be used to set configuration parameters used in
package scripts that persist across upgrades. For instance, if a package
had the following:</p>
<pre lang="json"><code>{
@@ -558,14 +559,14 @@ had the following:</p>
}
}
</code></pre>
-<p>It could also have a “start” command that referenced the
+<p>It could also have a "start" command that referenced the
<code>npm_package_config_port</code> environment variable.</p>
<h3 id="dependencies">dependencies</h3>
<p>Dependencies are specified in a simple object that maps a package name to a
version range. The version range is a string which has one or more
space-separated descriptors. Dependencies can also be identified with a
tarball or git URL.</p>
-<p><strong>Please do not put test harnesses or transpilers or other “development”
+<p><strong>Please do not put test harnesses or transpilers or other "development"
time tools in your <code>dependencies</code> object.</strong> See <code>devDependencies</code>, below.</p>
<p>See <a href="https://github.com/npm/node-semver#versions">semver</a> for more details about specifying version ranges.</p>
<ul>
@@ -574,17 +575,17 @@ time tools in your <code>dependencies</code> object.</strong> See <code>devDepe
<li><code>&gt;=version</code> etc</li>
<li><code>&lt;version</code></li>
<li><code>&lt;=version</code></li>
-<li><code>~version</code> “Approximately equivalent to version” See
+<li><code>~version</code> "Approximately equivalent to version" See
<a href="https://github.com/npm/node-semver#versions">semver</a></li>
-<li><code>^version</code> “Compatible with version” See <a href="https://github.com/npm/node-semver#versions">semver</a></li>
+<li><code>^version</code> "Compatible with version" See <a href="https://github.com/npm/node-semver#versions">semver</a></li>
<li><code>1.2.x</code> 1.2.0, 1.2.1, etc., but not 1.3.0</li>
-<li><code>http://...</code> See ‘URLs as Dependencies’ below</li>
+<li><code>http://...</code> See 'URLs as Dependencies' below</li>
<li><code>*</code> Matches any version</li>
<li><code>""</code> (just an empty string) Same as <code>*</code></li>
<li><code>version1 - version2</code> Same as <code>&gt;=version1 &lt;=version2</code>.</li>
<li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li>
-<li><code>git...</code> See ‘Git URLs as Dependencies’ below</li>
-<li><code>user/repo</code> See ‘GitHub URLs’ below</li>
+<li><code>git...</code> See 'Git URLs as Dependencies' below</li>
+<li><code>user/repo</code> See 'GitHub URLs' below</li>
<li><code>tag</code> A specific version tagged and published as <code>tag</code> See <a href="../commands/npm-dist-tag.html"><code>npm dist-tag</code></a></li>
<li><code>path/path/path</code> See <a href="#local-paths">Local Paths</a> below</li>
</ul>
@@ -629,8 +630,8 @@ git+https://isaacs@github.com/npm/cli.git
git://github.com/npm/cli.git#v1.0.27
</code></pre>
<h4 id="github-urls">GitHub URLs</h4>
-<p>As of version 1.1.65, you can refer to GitHub urls as just “foo”:
-“user/foo-project”. Just as with git URLs, a <code>commit-ish</code> suffix can be
+<p>As of version 1.1.65, you can refer to GitHub urls as just "foo":
+"user/foo-project". Just as with git URLs, a <code>commit-ish</code> suffix can be
included. For example:</p>
<pre lang="json"><code>{
"name": "foo",
@@ -660,13 +661,13 @@ contains a package. Local paths can be saved using <code>npm install -S</code> o
}
</code></pre>
<p>This feature is helpful for local offline development and creating tests
-that require npm installing where you don’t want to hit an external server,
+that require npm installing where you don't want to hit an external server,
but should not be used when publishing packages to the public registry.</p>
<h3 id="devdependencies">devDependencies</h3>
<p>If someone is planning on downloading and using your module in their
-program, then they probably don’t want or need to download and build the
+program, then they probably don't want or need to download and build the
external test or documentation framework that you use.</p>
-<p>In this case, it’s best to map these additional items in a
+<p>In this case, it's best to map these additional items in a
<code>devDependencies</code> object.</p>
<p>These things will be installed when doing <code>npm link</code> or <code>npm install</code> from
the root of a package, and can be managed like any other npm configuration
@@ -690,7 +691,7 @@ do this, and make the required package a devDependency.</p>
</code></pre>
<p>The <code>prepare</code> script will be run before publishing, so that users can
consume the functionality without requiring them to compile it themselves.
-In dev mode (ie, locally running <code>npm install</code>), it’ll run this script as
+In dev mode (ie, locally running <code>npm install</code>), it'll run this script as
well, so that you can test it easily.</p>
<h3 id="peerdependencies">peerDependencies</h3>
<p>In some cases, you want to express the compatibility of your package with a
@@ -721,7 +722,7 @@ an error if the tree cannot be resolved correctly. For this reason, make
sure your plugin requirement is as broad as possible, and not to lock it
down to specific patch versions.</p>
<p>Assuming the host complies with <a href="https://semver.org/">semver</a>, only changes
-in the host package’s major version will break your plugin. Thus, if you’ve
+in the host package's major version will break your plugin. Thus, if you've
worked with every 1.x version of the host package, use <code>"^1.0"</code> or <code>"1.x"</code>
to express this. If you depend on features introduced in 1.5.2, use
<code>"^1.5.2"</code>.</p>
@@ -779,7 +780,7 @@ be found or fails to install, then you may put it in the
<code>optionalDependencies</code> object. This is a map of package name to version or
url, just like the <code>dependencies</code> object. The difference is that build
failures do not cause installation to fail. Running <code>npm install --no-optional</code> will prevent these dependencies from being installed.</p>
-<p>It is still your program’s responsibility to handle the lack of the
+<p>It is still your program's responsibility to handle the lack of the
dependency. For example, something like this:</p>
<pre lang="js"><code>try {
var foo = require('foo')
@@ -798,7 +799,7 @@ if (foo) {
}
</code></pre>
<p>Entries in <code>optionalDependencies</code> will override entries of the same name in
-<code>dependencies</code>, so it’s usually best to only put in one place.</p>
+<code>dependencies</code>, so it's usually best to only put in one place.</p>
<h3 id="engines">engines</h3>
<p>You can specify the version of node that your stuff works on:</p>
<pre lang="json"><code>{
@@ -807,9 +808,9 @@ if (foo) {
}
}
</code></pre>
-<p>And, like with dependencies, if you don’t specify the version (or if you
-specify “*” as the version), then any version of node will do.</p>
-<p>You can also use the “engines” field to specify which versions of npm are
+<p>And, like with dependencies, if you don't specify the version (or if you
+specify "*" as the version), then any version of node will do.</p>
+<p>You can also use the "engines" field to specify which versions of npm are
capable of properly installing your program. For example:</p>
<pre lang="json"><code>{
"engines": {
@@ -831,7 +832,7 @@ module will run on:</p>
}
</code></pre>
<p>You can also block instead of allowing operating systems, just prepend the
-blocked os with a ‘!’:</p>
+blocked os with a '!':</p>
<pre lang="json"><code>{
"os": [
"!win32"
@@ -839,7 +840,7 @@ blocked os with a ‘!’:</p>
}
</code></pre>
<p>The host operating system is determined by <code>process.platform</code></p>
-<p>It is allowed to both block and allow an item, although there isn’t any
+<p>It is allowed to both block and allow an item, although there isn't any
good reason to do this.</p>
<h3 id="cpu">cpu</h3>
<p>If your code only runs on certain cpu architectures,
@@ -869,9 +870,9 @@ a specific registry (for example, an internal registry), then use the
<code>publishConfig</code> dictionary described below to override the <code>registry</code>
config param at publish-time.</p>
<h3 id="publishconfig">publishConfig</h3>
-<p>This is a set of config values that will be used at publish-time. It’s
+<p>This is a set of config values that will be used at publish-time. It's
especially handy if you want to set the tag, registry or access, so that
-you can ensure that a given package is not tagged with “latest”, published
+you can ensure that a given package is not tagged with "latest", published
to the global public registry or that a scoped module is private by
default.</p>
<p>See <a href="../using-npm/config.html"><code>config</code></a> to see the list of config options that
diff --git a/deps/npm/docs/output/configuring-npm/package-lock-json.html b/deps/npm/docs/output/configuring-npm/package-lock-json.html
index 41ee923047..47359d9448 100644
--- a/deps/npm/docs/output/configuring-npm/package-lock-json.html
+++ b/deps/npm/docs/output/configuring-npm/package-lock-json.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>package-lock.json</title>
<style>
body {
@@ -158,7 +159,7 @@ teammates, deployments, and continuous integration are guaranteed to
install exactly the same dependencies.</p>
</li>
<li>
-<p>Provide a facility for users to “time-travel” to previous states of
+<p>Provide a facility for users to "time-travel" to previous states of
<code>node_modules</code> without having to commit the directory itself.</p>
</li>
<li>
@@ -189,7 +190,7 @@ root of a project, <code>npm-shrinkwrap.json</code> will take precedence and
<code>package-lock.json</code> will be ignored.</p>
<h3 id="hidden-lockfiles">Hidden Lockfiles</h3>
<p>In order to avoid processing the <code>node_modules</code> folder repeatedly, npm as
-of v7 uses a “hidden” lockfile present in
+of v7 uses a "hidden" lockfile present in
<code>node_modules/.package-lock.json</code>. This contains information about the
tree, and is used in lieu of reading the entire <code>node_modules</code> hierarchy
provided that the following conditions are met:</p>
@@ -211,7 +212,7 @@ modified time on <code>node_modules/foo</code> will not reflect this change. If
are manually editing files in <code>node_modules</code>, it is generally best to
delete the file at <code>node_modules/.package-lock.json</code>.</p>
<p>As the hidden lockfile is ignored by older npm versions, it does not
-contain the backwards compatibility affordances present in “normal”
+contain the backwards compatibility affordances present in "normal"
lockfiles. That is, it is <code>lockfileVersion: 3</code>, rather than
<code>lockfileVersion: 2</code>.</p>
<h3 id="handling-old-lockfiles">Handling Old Lockfiles</h3>
@@ -221,11 +222,11 @@ information from either the <code>node_modules</code> tree or (in the case of em
<code>node_modules</code> trees or very old lockfile formats) the npm registry.</p>
<h3 id="file-format">File Format</h3>
<h4 id="name"><code>name</code></h4>
-<p>The name of the package this is a package-lock for. This will match what’s
+<p>The name of the package this is a package-lock for. This will match what's
in <code>package.json</code>.</p>
<h4 id="version"><code>version</code></h4>
<p>The version of the package this is a package-lock for. This will match
-what’s in <code>package.json</code>.</p>
+what's in <code>package.json</code>.</p>
<h4 id="lockfileversion"><code>lockfileVersion</code></h4>
<p>An integer version, starting at <code>1</code> with the version number of this
document whose semantics were used when generating this
@@ -235,7 +236,7 @@ information that would have otherwise required looking in <code>node_modules</co
the npm registry. Lockfiles generated by npm v7 will contain
<code>lockfileVersion: 2</code>.</p>
<ul>
-<li>No version provided: an “ancient” shrinkwrap file from a version of npm
+<li>No version provided: an "ancient" shrinkwrap file from a version of npm
prior to npm v5.</li>
<li><code>1</code>: The lockfile version used by npm v5 and v6.</li>
<li><code>2</code>: The lockfile version used by npm v7, which is backwards compatible
@@ -263,7 +264,7 @@ the case of packages fetched from the registry, this will be a url to a
tarball. In the case of git dependencies, this will be the full git url
with commit sha. In the case of link dependencies, this will be the
location of the link target. <code>registry.npmjs.org</code> is a magic value meaning
-“the currently configured registry”.</p>
+"the currently configured registry".</p>
</li>
<li>
<p>integrity: A <code>sha512</code> or <code>sha1</code> <a href="https://w3c.github.io/webappsec/specs/subresourceintegrity/">Standard Subresource
@@ -334,9 +335,9 @@ dependencies, this is the commit sha.</p>
</li>
<li>
<p>resolved: For registry sources this is path of the tarball relative to
-the registry URL. If the tarball URL isn’t on the same server as the
+the registry URL. If the tarball URL isn't on the same server as the
registry URL then this is a complete URL. <code>registry.npmjs.org</code> is a magic
-value meaning “the currently configured registry”.</p>
+value meaning "the currently configured registry".</p>
</li>
<li>
<p>bundled: If true, this is the bundled dependency and will be installed
diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html
index dbdb6fcbc1..639ef624bc 100644
--- a/deps/npm/docs/output/using-npm/config.html
+++ b/deps/npm/docs/output/using-npm/config.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>config</title>
<style>
body {
@@ -177,7 +178,7 @@ would become <code>npm_config_allow_same_version=true</code>.</p>
option <code>--userconfig</code> or environment variable <code>$NPM_CONFIG_USERCONFIG</code>)</li>
<li>global configuration file (defaults to <code>$PREFIX/etc/npmrc</code>; configurable via
CLI option <code>--globalconfig</code> or environment variable <code>$NPM_CONFIG_GLOBALCONFIG</code>)</li>
-<li>npm’s built-in configuration file (<code>/path/to/npm/npmrc</code>)</li>
+<li>npm's built-in configuration file (<code>/path/to/npm/npmrc</code>)</li>
</ul>
<p>See <a href="../configuring-npm/npmrc.html">npmrc</a> for more details.</p>
<h4 id="default-configs">Default Configs</h4>
@@ -264,8 +265,8 @@ safer to use a registry-provided authentication bearer token stored in the
<!-- raw HTML omitted -->
<h4 id="access"><code>access</code></h4>
<ul>
-<li>Default: ‘restricted’ for scoped packages, ‘public’ for unscoped packages</li>
-<li>Type: null, “restricted”, or “public”</li>
+<li>Default: 'restricted' for scoped packages, 'public' for unscoped packages</li>
+<li>Type: null, "restricted", or "public"</li>
</ul>
<p>When publishing scoped packages, the access level defaults to <code>restricted</code>.
If you want your scoped package to be publicly viewable (and installable)
@@ -302,7 +303,7 @@ to the same value as the current version.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” submit audit reports alongside the current npm command to the
+<p>When "true" submit audit reports alongside the current npm command to the
default registry and all registries configured for scopes. See the
documentation for <a href="../commands/npm-audit.html"><code>npm audit</code></a> for details on what is
submitted.</p>
@@ -311,7 +312,7 @@ submitted.</p>
<h4 id="audit-level"><code>audit-level</code></h4>
<ul>
<li>Default: null</li>
-<li>Type: null, “info”, “low”, “moderate”, “high”, “critical”, or “none”</li>
+<li>Type: null, "info", "low", "moderate", "high", "critical", or "none"</li>
</ul>
<p>The minimum level of vulnerability for <code>npm audit</code> to exit with a non-zero
exit code.</p>
@@ -324,7 +325,7 @@ exit code.</p>
</ul>
<p>If passed to <code>npm install</code>, will rebuild the npm tree such that only
versions that were available <strong>on or before</strong> the <code>--before</code> time get
-installed. If there’s no versions available for the current set of direct
+installed. If there's no versions available for the current set of direct
dependencies, the command will error.</p>
<p>If the requested version is a <code>dist-tag</code> and the given tag does not pass the
<code>--before</code> filter, the most recent version less than or equal to that tag
@@ -340,7 +341,7 @@ will be used. For example, <code>foo@latest</code> might install <code>foo@1.2</
<p>Tells npm to create symlinks (or <code>.cmd</code> shims on Windows) for package
executables.</p>
<p>Set to false to have it not do this. This can be used to work around the
-fact that some file systems don’t support symlinks, even on ostensibly Unix
+fact that some file systems don't support symlinks, even on ostensibly Unix
systems.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -362,11 +363,11 @@ terminal.</p>
</ul>
<p>The Certificate Authority signing certificate that is trusted for SSL
connections to the registry. Values should be in PEM format (Windows calls
-it “Base-64 encoded X.509 (.CER)”) with newlines replaced by the string
-“\n”. For example:</p>
+it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string
+"\n". For example:</p>
<pre lang="ini"><code>ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
</code></pre>
-<p>Set to <code>null</code> to only allow “known” registrars, or to a specific CA cert to
+<p>Set to <code>null</code> to only allow "known" registrars, or to a specific CA cert to
trust only that specific signing authority.</p>
<p>Multiple CAs can be trusted by specifying an array of certificates:</p>
<pre lang="ini"><code>ca[]="..."
@@ -380,7 +381,7 @@ ca[]="..."
<li>Default: Windows: <code>%LocalAppData%\npm-cache</code>, Posix: <code>~/.npm</code></li>
<li>Type: Path</li>
</ul>
-<p>The location of npm’s cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
+<p>The location of npm's cache directory. See <a href="../commands/npm-cache.html"><code>npm cache</code></a></p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="cafile"><code>cafile</code></h4>
@@ -389,13 +390,13 @@ ca[]="..."
<li>Type: Path</li>
</ul>
<p>A path to a file containing one or multiple Certificate Authority signing
-certificates. Similar to the <code>ca</code> setting, but allows for multiple CA’s, as
+certificates. Similar to the <code>ca</code> setting, but allows for multiple CA's, as
well as for the CA information to be stored in a file on disk.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="call"><code>call</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Optional companion option for <code>npm exec</code>, <code>npx</code> that allows for specifying a
@@ -410,11 +411,11 @@ custom command to be run along with the installed packages.</p>
<li>Type: null or String</li>
</ul>
<p>A client certificate to pass when accessing the registry. Values should be
-in PEM format (Windows calls it “Base-64 encoded X.509 (.CER)”) with
-newlines replaced by the string “\n”. For example:</p>
+in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
+newlines replaced by the string "\n". For example:</p>
<pre lang="ini"><code>cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
</code></pre>
-<p>It is <em>not</em> the path to a certificate file (and there is no “certfile”
+<p>It is <em>not</em> the path to a certificate file (and there is no "certfile"
option).</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -440,8 +441,8 @@ tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="color"><code>color</code></h4>
<ul>
-<li>Default: true unless the NO_COLOR environ is set to something other than ‘0’</li>
-<li>Type: “always” or Boolean</li>
+<li>Default: true unless the NO_COLOR environ is set to something other than '0'</li>
+<li>Type: "always" or Boolean</li>
</ul>
<p>If false, never shows colors. If <code>"always"</code> then always shows colors. If
true, then only prints color codes for tty file descriptors.</p>
@@ -483,7 +484,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="diff-dst-prefix"><code>diff-dst-prefix</code></h4>
<ul>
-<li>Default: “b/”</li>
+<li>Default: "b/"</li>
<li>Type: String</li>
</ul>
<p>Destination prefix to be used in <code>npm diff</code> output.</p>
@@ -517,7 +518,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<!-- raw HTML omitted -->
<h4 id="diff-src-prefix"><code>diff-src-prefix</code></h4>
<ul>
-<li>Default: “a/”</li>
+<li>Default: "a/"</li>
<li>Type: String</li>
</ul>
<p>Source prefix to be used in <code>npm diff</code> output.</p>
@@ -544,7 +545,7 @@ project. If <code>--all</code> is set, then npm will show all dependencies by de
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Indicates that you don’t want npm to make any changes and that it should
+<p>Indicates that you don't want npm to make any changes and that it should
only report what it would have done. This can be passed into any of the
commands that modify your local installation, eg, <code>install</code>, <code>update</code>,
<code>dedupe</code>, <code>uninstall</code>, as well as <code>pack</code> and <code>publish</code>.</p>
@@ -554,8 +555,8 @@ commands that modify your local installation, eg, <code>install</code>, <code>up
<!-- raw HTML omitted -->
<h4 id="editor"><code>editor</code></h4>
<ul>
-<li>Default: The EDITOR or VISUAL environment variables, or ‘notepad.exe’ on
-Windows, or ‘vim’ on Unix systems</li>
+<li>Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
+Windows, or 'vim' on Unix systems</li>
<li>Type: String</li>
</ul>
<p>The command to run for <code>npm edit</code> and <code>npm config edit</code>.</p>
@@ -577,7 +578,7 @@ Node.js version.</p>
<li>Default: 2</li>
<li>Type: Number</li>
</ul>
-<p>The “retries” config for the <code>retry</code> module to use when fetching packages
+<p>The "retries" config for the <code>retry</code> module to use when fetching packages
from the registry.</p>
<p>npm will retry idempotent read requests to the registry in the case of
network failures or 5xx HTTP errors.</p>
@@ -588,7 +589,7 @@ network failures or 5xx HTTP errors.</p>
<li>Default: 10</li>
<li>Type: Number</li>
</ul>
-<p>The “factor” config for the <code>retry</code> module to use when fetching packages.</p>
+<p>The "factor" config for the <code>retry</code> module to use when fetching packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></h4>
@@ -596,7 +597,7 @@ network failures or 5xx HTTP errors.</p>
<li>Default: 60000 (1 minute)</li>
<li>Type: Number</li>
</ul>
-<p>The “maxTimeout” config for the <code>retry</code> module to use when fetching
+<p>The "maxTimeout" config for the <code>retry</code> module to use when fetching
packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -605,7 +606,7 @@ packages.</p>
<li>Default: 10000 (10 seconds)</li>
<li>Type: Number</li>
</ul>
-<p>The “minTimeout” config for the <code>retry</code> module to use when fetching
+<p>The "minTimeout" config for the <code>retry</code> module to use when fetching
packages.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -639,7 +640,7 @@ range (including SemVer-major changes).</li>
<li>Implicitly set <code>--yes</code> during <code>npm init</code>.</li>
<li>Allow clobbering existing values in <code>npm pkg</code></li>
</ul>
-<p>If you don’t have a clear idea of what you want to do, it is strongly
+<p>If you don't have a clear idea of what you want to do, it is strongly
recommended that you do not use this option!</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -669,13 +670,13 @@ file.</p>
<li>Default: true</li>
<li>Type: Boolean</li>
</ul>
-<p>When “true” displays the message at the end of each <code>npm install</code>
+<p>When "true" displays the message at the end of each <code>npm install</code>
acknowledging the number of dependencies looking for funding. See <a href="../commands/npm-fund.html"><code>npm fund</code></a> for details.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="git"><code>git</code></h4>
<ul>
-<li>Default: “git”</li>
+<li>Default: "git"</li>
<li>Type: String</li>
</ul>
<p>The command to use for git commands. If git is installed on the computer,
@@ -695,7 +696,7 @@ but is not in the <code>PATH</code>, then set this to the full path to the git b
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Operates in “global” mode, so that packages are installed into the <code>prefix</code>
+<p>Operates in "global" mode, so that packages are installed into the <code>prefix</code>
folder instead of the current working directory. See
<a href="../configuring-npm/folders.html">folders</a> for more on the differences in behavior.</p>
<ul>
@@ -721,8 +722,8 @@ will be preferred.</p>
<!-- raw HTML omitted -->
<h4 id="globalconfig"><code>globalconfig</code></h4>
<ul>
-<li>Default: The global –prefix setting plus ‘etc/npmrc’. For example,
-‘/usr/local/etc/npmrc’</li>
+<li>Default: The global --prefix setting plus 'etc/npmrc'. For example,
+'/usr/local/etc/npmrc'</li>
<li>Type: Path</li>
</ul>
<p>The config file to read for global config options.</p>
@@ -730,7 +731,7 @@ will be preferred.</p>
<!-- raw HTML omitted -->
<h4 id="heading"><code>heading</code></h4>
<ul>
-<li>Default: “npm”</li>
+<li>Default: "npm"</li>
<li>Type: String</li>
</ul>
<p>The string that starts all the debugging log output.</p>
@@ -753,9 +754,9 @@ library.</p>
<li>Type: Boolean</li>
</ul>
<p>If true, npm will not exit with an error code when <code>run-script</code> is invoked
-for a script that isn’t defined in the <code>scripts</code> section of <code>package.json</code>.
-This option can be used when it’s desirable to optionally run a script when
-it’s present and fail if the script fails. This is useful, for example, when
+for a script that isn't defined in the <code>scripts</code> section of <code>package.json</code>.
+This option can be used when it's desirable to optionally run a script when
+it's present and fail if the script fails. This is useful, for example, when
running scripts that may only apply for some builds in an otherwise generic
CI setup.</p>
<!-- raw HTML omitted -->
@@ -775,7 +776,7 @@ will <em>not</em> run any pre- or post-scripts.</p>
<h4 id="include"><code>include</code></h4>
<ul>
<li>Default:</li>
-<li>Type: “prod”, “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Type: "prod", "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Option that allows for defining which types of dependencies to install.</p>
<p>This is the inverse of <code>--omit=&lt;type&gt;</code>.</p>
@@ -788,7 +789,7 @@ the order in which omit/include are specified on the command-line.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>Allow installing “staged” published packages, as defined by <a href="https://github.com/npm/rfcs/pull/92">npm RFC PR
+<p>Allow installing "staged" published packages, as defined by <a href="https://github.com/npm/rfcs/pull/92">npm RFC PR
#92</a>.</p>
<p>This is experimental, and not implemented by the npm public registry.</p>
<!-- raw HTML omitted -->
@@ -806,32 +807,32 @@ the specified workspaces, and not on the root project.</p>
<!-- raw HTML omitted -->
<h4 id="init-author-email"><code>init-author-email</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
-<p>The value <code>npm init</code> should use by default for the package author’s email.</p>
+<p>The value <code>npm init</code> should use by default for the package author's email.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-author-name"><code>init-author-name</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
-<p>The value <code>npm init</code> should use by default for the package author’s name.</p>
+<p>The value <code>npm init</code> should use by default for the package author's name.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-author-url"><code>init-author-url</code></h4>
<ul>
-<li>Default: “”</li>
-<li>Type: “” or URL</li>
+<li>Default: ""</li>
+<li>Type: "" or URL</li>
</ul>
-<p>The value <code>npm init</code> should use by default for the package author’s
+<p>The value <code>npm init</code> should use by default for the package author's
homepage.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="init-license"><code>init-license</code></h4>
<ul>
-<li>Default: “ISC”</li>
+<li>Default: "ISC"</li>
<li>Type: String</li>
</ul>
<p>The value <code>npm init</code> should use by default for the package license.</p>
@@ -839,7 +840,7 @@ homepage.</p>
<!-- raw HTML omitted -->
<h4 id="init-module"><code>init-module</code></h4>
<ul>
-<li>Default: “~/.npm-init.js”</li>
+<li>Default: "~/.npm-init.js"</li>
<li>Type: Path</li>
</ul>
<p>A module that will be loaded by the <code>npm init</code> command. See the
@@ -850,7 +851,7 @@ more information, or <a href="../commands/npm-init.html">npm init</a>.</p>
<!-- raw HTML omitted -->
<h4 id="init-version"><code>init-version</code></h4>
<ul>
-<li>Default: “1.0.0”</li>
+<li>Default: "1.0.0"</li>
<li>Type: SemVer string</li>
</ul>
<p>The value that <code>npm init</code> should use by default for the package version
@@ -876,10 +877,10 @@ saving them to your <code>package.json</code>.</li>
<li>Type: null or String</li>
</ul>
<p>A client key to pass when accessing the registry. Values should be in PEM
-format with newlines replaced by the string “\n”. For example:</p>
+format with newlines replaced by the string "\n". For example:</p>
<pre lang="ini"><code>key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
</code></pre>
-<p>It is <em>not</em> the path to a key file (and there is no “keyfile” option).</p>
+<p>It is <em>not</em> the path to a key file (and there is no "keyfile" option).</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="legacy-bundling"><code>legacy-bundling</code></h4>
@@ -928,9 +929,9 @@ npm registry. Must be IPv4 in versions of Node prior to 0.12.</p>
<!-- raw HTML omitted -->
<h4 id="location"><code>location</code></h4>
<ul>
-<li>Default: “user” unless <code>--global</code> is passed, which will also set this value
-to “global”</li>
-<li>Type: “global”, “user”, or “project”</li>
+<li>Default: "user" unless <code>--global</code> is passed, which will also set this value
+to "global"</li>
+<li>Type: "global", "user", or "project"</li>
</ul>
<p>When passed to <code>npm config</code> this refers to which config file to use.</p>
<!-- raw HTML omitted -->
@@ -939,7 +940,7 @@ to “global”</li>
<ul>
<li>Default: Version 2 if no lockfile or current lockfile version less than or
equal to 2, otherwise maintain current lockfile version</li>
-<li>Type: null, 1, 2, 3, “1”, “2”, or “3”</li>
+<li>Type: null, 1, 2, 3, "1", "2", or "3"</li>
</ul>
<p>Set the lockfile format version to be used in package-lock.json and
npm-shrinkwrap-json files. Possible options are:</p>
@@ -957,14 +958,14 @@ Ideal if all users are on npm version 7 and higher.</p>
<!-- raw HTML omitted -->
<h4 id="loglevel"><code>loglevel</code></h4>
<ul>
-<li>Default: “notice”</li>
-<li>Type: “silent”, “error”, “warn”, “notice”, “http”, “timing”, “info”,
-“verbose”, or “silly”</li>
+<li>Default: "notice"</li>
+<li>Type: "silent", "error", "warn", "notice", "http", "timing", "info",
+"verbose", or "silly"</li>
</ul>
<p>What level of logs to report. On failure, <em>all</em> logs are written to
<code>npm-debug.log</code> in the current working directory.</p>
<p>Any logs of a higher level than the setting are shown. The default is
-“notice”.</p>
+"notice".</p>
<p>See also the <code>foreground-scripts</code> config.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -995,11 +996,11 @@ combination).</p>
<!-- raw HTML omitted -->
<h4 id="message"><code>message</code></h4>
<ul>
-<li>Default: “%s”</li>
+<li>Default: "%s"</li>
<li>Type: String</li>
</ul>
<p>Commit message which is used by <code>npm version</code> when creating version commit.</p>
-<p>Any “%s” in the message will be replaced with the version number.</p>
+<p>Any "%s" in the message will be replaced with the version number.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="node-options"><code>node-options</code></h4>
@@ -1017,7 +1018,7 @@ how lifecycle scripts are called.</p>
<li>Default: Node.js <code>process.version</code> value</li>
<li>Type: SemVer string</li>
</ul>
-<p>The node version to use when checking a package’s <code>engines</code> setting.</p>
+<p>The node version to use when checking a package's <code>engines</code> setting.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="noproxy"><code>noproxy</code></h4>
@@ -1034,7 +1035,7 @@ how lifecycle scripts are called.</p>
<li>Default: Output of <code>npm --version</code></li>
<li>Type: SemVer string</li>
</ul>
-<p>The npm version to use when checking a package’s <code>engines</code> setting.</p>
+<p>The npm version to use when checking a package's <code>engines</code> setting.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="offline"><code>offline</code></h4>
@@ -1048,9 +1049,9 @@ allow the CLI to fill in missing cache data, see <code>--prefer-offline</code>.<
<!-- raw HTML omitted -->
<h4 id="omit"><code>omit</code></h4>
<ul>
-<li>Default: ‘dev’ if the <code>NODE_ENV</code> environment variable is set to
-‘production’, otherwise empty.</li>
-<li>Type: “dev”, “optional”, or “peer” (can be set multiple times)</li>
+<li>Default: 'dev' if the <code>NODE_ENV</code> environment variable is set to
+'production', otherwise empty.</li>
+<li>Type: "dev", "optional", or "peer" (can be set multiple times)</li>
</ul>
<p>Dependency types to omit from the installation tree on disk.</p>
<p>Note that these dependencies <em>are</em> still resolved and added to the
@@ -1067,7 +1068,7 @@ variable will be set to <code>'production'</code> for all lifecycle scripts.</p>
<li>Default: null</li>
<li>Type: null or String</li>
</ul>
-<p>This is a one-time password from a two-factor authenticator. It’s needed
+<p>This is a one-time password from a two-factor authenticator. It's needed
when publishing or changing package permissions with <code>npm access</code>.</p>
<p>If not set, and a registry response fails with a challenge for a one-time
password, npm will prompt on the command line for one.</p>
@@ -1075,7 +1076,7 @@ password, npm will prompt on the command line for one.</p>
<!-- raw HTML omitted -->
<h4 id="pack-destination"><code>pack-destination</code></h4>
<ul>
-<li>Default: “.”</li>
+<li>Default: "."</li>
<li>Type: String</li>
</ul>
<p>Directory in which <code>npm pack</code> will save tarballs.</p>
@@ -1155,10 +1156,10 @@ forces non-global commands to run in the specified folder.</p>
<!-- raw HTML omitted -->
<h4 id="preid"><code>preid</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
-<p>The “prerelease identifier” to use as a prefix for the “prerelease” part of
+<p>The "prerelease identifier" to use as a prefix for the "prerelease" part of
a semver. Like the <code>rc</code> in <code>1.2.0-rc.8</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
@@ -1201,7 +1202,7 @@ access tokens with the <code>npm token create</code> command.</p>
<!-- raw HTML omitted -->
<h4 id="registry"><code>registry</code></h4>
<ul>
-<li>Default: “<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>”</li>
+<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
<li>Type: URL</li>
</ul>
<p>The base URL of the npm registry.</p>
@@ -1242,7 +1243,7 @@ package.json.</p>
<li>Type: Boolean</li>
</ul>
<p>Dependencies saved to package.json will be configured with an exact version
-rather than using npm’s default semver range operator.</p>
+rather than using npm's default semver range operator.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="save-optional"><code>save-optional</code></h4>
@@ -1263,7 +1264,7 @@ rather than using npm’s default semver range operator.</p>
<!-- raw HTML omitted -->
<h4 id="save-prefix"><code>save-prefix</code></h4>
<ul>
-<li>Default: “^”</li>
+<li>Default: "^"</li>
<li>Type: String</li>
</ul>
<p>Configure how versions of packages installed to a package.json file via
@@ -1287,7 +1288,7 @@ or <code>--save-optional</code> are true.</p>
<!-- raw HTML omitted -->
<h4 id="scope"><code>scope</code></h4>
<ul>
-<li>Default: the scope of the current project, if any, or “”</li>
+<li>Default: the scope of the current project, if any, or ""</li>
<li>Type: String</li>
</ul>
<p>Associate an operation with a scope for a scoped registry.</p>
@@ -1310,7 +1311,7 @@ npm init --scope=@foo --yes
<!-- raw HTML omitted -->
<h4 id="script-shell"><code>script-shell</code></h4>
<ul>
-<li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li>
+<li>Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows</li>
<li>Type: null or String</li>
</ul>
<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init &lt;pkg&gt;</code> commands.</p>
@@ -1318,7 +1319,7 @@ npm init --scope=@foo --yes
<!-- raw HTML omitted -->
<h4 id="searchexclude"><code>searchexclude</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that limit the results from search.</p>
@@ -1335,7 +1336,7 @@ searches.</p>
<!-- raw HTML omitted -->
<h4 id="searchopts"><code>searchopts</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
</ul>
<p>Space-separated options that are always passed to search.</p>
@@ -1352,7 +1353,7 @@ using legacy search endpoint.</p>
<!-- raw HTML omitted -->
<h4 id="shell"><code>shell</code></h4>
<ul>
-<li>Default: SHELL environment variable, or “bash” on Posix, or “cmd.exe” on
+<li>Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on
Windows</li>
<li>Type: String</li>
</ul>
@@ -1393,7 +1394,7 @@ dependency relationships.</p>
<p>By default, conflicting <code>peerDependencies</code> deep in the dependency graph will
be resolved using the nearest non-peer dependency specification, even if
doing so will result in some packages receiving a peer dependency outside
-the range set in their package’s <code>peerDependencies</code> object.</p>
+the range set in their package's <code>peerDependencies</code> object.</p>
<p>When such and override is performed, a warning is printed, explaining the
conflict and the packages involved. If <code>--strict-peer-deps</code> is set, then
this warning is treated as a failure.</p>
@@ -1411,10 +1412,10 @@ via https.</p>
<!-- raw HTML omitted -->
<h4 id="tag"><code>tag</code></h4>
<ul>
-<li>Default: “latest”</li>
+<li>Default: "latest"</li>
<li>Type: String</li>
</ul>
-<p>If you ask npm to install a package and don’t tell it a specific version,
+<p>If you ask npm to install a package and don't tell it a specific version,
then it will install the specified tag.</p>
<p>Also the tag that is added to the package@version specified by the <code>npm tag</code>
command, if no explicit tag is given.</p>
@@ -1424,7 +1425,7 @@ tarball that will be compared with the local files by default.</p>
<!-- raw HTML omitted -->
<h4 id="tag-version-prefix"><code>tag-version-prefix</code></h4>
<ul>
-<li>Default: “v”</li>
+<li>Default: "v"</li>
<li>Type: String</li>
</ul>
<p>If set, alters the prefix used when tagging a new version when performing a
@@ -1452,7 +1453,7 @@ successfully. <code>_timing.json</code> is a newline delimited list of JSON obje
<li>Default: 0</li>
<li>Type: Octal numeric string in range 0000..0777 (0..511)</li>
</ul>
-<p>The “umask” value to use when setting the file creation mode on files and
+<p>The "umask" value to use when setting the file creation mode on files and
folders.</p>
<p>Folders and executables are given a mode which is <code>0o777</code> masked against
this value. Other files are given a mode which is <code>0o666</code> masked against
@@ -1494,8 +1495,8 @@ of npm than the latest.</p>
<!-- raw HTML omitted -->
<h4 id="user-agent"><code>user-agent</code></h4>
<ul>
-<li>Default: “npm/{npm-version} node/{node-version} {platform} {arch}
-workspaces/{workspaces} {ci}”</li>
+<li>Default: "npm/{npm-version} node/{node-version} {platform} {arch}
+workspaces/{workspaces} {ci}"</li>
<li>Type: String</li>
</ul>
<p>Sets the User-Agent request header. The following fields are replaced with
@@ -1514,7 +1515,7 @@ an empty string if <code>ci-name</code> is empty.</li>
<!-- raw HTML omitted -->
<h4 id="userconfig"><code>userconfig</code></h4>
<ul>
-<li>Default: “~/.npmrc”</li>
+<li>Default: "~/.npmrc"</li>
<li>Type: Path</li>
</ul>
<p>The location of user-level configuration settings.</p>
@@ -1537,15 +1538,15 @@ settings in the <code>globalconfig</code> file.</p>
<li>Default: false</li>
<li>Type: Boolean</li>
</ul>
-<p>If true, output the npm version as well as node’s <code>process.versions</code> map and
-the version in the current working directory’s <code>package.json</code> file if one
+<p>If true, output the npm version as well as node's <code>process.versions</code> map and
+the version in the current working directory's <code>package.json</code> file if one
exists, and exit successfully.</p>
<p>Only relevant when specified explicitly on the command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="viewer"><code>viewer</code></h4>
<ul>
-<li>Default: “man” on Posix, “browser” on Windows</li>
+<li>Default: "man" on Posix, "browser" on Windows</li>
<li>Type: String</li>
</ul>
<p>The program to use to view help content.</p>
@@ -1604,23 +1605,23 @@ other things (test, exec, publish, etc.) will operate on the root project,
<li>Default: null</li>
<li>Type: null or Boolean</li>
</ul>
-<p>Automatically answer “yes” to any prompts that npm might print on the
+<p>Automatically answer "yes" to any prompts that npm might print on the
command line.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="also"><code>also</code></h4>
<ul>
<li>Default: null</li>
-<li>Type: null, “dev”, or “development”</li>
-<li>DEPRECATED: Please use –include=dev instead.</li>
+<li>Type: null, "dev", or "development"</li>
+<li>DEPRECATED: Please use --include=dev instead.</li>
</ul>
<p>When set to <code>dev</code> or <code>development</code>, this is an alias for <code>--include=dev</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="auth-type"><code>auth-type</code></h4>
<ul>
-<li>Default: “legacy”</li>
-<li>Type: “legacy”, “sso”, “saml”, or “oauth”</li>
+<li>Default: "legacy"</li>
+<li>Type: "legacy", "sso", "saml", or "oauth"</li>
<li>DEPRECATED: This method of SSO/SAML/OAuth is deprecated and will be removed
in a future version of npm in favor of web-based login.</li>
</ul>
@@ -1649,14 +1650,14 @@ in a future version of npm in favor of web-based login.</li>
<ul>
<li>Default: false</li>
<li>Type: Boolean</li>
-<li>DEPRECATED: Please use –include=dev instead.</li>
+<li>DEPRECATED: Please use --include=dev instead.</li>
</ul>
<p>Alias for <code>--include=dev</code>.</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="initauthoremail"><code>init.author.email</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-author-email</code> instead.</li>
</ul>
@@ -1665,7 +1666,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initauthorname"><code>init.author.name</code></h4>
<ul>
-<li>Default: “”</li>
+<li>Default: ""</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-author-name</code> instead.</li>
</ul>
@@ -1674,8 +1675,8 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initauthorurl"><code>init.author.url</code></h4>
<ul>
-<li>Default: “”</li>
-<li>Type: “” or URL</li>
+<li>Default: ""</li>
+<li>Type: "" or URL</li>
<li>DEPRECATED: Use <code>--init-author-url</code> instead.</li>
</ul>
<p>Alias for <code>--init-author-url</code></p>
@@ -1683,7 +1684,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initlicense"><code>init.license</code></h4>
<ul>
-<li>Default: “ISC”</li>
+<li>Default: "ISC"</li>
<li>Type: String</li>
<li>DEPRECATED: Use <code>--init-license</code> instead.</li>
</ul>
@@ -1692,7 +1693,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initmodule"><code>init.module</code></h4>
<ul>
-<li>Default: “~/.npm-init.js”</li>
+<li>Default: "~/.npm-init.js"</li>
<li>Type: Path</li>
<li>DEPRECATED: Use <code>--init-module</code> instead.</li>
</ul>
@@ -1701,7 +1702,7 @@ in a future version of npm in favor of web-based login.</li>
<!-- raw HTML omitted -->
<h4 id="initversion"><code>init.version</code></h4>
<ul>
-<li>Default: “1.0.0”</li>
+<li>Default: "1.0.0"</li>
<li>Type: SemVer string</li>
<li>DEPRECATED: Use <code>--init-version</code> instead.</li>
</ul>
@@ -1711,7 +1712,7 @@ in a future version of npm in favor of web-based login.</li>
<h4 id="only"><code>only</code></h4>
<ul>
<li>Default: null</li>
-<li>Type: null, “prod”, or “production”</li>
+<li>Type: null, "prod", or "production"</li>
<li>DEPRECATED: Use <code>--omit=dev</code> to omit dev dependencies from the install.</li>
</ul>
<p>When set to <code>prod</code> or <code>production</code>, this is an alias for <code>--omit=dev</code>.</p>
@@ -1725,7 +1726,7 @@ in a future version of npm in favor of web-based login.</li>
<code>--include=optional</code> to include them.</li>
</ul>
<p>Default value does install optional deps unless otherwise omitted.</p>
-<p>Alias for –include=optional or –omit=optional</p>
+<p>Alias for --include=optional or --omit=optional</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="production"><code>production</code></h4>
@@ -1741,16 +1742,16 @@ in a future version of npm in favor of web-based login.</li>
<ul>
<li>Default: true</li>
<li>Type: Boolean</li>
-<li>DEPRECATED: Use the –package-lock setting instead.</li>
+<li>DEPRECATED: Use the --package-lock setting instead.</li>
</ul>
-<p>Alias for –package-lock</p>
+<p>Alias for --package-lock</p>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<h4 id="sso-poll-frequency"><code>sso-poll-frequency</code></h4>
<ul>
<li>Default: 500</li>
<li>Type: Number</li>
-<li>DEPRECATED: The –auth-type method of SSO/SAML/OAuth will be removed in a
+<li>DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a
future version of npm in favor of web-based login.</li>
</ul>
<p>When used with SSO-enabled <code>auth-type</code>s, configures how regularly the
@@ -1759,9 +1760,9 @@ registry should be polled while the user is completing authentication.</p>
<!-- raw HTML omitted -->
<h4 id="sso-type"><code>sso-type</code></h4>
<ul>
-<li>Default: “oauth”</li>
-<li>Type: null, “oauth”, or “saml”</li>
-<li>DEPRECATED: The –auth-type method of SSO/SAML/OAuth will be removed in a
+<li>Default: "oauth"</li>
+<li>Type: null, "oauth", or "saml"</li>
+<li>DEPRECATED: The --auth-type method of SSO/SAML/OAuth will be removed in a
future version of npm in favor of web-based login.</li>
</ul>
<p>If <code>--auth-type=sso</code>, the type of SSO type to use.</p>
diff --git a/deps/npm/docs/output/using-npm/developers.html b/deps/npm/docs/output/using-npm/developers.html
index 7553ac5a67..35221223b2 100644
--- a/deps/npm/docs/output/using-npm/developers.html
+++ b/deps/npm/docs/output/using-npm/developers.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>developers</title>
<style>
body {
@@ -145,7 +146,7 @@ npm command-line interface
</section>
<div id="_content"><h3 id="description">Description</h3>
-<p>So, you’ve decided to use npm to develop (and maybe publish/deploy)
+<p>So, you've decided to use npm to develop (and maybe publish/deploy)
your project.</p>
<p>Fantastic!</p>
<p>There are a few things that you need to do above the simple steps
@@ -162,7 +163,7 @@ topic, or <code>npm help thing</code> to see the same information.</p>
<li>c) a url that resolves to (b)</li>
<li>d) a <code>&lt;name&gt;@&lt;version&gt;</code> that is published on the registry with (c)</li>
<li>e) a <code>&lt;name&gt;@&lt;tag&gt;</code> that points to (d)</li>
-<li>f) a <code>&lt;name&gt;</code> that has a “latest” tag satisfying (e)</li>
+<li>f) a <code>&lt;name&gt;</code> that has a "latest" tag satisfying (e)</li>
<li>g) a <code>git</code> url that, when cloned, results in (a).</li>
</ul>
<p>Even if you never publish your package, you can still get a lot of
@@ -187,9 +188,9 @@ goes in that file. At the very least, you need:</p>
<li>
<p>name: This should be a string that identifies your project. Please do
not use the name to specify that it runs on node, or is in JavaScript.
-You can use the “engines” field to explicitly state the versions of node
-(or whatever else) that your program requires, and it’s pretty well
-assumed that it’s JavaScript.</p>
+You can use the "engines" field to explicitly state the versions of node
+(or whatever else) that your program requires, and it's pretty well
+assumed that it's JavaScript.</p>
<p>It does not necessarily need to match your github repository name.</p>
<p>So, <code>node-foo</code> and <code>bar-js</code> are bad names. <code>foo</code> or <code>bar</code> are better.</p>
</li>
@@ -207,24 +208,24 @@ new functionality that you depend on. Be explicit.</p>
<li>
<p>scripts: If you have a special compilation or installation script, then
you should put it in the <code>scripts</code> object. You should definitely have at
-least a basic smoke-test command as the “scripts.test” field. See
+least a basic smoke-test command as the "scripts.test" field. See
<a href="../using-npm/scripts.html">scripts</a>.</p>
</li>
<li>
<p>main: If you have a single module that serves as the entry point to your
-program (like what the “foo” package gives you at require(“foo”)), then
-you need to specify that in the “main” field.</p>
+program (like what the "foo" package gives you at require("foo")), then
+you need to specify that in the "main" field.</p>
</li>
<li>
<p>directories: This is an object mapping names to folders. The best ones
-to include are “lib” and “doc”, but if you use “man” to specify a folder
-full of man pages, they’ll get installed just like these ones.</p>
+to include are "lib" and "doc", but if you use "man" to specify a folder
+full of man pages, they'll get installed just like these ones.</p>
</li>
</ul>
<p>You can use <code>npm init</code> in the root of your package in order to get you
started with a pretty basic package.json file. See <a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p>
<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</h3>
-<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there’s no
+<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there's no
<code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will ignore
the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to include
something that is excluded by your <code>.gitignore</code> file, you can create an
@@ -240,14 +241,16 @@ as <code>.gitignore</code> files:</p>
<li>You can end patterns with a forward slash <code>/</code> to specify a directory.</li>
<li>You can negate a pattern by starting it with an exclamation point <code>!</code>.</li>
</ul>
-<p>By default, the following paths and files are ignored, so there’s no
+<p>By default, the following paths and files are ignored, so there's no
need to add them to <code>.npmignore</code> explicitly:</p>
<ul>
<li><code>.*.swp</code></li>
<li><code>._*</code></li>
<li><code>.DS_Store</code></li>
<li><code>.git</code></li>
+<li><code>.gitignore</code></li>
<li><code>.hg</code></li>
+<li><code>.npmignore</code></li>
<li><code>.npmrc</code></li>
<li><code>.lock-wscript</code></li>
<li><code>.svn</code></li>
@@ -257,7 +260,7 @@ need to add them to <code>.npmignore</code> explicitly:</p>
<li><code>npm-debug.log</code></li>
</ul>
<p>Additionally, everything in <code>node_modules</code> is ignored, except for
-bundled dependencies. npm automatically handles this for you, so don’t
+bundled dependencies. npm automatically handles this for you, so don't
bother adding <code>node_modules</code> to <code>.npmignore</code>.</p>
<p>The following paths and files are never ignored, so adding them to
<code>.npmignore</code> is pointless:</p>
@@ -285,25 +288,25 @@ of course.)</p>
<p>More info at <a href="../commands/npm-link.html"><code>npm link</code></a>.</p>
<h3 id="before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</h3>
<p><strong>This is important.</strong></p>
-<p>If you can not install it locally, you’ll have
-problems trying to publish it. Or, worse yet, you’ll be able to
-publish it, but you’ll be publishing a broken or pointless package.
-So don’t do that.</p>
+<p>If you can not install it locally, you'll have
+problems trying to publish it. Or, worse yet, you'll be able to
+publish it, but you'll be publishing a broken or pointless package.
+So don't do that.</p>
<p>In the root of your package, do this:</p>
<pre lang="bash"><code>npm install . -g
</code></pre>
-<p>That’ll show you that it’s working. If you’d rather just create a symlink
+<p>That'll show you that it's working. If you'd rather just create a symlink
package that points to your working directory, then do this:</p>
<pre lang="bash"><code>npm link
</code></pre>
-<p>Use <code>npm ls -g</code> to see if it’s there.</p>
+<p>Use <code>npm ls -g</code> to see if it's there.</p>
<p>To test a local install, go into some other folder, and then do:</p>
<pre lang="bash"><code>cd ../some-other-folder
npm install ../my-package
</code></pre>
<p>to install it locally into the node_modules folder in that other place.</p>
-<p>Then go into the node-repl, and try using require(“my-thing”) to
-bring in your module’s main module.</p>
+<p>Then go into the node-repl, and try using require("my-thing") to
+bring in your module's main module.</p>
<h3 id="create-a-user-account">Create a User Account</h3>
<p>Create a user with the adduser command. It works like this:</p>
<pre lang="bash"><code>npm adduser
@@ -311,7 +314,7 @@ bring in your module’s main module.</p>
<p>and then follow the prompts.</p>
<p>This is documented better in <a href="../commands/npm-adduser.html">npm adduser</a>.</p>
<h3 id="publish-your-package">Publish your Package</h3>
-<p>This part’s easy. In the root of your folder, do this:</p>
+<p>This part's easy. In the root of your folder, do this:</p>
<pre lang="bash"><code>npm publish
</code></pre>
<p>You can give publish a url to a tarball, or a filename of a tarball,
diff --git a/deps/npm/docs/output/using-npm/orgs.html b/deps/npm/docs/output/using-npm/orgs.html
index 4a80aa74cf..173ad3cf82 100644
--- a/deps/npm/docs/output/using-npm/orgs.html
+++ b/deps/npm/docs/output/using-npm/orgs.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>orgs</title>
<style>
body {
diff --git a/deps/npm/docs/output/using-npm/registry.html b/deps/npm/docs/output/using-npm/registry.html
index c32ca654c0..b55bce9ee5 100644
--- a/deps/npm/docs/output/using-npm/registry.html
+++ b/deps/npm/docs/output/using-npm/registry.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>registry</title>
<style>
body {
@@ -141,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><li><a href="#does-npm-send-any-information-about-me-back-to-the-registry">Does npm send any information about me back to the registry?</a></li><li><a href="#how-can-i-prevent-my-package-from-being-published-in-the-official-registry">How can I prevent my package from being published in the official registry?</a></li><li><a href="#where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other’s, published packages?</a></li><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="#does-npm-send-any-information-about-me-back-to-the-registry">Does npm send any information about me back to the registry?</a></li><li><a href="#how-can-i-prevent-my-package-from-being-published-in-the-official-registry">How can I prevent my package from being published in the official registry?</a></li><li><a href="#where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other's, published packages?</a></li><li><a href="#see-also">See also</a></li></ul></div>
</section>
<div id="_content"><h3 id="description">Description</h3>
@@ -152,9 +153,9 @@ package info.</p>
<a href="https://registry.npmjs.org">https://registry.npmjs.org</a> by default. Use of the npm public registry is
subject to terms of use available at <a href="https://docs.npmjs.com/policies/terms">https://docs.npmjs.com/policies/terms</a>.</p>
<p>You can configure npm to use any compatible registry you like, and even run
-your own registry. Use of someone else’s registry may be governed by their
+your own registry. Use of someone else's registry may be governed by their
terms of use.</p>
-<p>npm’s package registry implementation supports several
+<p>npm's package registry implementation supports several
write APIs as well, to allow for publishing packages and managing user
account information.</p>
<p>The npm public registry is powered by a CouchDB database,
@@ -162,9 +163,9 @@ of which there is a public mirror at <a href="https://skimdb.npmjs.com/registry"
<p>The registry URL used is determined by the scope of the package (see
<a href="../using-npm/scope.html"><code>scope</code></a>. If no scope is specified, the default registry is used, which is
supplied by the <code>registry</code> config parameter. See <a href="../commands/npm-config.html"><code>npm config</code></a>,
-<a href="../configuring-npm/npmrc.html"><code>npmrc</code></a>, and <a href="../using-npm/config.html"><code>config</code></a> for more on managing npm’s configuration.</p>
+<a href="../configuring-npm/npmrc.html"><code>npmrc</code></a>, and <a href="../using-npm/config.html"><code>config</code></a> for more on managing npm's configuration.</p>
<p>When the default registry is used in a package-lock or shrinkwrap is has the
-special meaning of “the currently configured registry”. If you create a lock
+special meaning of "the currently configured registry". If you create a lock
file while using the default registry you can switch to another registry and
npm will install packages from the new registry, but if you create a lock
file while using a custom registry packages will be installed from that
@@ -178,10 +179,10 @@ about your environment:</p>
scope. In the future npm hopes to build registry features that use this
information to allow you to customize your experience for your
organization.</li>
-<li><code>Npm-In-CI</code> – Set to “true” if npm believes this install is running in a
-continuous integration environment, “false” otherwise. This is detected by
+<li><code>Npm-In-CI</code> – Set to "true" if npm believes this install is running in a
+continuous integration environment, "false" otherwise. This is detected by
looking for the following environment variables: <code>CI</code>, <code>TDDIUM</code>,
-<code>JENKINS_URL</code>, <code>bamboo.buildKey</code>. If you’d like to learn more you may find
+<code>JENKINS_URL</code>, <code>bamboo.buildKey</code>. If you'd like to learn more you may find
the <a href="https://github.com/npm/npm-registry-client/pull/129">original PR</a>
interesting.
This is used to gather better metrics on how npm is used by humans, versus
@@ -195,7 +196,7 @@ published at all, or
<code>"publishConfig":{"registry":"http://my-internal-registry.local"}</code>
to force it to be published only to your internal/private registry.</p>
<p>See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for more info on what goes in the package.json file.</p>
-<h3 id="where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other’s, published packages?</h3>
+<h3 id="where-can-i-find-my-own--others-published-packages">Where can I find my own, &amp; other's, published packages?</h3>
<p><a href="https://www.npmjs.com/">https://www.npmjs.com/</a></p>
<h3 id="see-also">See also</h3>
<ul>
diff --git a/deps/npm/docs/output/using-npm/removal.html b/deps/npm/docs/output/using-npm/removal.html
index 2130e3efbe..955209a19c 100644
--- a/deps/npm/docs/output/using-npm/removal.html
+++ b/deps/npm/docs/output/using-npm/removal.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>removal</title>
<style>
body {
@@ -153,12 +154,12 @@ npm command-line interface
</code></pre>
<h3 id="more-severe-uninstalling">More Severe Uninstalling</h3>
<p>Usually, the above instructions are sufficient. That will remove
-npm, but leave behind anything you’ve installed.</p>
-<p>If that doesn’t work, or if you require more drastic measures,
+npm, but leave behind anything you've installed.</p>
+<p>If that doesn't work, or if you require more drastic measures,
continue reading.</p>
<p>Note that this is only necessary for globally-installed packages. Local
-installs are completely contained within a project’s <code>node_modules</code>
-folder. Delete that folder, and everything is gone less a package’s
+installs are completely contained within a project's <code>node_modules</code>
+folder. Delete that folder, and everything is gone less a package's
install script is particularly ill-behaved).</p>
<p>This assumes that you installed node and npm in the default place. If
you configured node with a different <code>--prefix</code>, or installed npm with a
diff --git a/deps/npm/docs/output/using-npm/scope.html b/deps/npm/docs/output/using-npm/scope.html
index 922554b186..db6fc2a115 100644
--- a/deps/npm/docs/output/using-npm/scope.html
+++ b/deps/npm/docs/output/using-npm/scope.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>scope</title>
<style>
body {
@@ -154,7 +155,7 @@ and followed by a slash, e.g.</p>
<p>Scopes are a way of grouping related packages together, and also affect a few
things about the way npm treats the package.</p>
<p>Each npm user/organization has their own scope, and only you can add packages
-in your scope. This means you don’t have to worry about someone taking your
+in your scope. This means you don't have to worry about someone taking your
package name ahead of you. Thus it is also a good way to signal official packages
for organizations.</p>
<p>Scoped packages can be published and installed as of <code>npm@2</code> and are supported
diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html
index 1b4556a1f8..3a51b05707 100644
--- a/deps/npm/docs/output/using-npm/scripts.html
+++ b/deps/npm/docs/output/using-npm/scripts.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>scripts</title>
<style>
body {
@@ -153,9 +154,9 @@ commands with matching names will be run for those as well (e.g. <code>premyscri
<code>myscript</code>, <code>postmyscript</code>). Scripts from dependencies can be run with
<code>npm explore &lt;pkg&gt; -- npm run &lt;stage&gt;</code>.</p>
<h3 id="pre--post-scripts">Pre &amp; Post Scripts</h3>
-<p>To create “pre” or “post” scripts for any scripts defined in the
+<p>To create "pre" or "post" scripts for any scripts defined in the
<code>"scripts"</code> section of the <code>package.json</code>, simply create another script
-<em>with a matching name</em> and add “pre” or “post” to the beginning of them.</p>
+<em>with a matching name</em> and add "pre" or "post" to the beginning of them.</p>
<pre lang="json"><code>{
"scripts": {
"precompress": "{{ executes BEFORE the `compress` script }}",
@@ -213,8 +214,8 @@ and <code>npm install</code>. See below for more info.</li>
</ul>
<p><strong>prepack</strong></p>
<ul>
-<li>Runs BEFORE a tarball is packed (on “<code>npm pack</code>”, “<code>npm publish</code>”, and when installing a git dependencies).</li>
-<li>NOTE: “<code>npm run pack</code>” is NOT the same as “<code>npm pack</code>”. “<code>npm run pack</code>” is an arbitrary user defined script name, where as, “<code>npm pack</code>” is a CLI defined command.</li>
+<li>Runs BEFORE a tarball is packed (on "<code>npm pack</code>", "<code>npm publish</code>", and when installing a git dependencies).</li>
+<li>NOTE: "<code>npm run pack</code>" is NOT the same as "<code>npm pack</code>". "<code>npm run pack</code>" is an arbitrary user defined script name, where as, "<code>npm pack</code>" is a CLI defined command.</li>
</ul>
<p><strong>postpack</strong></p>
<ul>
@@ -222,7 +223,7 @@ and <code>npm install</code>. See below for more info.</li>
</ul>
<h4 id="prepare-and-prepublish">Prepare and Prepublish</h4>
<p><strong>Deprecation Note: prepublish</strong></p>
-<p>Since <code>npm@1.1.71</code>, the npm CLI has run the <code>prepublish</code> script for both <code>npm publish</code> and <code>npm install</code>, because it’s a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, <a href="https://github.com/npm/npm/issues/10074">very confusing</a>. As of <code>npm@4.0.0</code>, a new event has been introduced, <code>prepare</code>, that preserves this existing behavior. A <em>new</em> event, <code>prepublishOnly</code> has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on <code>npm publish</code> (for instance, running the tests one last time to ensure they’re in good shape).</p>
+<p>Since <code>npm@1.1.71</code>, the npm CLI has run the <code>prepublish</code> script for both <code>npm publish</code> and <code>npm install</code>, because it's a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, <a href="https://github.com/npm/npm/issues/10074">very confusing</a>. As of <code>npm@4.0.0</code>, a new event has been introduced, <code>prepare</code>, that preserves this existing behavior. A <em>new</em> event, <code>prepublishOnly</code> has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on <code>npm publish</code> (for instance, running the tests one last time to ensure they're in good shape).</p>
<p>See <a href="https://github.com/npm/npm/issues/10074">https://github.com/npm/npm/issues/10074</a> for a much lengthier justification, with further reading, for this change.</p>
<p><strong>Use Cases</strong></p>
<p>If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the target system, use a <code>prepublish</code> script. This includes tasks such as:</p>
@@ -234,10 +235,10 @@ and <code>npm install</code>. See below for more info.</li>
<p>The advantage of doing these things at <code>prepublish</code> time is that they can be done once, in a single place, thus reducing complexity and variability. Additionally, this means that:</p>
<ul>
<li>You can depend on <code>coffee-script</code> as a <code>devDependency</code>, and thus
-your users don’t need to have it installed.</li>
-<li>You don’t need to include minifiers in your package, reducing
+your users don't need to have it installed.</li>
+<li>You don't need to include minifiers in your package, reducing
the size for your users.</li>
-<li>You don’t need to rely on your users having <code>curl</code> or <code>wget</code> or
+<li>You don't need to rely on your users having <code>curl</code> or <code>wget</code> or
other system tools on the target machines.</li>
</ul>
<h3 id="life-cycle-operation-order">Life Cycle Operation Order</h3>
@@ -273,7 +274,7 @@ other system tools on the target machines.</li>
<li><code>postprepare</code></li>
</ul>
<p>If there is a <code>binding.gyp</code> file in the root of your package and you
-haven’t defined your own <code>install</code> or <code>preinstall</code> scripts, npm will
+haven't defined your own <code>install</code> or <code>preinstall</code> scripts, npm will
default the <code>install</code> command to compile using node-gyp via <code>node-gyp rebuild</code></p>
<p>These are run from the scripts of <code>&lt;pkg-name&gt;</code></p>
<h4 id="npm-pack"><a href="../commands/npm-pack.html"><code>npm pack</code></a></h4>
@@ -338,7 +339,7 @@ will default the <code>start</code> command to <code>node server.js</code>. <co
<li><code>posttest</code></li>
</ul>
<h4 id="a-note-on-a-lack-of-npm-uninstall-scripts">A Note on a lack of <a href="../commands/npm-uninstall.html"><code>npm uninstall</code></a> scripts</h4>
-<p>While npm v6 had <code>uninstall</code> lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there’s no clear way to currently give the script enough context to be useful.</p>
+<p>While npm v6 had <code>uninstall</code> lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful.</p>
<p>Reasons for a package removal include:</p>
<ul>
<li>a user directly uninstalled this package</li>
@@ -375,8 +376,8 @@ exported into the <code>node_modules/.bin</code> directory on <code>npm install<
<p>The package.json fields are tacked onto the <code>npm_package_</code> prefix. So,
for instance, if you had <code>{"name":"foo", "version":"1.2.5"}</code> in your
package.json file, then your package scripts would have the
-<code>npm_package_name</code> environment variable set to “foo”, and the
-<code>npm_package_version</code> set to “1.2.5”. You can access these variables
+<code>npm_package_name</code> environment variable set to "foo", and the
+<code>npm_package_version</code> set to "1.2.5". You can access these variables
in your code with <code>process.env.npm_package_name</code> and
<code>process.env.npm_package_version</code>, and so on for other fields.</p>
<p>See <a href="../configuring-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
@@ -384,9 +385,9 @@ in your code with <code>process.env.npm_package_name</code> and
<p>Lastly, the <code>npm_lifecycle_event</code> environment variable is set to
whichever stage of the cycle is being executed. So, you could have a
single script used for different parts of the process which switches
-based on what’s currently happening.</p>
+based on what's currently happening.</p>
<p>Objects are flattened following this format, so if you had
-<code>{"scripts":{"install":"foo.js"}}</code> in your package.json, then you’d
+<code>{"scripts":{"install":"foo.js"}}</code> in your package.json, then you'd
see this in the script:</p>
<pre lang="bash"><code>process.env.npm_package_scripts_install === "foo.js"
</code></pre>
@@ -420,15 +421,15 @@ fine:</p>
<p>Scripts are run by passing the line as a script argument to <code>sh</code>.</p>
<p>If the script exits with a code other than 0, then this will abort the
process.</p>
-<p>Note that these script files don’t have to be Node.js or even
+<p>Note that these script files don't have to be Node.js or even
JavaScript programs. They just have to be some kind of executable
file.</p>
<h3 id="best-practices">Best Practices</h3>
<ul>
-<li>Don’t exit with a non-zero error code unless you <em>really</em> mean it.
+<li>Don't exit with a non-zero error code unless you <em>really</em> mean it.
Except for uninstall scripts, this will cause the npm action to
fail, and potentially be rolled back. If the failure is minor or
-only will prevent some optional features, then it’s better to just
+only will prevent some optional features, then it's better to just
print a warning and exit successfully.</li>
<li>Try not to use scripts to do what npm can do for you. Read through
<a href="../configuring-npm/package-json.html"><code>package.json</code></a> to see all the things that you can specify and enable
@@ -436,12 +437,12 @@ by simply describing your package appropriately. In general, this
will lead to a more robust and consistent state.</li>
<li>Inspect the env to determine where to put things. For instance, if
the <code>npm_config_binroot</code> environment variable is set to <code>/home/user/bin</code>, then
-don’t try to install executables into <code>/usr/local/bin</code>. The user
+don't try to install executables into <code>/usr/local/bin</code>. The user
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
+<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>prepublish</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/docs/output/using-npm/workspaces.html b/deps/npm/docs/output/using-npm/workspaces.html
index 530c9c2fdf..6f5a23e749 100644
--- a/deps/npm/docs/output/using-npm/workspaces.html
+++ b/deps/npm/docs/output/using-npm/workspaces.html
@@ -1,4 +1,5 @@
-<html><head>
+<!DOCTYPE html><html><head>
+<meta charset="utf-8">
<title>workspaces</title>
<style>
body {
@@ -154,7 +155,7 @@ as part of <code>npm install</code> and avoiding manually having to use <code>np
order to add references to packages that should be symlinked into the current
<code>node_modules</code> folder.</p>
<p>We also refer to these packages being auto-symlinked during <code>npm install</code> as a
-single <strong>workspace</strong>, meaning it’s a nested package within the current local
+single <strong>workspace</strong>, meaning it's a nested package within the current local
file system that is explicitly defined in the <a href="../configuring-npm/package-json#workspaces.html"><code>package.json</code></a>
<code>workspaces</code> configuration.</p>
<h3 id="defining-workspaces">Defining workspaces</h3>
@@ -198,7 +199,7 @@ structure of files and folders:</p>
file (if needed) while also making sure to properly configure the
<code>"workspaces"</code> property of your root project <code>package.json</code>.</p>
<h3 id="adding-dependencies-to-a-workspace">Adding dependencies to a workspace</h3>
-<p>It’s possible to directly add/remove/update dependencies of your workspaces
+<p>It's possible to directly add/remove/update dependencies of your workspaces
using the <a href="../using-npm/config#workspace.html"><code>workspace</code> config</a>.</p>
<p>For example, assuming the following structure:</p>
<pre><code>.
@@ -218,9 +219,9 @@ workspace:</p>
<p>Note: other installing commands such as <code>uninstall</code>, <code>ci</code>, etc will also
respect the provided <code>workspace</code> configuration.</p>
<h3 id="using-workspaces">Using workspaces</h3>
-<p>Given the <a href="https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together">specifities of how Node.js handles module resolution</a> it’s possible to consume any defined workspace
+<p>Given the <a href="https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together">specifities of how Node.js handles module resolution</a> it's possible to consume any defined workspace
by its declared <code>package.json</code> <code>name</code>. Continuing from the example defined
-above, let’s also create a Node.js script that will require the <code>workspace-a</code>
+above, let's also create a Node.js script that will require the <code>workspace-a</code>
example module, e.g:</p>
<pre><code>// ./workspace-a/index.js
module.exports = 'a'
@@ -248,7 +249,7 @@ of nested workspaces. For a project containing multiple workspaces, e.g:</p>
`-- b
`-- package.json
</code></pre>
-<p>By running a command using the <code>workspace</code> option, it’s possible to run the
+<p>By running a command using the <code>workspace</code> option, it's possible to run the
given command in the context of that specific workspace. e.g:</p>
<pre><code>npm run test --workspace=a
</code></pre>
@@ -258,7 +259,7 @@ given command in the context of that specific workspace. e.g:</p>
command-line in order to target multiple workspaces, e.g:</p>
<pre><code>npm run test --workspace=a --workspace=b
</code></pre>
-<p>It’s also possible to use the <code>workspaces</code> (plural) configuration option to
+<p>It's also possible to use the <code>workspaces</code> (plural) configuration option to
enable the same behavior but running that command in the context of <strong>all</strong>
configured workspaces. e.g:</p>
<pre><code>npm run test --workspaces
diff --git a/deps/npm/index.js b/deps/npm/index.js
index 570df352b9..5447643e04 100644
--- a/deps/npm/index.js
+++ b/deps/npm/index.js
@@ -1,4 +1,5 @@
-if (require.main === module)
+if (require.main === module) {
require('./lib/cli.js')(process)
-else
+} else {
throw new Error('The programmatic API was removed in npm v8.0.0')
+}
diff --git a/deps/npm/lib/arborist-cmd.js b/deps/npm/lib/arborist-cmd.js
index 48ba3b0c94..931ead8143 100644
--- a/deps/npm/lib/arborist-cmd.js
+++ b/deps/npm/lib/arborist-cmd.js
@@ -8,14 +8,11 @@ class ArboristCmd extends BaseCommand {
return true
}
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
+ static params = [
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
async execWorkspaces (args, filters) {
await this.setWorkspaces(filters)
diff --git a/deps/npm/lib/auth/legacy.js b/deps/npm/lib/auth/legacy.js
index 8659446dc4..2da82e361d 100644
--- a/deps/npm/lib/auth/legacy.js
+++ b/deps/npm/lib/auth/legacy.js
@@ -40,10 +40,11 @@ const login = async (npm, opts) => {
opts
)
} catch (err) {
- if (err.code === 'EOTP')
+ if (err.code === 'EOTP') {
newUser = await requestOTP()
- else
+ } else {
throw err
+ }
}
return newUser
@@ -58,20 +59,20 @@ const login = async (npm, opts) => {
opts.creds.username &&
opts.creds.password &&
opts.creds.email)
- if (err.code === 'EOTP')
+ if (err.code === 'EOTP') {
res = await requestOTP()
- else if (needsMoreInfo)
+ } else if (needsMoreInfo) {
throw err
- else {
+ } else {
// TODO: maybe this needs to check for err.code === 'E400' instead?
res = await addNewUser()
}
}
const newCreds = {}
- if (res && res.token)
+ if (res && res.token) {
newCreds.token = res.token
- else {
+ } else {
newCreds.username = opts.creds.username
newCreds.password = opts.creds.password
newCreds.email = opts.creds.email
diff --git a/deps/npm/lib/auth/sso.js b/deps/npm/lib/auth/sso.js
index 56cff3c06e..6fcfc30e5d 100644
--- a/deps/npm/lib/auth/sso.js
+++ b/deps/npm/lib/auth/sso.js
@@ -25,8 +25,9 @@ const pollForSession = ({ registry, token, opts }) => {
return sleep(opts.ssoPollFrequency).then(() => {
return pollForSession({ registry, token, opts })
})
- } else
+ } else {
throw err
+ }
}
)
}
@@ -41,8 +42,9 @@ const login = async (npm, { creds, registry, scope }) => {
const opts = { ...npm.flatOptions, creds, registry, scope }
const { ssoType } = opts
- if (!ssoType)
+ if (!ssoType) {
throw new Error('Missing option: sso-type')
+ }
// We're reusing the legacy login endpoint, so we need some dummy
// stuff here to pass validation. They're never used.
@@ -57,10 +59,12 @@ const login = async (npm, { creds, registry, scope }) => {
opts => profile.loginCouch(auth.username, auth.password, opts)
)
- if (!token)
+ if (!token) {
throw new Error('no SSO token returned')
- if (!sso)
+ }
+ if (!sso) {
throw new Error('no SSO URL returned by services')
+ }
await openUrl(npm, sso, 'to complete your login please visit')
diff --git a/deps/npm/lib/base-command.js b/deps/npm/lib/base-command.js
index c5fce6fd8d..ad261b5148 100644
--- a/deps/npm/lib/base-command.js
+++ b/deps/npm/lib/base-command.js
@@ -19,17 +19,22 @@ class BaseCommand {
get usage () {
let usage = `npm ${this.constructor.name}\n\n`
- if (this.constructor.description)
+ if (this.constructor.description) {
usage = `${usage}${this.constructor.description}\n\n`
+ }
usage = `${usage}Usage:\n`
- if (!this.constructor.usage)
+ if (!this.constructor.usage) {
usage = `${usage}npm ${this.constructor.name}`
- else
- usage = `${usage}${this.constructor.usage.map(u => `npm ${this.constructor.name} ${u}`).join('\n')}`
+ } else {
+ usage = `${usage}${this.constructor.usage
+ .map(u => `npm ${this.constructor.name} ${u}`)
+ .join('\n')}`
+ }
- if (this.constructor.params)
+ if (this.constructor.params) {
usage = `${usage}\n\nOptions:\n${this.wrappedParams}`
+ }
// Mostly this just appends aliases, this could be more clear
usage = usageUtil(this.constructor.name, usage)
@@ -43,7 +48,7 @@ class BaseCommand {
for (const param of this.constructor.params) {
const usage = `[${ConfigDefinitions[param].usage}]`
- if (line.length && (line.length + usage.length) > this.wrapWidth) {
+ if (line.length && line.length + usage.length > this.wrapWidth) {
results = [results, line].filter(Boolean).join('\n')
line = ''
}
@@ -54,23 +59,24 @@ class BaseCommand {
}
usageError (prefix = '') {
- if (prefix)
+ if (prefix) {
prefix += '\n\n'
+ }
return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
code: 'EUSAGE',
})
}
async execWorkspaces (args, filters) {
- throw Object.assign(
- new Error('This command does not support workspaces.'),
- { code: 'ENOWORKSPACES' }
- )
+ throw Object.assign(new Error('This command does not support workspaces.'), {
+ code: 'ENOWORKSPACES',
+ })
}
async setWorkspaces (filters) {
- if (this.isArboristCmd)
+ if (this.isArboristCmd) {
this.includeWorkspaceRoot = false
+ }
const ws = await getWorkspaces(filters, {
path: this.npm.localPrefix,
diff --git a/deps/npm/lib/cli.js b/deps/npm/lib/cli.js
index 0e6301517f..9dcd9d04d2 100644
--- a/deps/npm/lib/cli.js
+++ b/deps/npm/lib/cli.js
@@ -1,13 +1,10 @@
// Separated out for easier unit testing
-module.exports = async (process) => {
+module.exports = async process => {
// set it here so that regardless of what happens later, we don't
// leak any private CLI configs to other programs
process.title = 'npm'
- const {
- checkForBrokenNode,
- checkForUnsupportedNode,
- } = require('../lib/utils/unsupported.js')
+ const { checkForBrokenNode, checkForUnsupportedNode } = require('../lib/utils/unsupported.js')
checkForBrokenNode()
@@ -25,8 +22,9 @@ module.exports = async (process) => {
// if npm is called as "npmg" or "npm_g", then
// run in global mode.
- if (process.argv[1][process.argv[1].length - 1] === 'g')
+ if (process.argv[1][process.argv[1].length - 1] === 'g') {
process.argv.splice(1, 1, 'npm', '-g')
+ }
const replaceInfo = require('../lib/utils/replace-info.js')
log.verbose('cli', replaceInfo(process.argv))
@@ -70,7 +68,8 @@ module.exports = async (process) => {
if (err.code === 'EUNKNOWNCOMMAND') {
const didYouMean = require('./utils/did-you-mean.js')
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
- npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`)
+ npm.output(`Unknown command: "${cmd}"${suggestions}\n`)
+ npm.output('To see a list of supported npm commands, run:\n npm help')
process.exitCode = 1
return exitHandler()
}
diff --git a/deps/npm/lib/commands/access.js b/deps/npm/lib/commands/access.js
index 15e51a450a..f61c97d6f9 100644
--- a/deps/npm/lib/commands/access.js
+++ b/deps/npm/lib/commands/access.js
@@ -20,47 +20,38 @@ const subcommands = [
]
class Access extends BaseCommand {
- static get description () {
- return 'Set access level on published packages'
- }
-
- static get name () {
- return 'access'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- ]
- }
-
- static get usage () {
- return [
- 'public [<package>]',
- 'restricted [<package>]',
- 'grant <read-only|read-write> <scope:team> [<package>]',
- 'revoke <scope:team> [<package>]',
- '2fa-required [<package>]',
- '2fa-not-required [<package>]',
- 'ls-packages [<user>|<scope>|<scope:team>]',
- 'ls-collaborators [<package> [<user>]]',
- 'edit [<package>]',
- ]
- }
+ static description = 'Set access level on published packages'
+ static name = 'access'
+ static params = [
+ 'registry',
+ 'otp',
+ ]
+
+ static usage = [
+ 'public [<package>]',
+ 'restricted [<package>]',
+ 'grant <read-only|read-write> <scope:team> [<package>]',
+ 'revoke <scope:team> [<package>]',
+ '2fa-required [<package>]',
+ '2fa-not-required [<package>]',
+ 'ls-packages [<user>|<scope>|<scope:team>]',
+ 'ls-collaborators [<package> [<user>]]',
+ 'edit [<package>]',
+ ]
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length === 2)
+ if (argv.length === 2) {
return subcommands
+ }
switch (argv[2]) {
case 'grant':
- if (argv.length === 3)
+ if (argv.length === 3) {
return ['read-only', 'read-write']
- else
+ } else {
return []
+ }
case 'public':
case 'restricted':
@@ -77,11 +68,13 @@ class Access extends BaseCommand {
}
async exec ([cmd, ...args]) {
- if (!cmd)
+ if (!cmd) {
throw this.usageError('Subcommand is required.')
+ }
- if (!subcommands.includes(cmd) || !this[cmd])
+ if (!subcommands.includes(cmd) || !this[cmd]) {
throw this.usageError(`${cmd} is not a recognized subcommand.`)
+ }
return this[cmd](args, this.npm.flatOptions)
}
@@ -95,11 +88,13 @@ class Access extends BaseCommand {
}
async grant ([perms, scopeteam, pkg], opts) {
- if (!perms || (perms !== 'read-only' && perms !== 'read-write'))
+ if (!perms || (perms !== 'read-only' && perms !== 'read-write')) {
throw this.usageError('First argument must be either `read-only` or `read-write`.')
+ }
- if (!scopeteam)
+ if (!scopeteam) {
throw this.usageError('`<scope:team>` argument is required.')
+ }
const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
@@ -115,8 +110,9 @@ class Access extends BaseCommand {
}
async revoke ([scopeteam, pkg], opts) {
- if (!scopeteam)
+ if (!scopeteam) {
throw this.usageError('`<scope:team>` argument is required.')
+ }
const [, scope, team] = scopeteam.match(/^@?([^:]+):(.*)$/) || []
@@ -152,8 +148,9 @@ class Access extends BaseCommand {
}
async lsPackages ([owner], opts) {
- if (!owner)
+ if (!owner) {
owner = await getIdentity(this.npm, opts)
+ }
const pkgs = await libaccess.lsPackages(owner, opts)
@@ -183,9 +180,9 @@ class Access extends BaseCommand {
}
async getPackage (name, requireScope) {
- if (name && name.trim())
+ if (name && name.trim()) {
return name.trim()
- else {
+ } else {
try {
const pkg = await readPackageJson(path.resolve(this.npm.prefix, 'package.json'))
name = pkg.name
@@ -194,14 +191,16 @@ class Access extends BaseCommand {
throw new Error(
'no package name passed to command and no package.json found'
)
- } else
+ } else {
throw err
+ }
}
- if (requireScope && !name.match(/^@[^/]+\/.*$/))
+ if (requireScope && !name.match(/^@[^/]+\/.*$/)) {
throw this.usageError('This command is only available for scoped packages.')
- else
+ } else {
return name
+ }
}
}
}
diff --git a/deps/npm/lib/commands/adduser.js b/deps/npm/lib/commands/adduser.js
index 6136eb726f..6cd6d3001c 100644
--- a/deps/npm/lib/commands/adduser.js
+++ b/deps/npm/lib/commands/adduser.js
@@ -9,20 +9,12 @@ const authTypes = {
}
class AddUser extends BaseCommand {
- static get description () {
- return 'Add a registry user account'
- }
-
- static get name () {
- return 'adduser'
- }
-
- static get params () {
- return [
- 'registry',
- 'scope',
- ]
- }
+ static description = 'Add a registry user account'
+ static name = 'adduser'
+ static params = [
+ 'registry',
+ 'scope',
+ ]
async exec (args) {
const { scope } = this.npm.flatOptions
@@ -54,8 +46,9 @@ class AddUser extends BaseCommand {
if (scope) {
const scopedRegistry = this.npm.config.get(`${scope}:registry`)
const cliRegistry = this.npm.config.get('registry', 'cli')
- if (scopedRegistry && !cliRegistry)
+ if (scopedRegistry && !cliRegistry) {
return scopedRegistry
+ }
}
return registry
}
@@ -63,8 +56,9 @@ class AddUser extends BaseCommand {
getAuthType ({ authType }) {
const type = authTypes[authType]
- if (!type)
+ if (!type) {
throw new Error('no such auth module')
+ }
return type
}
@@ -72,8 +66,9 @@ class AddUser extends BaseCommand {
async updateConfig ({ newCreds, registry, scope }) {
this.npm.config.delete('_token', 'user') // prevent legacy pollution
this.npm.config.setCredentialsByURI(registry, newCreds)
- if (scope)
+ if (scope) {
this.npm.config.set(scope + ':registry', registry, 'user')
+ }
await this.npm.config.save('user')
}
}
diff --git a/deps/npm/lib/commands/audit.js b/deps/npm/lib/commands/audit.js
index d05633ab0f..fad43fe902 100644
--- a/deps/npm/lib/commands/audit.js
+++ b/deps/npm/lib/commands/audit.js
@@ -5,39 +5,26 @@ const auditError = require('../utils/audit-error.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Audit extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Run a security audit'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'audit'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'audit-level',
- 'dry-run',
- 'force',
- 'json',
- 'package-lock-only',
- 'omit',
- ...super.params,
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[fix]']
- }
+ static description = 'Run a security audit'
+ static name = 'audit'
+ static params = [
+ 'audit-level',
+ 'dry-run',
+ 'force',
+ 'json',
+ 'package-lock-only',
+ 'omit',
+ ...super.params,
+ ]
+
+ static usage = ['[fix]']
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length === 2)
+ if (argv.length === 2) {
return ['fix']
+ }
switch (argv[2]) {
case 'fix':
@@ -60,9 +47,9 @@ class Audit extends ArboristWorkspaceCmd {
const arb = new Arborist(opts)
const fix = args[0] === 'fix'
await arb.audit({ fix })
- if (fix)
+ if (fix) {
await reifyFinish(this.npm, arb)
- else {
+ } else {
// will throw if there's an error, because this is an audit command
auditError(this.npm, arb.auditReport)
const result = auditReport(arb.auditReport, opts)
diff --git a/deps/npm/lib/commands/bin.js b/deps/npm/lib/commands/bin.js
index 9a894f3bb5..8f5ae0cc52 100644
--- a/deps/npm/lib/commands/bin.js
+++ b/deps/npm/lib/commands/bin.js
@@ -2,23 +2,16 @@ const envPath = require('../utils/path.js')
const BaseCommand = require('../base-command.js')
class Bin extends BaseCommand {
- static get description () {
- return 'Display npm bin folder'
- }
-
- static get name () {
- return 'bin'
- }
-
- static get params () {
- return ['global']
- }
+ static description = 'Display npm bin folder'
+ static name = 'bin'
+ static params = ['global']
async exec (args) {
const b = this.npm.bin
this.npm.output(b)
- if (this.npm.config.get('global') && !envPath.includes(b))
+ if (this.npm.config.get('global') && !envPath.includes(b)) {
console.error('(not in PATH env variable)')
+ }
}
}
module.exports = Bin
diff --git a/deps/npm/lib/commands/birthday.js b/deps/npm/lib/commands/birthday.js
index 4fa0268f8b..27fe2c50ca 100644
--- a/deps/npm/lib/commands/birthday.js
+++ b/deps/npm/lib/commands/birthday.js
@@ -1,11 +1,10 @@
const BaseCommand = require('../base-command.js')
class Birthday extends BaseCommand {
+ static name = 'birthday'
async exec () {
- this.npm.config.set('package', ['@npmcli/npm-birthday'])
this.npm.config.set('yes', true)
- const exec = await this.npm.cmd('exec')
- return exec.exec(['npm-birthday'])
+ return this.npm.exec('exec', ['@npmcli/npm-birthday'])
}
}
diff --git a/deps/npm/lib/commands/bugs.js b/deps/npm/lib/commands/bugs.js
index 863a7ffeca..8ca8188ccd 100644
--- a/deps/npm/lib/commands/bugs.js
+++ b/deps/npm/lib/commands/bugs.js
@@ -5,26 +5,15 @@ const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
const BaseCommand = require('../base-command.js')
class Bugs extends BaseCommand {
- static get description () {
- return 'Report bugs for a package in a web browser'
- }
-
- static get name () {
- return 'bugs'
- }
-
- static get usage () {
- return ['[<pkgname>]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['browser', 'registry']
- }
+ static description = 'Report bugs for a package in a web browser'
+ static name = 'bugs'
+ static usage = ['[<pkgname>]']
+ static params = ['browser', 'registry']
async exec (args) {
- if (!args || !args.length)
+ if (!args || !args.length) {
args = ['.']
+ }
await Promise.all(args.map(pkg => this.getBugs(pkg)))
}
@@ -39,20 +28,24 @@ class Bugs extends BaseCommand {
getBugsUrl (mani) {
if (mani.bugs) {
- if (typeof mani.bugs === 'string')
+ if (typeof mani.bugs === 'string') {
return mani.bugs
+ }
- if (typeof mani.bugs === 'object' && mani.bugs.url)
+ if (typeof mani.bugs === 'object' && mani.bugs.url) {
return mani.bugs.url
+ }
- if (typeof mani.bugs === 'object' && mani.bugs.email)
+ if (typeof mani.bugs === 'object' && mani.bugs.email) {
return `mailto:${mani.bugs.email}`
+ }
}
// try to get it from the repo, if possible
const info = hostedFromMani(mani)
- if (info)
+ if (info) {
return info.bugs()
+ }
// just send them to the website, hopefully that has some info!
return `https://www.npmjs.com/package/${mani.name}`
diff --git a/deps/npm/lib/commands/cache.js b/deps/npm/lib/commands/cache.js
index b4a932d1be..b1c045bbfa 100644
--- a/deps/npm/lib/commands/cache.js
+++ b/deps/npm/lib/commands/cache.js
@@ -12,8 +12,10 @@ const localeCompare = require('@isaacs/string-locale-compare')('en')
const searchCachePackage = async (path, spec, cacheKeys) => {
const parsed = npa(spec)
- if (parsed.rawSpec !== '' && parsed.type === 'tag')
+ if (parsed.rawSpec !== '' && parsed.type === 'tag') {
throw new Error(`Cannot list cache keys for a tagged package.`)
+ }
+ /* eslint-disable-next-line max-len */
const searchMFH = new RegExp(`^make-fetch-happen:request-cache:.*(?<!/[@a-zA-Z]+)/${parsed.name}/-/(${parsed.name}[^/]+.tgz)$`)
const searchPack = new RegExp(`^make-fetch-happen:request-cache:.*/${parsed.escapedName}$`)
const results = new Set()
@@ -26,13 +28,15 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
const noExt = filename.slice(0, -4)
const noScope = `${parsed.name.split('/').pop()}-`
const ver = noExt.slice(noScope.length)
- if (semver.satisfies(ver, parsed.rawSpec))
+ if (semver.satisfies(ver, parsed.rawSpec)) {
results.add(key)
+ }
continue
}
// is this key a packument?
- if (!searchPack.test(key))
+ if (!searchPack.test(key)) {
continue
+ }
results.add(key)
let packument, details
@@ -43,16 +47,19 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
// if we couldn't parse the packument, abort
continue
}
- if (!packument.versions || typeof packument.versions !== 'object')
+ if (!packument.versions || typeof packument.versions !== 'object') {
continue
+ }
// assuming this is a packument
for (const ver of Object.keys(packument.versions)) {
if (semver.satisfies(ver, parsed.rawSpec)) {
- if (packument.versions[ver].dist
- && typeof packument.versions[ver].dist === 'object'
- && packument.versions[ver].dist.tarball !== undefined
- && cacheKeys.has(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`))
+ if (packument.versions[ver].dist &&
+ typeof packument.versions[ver].dist === 'object' &&
+ packument.versions[ver].dist.tarball !== undefined &&
+ cacheKeys.has(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`)
+ ) {
results.add(`make-fetch-happen:request-cache:${packument.versions[ver].dist.tarball}`)
+ }
}
}
}
@@ -60,38 +67,25 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
}
class Cache extends BaseCommand {
- static get description () {
- return 'Manipulates packages cache'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'cache'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['cache']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'add <tarball file>',
- 'add <folder>',
- 'add <tarball url>',
- 'add <git url>',
- 'add <name>@<version>',
- 'clean [<key>]',
- 'ls [<name>@<version>]',
- 'verify',
- ]
- }
+ static description = 'Manipulates packages cache'
+ static name = 'cache'
+ static params = ['cache']
+ static usage = [
+ 'add <tarball file>',
+ 'add <folder>',
+ 'add <tarball url>',
+ 'add <git url>',
+ 'add <name>@<version>',
+ 'clean [<key>]',
+ 'ls [<name>@<version>]',
+ 'verify',
+ ]
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length === 2)
+ if (argv.length === 2) {
return ['add', 'clean', 'verify', 'ls', 'delete']
+ }
// TODO - eventually...
switch (argv[2]) {
@@ -162,8 +156,9 @@ class Cache extends BaseCommand {
// npm cache add <folder>...
async add (args) {
log.silly('cache add', 'args', args)
- if (args.length === 0)
+ if (args.length === 0) {
throw this.usageError('First argument to `add` is required')
+ }
return Promise.all(args.map(spec => {
log.silly('cache add', 'spec', spec)
@@ -185,9 +180,16 @@ class Cache extends BaseCommand {
const stats = await cacache.verify(cache)
this.npm.output(`Cache verified and compressed (${prefix})`)
this.npm.output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
- stats.badContentCount && this.npm.output(`Corrupted content removed: ${stats.badContentCount}`)
- stats.reclaimedCount && this.npm.output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
- stats.missingContent && this.npm.output(`Missing content: ${stats.missingContent}`)
+ if (stats.badContentCount) {
+ this.npm.output(`Corrupted content removed: ${stats.badContentCount}`)
+ }
+ if (stats.reclaimedCount) {
+ /* eslint-disable-next-line max-len */
+ this.npm.output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
+ }
+ if (stats.missingContent) {
+ this.npm.output(`Missing content: ${stats.missingContent}`)
+ }
this.npm.output(`Index entries: ${stats.totalEntries}`)
this.npm.output(`Finished in ${stats.runTime.total / 1000}s`)
}
@@ -201,8 +203,9 @@ class Cache extends BaseCommand {
const results = new Set()
for (const spec of specs) {
const keySet = await searchCachePackage(cachePath, spec, cacheKeys)
- for (const key of keySet)
+ for (const key of keySet) {
results.add(key)
+ }
}
[...results].sort(localeCompare).forEach(key => this.npm.output(key))
return
diff --git a/deps/npm/lib/commands/ci.js b/deps/npm/lib/commands/ci.js
index a53c580670..e928a01d15 100644
--- a/deps/npm/lib/commands/ci.js
+++ b/deps/npm/lib/commands/ci.js
@@ -20,24 +20,13 @@ const removeNodeModules = async where => {
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class CI extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Install a project with a clean slate'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'ci'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'audit',
- 'ignore-scripts',
- 'script-shell',
- ]
- }
+ static description = 'Install a project with a clean slate'
+ static name = 'ci'
+ static params = [
+ 'audit',
+ 'ignore-scripts',
+ 'script-shell',
+ ]
async exec () {
if (this.npm.config.get('global')) {
diff --git a/deps/npm/lib/commands/completion.js b/deps/npm/lib/commands/completion.js
index fbbde0df70..4ded2de385 100644
--- a/deps/npm/lib/commands/completion.js
+++ b/deps/npm/lib/commands/completion.js
@@ -45,20 +45,14 @@ const { promisify } = require('util')
const BaseCommand = require('../base-command.js')
class Completion extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Tab Completion for npm'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'completion'
- }
+ static description = 'Tab Completion for npm'
+ static name = 'completion'
// completion for the completion command
async completion (opts) {
- if (opts.w > 2)
+ if (opts.w > 2) {
return
+ }
const { resolve } = require('path')
const [bashExists, zshExists] = await Promise.all([
@@ -66,11 +60,13 @@ class Completion extends BaseCommand {
fileExists(resolve(process.env.HOME, '.zshrc')),
])
const out = []
- if (zshExists)
+ if (zshExists) {
out.push(['>>', '~/.zshrc'])
+ }
- if (bashExists)
+ if (bashExists) {
out.push(['>>', '~/.bashrc'])
+ }
return out
}
@@ -88,8 +84,9 @@ class Completion extends BaseCommand {
// if the COMP_* isn't in the env, then just dump the script.
if (COMP_CWORD === undefined ||
COMP_LINE === undefined ||
- COMP_POINT === undefined)
+ COMP_POINT === undefined) {
return dumpScript()
+ }
// ok we're actually looking at the envs and outputting the suggestions
// get the partial line and partial word,
@@ -106,8 +103,9 @@ class Completion extends BaseCommand {
// figure out where in that last word the point is.
const partialWordRaw = args[w]
let i = partialWordRaw.length
- while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0)
+ while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0) {
i--
+ }
const partialWord = unescape(partialWordRaw.substr(0, i))
partialWords.push(partialWord)
@@ -126,8 +124,9 @@ class Completion extends BaseCommand {
}
if (partialWords.slice(0, -1).indexOf('--') === -1) {
- if (word.charAt(0) === '-')
+ if (word.charAt(0) === '-') {
return this.wrap(opts, configCompl(opts))
+ }
if (words[w - 1] &&
words[w - 1].charAt(0) === '-' &&
@@ -151,15 +150,16 @@ class Completion extends BaseCommand {
nopt(types, shorthands, partialWords.slice(0, -1), 0)
// check if there's a command already.
const cmd = parsed.argv.remain[1]
- if (!cmd)
+ if (!cmd) {
return this.wrap(opts, cmdCompl(opts))
+ }
Object.keys(parsed).forEach(k => this.npm.config.set(k, parsed[k]))
// at this point, if words[1] is some kind of npm command,
// then complete on it.
// otherwise, do nothing
- const impl = this.npm.cmd(cmd)
+ const impl = await this.npm.cmd(cmd)
if (impl.completion) {
const comps = await impl.completion(opts)
return this.wrap(opts, comps)
@@ -173,17 +173,18 @@ class Completion extends BaseCommand {
// Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand
// to: 'a', 'b c', or 'd' 'e'
wrap (opts, compls) {
- if (!Array.isArray(compls))
- compls = compls ? [compls] : []
+ // TODO this was dead code, leaving it in case we find some command we
+ // forgot that requires this. if so *that command should fix its
+ // completions*
+ // compls = compls.map(w => !/\s+/.test(w) ? w : '\'' + w + '\'')
- compls = compls.map(c =>
- Array.isArray(c) ? c.map(escape).join(' ') : escape(c))
-
- if (opts.partialWord)
+ if (opts.partialWord) {
compls = compls.filter(c => c.startsWith(opts.partialWord))
+ }
- if (compls.length > 0)
+ if (compls.length > 0) {
this.npm.output(compls.join('\n'))
+ }
}
}
@@ -197,8 +198,9 @@ const dumpScript = async () => {
await new Promise((res, rej) => {
let done = false
process.stdout.on('error', er => {
- if (done)
+ if (done) {
return
+ }
done = true
@@ -214,15 +216,17 @@ const dumpScript = async () => {
// can never ever work on OS X.
// TODO Ignoring coverage, see 'non EPIPE errors cause failures' test.
/* istanbul ignore next */
- if (er.errno === 'EPIPE')
+ if (er.errno === 'EPIPE') {
res()
- else
+ } else {
rej(er)
+ }
})
process.stdout.write(d, () => {
- if (done)
+ if (done) {
return
+ }
done = true
res()
@@ -233,9 +237,6 @@ const dumpScript = async () => {
const unescape = w => w.charAt(0) === '\'' ? w.replace(/^'|'$/g, '')
: w.replace(/\\ /g, ' ')
-const escape = w => !/\s+/.test(w) ? w
- : '\'' + w + '\''
-
// the current word has a dash. Return the config names,
// with the same number of dashes as the current word has.
const configCompl = opts => {
@@ -258,7 +259,7 @@ const isFlag = word => {
const split = word.match(/^(-*)((?:no-)+)?(.*)$/)
const no = split[2]
const conf = split[3]
- const {type} = definitions[conf]
+ const { type } = definitions[conf]
return no ||
type === Boolean ||
(Array.isArray(type) && type.includes(Boolean)) ||
@@ -269,12 +270,14 @@ const isFlag = word => {
// if they all resolve to the same thing, just return the thing it already is
const cmdCompl = opts => {
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
- if (!matches.length)
+ if (!matches.length) {
return matches
+ }
const derefs = new Set([...matches.map(c => deref(c))])
- if (derefs.size === 1)
+ if (derefs.size === 1) {
return [...derefs]
+ }
return fullList
}
diff --git a/deps/npm/lib/commands/config.js b/deps/npm/lib/commands/config.js
index fc482edb6a..0cdcd576f5 100644
--- a/deps/npm/lib/commands/config.js
+++ b/deps/npm/lib/commands/config.js
@@ -31,46 +31,35 @@ const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k)
const BaseCommand = require('../base-command.js')
class Config extends BaseCommand {
- static get description () {
- return 'Manage the npm configuration files'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'config'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'set <key>=<value> [<key>=<value> ...]',
- 'get [<key> [<key> ...]]',
- 'delete <key> [<key> ...]',
- 'list [--json]',
- 'edit',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'json',
- 'global',
- 'editor',
- 'location',
- 'long',
- ]
- }
+ static description = 'Manage the npm configuration files'
+ static name = 'config'
+ static usage = [
+ 'set <key>=<value> [<key>=<value> ...]',
+ 'get [<key> [<key> ...]]',
+ 'delete <key> [<key> ...]',
+ 'list [--json]',
+ 'edit',
+ ]
+
+ static params = [
+ 'json',
+ 'global',
+ 'editor',
+ 'location',
+ 'long',
+ ]
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv[1] !== 'config')
+ if (argv[1] !== 'config') {
argv.unshift('config')
+ }
if (argv.length === 2) {
const cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit']
- if (opts.partialWord !== 'l')
+ if (opts.partialWord !== 'l') {
cmds.push('list')
+ }
return cmds
}
@@ -79,8 +68,9 @@ class Config extends BaseCommand {
switch (action) {
case 'set':
// todo: complete with valid values, if possible.
- if (argv.length > 3)
+ if (argv.length > 3) {
return []
+ }
// fallthrough
/* eslint no-fallthrough:0 */
@@ -132,28 +122,32 @@ class Config extends BaseCommand {
}
async set (args) {
- if (!args.length)
+ if (!args.length) {
throw this.usageError()
+ }
const where = this.npm.flatOptions.location
for (const [key, val] of Object.entries(keyValues(args))) {
this.npm.log.info('config', 'set %j %j', key, val)
this.npm.config.set(key, val || '', where)
- if (!this.npm.config.validate(where))
+ if (!this.npm.config.validate(where)) {
this.npm.log.warn('config', 'omitting invalid config values')
+ }
}
await this.npm.config.save(where)
}
async get (keys) {
- if (!keys.length)
+ if (!keys.length) {
return this.list()
+ }
const out = []
for (const key of keys) {
- if (!publicVar(key))
+ if (!publicVar(key)) {
throw `The ${key} option is protected, and cannot be retrieved in this way`
+ }
const pref = keys.length > 1 ? `${key}=` : ''
out.push(pref + this.npm.config.get(key))
@@ -162,12 +156,14 @@ class Config extends BaseCommand {
}
async del (keys) {
- if (!keys.length)
+ if (!keys.length) {
throw this.usageError()
+ }
const where = this.npm.flatOptions.location
- for (const key of keys)
+ for (const key of keys) {
this.npm.config.delete(key, where)
+ }
await this.npm.config.save(where)
}
@@ -220,8 +216,9 @@ ${defData}
const [bin, ...args] = e.split(/\s+/)
const editor = spawn(bin, [...args, file], { stdio: 'inherit' })
editor.on('exit', (code) => {
- if (code)
+ if (code) {
return reject(new Error(`editor process exited with code: ${code}`))
+ }
return resolve()
})
})
@@ -232,12 +229,14 @@ ${defData}
// long does not have a flattener
const long = this.npm.config.get('long')
for (const [where, { data, source }] of this.npm.config.data.entries()) {
- if (where === 'default' && !long)
+ if (where === 'default' && !long) {
continue
+ }
const keys = Object.keys(data).sort(localeCompare)
- if (!keys.length)
+ if (!keys.length) {
continue
+ }
msg.push(`; "${where}" config from ${source}`, '')
for (const k of keys) {
@@ -265,8 +264,9 @@ ${defData}
async listJson () {
const publicConf = {}
for (const key in this.npm.config.list[0]) {
- if (!publicVar(key))
+ if (!publicVar(key)) {
continue
+ }
publicConf[key] = this.npm.config.get(key)
}
diff --git a/deps/npm/lib/commands/dedupe.js b/deps/npm/lib/commands/dedupe.js
index f9314cfc51..e1eafbe3bc 100644
--- a/deps/npm/lib/commands/dedupe.js
+++ b/deps/npm/lib/commands/dedupe.js
@@ -5,32 +5,21 @@ const reifyFinish = require('../utils/reify-finish.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Dedupe extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Reduce duplication in the package tree'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'dedupe'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'global-style',
- 'legacy-bundling',
- 'strict-peer-deps',
- 'package-lock',
- 'omit',
- 'ignore-scripts',
- 'audit',
- 'bin-links',
- 'fund',
- 'dry-run',
- ...super.params,
- ]
- }
+ static description = 'Reduce duplication in the package tree'
+ static name = 'dedupe'
+ static params = [
+ 'global-style',
+ 'legacy-bundling',
+ 'strict-peer-deps',
+ 'package-lock',
+ 'omit',
+ 'ignore-scripts',
+ 'audit',
+ 'bin-links',
+ 'fund',
+ 'dry-run',
+ ...super.params,
+ ]
async exec (args) {
if (this.npm.config.get('global')) {
diff --git a/deps/npm/lib/commands/deprecate.js b/deps/npm/lib/commands/deprecate.js
index 37b9d2dc27..839e974caf 100644
--- a/deps/npm/lib/commands/deprecate.js
+++ b/deps/npm/lib/commands/deprecate.js
@@ -7,31 +7,18 @@ const libaccess = require('libnpmaccess')
const BaseCommand = require('../base-command.js')
class Deprecate extends BaseCommand {
- static get description () {
- return 'Deprecate a version of a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'deprecate'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<pkg>[@<version>] <message>']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- ]
- }
+ static description = 'Deprecate a version of a package'
+ static name = 'deprecate'
+ static usage = ['<pkg>[@<version>] <message>']
+ static params = [
+ 'registry',
+ 'otp',
+ ]
async completion (opts) {
- if (opts.conf.argv.remain.length > 1)
+ if (opts.conf.argv.remain.length > 1) {
return []
+ }
const username = await getIdentity(this.npm, this.npm.flatOptions)
const packages = await libaccess.lsPackages(username, this.npm.flatOptions)
@@ -44,8 +31,9 @@ class Deprecate extends BaseCommand {
async exec ([pkg, msg]) {
// msg == null because '' is a valid value, it indicates undeprecate
- if (!pkg || msg == null)
+ if (!pkg || msg == null) {
throw this.usageError()
+ }
// fetch the data and make sure it exists.
const p = npa(pkg)
@@ -53,8 +41,9 @@ class Deprecate extends BaseCommand {
// "*" is the appropriate default.
const spec = p.rawSpec === '' ? '*' : p.fetchSpec
- if (semver.validRange(spec, true) === null)
+ if (semver.validRange(spec, true) === null) {
throw new Error(`invalid version range: ${spec}`)
+ }
const uri = '/' + p.escapedName
const packument = await fetch.json(uri, {
diff --git a/deps/npm/lib/commands/diff.js b/deps/npm/lib/commands/diff.js
index 67d0d15058..3134f502ea 100644
--- a/deps/npm/lib/commands/diff.js
+++ b/deps/npm/lib/commands/diff.js
@@ -12,59 +12,49 @@ const readPackageName = require('../utils/read-package-name.js')
const BaseCommand = require('../base-command.js')
class Diff extends BaseCommand {
- static get description () {
- return 'The registry diff command'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'diff'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '[...<paths>]',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'diff',
- 'diff-name-only',
- 'diff-unified',
- 'diff-ignore-all-space',
- 'diff-no-prefix',
- 'diff-src-prefix',
- 'diff-dst-prefix',
- 'diff-text',
- 'global',
- 'tag',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
+ static description = 'The registry diff command'
+ static name = 'diff'
+ static usage = [
+ '[...<paths>]',
+ ]
+
+ static params = [
+ 'diff',
+ 'diff-name-only',
+ 'diff-unified',
+ 'diff-ignore-all-space',
+ 'diff-no-prefix',
+ 'diff-src-prefix',
+ 'diff-dst-prefix',
+ 'diff-text',
+ 'global',
+ 'tag',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
async exec (args) {
const specs = this.npm.config.get('diff').filter(d => d)
- if (specs.length > 2)
+ if (specs.length > 2) {
throw this.usageError(`Can't use more than two --diff arguments.`)
+ }
// execWorkspaces may have set this already
- if (!this.prefix)
+ if (!this.prefix) {
this.prefix = this.npm.prefix
+ }
// this is the "top" directory, one up from node_modules
// in global mode we have to walk one up from globalDir because our
// node_modules is sometimes under ./lib, and in global mode we're only ever
// walking through node_modules (because we will have been given a package
// name already)
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
this.top = resolve(this.npm.globalDir, '..')
- else
+ } else {
this.top = this.prefix
+ }
const [a, b] = await this.retrieveSpecs(specs)
npmlog.info('diff', { src: a, dst: b })
@@ -96,8 +86,9 @@ class Diff extends BaseCommand {
npmlog.verbose('diff', 'could not read project dir package.json')
}
- if (!name)
+ if (!name) {
throw this.usageError('Needs multiple arguments to compare or run from a project dir.')
+ }
return name
}
@@ -129,14 +120,16 @@ class Diff extends BaseCommand {
noPackageJson = true
}
- const missingPackageJson = this.usageError('Needs multiple arguments to compare or run from a project dir.')
+ const missingPackageJson =
+ this.usageError('Needs multiple arguments to compare or run from a project dir.')
// using a valid semver range, that means it should just diff
// the cwd against a published version to the registry using the
// same project name and the provided semver range
if (semver.validRange(a)) {
- if (!pkgName)
+ if (!pkgName) {
throw missingPackageJson
+ }
return [
`${pkgName}@${a}`,
`file:${this.prefix}`,
@@ -165,8 +158,9 @@ class Diff extends BaseCommand {
}
if (!node || !node.name || !node.package || !node.package.version) {
- if (noPackageJson)
+ if (noPackageJson) {
throw missingPackageJson
+ }
return [
`${spec.name}@${spec.fetchSpec}`,
`file:${this.prefix}`,
@@ -177,8 +171,9 @@ class Diff extends BaseCommand {
(actualTree && actualTree.edgesOut.get(spec.name) || {}).spec
const tryAnySpec = () => {
- for (const edge of node.edgesIn)
+ for (const edge of node.edgesIn) {
return edge.spec
+ }
}
const aSpec = `file:${node.realpath}`
@@ -188,9 +183,9 @@ class Diff extends BaseCommand {
// work from the top of the arborist tree to find the original semver
// range declared in the package that depends on the package.
let bSpec
- if (spec.rawSpec)
+ if (spec.rawSpec) {
bSpec = spec.rawSpec
- else {
+ } else {
const bTargetVersion =
tryRootNodeSpec()
|| tryAnySpec()
@@ -217,8 +212,9 @@ class Diff extends BaseCommand {
`file:${spec.fetchSpec}`,
`file:${this.prefix}`,
]
- } else
+ } else {
throw this.usageError(`Spec type ${spec.type} not supported.`)
+ }
}
async convertVersionsToSpecs ([a, b]) {
@@ -234,19 +230,22 @@ class Diff extends BaseCommand {
npmlog.verbose('diff', 'could not read project dir package.json')
}
- if (!pkgName)
+ if (!pkgName) {
throw this.usageError('Needs to be run from a project dir in order to diff two versions.')
+ }
return [`${pkgName}@${a}`, `${pkgName}@${b}`]
}
// otherwise uses the name from the other arg to
// figure out the spec.name of what to compare
- if (!semverA && semverB)
+ if (!semverA && semverB) {
return [a, `${npa(a).name}@${b}`]
+ }
- if (semverA && !semverB)
+ if (semverA && !semverB) {
return [`${npa(b).name}@${a}`, b]
+ }
// no valid semver ranges used
return [a, b]
@@ -267,8 +266,9 @@ class Diff extends BaseCommand {
return specs.map(i => {
const spec = npa(i)
- if (spec.rawSpec)
+ if (spec.rawSpec) {
return i
+ }
const node = actualTree
&& actualTree.inventory.query('name', spec.name)
diff --git a/deps/npm/lib/commands/dist-tag.js b/deps/npm/lib/commands/dist-tag.js
index b7baa3d463..fa79b293c5 100644
--- a/deps/npm/lib/commands/dist-tag.js
+++ b/deps/npm/lib/commands/dist-tag.js
@@ -8,33 +8,20 @@ const readPackageName = require('../utils/read-package-name.js')
const BaseCommand = require('../base-command.js')
class DistTag extends BaseCommand {
- static get description () {
- return 'Modify package distribution tags'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['workspace', 'workspaces', 'include-workspace-root']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'dist-tag'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'add <pkg>@<version> [<tag>]',
- 'rm <pkg> <tag>',
- 'ls [<pkg>]',
- ]
- }
+ static description = 'Modify package distribution tags'
+ static params = ['workspace', 'workspaces', 'include-workspace-root']
+ static name = 'dist-tag'
+ static usage = [
+ 'add <pkg>@<version> [<tag>]',
+ 'rm <pkg> <tag>',
+ 'ls [<pkg>]',
+ ]
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length === 2)
+ if (argv.length === 2) {
return ['add', 'rm', 'ls']
+ }
switch (argv[2]) {
default:
@@ -45,21 +32,25 @@ class DistTag extends BaseCommand {
async exec ([cmdName, pkg, tag]) {
const opts = this.npm.flatOptions
- if (['add', 'a', 'set', 's'].includes(cmdName))
+ if (['add', 'a', 'set', 's'].includes(cmdName)) {
return this.add(pkg, tag, opts)
+ }
- if (['rm', 'r', 'del', 'd', 'remove'].includes(cmdName))
+ if (['rm', 'r', 'del', 'd', 'remove'].includes(cmdName)) {
return this.remove(pkg, tag, opts)
+ }
- if (['ls', 'l', 'sl', 'list'].includes(cmdName))
+ if (['ls', 'l', 'sl', 'list'].includes(cmdName)) {
return this.list(pkg, opts)
+ }
if (!pkg) {
// when only using the pkg name the default behavior
// should be listing the existing tags
return this.list(cmdName, opts)
- } else
+ } else {
throw this.usageError()
+ }
}
async execWorkspaces ([cmdName, pkg, tag], filters) {
@@ -68,16 +59,18 @@ class DistTag extends BaseCommand {
// - unset
// - .
// - .@version
- if (['ls', 'l', 'sl', 'list'].includes(cmdName) && (!pkg || pkg === '.' || /^\.@/.test(pkg)))
+ if (['ls', 'l', 'sl', 'list'].includes(cmdName) && (!pkg || pkg === '.' || /^\.@/.test(pkg))) {
return this.listWorkspaces(filters)
+ }
// pkg is unset
// cmdName is one of:
// - unset
// - .
// - .@version
- if (!pkg && (!cmdName || cmdName === '.' || /^\.@/.test(cmdName)))
+ if (!pkg && (!cmdName || cmdName === '.' || /^\.@/.test(cmdName))) {
return this.listWorkspaces(filters)
+ }
// anything else is just a regular dist-tag command
// so we fallback to the non-workspaces implementation
@@ -92,13 +85,15 @@ class DistTag extends BaseCommand {
log.verbose('dist-tag add', defaultTag, 'to', spec.name + '@' + version)
- if (!spec.name || !version || !defaultTag)
+ if (!spec.name || !version || !defaultTag) {
throw this.usageError()
+ }
const t = defaultTag.trim()
- if (semver.validRange(t))
+ if (semver.validRange(t)) {
throw new Error('Tag name must not be a valid SemVer range: ' + t)
+ }
const tags = await this.fetchTags(spec, opts)
if (tags[t] === version) {
@@ -125,8 +120,9 @@ class DistTag extends BaseCommand {
spec = npa(spec || '')
log.verbose('dist-tag del', tag, 'from', spec.name)
- if (!spec.name)
+ if (!spec.name) {
throw this.usageError()
+ }
const tags = await this.fetchTags(spec, opts)
if (!tags[tag]) {
@@ -148,11 +144,13 @@ class DistTag extends BaseCommand {
async list (spec, opts) {
if (!spec) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
throw this.usageError()
+ }
const pkg = await readPackageName(this.npm.prefix)
- if (!pkg)
+ if (!pkg) {
throw this.usageError()
+ }
return this.list(pkg, opts)
}
@@ -190,10 +188,12 @@ class DistTag extends BaseCommand {
`/-/package/${spec.escapedName}/dist-tags`,
{ ...opts, 'prefer-online': true, spec }
)
- if (data && typeof data === 'object')
+ if (data && typeof data === 'object') {
delete data._etag
- if (!data || !Object.keys(data).length)
+ }
+ if (!data || !Object.keys(data).length) {
throw new Error('No dist-tags found for ' + spec.name)
+ }
return data
}
diff --git a/deps/npm/lib/commands/docs.js b/deps/npm/lib/commands/docs.js
index 4482678ea7..9aba242057 100644
--- a/deps/npm/lib/commands/docs.js
+++ b/deps/npm/lib/commands/docs.js
@@ -5,35 +5,22 @@ const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
const BaseCommand = require('../base-command.js')
class Docs extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Open documentation for a package in a web browser'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'docs'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'browser',
- 'registry',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<pkgname> [<pkgname> ...]]']
- }
+ static description = 'Open documentation for a package in a web browser'
+ static name = 'docs'
+ static params = [
+ 'browser',
+ 'registry',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
+
+ static usage = ['[<pkgname> [<pkgname> ...]]']
async exec (args) {
- if (!args || !args.length)
+ if (!args || !args.length) {
args = ['.']
+ }
await Promise.all(args.map(pkg => this.getDocs(pkg)))
}
@@ -52,12 +39,14 @@ class Docs extends BaseCommand {
}
getDocsUrl (mani) {
- if (mani.homepage)
+ if (mani.homepage) {
return mani.homepage
+ }
const info = hostedFromMani(mani)
- if (info)
+ if (info) {
return info.docs()
+ }
return 'https://www.npmjs.com/package/' + mani.name
}
diff --git a/deps/npm/lib/commands/doctor.js b/deps/npm/lib/commands/doctor.js
index b6363467c6..6b8878b6f4 100644
--- a/deps/npm/lib/commands/doctor.js
+++ b/deps/npm/lib/commands/doctor.js
@@ -11,41 +11,35 @@ const { promisify } = require('util')
const ansiTrim = require('../utils/ansi-trim.js')
const isWindows = require('../utils/is-windows.js')
const ping = require('../utils/ping.js')
-const { registry: { default: defaultRegistry } } = require('../utils/config/definitions.js')
+const {
+ registry: { default: defaultRegistry },
+} = require('../utils/config/definitions.js')
const lstat = promisify(fs.lstat)
const readdir = promisify(fs.readdir)
const access = promisify(fs.access)
const { R_OK, W_OK, X_OK } = fs.constants
const maskLabel = mask => {
const label = []
- if (mask & R_OK)
+ if (mask & R_OK) {
label.push('readable')
+ }
- if (mask & W_OK)
+ if (mask & W_OK) {
label.push('writable')
+ }
- if (mask & X_OK)
+ if (mask & X_OK) {
label.push('executable')
+ }
return label.join(', ')
}
const BaseCommand = require('../base-command.js')
class Doctor extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Check your npm environment'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'doctor'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['registry']
- }
+ static description = 'Check your npm environment'
+ static name = 'doctor'
+ static params = ['registry']
async exec (args) {
this.npm.log.info('Running checkup')
@@ -59,13 +53,31 @@ class Doctor extends BaseCommand {
['node -v', 'getLatestNodejsVersion', []],
['npm config get registry', 'checkNpmRegistry', []],
['which git', 'getGitPath', []],
- ...(isWindows ? [] : [
- ['Perms check on cached files', 'checkFilesPermission', [this.npm.cache, true, R_OK]],
- ['Perms check on local node_modules', 'checkFilesPermission', [this.npm.localDir, true]],
- ['Perms check on global node_modules', 'checkFilesPermission', [this.npm.globalDir, false]],
- ['Perms check on local bin folder', 'checkFilesPermission', [this.npm.localBin, false, R_OK | W_OK | X_OK]],
- ['Perms check on global bin folder', 'checkFilesPermission', [this.npm.globalBin, false, X_OK]],
- ]),
+ ...(isWindows
+ ? []
+ : [
+ ['Perms check on cached files', 'checkFilesPermission', [this.npm.cache, true, R_OK]],
+ [
+ 'Perms check on local node_modules',
+ 'checkFilesPermission',
+ [this.npm.localDir, true],
+ ],
+ [
+ 'Perms check on global node_modules',
+ 'checkFilesPermission',
+ [this.npm.globalDir, false],
+ ],
+ [
+ 'Perms check on local bin folder',
+ 'checkFilesPermission',
+ [this.npm.localBin, false, R_OK | W_OK | X_OK],
+ ],
+ [
+ 'Perms check on global bin folder',
+ 'checkFilesPermission',
+ [this.npm.globalBin, false, X_OK],
+ ],
+ ]),
['Verify cache contents', 'verifyCachedFiles', [this.npm.flatOptions.cache]],
// TODO:
// - ensure arborist.loadActual() runs without errors and no invalid edges
@@ -85,39 +97,43 @@ class Doctor extends BaseCommand {
messages.push(line)
}
- const outHead = ['Check', 'Value', 'Recommendation/Notes']
- .map(!this.npm.color ? h => h : h => chalk.underline(h))
+ const outHead = ['Check', 'Value', 'Recommendation/Notes'].map(
+ !this.npm.color ? h => h : h => chalk.underline(h)
+ )
let allOk = true
- const outBody = messages.map(!this.npm.color
- ? item => {
- allOk = allOk && item[1]
- item[1] = item[1] ? 'ok' : 'not ok'
- item[2] = String(item[2])
- return item
- }
- : item => {
- allOk = allOk && item[1]
- if (!item[1]) {
- item[0] = chalk.red(item[0])
- item[2] = chalk.magenta(String(item[2]))
+ const outBody = messages.map(
+ !this.npm.color
+ ? item => {
+ allOk = allOk && item[1]
+ item[1] = item[1] ? 'ok' : 'not ok'
+ item[2] = String(item[2])
+ return item
}
- item[1] = item[1] ? chalk.green('ok') : chalk.red('not ok')
- return item
- })
+ : item => {
+ allOk = allOk && item[1]
+ if (!item[1]) {
+ item[0] = chalk.red(item[0])
+ item[2] = chalk.magenta(String(item[2]))
+ }
+ item[1] = item[1] ? chalk.green('ok') : chalk.red('not ok')
+ return item
+ }
+ )
const outTable = [outHead, ...outBody]
const tableOpts = {
stringLength: s => ansiTrim(s).length,
}
- const silent = this.npm.log.levels[this.npm.log.level] >
- this.npm.log.levels.error
+ const silent = this.npm.log.levels[this.npm.log.level] > this.npm.log.levels.error
if (!silent) {
this.npm.output(table(outTable, tableOpts))
- if (!allOk)
+ if (!allOk) {
console.error('')
+ }
}
- if (!allOk)
+ if (!allOk) {
throw new Error('Some problems found. See above for recommendations.')
+ }
}
async checkPing () {
@@ -127,10 +143,11 @@ class Doctor extends BaseCommand {
await ping(this.npm.flatOptions)
return ''
} catch (er) {
- if (/^E\d{3}$/.test(er.code || ''))
+ if (/^E\d{3}$/.test(er.code || '')) {
throw er.code.substr(1) + ' ' + er.message
- else
+ } else {
throw er.message
+ }
} finally {
tracker.finish()
}
@@ -141,10 +158,11 @@ class Doctor extends BaseCommand {
tracker.info('getLatestNpmVersion', 'Getting npm package information')
try {
const latest = (await pacote.manifest('npm@latest', this.npm.flatOptions)).version
- if (semver.gte(this.npm.version, latest))
+ if (semver.gte(this.npm.version, latest)) {
return `current: v${this.npm.version}, latest: v${latest}`
- else
+ } else {
throw `Use npm v${latest}`
+ }
} finally {
tracker.finish()
}
@@ -163,26 +181,29 @@ class Doctor extends BaseCommand {
let maxCurrent = '0.0.0'
let maxLTS = '0.0.0'
for (const { lts, version } of data) {
- if (lts && semver.gt(version, maxLTS))
+ if (lts && semver.gt(version, maxLTS)) {
maxLTS = version
+ }
- if (semver.satisfies(version, currentRange) &&
- semver.gt(version, maxCurrent))
+ if (semver.satisfies(version, currentRange) && semver.gt(version, maxCurrent)) {
maxCurrent = version
+ }
}
const recommended = semver.gt(maxCurrent, maxLTS) ? maxCurrent : maxLTS
- if (semver.gte(process.version, recommended))
+ if (semver.gte(process.version, recommended)) {
return `current: ${current}, recommended: ${recommended}`
- else
+ } else {
throw `Use node ${recommended} (current: ${current})`
+ }
} finally {
tracker.finish()
}
}
async checkFilesPermission (root, shouldOwn, mask = null) {
- if (mask === null)
+ if (mask === null) {
mask = shouldOwn ? R_OK | W_OK : R_OK
+ }
let ok = true
@@ -194,24 +215,25 @@ class Doctor extends BaseCommand {
const files = new Set([root])
for (const f of files) {
tracker.silly('checkFilesPermission', f.substr(root.length + 1))
- const st = await lstat(f)
- .catch(er => {
- ok = false
- tracker.warn('checkFilesPermission', 'error getting info for ' + f)
- })
+ const st = await lstat(f).catch(er => {
+ ok = false
+ tracker.warn('checkFilesPermission', 'error getting info for ' + f)
+ })
tracker.completeWork(1)
- if (!st)
+ if (!st) {
continue
+ }
if (shouldOwn && (uid !== st.uid || gid !== st.gid)) {
tracker.warn('checkFilesPermission', 'should be owner of ' + f)
ok = false
}
- if (!st.isDirectory() && !st.isFile())
+ if (!st.isDirectory() && !st.isFile()) {
continue
+ }
try {
await access(f, mask)
@@ -223,23 +245,26 @@ class Doctor extends BaseCommand {
}
if (st.isDirectory()) {
- const entries = await readdir(f)
- .catch(er => {
- ok = false
- tracker.warn('checkFilesPermission', 'error reading directory ' + f)
- return []
- })
- for (const entry of entries)
+ const entries = await readdir(f).catch(er => {
+ ok = false
+ tracker.warn('checkFilesPermission', 'error reading directory ' + f)
+ return []
+ })
+ for (const entry of entries) {
files.add(resolve(f, entry))
+ }
}
}
} finally {
tracker.finish()
if (!ok) {
- throw `Check the permissions of files in ${root}` +
+ throw (
+ `Check the permissions of files in ${root}` +
(shouldOwn ? ' (should be owned by current user)' : '')
- } else
+ )
+ } else {
return ''
+ }
}
}
@@ -261,27 +286,29 @@ class Doctor extends BaseCommand {
tracker.info('verifyCachedFiles', 'Verifying the npm cache')
try {
const stats = await cacache.verify(this.npm.flatOptions.cache)
- const {
- badContentCount,
- reclaimedCount,
- missingContent,
- reclaimedSize,
- } = stats
+ const { badContentCount, reclaimedCount, missingContent, reclaimedSize } = stats
if (badContentCount || reclaimedCount || missingContent) {
- if (badContentCount)
+ if (badContentCount) {
tracker.warn('verifyCachedFiles', `Corrupted content removed: ${badContentCount}`)
+ }
- if (reclaimedCount)
- tracker.warn('verifyCachedFiles', `Content garbage-collected: ${reclaimedCount} (${reclaimedSize} bytes)`)
+ if (reclaimedCount) {
+ tracker.warn(
+ 'verifyCachedFiles',
+ `Content garbage-collected: ${reclaimedCount} (${reclaimedSize} bytes)`
+ )
+ }
- if (missingContent)
+ if (missingContent) {
tracker.warn('verifyCachedFiles', `Missing content: ${missingContent}`)
+ }
tracker.warn('verifyCachedFiles', 'Cache issues have been fixed')
}
- tracker.info('verifyCachedFiles', `Verification complete. Stats: ${
- JSON.stringify(stats, null, 2)
- }`)
+ tracker.info(
+ 'verifyCachedFiles',
+ `Verification complete. Stats: ${JSON.stringify(stats, null, 2)}`
+ )
return `verified ${stats.verifiedContent} tarballs`
} finally {
tracker.finish()
@@ -289,10 +316,11 @@ class Doctor extends BaseCommand {
}
async checkNpmRegistry () {
- if (this.npm.flatOptions.registry !== defaultRegistry)
+ if (this.npm.flatOptions.registry !== defaultRegistry) {
throw `Try \`npm config set registry=${defaultRegistry}\``
- else
+ } else {
return `using default registry (${defaultRegistry})`
+ }
}
}
diff --git a/deps/npm/lib/commands/edit.js b/deps/npm/lib/commands/edit.js
index 4f0af6e833..5f069c4f13 100644
--- a/deps/npm/lib/commands/edit.js
+++ b/deps/npm/lib/commands/edit.js
@@ -9,33 +9,21 @@ const completion = require('../utils/completion/installed-shallow.js')
const BaseCommand = require('../base-command.js')
class Edit extends BaseCommand {
- static get description () {
- return 'Edit an installed package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'edit'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<pkg>[/<subpkg>...]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['editor']
- }
+ static description = 'Edit an installed package'
+ static name = 'edit'
+ static usage = ['<pkg>[/<subpkg>...]']
+ static params = ['editor']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
async exec (args) {
- if (args.length !== 1)
+ if (args.length !== 1) {
throw this.usageError()
+ }
const path = splitPackageNames(args[0])
const dir = resolve(this.npm.dir, path)
@@ -43,13 +31,15 @@ class Edit extends BaseCommand {
// graceful-fs does not promisify
await new Promise((resolve, reject) => {
fs.lstat(dir, (err) => {
- if (err)
+ if (err) {
return reject(err)
+ }
const [bin, ...args] = this.npm.config.get('editor').split(/\s+/)
const editor = spawn(bin, [...args, dir], { stdio: 'inherit' })
editor.on('exit', (code) => {
- if (code)
+ if (code) {
return reject(new Error(`editor process exited with code: ${code}`))
+ }
this.npm.exec('rebuild', [dir]).catch(reject).then(resolve)
})
})
diff --git a/deps/npm/lib/commands/exec.js b/deps/npm/lib/commands/exec.js
index ffe72ccb4c..515ac910f8 100644
--- a/deps/npm/lib/commands/exec.js
+++ b/deps/npm/lib/commands/exec.js
@@ -28,43 +28,31 @@ const getLocationMsg = require('../exec/get-workspace-location-msg.js')
// process.env.npm_lifecycle_event = 'npx'
class Exec extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Run a command from a local or remote npm package'
- }
+ static description = 'Run a command from a local or remote npm package'
+ static params = [
+ 'package',
+ 'call',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'package',
- 'call',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'exec'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '-- <pkg>[@<version>] [args...]',
- '--package=<pkg>[@<version>] -- <cmd> [args...]',
- '-c \'<cmd> [args...]\'',
- '--package=foo -c \'<cmd> [args...]\'',
- ]
- }
+ static name = 'exec'
+ static usage = [
+ '-- <pkg>[@<version>] [args...]',
+ '--package=<pkg>[@<version>] -- <cmd> [args...]',
+ '-c \'<cmd> [args...]\'',
+ '--package=foo -c \'<cmd> [args...]\'',
+ ]
async exec (_args, { locationMsg, path, runPath } = {}) {
- if (!path)
+ if (!path) {
path = this.npm.localPrefix
+ }
- if (!runPath)
+ if (!runPath) {
runPath = process.cwd()
+ }
const args = [..._args]
const call = this.npm.config.get('call')
@@ -79,8 +67,9 @@ class Exec extends BaseCommand {
const packages = this.npm.config.get('package')
const yes = this.npm.config.get('yes')
- if (call && _args.length)
+ if (call && _args.length) {
throw this.usageError()
+ }
return libexec({
...flatOptions,
diff --git a/deps/npm/lib/commands/explain.js b/deps/npm/lib/commands/explain.js
index 0ef41559f7..fd62b87fc8 100644
--- a/deps/npm/lib/commands/explain.js
+++ b/deps/npm/lib/commands/explain.js
@@ -8,36 +8,24 @@ const validName = require('validate-npm-package-name')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Explain extends ArboristWorkspaceCmd {
- static get description () {
- return 'Explain installed packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'explain'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<folder | specifier>']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'json',
- 'workspace',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ static description = 'Explain installed packages'
+ static name = 'explain'
+ static usage = ['<folder | specifier>']
+ static params = [
+ 'json',
+ 'workspace',
+ ]
+
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
async exec (args) {
- if (!args.length)
+ if (!args.length) {
throw this.usageError()
+ }
const arb = new Arborist({ path: this.npm.prefix, ...this.npm.flatOptions })
const tree = await arb.loadActual()
@@ -45,9 +33,9 @@ class Explain extends ArboristWorkspaceCmd {
if (this.npm.flatOptions.workspacesEnabled
&& this.workspaceNames
&& this.workspaceNames.length
- )
+ ) {
this.filterSet = arb.workspaceDependencySet(tree, this.workspaceNames)
- else if (!this.npm.flatOptions.workspacesEnabled) {
+ } else if (!this.npm.flatOptions.workspacesEnabled) {
this.filterSet =
arb.excludeWorkspacesDependencySet(tree)
}
@@ -58,20 +46,22 @@ class Explain extends ArboristWorkspaceCmd {
const filteredOut = this.filterSet
&& this.filterSet.size > 0
&& !this.filterSet.has(node)
- if (!filteredOut)
+ if (!filteredOut) {
nodes.add(node)
+ }
}
}
- if (nodes.size === 0)
+ if (nodes.size === 0) {
throw new Error(`No dependencies found matching ${args.join(', ')}`)
+ }
const expls = []
for (const node of nodes) {
const { extraneous, dev, optional, devOptional, peer, inBundle } = node
const expl = node.explain()
- if (extraneous)
+ if (extraneous) {
expl.extraneous = true
- else {
+ } else {
expl.dev = dev
expl.optional = optional
expl.devOptional = devOptional
@@ -81,9 +71,9 @@ class Explain extends ArboristWorkspaceCmd {
expls.push(expl)
}
- if (this.npm.flatOptions.json)
+ if (this.npm.flatOptions.json) {
this.npm.output(JSON.stringify(expls, null, 2))
- else {
+ } else {
this.npm.output(expls.map(expl => {
return explainNode(expl, Infinity, this.npm.color)
}).join('\n\n'))
@@ -93,21 +83,24 @@ class Explain extends ArboristWorkspaceCmd {
getNodes (tree, arg) {
// if it's just a name, return packages by that name
const { validForOldPackages: valid } = validName(arg)
- if (valid)
+ if (valid) {
return tree.inventory.query('packageName', arg)
+ }
// if it's a location, get that node
const maybeLoc = arg.replace(/\\/g, '/').replace(/\/+$/, '')
const nodeByLoc = tree.inventory.get(maybeLoc)
- if (nodeByLoc)
+ if (nodeByLoc) {
return [nodeByLoc]
+ }
// maybe a path to a node_modules folder
const maybePath = relative(this.npm.prefix, resolve(maybeLoc))
.replace(/\\/g, '/').replace(/\/+$/, '')
const nodeByPath = tree.inventory.get(maybePath)
- if (nodeByPath)
+ if (nodeByPath) {
return [nodeByPath]
+ }
// otherwise, try to select all matching nodes
try {
@@ -119,8 +112,9 @@ class Explain extends ArboristWorkspaceCmd {
getNodesByVersion (tree, arg) {
const spec = npa(arg, this.npm.prefix)
- if (spec.type !== 'version' && spec.type !== 'range')
+ if (spec.type !== 'version' && spec.type !== 'range') {
return []
+ }
return tree.inventory.filter(node => {
return node.package.name === spec.name &&
diff --git a/deps/npm/lib/commands/explore.js b/deps/npm/lib/commands/explore.js
index 81a71f86ab..f94fff01c4 100644
--- a/deps/npm/lib/commands/explore.js
+++ b/deps/npm/lib/commands/explore.js
@@ -8,40 +8,29 @@ const completion = require('../utils/completion/installed-shallow.js')
const BaseCommand = require('../base-command.js')
class Explore extends BaseCommand {
- static get description () {
- return 'Browse an installed package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'explore'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<pkg> [ -- <command>]']
- }
+ static description = 'Browse an installed package'
+ static name = 'explore'
+ static usage = ['<pkg> [ -- <command>]']
+ static params = ['shell']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['shell']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
async exec (args) {
- if (args.length < 1 || !args[0])
+ if (args.length < 1 || !args[0]) {
throw this.usageError()
+ }
const pkgname = args.shift()
// detect and prevent any .. shenanigans
const path = join(this.npm.dir, join('/', pkgname))
- if (relative(path, this.npm.dir) === '')
+ if (relative(path, this.npm.dir) === '') {
throw this.usageError()
+ }
// run as if running a script named '_explore', which we set to either
// the set of arguments, or the shell config, and let @npmcli/run-script
@@ -58,8 +47,9 @@ class Explore extends BaseCommand {
_explore: args.join(' ').trim() || shell,
}
- if (!args.length)
+ if (!args.length) {
this.npm.output(`\nExploring ${path}\nType 'exit' or ^D when finished\n`)
+ }
this.npm.log.disableProgress()
try {
return await runScript({
@@ -76,8 +66,9 @@ class Explore extends BaseCommand {
// if it's not an exit error, or non-interactive, throw it
const isProcExit = er.message === 'command failed' &&
(typeof er.code === 'number' || /^SIG/.test(er.signal || ''))
- if (args.length || !isProcExit)
+ if (args.length || !isProcExit) {
throw er
+ }
})
} finally {
this.npm.log.enableProgress()
diff --git a/deps/npm/lib/commands/find-dupes.js b/deps/npm/lib/commands/find-dupes.js
index 5467a94dd9..a9de2410ec 100644
--- a/deps/npm/lib/commands/find-dupes.js
+++ b/deps/npm/lib/commands/find-dupes.js
@@ -2,31 +2,20 @@
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class FindDupes extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Find duplication in the package tree'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'find-dupes'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'global-style',
- 'legacy-bundling',
- 'strict-peer-deps',
- 'package-lock',
- 'omit',
- 'ignore-scripts',
- 'audit',
- 'bin-links',
- 'fund',
- ...super.params,
- ]
- }
+ static description = 'Find duplication in the package tree'
+ static name = 'find-dupes'
+ static params = [
+ 'global-style',
+ 'legacy-bundling',
+ 'strict-peer-deps',
+ 'package-lock',
+ 'omit',
+ 'ignore-scripts',
+ 'audit',
+ 'bin-links',
+ 'fund',
+ ...super.params,
+ ]
async exec (args, cb) {
this.npm.config.set('dry-run', true)
diff --git a/deps/npm/lib/commands/fund.js b/deps/npm/lib/commands/fund.js
index fbf78051d9..81c6d9a1b0 100644
--- a/deps/npm/lib/commands/fund.js
+++ b/deps/npm/lib/commands/fund.js
@@ -5,11 +5,7 @@ const pacote = require('pacote')
const semver = require('semver')
const npa = require('npm-package-arg')
const { depth } = require('treeverse')
-const {
- readTree: getFundingInfo,
- normalizeFunding,
- isValidFunding,
-} = require('libnpmfund')
+const { readTree: getFundingInfo, normalizeFunding, isValidFunding } = require('libnpmfund')
const completion = require('../utils/completion/installed-deep.js')
const openUrl = require('../utils/open-url.js')
@@ -21,33 +17,13 @@ const getPrintableName = ({ name, version }) => {
}
class Fund extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Retrieve funding information'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'fund'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'json',
- 'browser',
- 'unicode',
- 'workspace',
- 'which',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg>]']
- }
+ static description = 'Retrieve funding information'
+ static name = 'fund'
+ static params = ['json', 'browser', 'unicode', 'workspace', 'which']
+ static usage = ['[[<@scope>/]<pkg>]']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
@@ -59,11 +35,12 @@ class Fund extends ArboristWorkspaceCmd {
const fundingSourceNumber = numberArg && parseInt(numberArg, 10)
const badFundingSourceNumber =
- numberArg !== null &&
- (String(fundingSourceNumber) !== numberArg || fundingSourceNumber < 1)
+ numberArg !== null && (String(fundingSourceNumber) !== numberArg || fundingSourceNumber < 1)
if (badFundingSourceNumber) {
- const err = new Error('`npm fund [<@scope>/]<pkg> [--which=fundingSourceNumber]` must be given a positive integer')
+ const err = new Error(
+ '`npm fund [<@scope>/]<pkg> [--which=fundingSourceNumber]` must be given a positive integer'
+ )
err.code = 'EFUNDNUMBER'
throw err
}
@@ -95,10 +72,11 @@ class Fund extends ArboristWorkspaceCmd {
workspaces: this.workspaceNames,
})
- if (this.npm.config.get('json'))
+ if (this.npm.config.get('json')) {
this.npm.output(this.printJSON(fundingInfo))
- else
+ } else {
this.npm.output(this.printHuman(fundingInfo))
+ }
}
printJSON (fundingInfo) {
@@ -110,8 +88,7 @@ class Fund extends ArboristWorkspaceCmd {
const unicode = this.npm.config.get('unicode')
const seenUrls = new Map()
- const tree = obj =>
- archy(obj, '', { unicode })
+ const tree = obj => archy(obj, '', { unicode })
const result = depth({
tree: fundingInfo,
@@ -119,9 +96,7 @@ class Fund extends ArboristWorkspaceCmd {
// composes human readable package name
// and creates a new archy item for readable output
visit: ({ name, version, funding }) => {
- const [fundingSource] = []
- .concat(normalizeFunding(funding))
- .filter(isValidFunding)
+ const [fundingSource] = [].concat(normalizeFunding(funding)).filter(isValidFunding)
const { url } = fundingSource || {}
const pkgRef = getPrintableName({ name, version })
let item = {
@@ -139,8 +114,9 @@ class Fund extends ArboristWorkspaceCmd {
item = seenUrls.get(url)
item.label += `, ${pkgRef}`
return null
- } else
+ } else {
seenUrls.set(url, item)
+ }
}
return item
@@ -149,20 +125,20 @@ class Fund extends ArboristWorkspaceCmd {
// puts child nodes back into returned archy
// output while also filtering out missing items
leave: (item, children) => {
- if (item)
+ if (item) {
item.nodes = children.filter(Boolean)
+ }
return item
},
// turns tree-like object return by libnpmfund
// into children to be properly read by treeverse
- getChildren: (node) =>
- Object.keys(node.dependencies || {})
- .map(key => ({
- name: key,
- ...node.dependencies[key],
- })),
+ getChildren: node =>
+ Object.keys(node.dependencies || {}).map(key => ({
+ name: key,
+ ...node.dependencies[key],
+ })),
})
const res = tree(result)
@@ -179,8 +155,9 @@ class Fund extends ArboristWorkspaceCmd {
} else {
// matches any file path within current arborist inventory
for (const item of tree.inventory.values()) {
- if (item.path === arg.fetchSpec)
+ if (item.path === arg.fetchSpec) {
return item.package
+ }
}
}
} else {
@@ -190,17 +167,17 @@ class Fund extends ArboristWorkspaceCmd {
.filter(i => semver.valid(i.package.version))
.sort((a, b) => semver.rcompare(a.package.version, b.package.version))
- if (item)
+ if (item) {
return item.package
+ }
}
}
- const { funding } = retrievePackageMetadata() ||
- await pacote.manifest(arg, this.npm.flatOptions).catch(() => ({}))
+ const { funding } =
+ retrievePackageMetadata() ||
+ (await pacote.manifest(arg, this.npm.flatOptions).catch(() => ({})))
- const validSources = []
- .concat(normalizeFunding(funding))
- .filter(isValidFunding)
+ const validSources = [].concat(normalizeFunding(funding)).filter(isValidFunding)
const matchesValidSource =
validSources.length === 1 ||
@@ -218,7 +195,10 @@ class Fund extends ArboristWorkspaceCmd {
const msg = `${typePrefix} available at the following URL`
this.npm.output(`${i + 1}: ${msg}: ${url}`)
})
- this.npm.output('Run `npm fund [<@scope>/]<pkg> --which=1`, for example, to open the first funding URL listed in that package')
+ this.npm.output(
+ /* eslint-disable-next-line max-len */
+ 'Run `npm fund [<@scope>/]<pkg> --which=1`, for example, to open the first funding URL listed in that package'
+ )
} else {
const noFundingError = new Error(`No valid funding method available for: ${spec}`)
noFundingError.code = 'ENOFUND'
diff --git a/deps/npm/lib/commands/get.js b/deps/npm/lib/commands/get.js
index 0e314efe71..7583ade23d 100644
--- a/deps/npm/lib/commands/get.js
+++ b/deps/npm/lib/commands/get.js
@@ -1,22 +1,12 @@
const BaseCommand = require('../base-command.js')
class Get extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Get a value from the npm configuration'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'get'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<key> ...] (See `npm config`)']
- }
+ static description = 'Get a value from the npm configuration'
+ static name = 'get'
+ static usage = ['[<key> ...] (See `npm config`)']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
const config = await this.npm.cmd('config')
return config.completion(opts)
diff --git a/deps/npm/lib/commands/help-search.js b/deps/npm/lib/commands/help-search.js
index a179939abf..6025a6dabd 100644
--- a/deps/npm/lib/commands/help-search.js
+++ b/deps/npm/lib/commands/help-search.js
@@ -7,38 +7,26 @@ const readFile = promisify(fs.readFile)
const BaseCommand = require('../base-command.js')
class HelpSearch extends BaseCommand {
- static get description () {
- return 'Search npm help documentation'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'help-search'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<text>']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['long']
- }
+ static description = 'Search npm help documentation'
+ static name = 'help-search'
+ static usage = ['<text>']
+ static params = ['long']
async exec (args) {
- if (!args.length)
+ if (!args.length) {
throw this.usageError()
+ }
const docPath = path.resolve(__dirname, '..', '..', 'docs/content')
const files = await glob(`${docPath}/*/*.md`)
const data = await this.readFiles(files)
const results = await this.searchFiles(args, data, files)
const formatted = this.formatResults(args, results)
- if (!formatted.trim())
+ if (!formatted.trim()) {
this.npm.output(`No matches in help for: ${args.join(' ')}\n`)
- else
+ } else {
this.npm.output(formatted)
+ }
}
async readFiles (files) {
@@ -55,8 +43,9 @@ class HelpSearch extends BaseCommand {
for (const [file, content] of Object.entries(data)) {
const lowerCase = content.toLowerCase()
// skip if no matches at all
- if (!args.some(a => lowerCase.includes(a.toLowerCase())))
+ if (!args.some(a => lowerCase.includes(a.toLowerCase()))) {
continue
+ }
const lines = content.split(/\n+/)
@@ -90,17 +79,20 @@ class HelpSearch extends BaseCommand {
// now squish any string of nulls into a single null
const pruned = lines.reduce((l, r) => {
- if (!(r === null && l[l.length - 1] === null))
+ if (!(r === null && l[l.length - 1] === null)) {
l.push(r)
+ }
return l
}, [])
- if (pruned[pruned.length - 1] === null)
+ if (pruned[pruned.length - 1] === null) {
pruned.pop()
+ }
- if (pruned[0] === null)
+ if (pruned[0] === null) {
pruned.shift()
+ }
// now count how many args were found
const found = {}
@@ -157,15 +149,17 @@ class HelpSearch extends BaseCommand {
out.push(' '.repeat((Math.max(1, cols - out.join(' ').length - r.length - 1))))
out.push(r)
- if (!this.npm.config.get('long'))
+ if (!this.npm.config.get('long')) {
return out.join('')
+ }
out.unshift('\n\n')
out.push('\n')
out.push('-'.repeat(cols - 1) + '\n')
res.lines.forEach((line, i) => {
- if (line === null || i > 3)
+ if (line === null || i > 3) {
return
+ }
if (!this.npm.color) {
out.push(line + '\n')
diff --git a/deps/npm/lib/commands/help.js b/deps/npm/lib/commands/help.js
index bfc7f8b60e..f94178dd5d 100644
--- a/deps/npm/lib/commands/help.js
+++ b/deps/npm/lib/commands/help.js
@@ -13,29 +13,15 @@ const BaseCommand = require('../base-command.js')
const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/
class Help extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Get help on npm'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'help'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<term> [<terms..>]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['viewer']
- }
+ static description = 'Get help on npm'
+ static name = 'help'
+ static usage = ['<term> [<terms..>]']
+ static params = ['viewer']
async completion (opts) {
- if (opts.conf.argv.remain.length > 2)
+ if (opts.conf.argv.remain.length > 2) {
return []
+ }
const g = path.resolve(__dirname, '../../man/man[0-9]/*.[0-9]')
const files = await glob(g)
@@ -51,15 +37,18 @@ class Help extends BaseCommand {
// By default we search all of our man subdirectories, but if the user has
// asked for a specific one we limit the search to just there
let manSearch = 'man*'
- if (/^\d+$/.test(args[0]))
+ if (/^\d+$/.test(args[0])) {
manSearch = `man${args.shift()}`
+ }
- if (!args.length)
+ if (!args.length) {
return this.npm.output(await this.npm.usage)
+ }
// npm help foo bar baz: search topics
- if (args.length > 1)
+ if (args.length > 1) {
return this.helpSearch(args)
+ }
let section = this.npm.deref(args[0]) || args[0]
@@ -76,17 +65,19 @@ class Help extends BaseCommand {
const bManNumber = b.match(manNumberRegex)[1]
// man number sort first so that 1 aka commands are preferred
- if (aManNumber !== bManNumber)
+ if (aManNumber !== bManNumber) {
return aManNumber - bManNumber
+ }
return localeCompare(a, b)
})
const man = mans[0]
- if (man)
+ if (man) {
await this.viewMan(man)
- else
+ } else {
return this.helpSearch(args)
+ }
}
helpSearch (args) {
@@ -114,7 +105,7 @@ class Help extends BaseCommand {
break
case 'browser':
- await openUrl(this.npm, this.htmlMan(man), 'help available at the following URL')
+ await openUrl(this.npm, this.htmlMan(man), 'help available at the following URL', true)
return
default:
@@ -125,8 +116,9 @@ class Help extends BaseCommand {
const proc = spawn(bin, args, opts)
return new Promise((resolve, reject) => {
proc.on('exit', (code) => {
- if (code)
+ if (code) {
return reject(new Error(`help process exited with code: ${code}`))
+ }
return resolve()
})
diff --git a/deps/npm/lib/commands/hook.js b/deps/npm/lib/commands/hook.js
index 7b2deff229..2881f044e8 100644
--- a/deps/npm/lib/commands/hook.js
+++ b/deps/npm/lib/commands/hook.js
@@ -5,30 +5,19 @@ const Table = require('cli-table3')
const BaseCommand = require('../base-command.js')
class Hook extends BaseCommand {
- static get description () {
- return 'Manage registry hooks'
- }
-
- static get name () {
- return 'hook'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- ]
- }
+ static description = 'Manage registry hooks'
+ static name = 'hook'
+ static params = [
+ 'registry',
+ 'otp',
+ ]
- static get usage () {
- return [
- 'add <pkg> <url> <secret> [--type=<type>]',
- 'ls [pkg]',
- 'rm <id>',
- 'update <id> <url> <secret>',
- ]
- }
+ static usage = [
+ 'add <pkg> <url> <secret> [--type=<type>]',
+ 'ls [pkg]',
+ 'rm <id>',
+ 'update <id> <url> <secret>',
+ ]
async exec (args) {
return otplease(this.npm.flatOptions, (opts) => {
@@ -50,9 +39,9 @@ class Hook extends BaseCommand {
async add (pkg, uri, secret, opts) {
const hook = await hookApi.add(pkg, uri, secret, opts)
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(hook, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(Object.keys(hook).join('\t'))
this.npm.output(Object.keys(hook).map(k => hook[k]).join('\t'))
} else if (!opts.silent && opts.loglevel !== 'silent') {
@@ -64,20 +53,21 @@ class Hook extends BaseCommand {
async ls (pkg, opts) {
const hooks = await hookApi.ls({ ...opts, package: pkg })
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(hooks, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(Object.keys(hooks[0]).join('\t'))
hooks.forEach(hook => {
this.npm.output(Object.keys(hook).map(k => hook[k]).join('\t'))
})
- } else if (!hooks.length)
+ } else if (!hooks.length) {
this.npm.output("You don't have any hooks configured yet.")
- else if (!opts.silent && opts.loglevel !== 'silent') {
- if (hooks.length === 1)
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
+ if (hooks.length === 1) {
this.npm.output('You have one hook configured.')
- else
+ } else {
this.npm.output(`You have ${hooks.length} hooks configured.`)
+ }
const table = new Table({ head: ['id', 'target', 'endpoint'] })
hooks.forEach((hook) => {
@@ -94,8 +84,9 @@ class Hook extends BaseCommand {
},
hook.response_code,
])
- } else
+ } else {
table.push([{ colSpan: 2, content: 'never triggered' }])
+ }
})
this.npm.output(table.toString())
}
@@ -103,9 +94,9 @@ class Hook extends BaseCommand {
async rm (id, opts) {
const hook = await hookApi.rm(id, opts)
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(hook, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(Object.keys(hook).join('\t'))
this.npm.output(Object.keys(hook).map(k => hook[k]).join('\t'))
} else if (!opts.silent && opts.loglevel !== 'silent') {
@@ -117,9 +108,9 @@ class Hook extends BaseCommand {
async update (id, uri, secret, opts) {
const hook = await hookApi.update(id, uri, secret, opts)
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(hook, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(Object.keys(hook).join('\t'))
this.npm.output(Object.keys(hook).map(k => hook[k]).join('\t'))
} else if (!opts.silent && opts.loglevel !== 'silent') {
@@ -131,10 +122,12 @@ class Hook extends BaseCommand {
hookName (hook) {
let target = hook.name
- if (hook.type === 'scope')
+ if (hook.type === 'scope') {
target = '@' + target
- if (hook.type === 'owner')
+ }
+ if (hook.type === 'owner') {
target = '~' + target
+ }
return target
}
}
diff --git a/deps/npm/lib/commands/init.js b/deps/npm/lib/commands/init.js
index b88b38436e..eaca2716ee 100644
--- a/deps/npm/lib/commands/init.js
+++ b/deps/npm/lib/commands/init.js
@@ -12,34 +12,20 @@ const getLocationMsg = require('../exec/get-workspace-location-msg.js')
const BaseCommand = require('../base-command.js')
class Init extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Create a package.json file'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['yes', 'force', 'workspace', 'workspaces', 'include-workspace-root']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'init'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '[--force|-f|--yes|-y|--scope]',
- '<@scope> (same as `npx <@scope>/create`)',
- '[<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)',
- ]
- }
+ static description = 'Create a package.json file'
+ static params = ['yes', 'force', 'workspace', 'workspaces', 'include-workspace-root']
+ static name = 'init'
+ static usage = [
+ '[--force|-f|--yes|-y|--scope]',
+ '<@scope> (same as `npx <@scope>/create`)',
+ '[<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)',
+ ]
async exec (args) {
// npm exec style
- if (args.length)
+ if (args.length) {
return (await this.execCreate({ args, path: process.cwd() }))
+ }
// no args, uses classic init-package-json boilerplate
await this.template()
@@ -47,8 +33,9 @@ class Init extends BaseCommand {
async execWorkspaces (args, filters) {
// if the root package is uninitiated, take care of it first
- if (this.npm.flatOptions.includeWorkspaceRoot)
+ if (this.npm.flatOptions.includeWorkspaceRoot) {
await this.exec(args)
+ }
// reads package.json for the top-level folder first, by doing this we
// ensure the command throw if no package.json is found before trying
@@ -80,9 +67,9 @@ class Init extends BaseCommand {
const [initerName, ...otherArgs] = args
let packageName = initerName
- if (/^@[^/]+$/.test(initerName))
+ if (/^@[^/]+$/.test(initerName)) {
packageName = initerName + '/create'
- else {
+ } else {
const req = npa(initerName)
if (req.type === 'git' && req.hosted) {
const { user, project } = req.hosted
@@ -90,8 +77,9 @@ class Init extends BaseCommand {
.replace(user + '/' + project, user + '/create-' + project)
} else if (req.registry) {
packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-')
- if (req.rawSpec)
+ if (req.rawSpec) {
packageName += '@' + req.rawSpec
+ }
} else {
throw Object.assign(new Error(
'Unrecognized initializer: ' + initerName +
@@ -166,9 +154,9 @@ class Init extends BaseCommand {
this.npm.log.warn('init', 'canceled')
return res()
}
- if (er)
+ if (er) {
rej(er)
- else {
+ } else {
this.npm.log.info('init', 'written successfully')
res(data)
}
@@ -181,8 +169,9 @@ class Init extends BaseCommand {
// skip setting workspace if current package.json glob already satisfies it
for (const wPath of workspaces.values()) {
- if (wPath === workspacePath)
+ if (wPath === workspacePath) {
return
+ }
}
// if a create-pkg didn't generate a package.json at the workspace
diff --git a/deps/npm/lib/commands/install-ci-test.js b/deps/npm/lib/commands/install-ci-test.js
index 7b121f7766..9977a2edc5 100644
--- a/deps/npm/lib/commands/install-ci-test.js
+++ b/deps/npm/lib/commands/install-ci-test.js
@@ -4,14 +4,8 @@
const CI = require('./ci.js')
class InstallCITest extends CI {
- static get description () {
- return 'Install a project with a clean slate and run tests'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'install-ci-test'
- }
+ static description = 'Install a project with a clean slate and run tests'
+ static name = 'install-ci-test'
async exec (args, cb) {
await this.npm.exec('ci', args)
diff --git a/deps/npm/lib/commands/install-test.js b/deps/npm/lib/commands/install-test.js
index 74e7ebcf86..191d70909f 100644
--- a/deps/npm/lib/commands/install-test.js
+++ b/deps/npm/lib/commands/install-test.js
@@ -4,14 +4,8 @@
const Install = require('./install.js')
class InstallTest extends Install {
- static get description () {
- return 'Install package(s) and run tests'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'install-test'
- }
+ static description = 'Install package(s) and run tests'
+ static name = 'install-test'
async exec (args, cb) {
await this.npm.exec('install', args)
diff --git a/deps/npm/lib/commands/install.js b/deps/npm/lib/commands/install.js
index ea3bbcee3f..02ccb57248 100644
--- a/deps/npm/lib/commands/install.js
+++ b/deps/npm/lib/commands/install.js
@@ -1,5 +1,4 @@
/* eslint-disable camelcase */
-/* eslint-disable standard/no-callback-literal */
const fs = require('fs')
const util = require('util')
const readdir = util.promisify(fs.readdir)
@@ -13,51 +12,37 @@ const checks = require('npm-install-checks')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Install extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Install a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'install'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'save',
- 'save-exact',
- 'global',
- 'global-style',
- 'legacy-bundling',
- 'strict-peer-deps',
- 'package-lock',
- 'omit',
- 'ignore-scripts',
- 'audit',
- 'bin-links',
- 'fund',
- 'dry-run',
- ...super.params,
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '[<@scope>/]<pkg>',
- '[<@scope>/]<pkg>@<tag>',
- '[<@scope>/]<pkg>@<version>',
- '[<@scope>/]<pkg>@<version range>',
- '<alias>@npm:<name>',
- '<folder>',
- '<tarball file>',
- '<tarball url>',
- '<git:// url>',
- '<github username>/<github project>',
- ]
- }
+ static description = 'Install a package'
+ static name = 'install'
+ static params = [
+ 'save',
+ 'save-exact',
+ 'global',
+ 'global-style',
+ 'legacy-bundling',
+ 'strict-peer-deps',
+ 'package-lock',
+ 'omit',
+ 'ignore-scripts',
+ 'audit',
+ 'bin-links',
+ 'fund',
+ 'dry-run',
+ ...super.params,
+ ]
+
+ static usage = [
+ '[<@scope>/]<pkg>',
+ '[<@scope>/]<pkg>@<tag>',
+ '[<@scope>/]<pkg>@<version>',
+ '[<@scope>/]<pkg>@<version range>',
+ '<alias>@npm:<name>',
+ '<folder>',
+ '<tarball file>',
+ '<tarball url>',
+ '<git:// url>',
+ '<github username>/<github project>',
+ ]
async completion (opts) {
const { partialWord } = opts
@@ -78,37 +63,33 @@ class Install extends ArboristWorkspaceCmd {
const partialName = partialWord.slice(lastSlashIdx + 1)
const partialPath = partialWord.slice(0, lastSlashIdx) || '/'
- const annotatePackageDirMatch = async (sibling) => {
- const fullPath = join(partialPath, sibling)
- if (sibling.slice(0, partialName.length) !== partialName)
- return null // not name match
+ const isDirMatch = async sibling => {
+ if (sibling.slice(0, partialName.length) !== partialName) {
+ return false
+ }
try {
- const contents = await readdir(fullPath)
- return {
- fullPath,
- isPackage: contents.indexOf('package.json') !== -1,
- }
+ const contents = await readdir(join(partialPath, sibling))
+ const result = (contents.indexOf('package.json') !== -1)
+ return result
} catch (er) {
- return { isPackage: false }
+ return false
}
}
try {
const siblings = await readdir(partialPath)
- const matches = await Promise.all(
- siblings.map(async sibling => {
- return await annotatePackageDirMatch(sibling)
- })
- )
- const match = matches.filter(el => !el || el.isPackage).pop()
- if (match) {
- // Success - only one match and it is a package dir
- return [match.fullPath]
- } else {
- // no matches
- return []
+ const matches = []
+ for (const sibling of siblings) {
+ if (await isDirMatch(sibling)) {
+ matches.push(sibling)
+ }
}
+ if (matches.length === 1) {
+ return [join(partialPath, matches[0])]
+ }
+ // no matches
+ return []
} catch (er) {
return [] // invalid dir: no matching
}
@@ -136,10 +117,15 @@ class Install extends ArboristWorkspaceCmd {
try {
checks.checkEngine(npmManifest, npmManifest.version, process.version)
} catch (e) {
- if (forced)
- this.npm.log.warn('install', `Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}`)
- else
+ if (forced) {
+ this.npm.log.warn(
+ 'install',
+ /* eslint-disable-next-line max-len */
+ `Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}`
+ )
+ } else {
throw e
+ }
}
}
@@ -147,12 +133,17 @@ class Install extends ArboristWorkspaceCmd {
args = args.filter(a => resolve(a) !== this.npm.prefix)
// `npm i -g` => "install this package globally"
- if (where === globalTop && !args.length)
+ if (where === globalTop && !args.length) {
args = ['.']
+ }
// TODO: Add warnings for other deprecated flags? or remove this one?
- if (isDev)
- log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.')
+ if (isDev) {
+ log.warn(
+ 'install',
+ 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.'
+ )
+ }
const opts = {
...this.npm.flatOptions,
diff --git a/deps/npm/lib/commands/link.js b/deps/npm/lib/commands/link.js
index 4a800d7c60..8755af6f68 100644
--- a/deps/npm/lib/commands/link.js
+++ b/deps/npm/lib/commands/link.js
@@ -12,43 +12,29 @@ const reifyFinish = require('../utils/reify-finish.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Link extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Symlink a package folder'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'link'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '(in package dir)',
- '[<@scope>/]<pkg>[@<version>]',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'save',
- 'save-exact',
- 'global',
- 'global-style',
- 'legacy-bundling',
- 'strict-peer-deps',
- 'package-lock',
- 'omit',
- 'ignore-scripts',
- 'audit',
- 'bin-links',
- 'fund',
- 'dry-run',
- ...super.params,
- ]
- }
+ static description = 'Symlink a package folder'
+ static name = 'link'
+ static usage = [
+ '(in package dir)',
+ '[<@scope>/]<pkg>[@<version>]',
+ ]
+
+ static params = [
+ 'save',
+ 'save-exact',
+ 'global',
+ 'global-style',
+ 'legacy-bundling',
+ 'strict-peer-deps',
+ 'package-lock',
+ 'omit',
+ 'ignore-scripts',
+ 'audit',
+ 'bin-links',
+ 'fund',
+ 'dry-run',
+ ...super.params,
+ ]
async completion (opts) {
const dir = this.npm.globalDir
@@ -169,8 +155,9 @@ class Link extends ArboristWorkspaceCmd {
// Returns a list of items that can't be fulfilled by
// things found in the current arborist inventory
missingArgsFromTree (tree, args) {
- if (tree.isLink)
+ if (tree.isLink) {
return this.missingArgsFromTree(tree.target, args)
+ }
const foundNodes = []
const missing = args.filter(a => {
@@ -193,8 +180,9 @@ class Link extends ArboristWorkspaceCmd {
// remote nodes from the loaded tree in order
// to avoid dropping them later when reifying
- for (const node of foundNodes)
+ for (const node of foundNodes) {
node.parent = null
+ }
return missing
}
diff --git a/deps/npm/lib/commands/ll.js b/deps/npm/lib/commands/ll.js
index d438de61e2..99a144fde3 100644
--- a/deps/npm/lib/commands/ll.js
+++ b/deps/npm/lib/commands/ll.js
@@ -1,15 +1,8 @@
const LS = require('./ls.js')
class LL extends LS {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'll'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg> ...]']
- }
+ static name = 'll'
+ static usage = ['[[<@scope>/]<pkg> ...]']
async exec (args) {
this.npm.config.set('long', true)
diff --git a/deps/npm/lib/commands/logout.js b/deps/npm/lib/commands/logout.js
index 3c0bdc7565..e17b2b8790 100644
--- a/deps/npm/lib/commands/logout.js
+++ b/deps/npm/lib/commands/logout.js
@@ -4,23 +4,12 @@ const npmFetch = require('npm-registry-fetch')
const BaseCommand = require('../base-command.js')
class Logout extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Log out of the registry'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'logout'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'scope',
- ]
- }
+ static description = 'Log out of the registry'
+ static name = 'logout'
+ static params = [
+ 'registry',
+ 'scope',
+ ]
async exec (args) {
const registry = this.npm.config.get('registry')
@@ -37,15 +26,16 @@ class Logout extends BaseCommand {
method: 'DELETE',
ignoreBody: true,
})
- } else if (auth.isBasicAuth)
+ } else if (auth.isBasicAuth) {
log.verbose('logout', `clearing user credentials for ${reg}`)
- else {
+ } else {
const msg = `not logged in to ${reg}, so can't log out!`
throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' })
}
- if (scope)
+ if (scope) {
this.npm.config.delete(regRef, 'user')
+ }
this.npm.config.clearCredentialsByURI(reg)
diff --git a/deps/npm/lib/commands/ls.js b/deps/npm/lib/commands/ls.js
index af7d44ab41..8c338c0647 100644
--- a/deps/npm/lib/commands/ls.js
+++ b/deps/npm/lib/commands/ls.js
@@ -25,39 +25,25 @@ const ArboristWorkspaceCmd = require('../arborist-cmd.js')
const localeCompare = require('@isaacs/string-locale-compare')('en')
class LS extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'List installed packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'ls'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg> ...]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'all',
- 'json',
- 'long',
- 'parseable',
- 'global',
- 'depth',
- 'omit',
- 'link',
- 'package-lock-only',
- 'unicode',
- ...super.params,
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ static description = 'List installed packages'
+ static name = 'ls'
+ static usage = ['[[<@scope>/]<pkg> ...]']
+ static params = [
+ 'all',
+ 'json',
+ 'long',
+ 'parseable',
+ 'global',
+ 'depth',
+ 'omit',
+ 'link',
+ 'package-lock-only',
+ 'unicode',
+ ...super.params,
+ ]
+
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
@@ -88,23 +74,26 @@ class LS extends ArboristWorkspaceCmd {
legacyPeerDeps: false,
path,
})
- const tree = await this.initTree({arb, args, packageLockOnly })
+ const tree = await this.initTree({ arb, args, packageLockOnly })
// filters by workspaces nodes when using -w <workspace-name>
// We only have to filter the first layer of edges, so we don't
// explore anything that isn't part of the selected workspace set.
let wsNodes
- if (this.workspaceNames && this.workspaceNames.length)
+ if (this.workspaceNames && this.workspaceNames.length) {
wsNodes = arb.workspaceNodes(tree, this.workspaceNames)
+ }
const filterBySelectedWorkspaces = edge => {
if (!workspacesEnabled
&& edge.from.isProjectRoot
&& edge.to.isWorkspace
- )
+ ) {
return false
+ }
- if (!wsNodes || !wsNodes.length)
+ if (!wsNodes || !wsNodes.length) {
return true
+ }
if (edge.from.isProjectRoot) {
return edge.to &&
@@ -176,8 +165,9 @@ class LS extends ArboristWorkspaceCmd {
// loop through list of node problems to add them to global list
if (node[_include]) {
- for (const problem of node[_problems])
+ for (const problem of node[_problems]) {
problems.add(problem)
+ }
}
seenItems.add(item)
@@ -200,8 +190,9 @@ class LS extends ArboristWorkspaceCmd {
)
// if filtering items, should exit with error code on no results
- if (result && !result[_include] && args.length)
+ if (result && !result[_include] && args.length) {
process.exitCode = 1
+ }
if (rootError) {
throw Object.assign(
@@ -237,8 +228,9 @@ class LS extends ArboristWorkspaceCmd {
module.exports = LS
const isGitNode = (node) => {
- if (!node.resolved)
+ if (!node.resolved) {
return
+ }
try {
const { type } = npa(node.resolved)
@@ -257,14 +249,17 @@ const isExtraneous = (node, { global }) =>
const getProblems = (node, { global }) => {
const problems = new Set()
- if (node[_missing] && !isOptional(node))
+ if (node[_missing] && !isOptional(node)) {
problems.add(`missing: ${node.pkgid}, required by ${node[_missing]}`)
+ }
- if (node[_invalid])
+ if (node[_invalid]) {
problems.add(`invalid: ${node.pkgid} ${node.path}`)
+ }
- if (isExtraneous(node, { global }))
+ if (isExtraneous(node, { global })) {
problems.add(`extraneous: ${node.pkgid} ${node.path}`)
+ }
return problems
}
@@ -297,10 +292,11 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
// special formatting for top-level package name
if (node.isRoot) {
const hasNoPackageJson = !Object.keys(node.package).length
- if (hasNoPackageJson || global)
+ if (hasNoPackageJson || global) {
printable = path
- else
+ } else {
printable += `${long ? EOL : ' '}${path}`
+ }
}
const highlightDepName =
@@ -347,19 +343,22 @@ const getHumanOutputItem = (node, { args, color, global, long }) => {
const getJsonOutputItem = (node, { global, long }) => {
const item = {}
- if (node.version)
+ if (node.version) {
item.version = node.version
+ }
- if (node.resolved)
+ if (node.resolved) {
item.resolved = node.resolved
+ }
item[_name] = node.name
// special formatting for top-level package name
const hasPackageJson =
node && node.package && Object.keys(node.package).length
- if (node.isRoot && hasPackageJson)
+ if (node.isRoot && hasPackageJson) {
item.name = node.package.name || node.name
+ }
if (long && !node[_missing]) {
item.name = item[_name]
@@ -376,18 +375,21 @@ const getJsonOutputItem = (node, { global, long }) => {
}
// augment json output items with extra metadata
- if (isExtraneous(node, { global }))
+ if (isExtraneous(node, { global })) {
item.extraneous = true
+ }
- if (node[_invalid])
+ if (node[_invalid]) {
item.invalid = node[_invalid]
+ }
if (node[_missing] && !isOptional(node)) {
item.required = node[_required]
item.missing = true
}
- if (node[_include] && node[_problems] && node[_problems].size)
+ if (node[_include] && node[_problems] && node[_problems].size) {
item.problems = [...node[_problems]]
+ }
return augmentItemWithIncludeMetadata(node, item)
}
@@ -436,8 +438,9 @@ const mapEdgesToNodes = ({ seenPaths }) => (edge) => {
// item would appear twice given that it's a children of an extraneous item,
// so it's marked extraneous but it will ALSO show up in edgesOuts of
// its parent so it ends up as two diff nodes if we don't track it
- if (node.path)
+ if (node.path) {
seenPaths.add(node.path)
+ }
node[_required] = edge.spec || '*'
node[_type] = edge.type
@@ -515,20 +518,23 @@ const humanOutput = ({ color, result, seenItems, unicode }) => {
// so that all its ancestors should be displayed)
// here is where we put items in their expected place for archy output
for (const item of seenItems) {
- if (item[_include] && item[_parent])
+ if (item[_include] && item[_parent]) {
item[_parent].nodes.push(item)
+ }
}
- if (!result.nodes.length)
+ if (!result.nodes.length) {
result.nodes = ['(empty)']
+ }
const archyOutput = archy(result, '', { unicode })
return color ? chalk.reset(archyOutput) : archyOutput
}
const jsonOutput = ({ path, problems, result, rootError, seenItems }) => {
- if (problems.size)
+ if (problems.size) {
result.problems = [...problems]
+ }
if (rootError) {
result.problems = [
@@ -546,8 +552,9 @@ const jsonOutput = ({ path, problems, result, rootError, seenItems }) => {
// append current item to its parent item.dependencies obj in order
// to provide a json object structure that represents the installed tree
if (item[_include] && item[_parent]) {
- if (!item[_parent].dependencies)
+ if (!item[_parent].dependencies) {
item[_parent].dependencies = {}
+ }
item[_parent].dependencies[item[_name]] = item
}
diff --git a/deps/npm/lib/commands/org.js b/deps/npm/lib/commands/org.js
index 6d0b8cd505..c6882a8e26 100644
--- a/deps/npm/lib/commands/org.js
+++ b/deps/npm/lib/commands/org.js
@@ -4,38 +4,21 @@ const Table = require('cli-table3')
const BaseCommand = require('../base-command.js')
class Org extends BaseCommand {
- static get description () {
- return 'Manage orgs'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'org'
- }
+ static description = 'Manage orgs'
+ static name = 'org'
+ static usage = [
+ 'set orgname username [developer | admin | owner]',
+ 'rm orgname username',
+ 'ls orgname [<username>]',
+ ]
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'set orgname username [developer | admin | owner]',
- 'rm orgname username',
- 'ls orgname [<username>]',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- 'json',
- 'parseable',
- ]
- }
+ static params = ['registry', 'otp', 'json', 'parseable']
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length === 2)
+ if (argv.length === 2) {
return ['set', 'rm', 'ls']
+ }
switch (argv[2]) {
case 'ls':
@@ -66,85 +49,109 @@ class Org extends BaseCommand {
set (org, user, role, opts) {
role = role || 'developer'
- if (!org)
+ if (!org) {
throw new Error('First argument `orgname` is required.')
+ }
- if (!user)
+ if (!user) {
throw new Error('Second argument `username` is required.')
+ }
- if (!['owner', 'admin', 'developer'].find(x => x === role))
- throw new Error('Third argument `role` must be one of `owner`, `admin`, or `developer`, with `developer` being the default value if omitted.')
+ if (!['owner', 'admin', 'developer'].find(x => x === role)) {
+ throw new Error(
+ /* eslint-disable-next-line max-len */
+ 'Third argument `role` must be one of `owner`, `admin`, or `developer`, with `developer` being the default value if omitted.'
+ )
+ }
return liborg.set(org, user, role, opts).then(memDeets => {
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(memDeets, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(['org', 'orgsize', 'user', 'role'].join('\t'))
- this.npm.output([
- memDeets.org.name,
- memDeets.org.size,
- memDeets.user,
- memDeets.role,
- ].join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent')
- this.npm.output(`Added ${memDeets.user} as ${memDeets.role} to ${memDeets.org.name}. You now have ${memDeets.org.size} member${memDeets.org.size === 1 ? '' : 's'} in this org.`)
+ this.npm.output(
+ [memDeets.org.name, memDeets.org.size, memDeets.user, memDeets.role].join('\t')
+ )
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
+ this.npm.output(
+ `Added ${memDeets.user} as ${memDeets.role} to ${memDeets.org.name}. You now have ${
+ memDeets.org.size
+ } member${memDeets.org.size === 1 ? '' : 's'} in this org.`
+ )
+ }
return memDeets
})
}
rm (org, user, opts) {
- if (!org)
+ if (!org) {
throw new Error('First argument `orgname` is required.')
+ }
- if (!user)
+ if (!user) {
throw new Error('Second argument `username` is required.')
+ }
- return liborg.rm(org, user, opts).then(() => {
- return liborg.ls(org, opts)
- }).then(roster => {
- user = user.replace(/^[~@]?/, '')
- org = org.replace(/^[~@]?/, '')
- const userCount = Object.keys(roster).length
- if (opts.json) {
- this.npm.output(JSON.stringify({
- user,
- org,
- userCount,
- deleted: true,
- }))
- } else if (opts.parseable) {
- this.npm.output(['user', 'org', 'userCount', 'deleted'].join('\t'))
- this.npm.output([user, org, userCount, true].join('\t'))
- } else if (!opts.silent && opts.loglevel !== 'silent')
- this.npm.output(`Successfully removed ${user} from ${org}. You now have ${userCount} member${userCount === 1 ? '' : 's'} in this org.`)
- })
+ return liborg
+ .rm(org, user, opts)
+ .then(() => {
+ return liborg.ls(org, opts)
+ })
+ .then(roster => {
+ user = user.replace(/^[~@]?/, '')
+ org = org.replace(/^[~@]?/, '')
+ const userCount = Object.keys(roster).length
+ if (opts.json) {
+ this.npm.output(
+ JSON.stringify({
+ user,
+ org,
+ userCount,
+ deleted: true,
+ })
+ )
+ } else if (opts.parseable) {
+ this.npm.output(['user', 'org', 'userCount', 'deleted'].join('\t'))
+ this.npm.output([user, org, userCount, true].join('\t'))
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
+ this.npm.output(
+ `Successfully removed ${user} from ${org}. You now have ${userCount} member${
+ userCount === 1 ? '' : 's'
+ } in this org.`
+ )
+ }
+ })
}
ls (org, user, opts) {
- if (!org)
+ if (!org) {
throw new Error('First argument `orgname` is required.')
+ }
return liborg.ls(org, opts).then(roster => {
if (user) {
const newRoster = {}
- if (roster[user])
+ if (roster[user]) {
newRoster[user] = roster[user]
+ }
roster = newRoster
}
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(roster, null, 2))
- else if (opts.parseable) {
+ } else if (opts.parseable) {
this.npm.output(['user', 'role'].join('\t'))
Object.keys(roster).forEach(user => {
this.npm.output([user, roster[user]].join('\t'))
})
} else if (!opts.silent && opts.loglevel !== 'silent') {
const table = new Table({ head: ['user', 'role'] })
- Object.keys(roster).sort().forEach(user => {
- table.push([user, roster[user]])
- })
+ Object.keys(roster)
+ .sort()
+ .forEach(user => {
+ table.push([user, roster[user]])
+ })
this.npm.output(table.toString())
}
})
diff --git a/deps/npm/lib/commands/outdated.js b/deps/npm/lib/commands/outdated.js
index 119316d3b4..e1a6f8150a 100644
--- a/deps/npm/lib/commands/outdated.js
+++ b/deps/npm/lib/commands/outdated.js
@@ -14,32 +14,17 @@ const ansiTrim = require('../utils/ansi-trim.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Outdated extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Check for outdated packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'outdated'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg> ...]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'all',
- 'json',
- 'long',
- 'parseable',
- 'global',
- 'workspace',
- ]
- }
+ static description = 'Check for outdated packages'
+ static name = 'outdated'
+ static usage = ['[[<@scope>/]<pkg> ...]']
+ static params = [
+ 'all',
+ 'json',
+ 'long',
+ 'parseable',
+ 'global',
+ 'workspace',
+ ]
async exec (args) {
const global = path.resolve(this.npm.globalDir, '..')
@@ -91,19 +76,21 @@ class Outdated extends ArboristWorkspaceCmd {
// sorts list alphabetically
const outdated = this.list.sort((a, b) => localeCompare(a.name, b.name))
- if (outdated.length > 0)
+ if (outdated.length > 0) {
process.exitCode = 1
+ }
// return if no outdated packages
- if (outdated.length === 0 && !this.npm.config.get('json'))
+ if (outdated.length === 0 && !this.npm.config.get('json')) {
return
+ }
// display results
- if (this.npm.config.get('json'))
+ if (this.npm.config.get('json')) {
this.npm.output(this.makeJSON(outdated))
- else if (this.npm.config.get('parseable'))
+ } else if (this.npm.config.get('parseable')) {
this.npm.output(this.makeParseable(outdated))
- else {
+ } else {
const outList = outdated.map(x => this.makePretty(x))
const outHead = ['Package',
'Current',
@@ -113,12 +100,14 @@ class Outdated extends ArboristWorkspaceCmd {
'Depended by',
]
- if (this.npm.config.get('long'))
+ if (this.npm.config.get('long')) {
outHead.push('Package Type', 'Homepage')
+ }
const outTable = [outHead].concat(outList)
- if (this.npm.color)
+ if (this.npm.color) {
outTable[0] = outTable[0].map(heading => styles.underline(heading))
+ }
const tableOpts = {
align: ['l', 'r', 'r', 'r', 'l'],
@@ -145,18 +134,21 @@ class Outdated extends ArboristWorkspaceCmd {
}
getEdgesIn (node) {
- for (const edge of node.edgesIn)
+ for (const edge of node.edgesIn) {
this.trackEdge(edge)
+ }
}
getEdgesOut (node) {
// TODO: normalize usage of edges and avoid looping through nodes here
if (this.npm.config.get('global')) {
- for (const child of node.children.values())
+ for (const child of node.children.values()) {
this.trackEdge(child)
+ }
} else {
- for (const edge of node.edgesOut.values())
+ for (const edge of node.edgesOut.values()) {
this.trackEdge(edge)
+ }
}
}
@@ -167,15 +159,17 @@ class Outdated extends ArboristWorkspaceCmd {
&& this.filterSet.size > 0
&& !this.filterSet.has(edge.from.target)
- if (filteredOut)
+ if (filteredOut) {
return
+ }
this.edges.add(edge)
}
getWorkspacesEdges (node) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
return
+ }
for (const edge of this.tree.edgesOut.values()) {
const workspace = edge
@@ -183,8 +177,9 @@ class Outdated extends ArboristWorkspaceCmd {
&& edge.to.target
&& edge.to.target.isWorkspace
- if (workspace)
+ if (workspace) {
this.getEdgesOut(edge.to.target)
+ }
}
}
@@ -209,22 +204,25 @@ class Outdated extends ArboristWorkspaceCmd {
: 'dependencies'
for (const omitType of this.npm.config.get('omit')) {
- if (node[omitType])
+ if (node[omitType]) {
return
+ }
}
// deps different from prod not currently
// on disk are not included in the output
- if (edge.error === 'MISSING' && type !== 'dependencies')
+ if (edge.error === 'MISSING' && type !== 'dependencies') {
return
+ }
try {
const packument = await this.getPackument(spec)
const expected = edge.spec
// if it's not a range, version, or tag, skip it
try {
- if (!npa(`${edge.name}@${edge.spec}`).registry)
+ if (!npa(`${edge.name}@${edge.spec}`).registry) {
return null
+ }
} catch (err) {
return null
}
@@ -259,14 +257,16 @@ class Outdated extends ArboristWorkspaceCmd {
err.code === 'ETARGET' ||
err.code === 'E403' ||
err.code === 'E404')
- )
+ ) {
throw err
+ }
}
}
maybeWorkspaceName (node) {
- if (!node.isWorkspace)
+ if (!node.isWorkspace) {
return node.name
+ }
const humanOutput =
!this.npm.config.get('json') && !this.npm.config.get('parseable')
@@ -331,8 +331,9 @@ class Outdated extends ArboristWorkspaceCmd {
name + '@' + latest,
dependent,
]
- if (this.npm.config.get('long'))
+ if (this.npm.config.get('long')) {
out.push(type, homepage)
+ }
return out.join(':')
}).join(os.EOL)
diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js
index 5d28e2b750..8f0b1f1eff 100644
--- a/deps/npm/lib/commands/owner.js
+++ b/deps/npm/lib/commands/owner.js
@@ -8,58 +8,51 @@ const readLocalPkgName = require('../utils/read-package-name.js')
const BaseCommand = require('../base-command.js')
class Owner extends BaseCommand {
- static get description () {
- return 'Manage package owners'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'owner'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'add <user> [<@scope>/]<pkg>',
- 'rm <user> [<@scope>/]<pkg>',
- 'ls [<@scope>/]<pkg>',
- ]
- }
+ static description = 'Manage package owners'
+ static name = 'owner'
+ static params = [
+ 'registry',
+ 'otp',
+ ]
+
+ static usage = [
+ 'add <user> [<@scope>/]<pkg>',
+ 'rm <user> [<@scope>/]<pkg>',
+ 'ls [<@scope>/]<pkg>',
+ ]
async completion (opts) {
const argv = opts.conf.argv.remain
- if (argv.length > 3)
+ if (argv.length > 3) {
return []
+ }
- if (argv[1] !== 'owner')
+ if (argv[1] !== 'owner') {
argv.unshift('owner')
+ }
- if (argv.length === 2)
+ if (argv.length === 2) {
return ['add', 'rm', 'ls']
+ }
// reaches registry in order to autocomplete rm
if (argv[2] === 'rm') {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
return []
+ }
const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName)
+ if (!pkgName) {
return []
+ }
const spec = npa(pkgName)
const data = await pacote.packument(spec, {
...this.npm.flatOptions,
fullMetadata: true,
})
- if (data && data.maintainers && data.maintainers.length)
+ if (data && data.maintainers && data.maintainers.length) {
return data.maintainers.map(m => m.name)
+ }
}
return []
}
@@ -82,12 +75,14 @@ class Owner extends BaseCommand {
async ls (pkg, opts) {
if (!pkg) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
throw this.usageError()
+ }
const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName)
+ if (!pkgName) {
throw this.usageError()
+ }
pkg = pkgName
}
@@ -97,10 +92,11 @@ class Owner extends BaseCommand {
try {
const packumentOpts = { ...opts, fullMetadata: true }
const { maintainers } = await pacote.packument(spec, packumentOpts)
- if (!maintainers || !maintainers.length)
+ if (!maintainers || !maintainers.length) {
this.npm.output('no admin found')
- else
+ } else {
this.npm.output(maintainers.map(o => `${o.name} <${o.email}>`).join('\n'))
+ }
return maintainers
} catch (err) {
@@ -110,15 +106,18 @@ class Owner extends BaseCommand {
}
async add (user, pkg, opts) {
- if (!user)
+ if (!user) {
throw this.usageError()
+ }
if (!pkg) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
throw this.usageError()
+ }
const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName)
+ if (!pkgName) {
throw this.usageError()
+ }
pkg = pkgName
}
@@ -130,15 +129,18 @@ class Owner extends BaseCommand {
}
async rm (user, pkg, opts) {
- if (!user)
+ if (!user) {
throw this.usageError()
+ }
if (!pkg) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
throw this.usageError()
+ }
const pkgName = await readLocalPkgName(this.npm.prefix)
- if (!pkgName)
+ if (!pkgName) {
throw this.usageError()
+ }
pkg = pkgName
}
@@ -178,8 +180,9 @@ class Owner extends BaseCommand {
const before = data.maintainers ? data.maintainers.length : 0
const m = validation(u, data.maintainers)
- if (!m)
- return // invalid owners
+ if (!m) {
+ return
+ } // invalid owners
const body = {
_id: data._id,
@@ -197,10 +200,11 @@ class Owner extends BaseCommand {
})
if (!res.error) {
- if (m.length < before)
+ if (m.length < before) {
this.npm.output(`- ${user} (${spec.name})`)
- else
+ } else {
this.npm.output(`+ ${user} (${spec.name})`)
+ }
} else {
throw Object.assign(
new Error('Failed to update package: ' + JSON.stringify(res)),
diff --git a/deps/npm/lib/commands/pack.js b/deps/npm/lib/commands/pack.js
index 013e88b44a..d84dde86e8 100644
--- a/deps/npm/lib/commands/pack.js
+++ b/deps/npm/lib/commands/pack.js
@@ -12,36 +12,23 @@ const writeFile = util.promisify(require('fs').writeFile)
const BaseCommand = require('../base-command.js')
class Pack extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Create a tarball from a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'pack'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'dry-run',
- 'json',
- 'pack-destination',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg>...]']
- }
+ static description = 'Create a tarball from a package'
+ static name = 'pack'
+ static params = [
+ 'dry-run',
+ 'json',
+ 'pack-destination',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
+
+ static usage = ['[[<@scope>/]<pkg>...]']
async exec (args) {
- if (args.length === 0)
+ if (args.length === 0) {
args = ['.']
+ }
const unicode = this.npm.config.get('unicode')
const dryRun = this.npm.config.get('dry-run')
@@ -53,8 +40,9 @@ class Pack extends BaseCommand {
for (const arg of args) {
const spec = npa(arg)
const manifest = await pacote.manifest(spec, this.npm.flatOptions)
- if (!manifest._id)
+ if (!manifest._id) {
throw new Error('Invalid package, must have name and version')
+ }
const filename = `${manifest.name}-${manifest.version}.tgz`
.replace(/^@/, '').replace(/\//, '-')
@@ -69,8 +57,9 @@ class Pack extends BaseCommand {
const pkgContents = await getContents(manifest, tarballData)
const tarballFilename = path.resolve(this.npm.config.get('pack-destination'), filename)
- if (!dryRun)
+ if (!dryRun) {
await writeFile(tarballFilename, tarballData)
+ }
tarballs.push(pkgContents)
}
diff --git a/deps/npm/lib/commands/ping.js b/deps/npm/lib/commands/ping.js
index d8ad1dc2a2..a049d24127 100644
--- a/deps/npm/lib/commands/ping.js
+++ b/deps/npm/lib/commands/ping.js
@@ -3,20 +3,9 @@ const pingUtil = require('../utils/ping.js')
const BaseCommand = require('../base-command.js')
class Ping extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Ping npm registry'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['registry']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'ping'
- }
+ static description = 'Ping npm registry'
+ static params = ['registry']
+ static name = 'ping'
async exec (args) {
log.notice('PING', this.npm.config.get('registry'))
@@ -30,8 +19,9 @@ class Ping extends BaseCommand {
time,
details,
}, null, 2))
- } else if (Object.keys(details).length)
+ } else if (Object.keys(details).length) {
log.notice('PONG', `${JSON.stringify(details, null, 2)}`)
+ }
}
}
module.exports = Ping
diff --git a/deps/npm/lib/commands/pkg.js b/deps/npm/lib/commands/pkg.js
index 1fa2c3bc57..007932429d 100644
--- a/deps/npm/lib/commands/pkg.js
+++ b/deps/npm/lib/commands/pkg.js
@@ -3,39 +3,27 @@ const BaseCommand = require('../base-command.js')
const Queryable = require('../utils/queryable.js')
class Pkg extends BaseCommand {
- static get description () {
- return 'Manages your package.json'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'pkg'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'set <key>=<value> [<key>=<value> ...]',
- 'get [<key> [<key> ...]]',
- 'delete <key> [<key> ...]',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'force',
- 'json',
- 'workspace',
- 'workspaces',
- ]
- }
+ static description = 'Manages your package.json'
+ static name = 'pkg'
+ static usage = [
+ 'set <key>=<value> [<key>=<value> ...]',
+ 'get [<key> [<key> ...]]',
+ 'delete <key> [<key> ...]',
+ ]
+
+ static params = [
+ 'force',
+ 'json',
+ 'workspace',
+ 'workspaces',
+ ]
async exec (args, { prefix } = {}) {
- if (!prefix)
+ if (!prefix) {
this.prefix = this.npm.localPrefix
- else
+ } else {
this.prefix = prefix
+ }
if (this.npm.config.get('global')) {
throw Object.assign(
@@ -81,15 +69,17 @@ class Pkg extends BaseCommand {
// in case there's only a single result from the query
// just prints that one element to stdout
- if (Object.keys(result).length === 1)
+ if (Object.keys(result).length === 1) {
result = result[args]
+ }
}
// only outputs if not running with workspaces config,
// in case you're retrieving info for workspaces the pkgWorkspaces
// will handle the output to make sure it get keyed by ws name
- if (!this.workspaces)
+ if (!this.workspaces) {
this.npm.output(JSON.stringify(result, null, 2))
+ }
return result
}
@@ -98,8 +88,9 @@ class Pkg extends BaseCommand {
const setError = () =>
this.usageError('npm pkg set expects a key=value pair of args.')
- if (!args.length)
+ if (!args.length) {
throw setError()
+ }
const force = this.npm.config.get('force')
const json = this.npm.config.get('json')
@@ -108,8 +99,9 @@ class Pkg extends BaseCommand {
for (const arg of args) {
const [key, ...rest] = arg.split('=')
const value = rest.join('=')
- if (!key || !value)
+ if (!key || !value) {
throw setError()
+ }
q.set(key, json ? JSON.parse(value) : value, { force })
}
@@ -122,14 +114,16 @@ class Pkg extends BaseCommand {
const setError = () =>
this.usageError('npm pkg delete expects key args.')
- if (!args.length)
+ if (!args.length) {
throw setError()
+ }
const pkgJson = await PackageJson.load(this.prefix)
const q = new Queryable(pkgJson.content)
for (const key of args) {
- if (!key)
+ if (!key) {
throw setError()
+ }
q.delete(key)
}
diff --git a/deps/npm/lib/commands/prefix.js b/deps/npm/lib/commands/prefix.js
index 1f2a78c312..264b819fc7 100644
--- a/deps/npm/lib/commands/prefix.js
+++ b/deps/npm/lib/commands/prefix.js
@@ -1,25 +1,10 @@
const BaseCommand = require('../base-command.js')
class Prefix extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Display prefix'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'prefix'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['global']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[-g]']
- }
+ static description = 'Display prefix'
+ static name = 'prefix'
+ static params = ['global']
+ static usage = ['[-g]']
async exec (args) {
return this.npm.output(this.npm.prefix)
diff --git a/deps/npm/lib/commands/profile.js b/deps/npm/lib/commands/profile.js
index abfe5edd7a..0939013cc2 100644
--- a/deps/npm/lib/commands/profile.js
+++ b/deps/npm/lib/commands/profile.js
@@ -38,40 +38,28 @@ const writableProfileKeys = [
const BaseCommand = require('../base-command.js')
class Profile extends BaseCommand {
- static get description () {
- return 'Change settings on your registry profile'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'profile'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'enable-2fa [auth-only|auth-and-writes]',
- 'disable-2fa',
- 'get [<key>]',
- 'set <key> <value>',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'json',
- 'parseable',
- 'otp',
- ]
- }
+ static description = 'Change settings on your registry profile'
+ static name = 'profile'
+ static usage = [
+ 'enable-2fa [auth-only|auth-and-writes]',
+ 'disable-2fa',
+ 'get [<key>]',
+ 'set <key> <value>',
+ ]
+
+ static params = [
+ 'registry',
+ 'json',
+ 'parseable',
+ 'otp',
+ ]
async completion (opts) {
var argv = opts.conf.argv.remain
- if (!argv[2])
+ if (!argv[2]) {
return ['enable-2fa', 'disable-2fa', 'get', 'set']
+ }
switch (argv[2]) {
case 'enable-2fa':
@@ -89,8 +77,9 @@ class Profile extends BaseCommand {
}
async exec (args) {
- if (args.length === 0)
+ if (args.length === 0) {
throw this.usageError()
+ }
log.gauge.show('profile')
@@ -122,8 +111,9 @@ class Profile extends BaseCommand {
npmProfile.get(this.npm.flatOptions)
)
- if (!info.cidr_whitelist)
+ if (!info.cidr_whitelist) {
delete info.cidr_whitelist
+ }
if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify(info, null, 2))
@@ -132,21 +122,24 @@ class Profile extends BaseCommand {
// clean up and format key/values for output
const cleaned = {}
- for (const key of knownProfileKeys)
+ for (const key of knownProfileKeys) {
cleaned[key] = info[key] || ''
+ }
const unknownProfileKeys = Object.keys(info).filter((k) => !(k in cleaned))
- for (const key of unknownProfileKeys)
+ for (const key of unknownProfileKeys) {
cleaned[key] = info[key] || ''
+ }
delete cleaned.tfa
delete cleaned.email_verified
cleaned.email += info.email_verified ? ' (verified)' : '(unverified)'
- if (info.tfa && !info.tfa.pending)
+ if (info.tfa && !info.tfa.pending) {
cleaned[tfa] = info.tfa.mode
- else
+ } else {
cleaned[tfa] = 'disabled'
+ }
if (args.length) {
const values = args // comma or space separated
@@ -159,15 +152,17 @@ class Profile extends BaseCommand {
} else {
if (this.npm.config.get('parseable')) {
for (const key of Object.keys(info)) {
- if (key === 'tfa')
+ if (key === 'tfa') {
this.npm.output(`${key}\t${cleaned[tfa]}`)
- else
+ } else {
this.npm.output(`${key}\t${info[key]}`)
+ }
}
} else {
const table = new Table()
- for (const key of Object.keys(cleaned))
+ for (const key of Object.keys(cleaned)) {
table.push({ [ansistyles.bright(key)]: cleaned[key] })
+ }
this.npm.output(table.toString())
}
@@ -192,8 +187,9 @@ class Profile extends BaseCommand {
return newpassword
}
- if (prop !== 'password' && value === null)
+ if (prop !== 'password' && value === null) {
throw new Error('npm profile set <prop> <value>')
+ }
if (prop === 'password' && value !== null) {
throw new Error(
@@ -217,26 +213,29 @@ class Profile extends BaseCommand {
const user = await pulseTillDone.withPromise(npmProfile.get(conf))
const newUser = {}
- for (const key of writableProfileKeys)
+ for (const key of writableProfileKeys) {
newUser[key] = user[key]
+ }
newUser[prop] = value
const result = await otplease(conf, conf => npmProfile.set(newUser, conf))
- if (this.npm.config.get('json'))
+ if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify({ [prop]: result[prop] }, null, 2))
- else if (this.npm.config.get('parseable'))
+ } else if (this.npm.config.get('parseable')) {
this.npm.output(prop + '\t' + result[prop])
- else if (result[prop] != null)
+ } else if (result[prop] != null) {
this.npm.output('Set', prop, 'to', result[prop])
- else
+ } else {
this.npm.output('Set', prop)
+ }
}
async enable2fa (args) {
- if (args.length > 1)
+ if (args.length > 1) {
throw new Error('npm profile enable-2fa [auth-and-writes|auth-only]')
+ }
const mode = args[0] || 'auth-and-writes'
if (mode !== 'auth-only' && mode !== 'auth-and-writes') {
@@ -267,11 +266,11 @@ class Profile extends BaseCommand {
const creds = this.npm.config.getCredentialsByURI(this.npm.config.get('registry'))
const auth = {}
- if (creds.token)
+ if (creds.token) {
auth.token = creds.token
- else if (creds.username)
+ } else if (creds.username) {
auth.basic = { username: creds.username, password: creds.password }
- else if (creds.auth) {
+ } else if (creds.auth) {
const basic = Buffer.from(creds.auth, 'base64').toString().split(':', 2)
auth.basic = { username: basic[0], password: basic[1] }
}
@@ -370,8 +369,9 @@ class Profile extends BaseCommand {
'if you lose your authentication device.'
)
- for (const tfaCode of result.tfa)
+ for (const tfaCode of result.tfa) {
this.npm.output('\t' + tfaCode)
+ }
}
async disable2fa (args) {
@@ -396,12 +396,13 @@ class Profile extends BaseCommand {
tfa: { password: password, mode: 'disable' },
}, conf))
- if (this.npm.config.get('json'))
+ if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify({ tfa: false }, null, 2))
- else if (this.npm.config.get('parseable'))
+ } else if (this.npm.config.get('parseable')) {
this.npm.output('tfa\tfalse')
- else
+ } else {
this.npm.output('Two factor authentication disabled.')
+ }
}
}
module.exports = Profile
diff --git a/deps/npm/lib/commands/prune.js b/deps/npm/lib/commands/prune.js
index 334ee4dd4a..403575e024 100644
--- a/deps/npm/lib/commands/prune.js
+++ b/deps/npm/lib/commands/prune.js
@@ -4,25 +4,10 @@ const reifyFinish = require('../utils/reify-finish.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Prune extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Remove extraneous packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'prune'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['omit', 'dry-run', 'json', ...super.params]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<pkg>...]']
- }
+ static description = 'Remove extraneous packages'
+ static name = 'prune'
+ static params = ['omit', 'dry-run', 'json', ...super.params]
+ static usage = ['[[<@scope>/]<pkg>...]']
async exec () {
const where = this.npm.prefix
diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js
index 3bc309c12a..88ddcae7bb 100644
--- a/deps/npm/lib/commands/publish.js
+++ b/deps/npm/lib/commands/publish.js
@@ -26,40 +26,27 @@ const readJson = util.promisify(require('read-package-json'))
const BaseCommand = require('../base-command.js')
class Publish extends BaseCommand {
- static get description () {
- return 'Publish a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'publish'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'tag',
- 'access',
- 'dry-run',
- 'otp',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- '[<folder>]',
- ]
- }
+ static description = 'Publish a package'
+ static name = 'publish'
+ static params = [
+ 'tag',
+ 'access',
+ 'dry-run',
+ 'otp',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
+
+ static usage = ['[<folder>]']
async exec (args) {
- if (args.length === 0)
+ if (args.length === 0) {
args = ['.']
- if (args.length !== 1)
+ }
+ if (args.length !== 1) {
throw this.usageError()
+ }
log.verbose('publish', replaceInfo(args))
@@ -70,8 +57,9 @@ class Publish extends BaseCommand {
const ignoreScripts = this.npm.config.get('ignore-scripts')
const silent = log.level === 'silent'
- if (semver.validRange(defaultTag))
+ if (semver.validRange(defaultTag)) {
throw new Error('Tag name must not be a valid SemVer range: ' + defaultTag.trim())
+ }
const opts = { ...this.npm.flatOptions }
@@ -80,8 +68,9 @@ class Publish extends BaseCommand {
const spec = npa(args[0])
let manifest = await this.getManifest(spec, opts)
- if (manifest.publishConfig)
+ if (manifest.publishConfig) {
flatten(manifest.publishConfig, opts)
+ }
// only run scripts for directory type publishes
if (spec.type === 'directory' && !ignoreScripts) {
@@ -101,13 +90,15 @@ class Publish extends BaseCommand {
// so that we send the latest and greatest thing to the registry
// note that publishConfig might have changed as well!
manifest = await this.getManifest(spec, opts)
- if (manifest.publishConfig)
+ if (manifest.publishConfig) {
flatten(manifest.publishConfig, opts)
+ }
// note that logTar calls npmlog.notice(), so if we ARE in silent mode,
// this will do nothing, but we still want it in the debuglog if it fails.
- if (!json)
+ if (!json) {
logTar(pkgContents, { log, unicode })
+ }
if (!dryRun) {
const resolved = npa.resolve(manifest.name, manifest.version)
@@ -140,10 +131,11 @@ class Publish extends BaseCommand {
}
if (!this.suppressOutput) {
- if (!silent && json)
+ if (!silent && json) {
this.npm.output(JSON.stringify(pkgContents, null, 2))
- else if (!silent)
+ } else if (!silent) {
this.npm.output(`+ ${pkgContents.id}`)
+ }
}
return pkgContents
@@ -180,21 +172,24 @@ class Publish extends BaseCommand {
}
// This needs to be in-line w/ the rest of the output that non-JSON
// publish generates
- if (!silent && !json)
+ if (!silent && !json) {
this.npm.output(`+ ${pkgContents.id}`)
- else
+ } else {
results[name] = pkgContents
+ }
}
- if (!silent && json)
+ if (!silent && json) {
this.npm.output(JSON.stringify(results, null, 2))
+ }
}
// if it's a directory, read it from the file system
// otherwise, get the full metadata from whatever it is
getManifest (spec, opts) {
- if (spec.type === 'directory')
+ if (spec.type === 'directory') {
return readJson(`${spec.fetchSpec}/package.json`)
+ }
return pacote.manifest(spec, { ...opts, fullMetadata: true })
}
}
diff --git a/deps/npm/lib/commands/rebuild.js b/deps/npm/lib/commands/rebuild.js
index 3b9211e2e4..471d60b740 100644
--- a/deps/npm/lib/commands/rebuild.js
+++ b/deps/npm/lib/commands/rebuild.js
@@ -6,32 +6,19 @@ const completion = require('../utils/completion/installed-deep.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Rebuild extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Rebuild a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'rebuild'
- }
+ static description = 'Rebuild a package'
+ static name = 'rebuild'
+ static params = [
+ 'global',
+ 'bin-links',
+ 'ignore-scripts',
+ ...super.params,
+ ]
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'global',
- 'bin-links',
- 'ignore-scripts',
- ...super.params,
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[[<@scope>/]<name>[@<version>] ...]']
- }
+ static usage = ['[[<@scope>/]<name>[@<version>] ...]']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
@@ -51,33 +38,39 @@ class Rebuild extends ArboristWorkspaceCmd {
const tree = await arb.loadActual()
const specs = args.map(arg => {
const spec = npa(arg)
- if (spec.type === 'tag' && spec.rawSpec === '')
+ if (spec.type === 'tag' && spec.rawSpec === '') {
return spec
+ }
- if (spec.type !== 'range' && spec.type !== 'version' && spec.type !== 'directory')
+ if (spec.type !== 'range' && spec.type !== 'version' && spec.type !== 'directory') {
throw new Error('`npm rebuild` only supports SemVer version/range specifiers')
+ }
return spec
})
const nodes = tree.inventory.filter(node => this.isNode(specs, node))
await arb.rebuild({ nodes })
- } else
+ } else {
await arb.rebuild()
+ }
this.npm.output('rebuilt dependencies successfully')
}
isNode (specs, node) {
return specs.some(spec => {
- if (spec.type === 'directory')
+ if (spec.type === 'directory') {
return node.path === spec.fetchSpec
+ }
- if (spec.name !== node.name)
+ if (spec.name !== node.name) {
return false
+ }
- if (spec.rawSpec === '' || spec.rawSpec === '*')
+ if (spec.rawSpec === '' || spec.rawSpec === '*') {
return true
+ }
const { version } = node.package
// TODO: add tests for a package with missing version
diff --git a/deps/npm/lib/commands/repo.js b/deps/npm/lib/commands/repo.js
index 372940512c..cc68e85650 100644
--- a/deps/npm/lib/commands/repo.js
+++ b/deps/npm/lib/commands/repo.js
@@ -7,29 +7,15 @@ const openUrl = require('../utils/open-url.js')
const BaseCommand = require('../base-command.js')
class Repo extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Open package repository page in the browser'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'repo'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['browser', 'workspace', 'workspaces', 'include-workspace-root']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<pkgname> [<pkgname> ...]]']
- }
+ static description = 'Open package repository page in the browser'
+ static name = 'repo'
+ static params = ['browser', 'workspace', 'workspaces', 'include-workspace-root']
+ static usage = ['[<pkgname> [<pkgname> ...]]']
async exec (args) {
- if (!args || !args.length)
+ if (!args || !args.length) {
args = ['.']
+ }
await Promise.all(args.map(pkg => this.get(pkg)))
}
@@ -86,8 +72,9 @@ const unknownHostedUrl = url => {
} = new URL(url)
/* istanbul ignore next - URL ctor should prevent this */
- if (!protocol || !hostname)
+ if (!protocol || !hostname) {
return null
+ }
const proto = /(git\+)http:$/.test(protocol) ? 'http:' : 'https:'
const path = pathname.replace(/\.git$/, '')
diff --git a/deps/npm/lib/commands/restart.js b/deps/npm/lib/commands/restart.js
index f832d6a1e3..a12368644a 100644
--- a/deps/npm/lib/commands/restart.js
+++ b/deps/npm/lib/commands/restart.js
@@ -2,22 +2,11 @@ const LifecycleCmd = require('../lifecycle-cmd.js')
// This ends up calling run-script(['restart', ...args])
class Restart extends LifecycleCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Restart a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'restart'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'ignore-scripts',
- 'script-shell',
- ]
- }
+ static description = 'Restart a package'
+ static name = 'restart'
+ static params = [
+ 'ignore-scripts',
+ 'script-shell',
+ ]
}
module.exports = Restart
diff --git a/deps/npm/lib/commands/root.js b/deps/npm/lib/commands/root.js
index acfc5c70ef..7749c60245 100644
--- a/deps/npm/lib/commands/root.js
+++ b/deps/npm/lib/commands/root.js
@@ -1,19 +1,8 @@
const BaseCommand = require('../base-command.js')
class Root extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Display npm root'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'root'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['global']
- }
+ static description = 'Display npm root'
+ static name = 'root'
+ static params = ['global']
async exec () {
this.npm.output(this.npm.dir)
diff --git a/deps/npm/lib/commands/run-script.js b/deps/npm/lib/commands/run-script.js
index 34e96257c3..37140c8c53 100644
--- a/deps/npm/lib/commands/run-script.js
+++ b/deps/npm/lib/commands/run-script.js
@@ -28,32 +28,18 @@ const nocolor = {
const BaseCommand = require('../base-command.js')
class RunScript extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Run arbitrary package scripts'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- 'if-present',
- 'ignore-scripts',
- 'script-shell',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'run-script'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<command> [-- <args>]']
- }
+ static description = 'Run arbitrary package scripts'
+ static params = [
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ 'if-present',
+ 'ignore-scripts',
+ 'script-shell',
+ ]
+
+ static name = 'run-script'
+ static usage = ['<command> [-- <args>]']
async completion (opts) {
const argv = opts.conf.argv.remain
@@ -66,17 +52,19 @@ class RunScript extends BaseCommand {
}
async exec (args) {
- if (args.length)
+ if (args.length) {
return this.run(args)
- else
+ } else {
return this.list(args)
+ }
}
async execWorkspaces (args, filters) {
- if (args.length)
+ if (args.length) {
return this.runWorkspaces(args, filters)
- else
+ } else {
return this.listWorkspaces(args, filters)
+ }
}
async run ([event, ...args], { path = this.npm.localPrefix, pkg } = {}) {
@@ -87,32 +75,38 @@ class RunScript extends BaseCommand {
pkg = pkg || (await rpj(`${path}/package.json`))
const { scripts = {} } = pkg
- if (event === 'restart' && !scripts.restart)
+ if (event === 'restart' && !scripts.restart) {
scripts.restart = 'npm stop --if-present && npm start'
- else if (event === 'env' && !scripts.env)
+ } else if (event === 'env' && !scripts.env) {
scripts.env = isWindowsShell ? 'SET' : 'env'
+ }
pkg.scripts = scripts
if (
!Object.prototype.hasOwnProperty.call(scripts, event) &&
- !(event === 'start' && await isServerPackage(path))
+ !(event === 'start' && (await isServerPackage(path)))
) {
- if (this.npm.config.get('if-present'))
+ if (this.npm.config.get('if-present')) {
return
+ }
const suggestions = await didYouMean(this.npm, path, event)
- throw new Error(`Missing script: "${event}"${suggestions}\n\nTo see a list of scripts, run:\n npm run`)
+ throw new Error(
+ `Missing script: "${event}"${suggestions}\n\nTo see a list of scripts, run:\n npm run`
+ )
}
// positional args only added to the main event, not pre/post
const events = [[event, args]]
if (!this.npm.config.get('ignore-scripts')) {
- if (scripts[`pre${event}`])
+ if (scripts[`pre${event}`]) {
events.unshift([`pre${event}`, []])
+ }
- if (scripts[`post${event}`])
+ if (scripts[`post${event}`]) {
events.push([`post${event}`, []])
+ }
}
const opts = {
@@ -140,12 +134,14 @@ class RunScript extends BaseCommand {
const pkgid = _id || name
const color = this.npm.color
- if (!scripts)
+ if (!scripts) {
return []
+ }
const allScripts = Object.keys(scripts)
- if (log.level === 'silent')
+ if (log.level === 'silent') {
return allScripts
+ }
if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify(scripts, null, 2))
@@ -153,8 +149,9 @@ class RunScript extends BaseCommand {
}
if (this.npm.config.get('parseable')) {
- for (const [script, cmd] of Object.entries(scripts))
+ for (const [script, cmd] of Object.entries(scripts)) {
this.npm.output(`${script}:${cmd}`)
+ }
return allScripts
}
@@ -170,24 +167,30 @@ class RunScript extends BaseCommand {
const colorize = color ? chalk : nocolor
if (cmds.length) {
- this.npm.output(`${
- colorize.reset(colorize.bold('Lifecycle scripts'))} included in ${
- colorize.green(pkgid)}:`)
+ this.npm.output(
+ `${colorize.reset(colorize.bold('Lifecycle scripts'))} included in ${colorize.green(
+ pkgid
+ )}:`
+ )
}
- for (const script of cmds)
+ for (const script of cmds) {
this.npm.output(prefix + script + indent + colorize.dim(scripts[script]))
+ }
if (!cmds.length && runScripts.length) {
- this.npm.output(`${
- colorize.bold('Scripts')
- } available in ${colorize.green(pkgid)} via \`${
- colorize.blue('npm run-script')}\`:`)
- } else if (runScripts.length)
+ this.npm.output(
+ `${colorize.bold('Scripts')} available in ${colorize.green(pkgid)} via \`${colorize.blue(
+ 'npm run-script'
+ )}\`:`
+ )
+ } else if (runScripts.length) {
this.npm.output(`\navailable via \`${colorize.blue('npm run-script')}\`:`)
+ }
- for (const script of runScripts)
+ for (const script of runScripts) {
this.npm.output(prefix + script + indent + colorize.dim(scripts[script]))
+ }
this.npm.output('')
return allScripts
@@ -212,8 +215,9 @@ class RunScript extends BaseCommand {
// avoids exiting with error code in case there's scripts missing
// in some workspaces since other scripts might have succeeded
- if (!scriptMissing)
+ if (!scriptMissing) {
process.exitCode = 1
+ }
return scriptMissing
})
@@ -221,15 +225,17 @@ class RunScript extends BaseCommand {
}
// in case **all** tests are missing, then it should exit with error code
- if (res.every(Boolean))
+ if (res.every(Boolean)) {
throw new Error(`Missing script: ${args[0]}`)
+ }
}
async listWorkspaces (args, filters) {
await this.setWorkspaces(filters)
- if (log.level === 'silent')
+ if (log.level === 'silent') {
return
+ }
if (this.npm.config.get('json')) {
const res = {}
@@ -244,14 +250,16 @@ class RunScript extends BaseCommand {
if (this.npm.config.get('parseable')) {
for (const workspacePath of this.workspacePaths) {
const { scripts, name } = await rpj(`${workspacePath}/package.json`)
- for (const [script, cmd] of Object.entries(scripts || {}))
+ for (const [script, cmd] of Object.entries(scripts || {})) {
this.npm.output(`${name}:${script}:${cmd}`)
+ }
}
return
}
- for (const workspacePath of this.workspacePaths)
+ for (const workspacePath of this.workspacePaths) {
await this.list(args, workspacePath)
+ }
}
}
diff --git a/deps/npm/lib/commands/search.js b/deps/npm/lib/commands/search.js
index e60f41afb0..ff533ebbd1 100644
--- a/deps/npm/lib/commands/search.js
+++ b/deps/npm/lib/commands/search.js
@@ -14,10 +14,11 @@ function prepareIncludes (args) {
function prepareExcludes (searchexclude) {
var exclude
- if (typeof searchexclude === 'string')
+ if (typeof searchexclude === 'string') {
exclude = searchexclude.split(/\s+/)
- else
+ } else {
exclude = []
+ }
return exclude
.map(s => s.toLowerCase())
@@ -26,37 +27,23 @@ function prepareExcludes (searchexclude) {
const BaseCommand = require('../base-command.js')
class Search extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Search for packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'search'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'long',
- 'json',
- 'color',
- 'parseable',
- 'description',
- 'searchopts',
- 'searchexclude',
- 'registry',
- 'prefer-online',
- 'prefer-offline',
- 'offline',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[search terms ...]']
- }
+ static description = 'Search for packages'
+ static name = 'search'
+ static params = [
+ 'long',
+ 'json',
+ 'color',
+ 'parseable',
+ 'description',
+ 'searchopts',
+ 'searchexclude',
+ 'registry',
+ 'prefer-online',
+ 'prefer-offline',
+ 'offline',
+ ]
+
+ static usage = ['[search terms ...]']
async exec (args) {
const opts = {
@@ -66,16 +53,18 @@ class Search extends BaseCommand {
exclude: prepareExcludes(this.npm.flatOptions.search.exclude),
}
- if (opts.include.length === 0)
+ if (opts.include.length === 0) {
throw new Error('search must be called with arguments')
+ }
// Used later to figure out whether we had any packages go out
let anyOutput = false
class FilterStream extends Minipass {
write (pkg) {
- if (packageFilter(pkg, opts.include, opts.exclude))
+ if (packageFilter(pkg, opts.include, opts.exclude)) {
super.write(pkg)
+ }
}
}
@@ -96,14 +85,16 @@ class Search extends BaseCommand {
)
p.on('data', chunk => {
- if (!anyOutput)
+ if (!anyOutput) {
anyOutput = true
+ }
this.npm.output(chunk.toString('utf8'))
})
await p.promise()
- if (!anyOutput && !this.npm.config.get('json') && !this.npm.config.get('parseable'))
+ if (!anyOutput && !this.npm.config.get('json') && !this.npm.config.get('parseable')) {
this.npm.output('No matches found for ' + (args.map(JSON.stringify).join(' ')))
+ }
log.silly('search', 'search completed')
log.clearProgress()
diff --git a/deps/npm/lib/commands/set-script.js b/deps/npm/lib/commands/set-script.js
index 00f9b5d5b1..58fd2726db 100644
--- a/deps/npm/lib/commands/set-script.js
+++ b/deps/npm/lib/commands/set-script.js
@@ -5,25 +5,10 @@ const PackageJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
class SetScript extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Set tasks in the scripts section of package.json'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['workspace', 'workspaces', 'include-workspace-root']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'set-script'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<script>] [<command>]']
- }
+ static description = 'Set tasks in the scripts section of package.json'
+ static params = ['workspace', 'workspaces', 'include-workspace-root']
+ static name = 'set-script'
+ static usage = ['[<script>] [<command>]']
async completion (opts) {
const argv = opts.conf.argv.remain
@@ -36,19 +21,22 @@ class SetScript extends BaseCommand {
}
validate (args) {
- if (process.env.npm_lifecycle_event === 'postinstall')
+ if (process.env.npm_lifecycle_event === 'postinstall') {
throw new Error('Scripts can’t set from the postinstall script')
+ }
// Parse arguments
- if (args.length !== 2)
+ if (args.length !== 2) {
throw new Error(`Expected 2 arguments: got ${args.length}`)
+ }
}
async exec (args) {
this.validate(args)
const warn = await this.doSetScript(this.npm.localPrefix, args[0], args[1])
- if (warn)
+ if (warn) {
log.warn('set-script', `Script "${args[0]}" was overwritten`)
+ }
}
async execWorkspaces (args, filters) {
@@ -86,8 +74,9 @@ class SetScript extends BaseCommand {
&& scripts[name]
&& scripts[name] !== value
- if (overwriting)
+ if (overwriting) {
warn = true
+ }
pkgJson.update({
scripts: {
diff --git a/deps/npm/lib/commands/set.js b/deps/npm/lib/commands/set.js
index cdaabc04ac..1dc90e81f8 100644
--- a/deps/npm/lib/commands/set.js
+++ b/deps/npm/lib/commands/set.js
@@ -1,28 +1,20 @@
const BaseCommand = require('../base-command.js')
class Set extends BaseCommand {
- static get description () {
- return 'Set a value in the npm configuration'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'set'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
- }
+ static description = 'Set a value in the npm configuration'
+ static name = 'set'
+ static usage = ['<key>=<value> [<key>=<value> ...] (See `npm config`)']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return this.npm.cmd('config').completion(opts)
}
async exec (args) {
- if (!args.length)
+ if (!args.length) {
throw this.usageError()
+ }
return this.npm.exec('config', ['set'].concat(args))
}
}
diff --git a/deps/npm/lib/commands/shrinkwrap.js b/deps/npm/lib/commands/shrinkwrap.js
index 42489a27f5..dfb3c8e381 100644
--- a/deps/npm/lib/commands/shrinkwrap.js
+++ b/deps/npm/lib/commands/shrinkwrap.js
@@ -5,15 +5,8 @@ const log = require('npmlog')
const BaseCommand = require('../base-command.js')
class Shrinkwrap extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Lock down dependency versions for publication'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'shrinkwrap'
- }
+ static description = 'Lock down dependency versions for publication'
+ static name = 'shrinkwrap'
async exec () {
// if has a npm-shrinkwrap.json, nothing to do
@@ -57,19 +50,22 @@ class Shrinkwrap extends BaseCommand {
if (newFile) {
let message = 'created a lockfile as npm-shrinkwrap.json'
- if (updatedVersion)
+ if (updatedVersion) {
message += ` with version ${updatedVersion}`
+ }
log.notice('', message)
} else if (notSW) {
await unlink(oldFilename)
let message = 'package-lock.json has been renamed to npm-shrinkwrap.json'
- if (updatedVersion)
+ if (updatedVersion) {
message += ` and updated to version ${updatedVersion}`
+ }
log.notice('', message)
- } else if (updatedVersion)
+ } else if (updatedVersion) {
log.notice('', `npm-shrinkwrap.json updated to version ${updatedVersion}`)
- else
+ } else {
log.notice('', 'npm-shrinkwrap.json up to date')
+ }
}
}
module.exports = Shrinkwrap
diff --git a/deps/npm/lib/commands/star.js b/deps/npm/lib/commands/star.js
index 36003a0200..1bbd25efda 100644
--- a/deps/npm/lib/commands/star.js
+++ b/deps/npm/lib/commands/star.js
@@ -6,31 +6,18 @@ const getIdentity = require('../utils/get-identity')
const BaseCommand = require('../base-command.js')
class Star extends BaseCommand {
- static get description () {
- return 'Mark your favorite packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'star'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<pkg>...]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'unicode',
- ]
- }
+ static description = 'Mark your favorite packages'
+ static name = 'star'
+ static usage = ['[<pkg>...]']
+ static params = [
+ 'registry',
+ 'unicode',
+ ]
async exec (args) {
- if (!args.length)
+ if (!args.length) {
throw this.usageError()
+ }
// if we're unstarring, then show an empty star image
// otherwise, show the full star image
@@ -52,8 +39,9 @@ class Star extends BaseCommand {
}),
])
- if (!username)
+ if (!username) {
throw new Error('You need to be logged in!')
+ }
const body = {
_id: fullData._id,
diff --git a/deps/npm/lib/commands/stars.js b/deps/npm/lib/commands/stars.js
index d430be2ced..1260655d07 100644
--- a/deps/npm/lib/commands/stars.js
+++ b/deps/npm/lib/commands/stars.js
@@ -5,45 +5,32 @@ const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
class Stars extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'View packages marked as favorites'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'stars'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<user>]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- ]
- }
+ static description = 'View packages marked as favorites'
+ static name = 'stars'
+ static usage = ['[<user>]']
+ static params = ['registry']
async exec ([user]) {
try {
- if (!user)
+ if (!user) {
user = await getIdentity(this.npm, this.npm.flatOptions)
+ }
const { rows } = await fetch.json('/-/_view/starredByUser', {
...this.npm.flatOptions,
query: { key: `"${user}"` },
})
- if (rows.length === 0)
+ if (rows.length === 0) {
log.warn('stars', 'user has not starred any packages')
+ }
- for (const row of rows)
+ for (const row of rows) {
this.npm.output(row.value)
+ }
} catch (err) {
- if (err.code === 'ENEEDAUTH')
+ if (err.code === 'ENEEDAUTH') {
log.warn('stars', 'auth is required to look up your username')
+ }
throw err
}
}
diff --git a/deps/npm/lib/commands/start.js b/deps/npm/lib/commands/start.js
index e075c22dff..1731e48451 100644
--- a/deps/npm/lib/commands/start.js
+++ b/deps/npm/lib/commands/start.js
@@ -2,22 +2,11 @@ const LifecycleCmd = require('../lifecycle-cmd.js')
// This ends up calling run-script(['start', ...args])
class Start extends LifecycleCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Start a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'start'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'ignore-scripts',
- 'script-shell',
- ]
- }
+ static description = 'Start a package'
+ static name = 'start'
+ static params = [
+ 'ignore-scripts',
+ 'script-shell',
+ ]
}
module.exports = Start
diff --git a/deps/npm/lib/commands/stop.js b/deps/npm/lib/commands/stop.js
index 869d81fdf1..2442a9442f 100644
--- a/deps/npm/lib/commands/stop.js
+++ b/deps/npm/lib/commands/stop.js
@@ -2,22 +2,11 @@ const LifecycleCmd = require('../lifecycle-cmd.js')
// This ends up calling run-script(['stop', ...args])
class Stop extends LifecycleCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Stop a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'stop'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'ignore-scripts',
- 'script-shell',
- ]
- }
+ static description = 'Stop a package'
+ static name = 'stop'
+ static params = [
+ 'ignore-scripts',
+ 'script-shell',
+ ]
}
module.exports = Stop
diff --git a/deps/npm/lib/commands/team.js b/deps/npm/lib/commands/team.js
index b337a75360..3d2fff0f06 100644
--- a/deps/npm/lib/commands/team.js
+++ b/deps/npm/lib/commands/team.js
@@ -5,45 +5,34 @@ const otplease = require('../utils/otplease.js')
const BaseCommand = require('../base-command.js')
class Team extends BaseCommand {
- static get description () {
- return 'Manage organization teams and team memberships'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'team'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'create <scope:team> [--otp <otpcode>]',
- 'destroy <scope:team> [--otp <otpcode>]',
- 'add <scope:team> <user> [--otp <otpcode>]',
- 'rm <scope:team> <user> [--otp <otpcode>]',
- 'ls <scope>|<scope:team>',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'otp',
- 'parseable',
- 'json',
- ]
- }
+ static description = 'Manage organization teams and team memberships'
+ static name = 'team'
+ static usage = [
+ 'create <scope:team> [--otp <otpcode>]',
+ 'destroy <scope:team> [--otp <otpcode>]',
+ 'add <scope:team> <user> [--otp <otpcode>]',
+ 'rm <scope:team> <user> [--otp <otpcode>]',
+ 'ls <scope>|<scope:team>',
+ ]
+
+ static params = [
+ 'registry',
+ 'otp',
+ 'parseable',
+ 'json',
+ ]
async completion (opts) {
const { conf: { argv: { remain: argv } } } = opts
const subcommands = ['create', 'destroy', 'add', 'rm', 'ls']
- if (argv.length === 2)
+ if (argv.length === 2) {
return subcommands
+ }
- if (subcommands.includes(argv[2]))
+ if (subcommands.includes(argv[2])) {
return []
+ }
throw new Error(argv[2] + ' not recognized')
}
@@ -62,10 +51,11 @@ class Team extends BaseCommand {
case 'rm': return this.rm(entity, user, opts)
case 'ls': {
const match = entity.match(/[^:]+:.+/)
- if (match)
+ if (match) {
return this.listUsers(entity, opts)
- else
+ } else {
return this.listTeams(entity, opts)
+ }
}
default:
throw this.usageError()
@@ -80,10 +70,11 @@ class Team extends BaseCommand {
created: true,
team: entity,
}))
- } else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(`${entity}\tcreated`)
- else if (!opts.silent && opts.loglevel !== 'silent')
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
this.npm.output(`+@${entity}`)
+ }
}
async destroy (entity, opts) {
@@ -93,10 +84,11 @@ class Team extends BaseCommand {
deleted: true,
team: entity,
}))
- } else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(`${entity}\tdeleted`)
- else if (!opts.silent && opts.loglevel !== 'silent')
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
this.npm.output(`-@${entity}`)
+ }
}
async add (entity, user, opts) {
@@ -107,10 +99,11 @@ class Team extends BaseCommand {
team: entity,
user,
}))
- } else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(`${user}\t${entity}\tadded`)
- else if (!opts.silent && opts.loglevel !== 'silent')
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
this.npm.output(`${user} added to @${entity}`)
+ }
}
async rm (entity, user, opts) {
@@ -121,19 +114,20 @@ class Team extends BaseCommand {
team: entity,
user,
}))
- } else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(`${user}\t${entity}\tremoved`)
- else if (!opts.silent && opts.loglevel !== 'silent')
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
this.npm.output(`${user} removed from @${entity}`)
+ }
}
async listUsers (entity, opts) {
const users = (await libteam.lsUsers(entity, opts)).sort()
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(users, null, 2))
- else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(users.join('\n'))
- else if (!opts.silent && opts.loglevel !== 'silent') {
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
const plural = users.length === 1 ? '' : 's'
const more = users.length === 0 ? '' : ':\n'
this.npm.output(`\n@${entity} has ${users.length} user${plural}${more}`)
@@ -143,11 +137,11 @@ class Team extends BaseCommand {
async listTeams (entity, opts) {
const teams = (await libteam.lsTeams(entity, opts)).sort()
- if (opts.json)
+ if (opts.json) {
this.npm.output(JSON.stringify(teams, null, 2))
- else if (opts.parseable)
+ } else if (opts.parseable) {
this.npm.output(teams.join('\n'))
- else if (!opts.silent && opts.loglevel !== 'silent') {
+ } else if (!opts.silent && opts.loglevel !== 'silent') {
const plural = teams.length === 1 ? '' : 's'
const more = teams.length === 0 ? '' : ':\n'
this.npm.output(`\n@${entity} has ${teams.length} team${plural}${more}`)
diff --git a/deps/npm/lib/commands/test.js b/deps/npm/lib/commands/test.js
index ef4048cafa..2cea8f7d79 100644
--- a/deps/npm/lib/commands/test.js
+++ b/deps/npm/lib/commands/test.js
@@ -2,22 +2,11 @@ const LifecycleCmd = require('../lifecycle-cmd.js')
// This ends up calling run-script(['test', ...args])
class Test extends LifecycleCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Test a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'test'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'ignore-scripts',
- 'script-shell',
- ]
- }
+ static description = 'Test a package'
+ static name = 'test'
+ static params = [
+ 'ignore-scripts',
+ 'script-shell',
+ ]
}
module.exports = Test
diff --git a/deps/npm/lib/commands/token.js b/deps/npm/lib/commands/token.js
index f7b92ea1dd..db23742038 100644
--- a/deps/npm/lib/commands/token.js
+++ b/deps/npm/lib/commands/token.js
@@ -10,50 +10,30 @@ const readUserInfo = require('../utils/read-user-info.js')
const BaseCommand = require('../base-command.js')
class Token extends BaseCommand {
- static get description () {
- return 'Manage your authentication tokens'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'token'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return [
- 'list',
- 'revoke <id|token>',
- 'create [--read-only] [--cidr=list]',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'read-only',
- 'cidr',
- 'registry',
- 'otp',
- ]
- }
+ static description = 'Manage your authentication tokens'
+ static name = 'token'
+ static usage = ['list', 'revoke <id|token>', 'create [--read-only] [--cidr=list]']
+ static params = ['read-only', 'cidr', 'registry', 'otp']
async completion (opts) {
const argv = opts.conf.argv.remain
const subcommands = ['list', 'revoke', 'create']
- if (argv.length === 2)
+ if (argv.length === 2) {
return subcommands
+ }
- if (subcommands.includes(argv[2]))
+ if (subcommands.includes(argv[2])) {
return []
+ }
throw new Error(argv[2] + ' not recognized')
}
async exec (args, cb) {
log.gauge.show('token')
- if (args.length === 0)
+ if (args.length === 0) {
return this.list()
+ }
switch (args[0]) {
case 'list':
case 'ls':
@@ -79,25 +59,26 @@ class Token extends BaseCommand {
return
} else if (conf.parseable) {
this.npm.output(['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t'))
- tokens.forEach((token) => {
- this.npm.output([
- token.key,
- token.token,
- token.created,
- token.readonly ? 'true' : 'false',
- token.cidr_whitelist ? token.cidr_whitelist.join(',') : '',
- ].join('\t'))
+ tokens.forEach(token => {
+ this.npm.output(
+ [
+ token.key,
+ token.token,
+ token.created,
+ token.readonly ? 'true' : 'false',
+ token.cidr_whitelist ? token.cidr_whitelist.join(',') : '',
+ ].join('\t')
+ )
})
return
}
this.generateTokenIds(tokens, 6)
- const idWidth = tokens.reduce((acc, token) =>
- Math.max(acc, token.id.length), 0)
+ const idWidth = tokens.reduce((acc, token) => Math.max(acc, token.id.length), 0)
const table = new Table({
head: ['id', 'token', 'created', 'readonly', 'CIDR whitelist'],
colWidths: [Math.max(idWidth, 2) + 2, 9, 12, 10],
})
- tokens.forEach((token) => {
+ tokens.forEach(token => {
table.push([
token.id,
token.token + '…',
@@ -110,39 +91,47 @@ class Token extends BaseCommand {
}
async rm (args) {
- if (args.length === 0)
+ if (args.length === 0) {
throw this.usageError('`<tokenKey>` argument is required.')
+ }
const conf = this.config()
const toRemove = []
const progress = log.newItem('removing tokens', toRemove.length)
progress.info('token', 'getting existing list')
const tokens = await pulseTillDone.withPromise(profile.listTokens(conf))
- args.forEach((id) => {
- const matches = tokens.filter((token) => token.key.indexOf(id) === 0)
- if (matches.length === 1)
+ args.forEach(id => {
+ const matches = tokens.filter(token => token.key.indexOf(id) === 0)
+ if (matches.length === 1) {
toRemove.push(matches[0].key)
- else if (matches.length > 1)
- throw new Error(`Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm token list\`.`)
- else {
+ } else if (matches.length > 1) {
+ throw new Error(
+ /* eslint-disable-next-line max-len */
+ `Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm token list\`.`
+ )
+ } else {
const tokenMatches = tokens.some(t => id.indexOf(t.token) === 0)
- if (!tokenMatches)
+ if (!tokenMatches) {
throw new Error(`Unknown token id or value "${id}".`)
+ }
toRemove.push(id)
}
})
- await Promise.all(toRemove.map(key => {
- return otplease(conf, conf => {
- return profile.removeToken(key, conf)
+ await Promise.all(
+ toRemove.map(key => {
+ return otplease(conf, conf => {
+ return profile.removeToken(key, conf)
+ })
})
- }))
- if (conf.json)
+ )
+ if (conf.json) {
this.npm.output(JSON.stringify(toRemove))
- else if (conf.parseable)
+ } else if (conf.parseable) {
this.npm.output(toRemove.join('\t'))
- else
+ } else {
this.npm.output('Removed ' + toRemove.length + ' token' + (toRemove.length !== 1 ? 's' : ''))
+ }
}
async create (args) {
@@ -150,34 +139,40 @@ class Token extends BaseCommand {
const cidr = conf.cidr
const readonly = conf.readOnly
- return readUserInfo.password().then((password) => {
- const validCIDR = this.validateCIDRList(cidr)
- log.info('token', 'creating')
- return pulseTillDone.withPromise(otplease(conf, conf => {
- return profile.createToken(password, readonly, validCIDR, conf)
- }))
- }).then((result) => {
- delete result.key
- delete result.updated
- if (conf.json)
- this.npm.output(JSON.stringify(result))
- else if (conf.parseable)
- Object.keys(result).forEach((k) => this.npm.output(k + '\t' + result[k]))
- else {
- const table = new Table()
- for (const k of Object.keys(result))
- table.push({ [ansistyles.bright(k)]: String(result[k]) })
- this.npm.output(table.toString())
- }
- })
+ return readUserInfo
+ .password()
+ .then(password => {
+ const validCIDR = this.validateCIDRList(cidr)
+ log.info('token', 'creating')
+ return pulseTillDone.withPromise(
+ otplease(conf, conf => {
+ return profile.createToken(password, readonly, validCIDR, conf)
+ })
+ )
+ })
+ .then(result => {
+ delete result.key
+ delete result.updated
+ if (conf.json) {
+ this.npm.output(JSON.stringify(result))
+ } else if (conf.parseable) {
+ Object.keys(result).forEach(k => this.npm.output(k + '\t' + result[k]))
+ } else {
+ const table = new Table()
+ for (const k of Object.keys(result)) {
+ table.push({ [ansistyles.bright(k)]: String(result[k]) })
+ }
+ this.npm.output(table.toString())
+ }
+ })
}
config () {
const conf = { ...this.npm.flatOptions }
const creds = this.npm.config.getCredentialsByURI(conf.registry)
- if (creds.token)
+ if (creds.token) {
conf.auth = { token: creds.token }
- else if (creds.username) {
+ } else if (creds.username) {
conf.auth = {
basic: {
username: creds.username,
@@ -192,11 +187,13 @@ class Token extends BaseCommand {
password: auth[1],
},
}
- } else
+ } else {
conf.auth = {}
+ }
- if (conf.otp)
+ if (conf.otp) {
conf.auth.otp = conf.otp
+ }
return conf
}
@@ -209,9 +206,9 @@ class Token extends BaseCommand {
for (const token of tokens) {
token.id = token.key
for (let ii = minLength; ii < token.key.length; ++ii) {
- const match = tokens.some(ot =>
- ot !== token &&
- ot.key.slice(0, ii) === token.key.slice(0, ii))
+ const match = tokens.some(
+ ot => ot !== token && ot.key.slice(0, ii) === token.key.slice(0, ii)
+ )
if (!match) {
token.id = token.key.slice(0, ii)
break
@@ -226,11 +223,15 @@ class Token extends BaseCommand {
const maybeList = cidrs ? (Array.isArray(cidrs) ? cidrs : [cidrs]) : []
const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList
for (const cidr of list) {
- if (isCidrV6(cidr))
- throw this.invalidCIDRError('CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6')
+ if (isCidrV6(cidr)) {
+ throw this.invalidCIDRError(
+ 'CIDR whitelist can only contain IPv4 addresses, ' + cidr + ' is IPv6'
+ )
+ }
- if (!isCidrV4(cidr))
+ if (!isCidrV4(cidr)) {
throw this.invalidCIDRError('CIDR whitelist contains invalid CIDR entry: ' + cidr)
+ }
}
return list
}
diff --git a/deps/npm/lib/commands/uninstall.js b/deps/npm/lib/commands/uninstall.js
index 09b6e47a78..dba45e127a 100644
--- a/deps/npm/lib/commands/uninstall.js
+++ b/deps/npm/lib/commands/uninstall.js
@@ -7,26 +7,13 @@ const completion = require('../utils/completion/installed-shallow.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Uninstall extends ArboristWorkspaceCmd {
- static get description () {
- return 'Remove a package'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'uninstall'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['save', ...super.params]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<@scope>/]<pkg>...']
- }
+ static description = 'Remove a package'
+ static name = 'uninstall'
+ static params = ['save', ...super.params]
+ static usage = ['[<@scope>/]<pkg>...']
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
@@ -39,18 +26,19 @@ class Uninstall extends ArboristWorkspaceCmd {
: this.npm.localPrefix
if (!args.length) {
- if (!global)
+ if (!global) {
throw new Error('Must provide a package name to remove')
- else {
+ } else {
let pkg
try {
pkg = await rpj(resolve(this.npm.localPrefix, 'package.json'))
} catch (er) {
- if (er.code !== 'ENOENT' && er.code !== 'ENOTDIR')
+ if (er.code !== 'ENOENT' && er.code !== 'ENOTDIR') {
throw er
- else
+ } else {
throw this.usageError()
+ }
}
args.push(pkg.name)
diff --git a/deps/npm/lib/commands/unpublish.js b/deps/npm/lib/commands/unpublish.js
index 60ab4a5f9b..3636dc58a6 100644
--- a/deps/npm/lib/commands/unpublish.js
+++ b/deps/npm/lib/commands/unpublish.js
@@ -11,60 +11,52 @@ const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
class Unpublish extends BaseCommand {
- static get description () {
- return 'Remove a package from the registry'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'unpublish'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['dry-run', 'force', 'workspace', 'workspaces']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<@scope>/]<pkg>[@<version>]']
- }
+ static description = 'Remove a package from the registry'
+ static name = 'unpublish'
+ static params = ['dry-run', 'force', 'workspace', 'workspaces']
+ static usage = ['[<@scope>/]<pkg>[@<version>]']
async completion (args) {
const { partialWord, conf } = args
- if (conf.argv.remain.length >= 3)
+ if (conf.argv.remain.length >= 3) {
return []
+ }
const opts = this.npm.flatOptions
const username = await getIdentity(this.npm, { ...opts }).catch(() => null)
- if (!username)
+ if (!username) {
return []
+ }
const access = await libaccess.lsPackages(username, opts)
// do a bit of filtering at this point, so that we don't need
// to fetch versions for more than one thing, but also don't
// accidentally unpublish a whole project
let pkgs = Object.keys(access || {})
- if (!partialWord || !pkgs.length)
+ if (!partialWord || !pkgs.length) {
return pkgs
+ }
const pp = npa(partialWord).name
pkgs = pkgs.filter(p => !p.indexOf(pp))
- if (pkgs.length > 1)
+ if (pkgs.length > 1) {
return pkgs
+ }
const json = await npmFetch.json(npa(pkgs[0]).escapedName, opts)
const versions = Object.keys(json.versions)
- if (!versions.length)
+ if (!versions.length) {
return pkgs
- else
+ } else {
return versions.map(v => `${pkgs[0]}@${v}`)
+ }
}
async exec (args) {
- if (args.length > 1)
+ if (args.length > 1) {
throw this.usageError()
+ }
const spec = args.length && npa(args[0])
const force = this.npm.config.get('force')
@@ -93,10 +85,11 @@ class Unpublish extends BaseCommand {
try {
manifest = await readJson(pkgJson)
} catch (err) {
- if (err && err.code !== 'ENOENT' && err.code !== 'ENOTDIR')
+ if (err && err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {
throw err
- else
+ } else {
throw this.usageError()
+ }
}
this.npm.log.verbose('unpublish', manifest)
@@ -104,19 +97,22 @@ class Unpublish extends BaseCommand {
const { name, version, publishConfig } = manifest
const pkgJsonSpec = npa.resolve(name, version)
const optsWithPub = { ...opts, publishConfig }
- if (!dryRun)
+ if (!dryRun) {
await otplease(opts, opts => libunpub(pkgJsonSpec, optsWithPub))
+ }
pkgName = name
pkgVersion = version ? `@${version}` : ''
} else {
- if (!dryRun)
+ if (!dryRun) {
await otplease(opts, opts => libunpub(spec, opts))
+ }
pkgName = spec.name
pkgVersion = spec.type === 'version' ? `@${spec.rawSpec}` : ''
}
- if (!silent)
+ if (!silent) {
this.npm.output(`- ${pkgName}${pkgVersion}`)
+ }
}
async execWorkspaces (args, filters) {
@@ -130,8 +126,9 @@ class Unpublish extends BaseCommand {
)
}
- for (const name of this.workspaceNames)
+ for (const name of this.workspaceNames) {
await this.exec([name])
+ }
}
}
module.exports = Unpublish
diff --git a/deps/npm/lib/commands/unstar.js b/deps/npm/lib/commands/unstar.js
index 9f7573a9d1..9a64c84317 100644
--- a/deps/npm/lib/commands/unstar.js
+++ b/deps/npm/lib/commands/unstar.js
@@ -1,24 +1,13 @@
const Star = require('./star.js')
class Unstar extends Star {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Remove an item from your favorite packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'unstar'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'registry',
- 'unicode',
- 'otp',
- ]
- }
+ static description = 'Remove an item from your favorite packages'
+ static name = 'unstar'
+ static params = [
+ 'registry',
+ 'unicode',
+ 'otp',
+ ]
async exec (args) {
this.npm.config.set('star.unstar', true)
diff --git a/deps/npm/lib/commands/update.js b/deps/npm/lib/commands/update.js
index 7423cb7943..4bb74990be 100644
--- a/deps/npm/lib/commands/update.js
+++ b/deps/npm/lib/commands/update.js
@@ -8,40 +8,27 @@ const completion = require('../utils/completion/installed-deep.js')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Update extends ArboristWorkspaceCmd {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Update packages'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'update'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'global',
- 'global-style',
- 'legacy-bundling',
- 'strict-peer-deps',
- 'package-lock',
- 'omit',
- 'ignore-scripts',
- 'audit',
- 'bin-links',
- 'fund',
- 'dry-run',
- ...super.params,
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<pkg>...]']
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
+ static description = 'Update packages'
+ static name = 'update'
+ static params = [
+ 'global',
+ 'global-style',
+ 'legacy-bundling',
+ 'strict-peer-deps',
+ 'package-lock',
+ 'omit',
+ 'ignore-scripts',
+ 'audit',
+ 'bin-links',
+ 'fund',
+ 'dry-run',
+ ...super.params,
+ ]
+
+ static usage = ['[<pkg>...]']
+
+ // TODO
+ /* istanbul ignore next */
async completion (opts) {
return completion(this.npm, opts)
}
diff --git a/deps/npm/lib/commands/version.js b/deps/npm/lib/commands/version.js
index 60e1e36f58..8c676b3a76 100644
--- a/deps/npm/lib/commands/version.js
+++ b/deps/npm/lib/commands/version.js
@@ -6,39 +6,32 @@ const readFile = promisify(require('fs').readFile)
const BaseCommand = require('../base-command.js')
class Version extends BaseCommand {
- static get description () {
- return 'Bump a package version'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'version'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'allow-same-version',
- 'commit-hooks',
- 'git-tag-version',
- 'json',
- 'preid',
- 'sign-git-tag',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]']
- }
+ static description = 'Bump a package version'
+ static name = 'version'
+ static params = [
+ 'allow-same-version',
+ 'commit-hooks',
+ 'git-tag-version',
+ 'json',
+ 'preid',
+ 'sign-git-tag',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
+
+ /* eslint-disable-next-line max-len */
+ static usage = ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]']
async completion (opts) {
- const { conf: { argv: { remain } } } = opts
- if (remain.length > 2)
+ const {
+ conf: {
+ argv: { remain },
+ },
+ } = opts
+ if (remain.length > 2) {
return []
+ }
return [
'major',
@@ -104,17 +97,20 @@ class Version extends BaseCommand {
.then(data => JSON.parse(data))
.catch(() => ({}))
- if (pkg.name && pkg.version)
+ if (pkg.name && pkg.version) {
results[pkg.name] = pkg.version
+ }
results.npm = this.npm.version
- for (const [key, version] of Object.entries(process.versions))
+ for (const [key, version] of Object.entries(process.versions)) {
results[key] = version
+ }
- if (this.npm.config.get('json'))
+ if (this.npm.config.get('json')) {
this.npm.output(JSON.stringify(results, null, 2))
- else
+ } else {
this.npm.output(results)
+ }
}
async listWorkspaces (filters) {
@@ -123,11 +119,11 @@ class Version extends BaseCommand {
for (const path of this.workspacePaths) {
const pj = resolve(path, 'package.json')
// setWorkspaces has already parsed package.json so we know it won't error
- const pkg = await readFile(pj, 'utf8')
- .then(data => JSON.parse(data))
+ const pkg = await readFile(pj, 'utf8').then(data => JSON.parse(data))
- if (pkg.name && pkg.version)
+ if (pkg.name && pkg.version) {
results[pkg.name] = pkg.version
+ }
}
return this.list(results)
}
diff --git a/deps/npm/lib/commands/view.js b/deps/npm/lib/commands/view.js
index 24d13cfcfb..105ebc16df 100644
--- a/deps/npm/lib/commands/view.js
+++ b/deps/npm/lib/commands/view.js
@@ -20,30 +20,16 @@ const readJson = async file => jsonParse(await readFile(file, 'utf8'))
const Queryable = require('../utils/queryable.js')
const BaseCommand = require('../base-command.js')
class View extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'View registry info'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return [
- 'json',
- 'workspace',
- 'workspaces',
- 'include-workspace-root',
- ]
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'view'
- }
+ static description = 'View registry info'
+ static name = 'view'
+ static params = [
+ 'json',
+ 'workspace',
+ 'workspaces',
+ 'include-workspace-root',
+ ]
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get usage () {
- return ['[<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]']
- }
+ static usage = ['[<@scope>/]<pkg>[@<version>] [<field>[.subfield]...]']
async completion (opts) {
if (opts.conf.argv.remain.length <= 2) {
@@ -67,44 +53,51 @@ class View extends BaseCommand {
function getFields (d, f, pref) {
f = f || []
- if (!d)
+ if (!d) {
return f
+ }
pref = pref || []
Object.keys(d).forEach((k) => {
- if (k.charAt(0) === '_' || k.indexOf('.') !== -1)
+ if (k.charAt(0) === '_' || k.indexOf('.') !== -1) {
return
+ }
const p = pref.concat(k).join('.')
f.push(p)
if (Array.isArray(d[k])) {
d[k].forEach((val, i) => {
const pi = p + '[' + i + ']'
- if (val && typeof val === 'object')
+ if (val && typeof val === 'object') {
getFields(val, f, [p])
- else
+ } else {
f.push(pi)
+ }
})
return
}
- if (typeof d[k] === 'object')
+ if (typeof d[k] === 'object') {
getFields(d[k], f, [p])
+ }
})
return f
}
}
async exec (args) {
- if (!args.length)
+ if (!args.length) {
args = ['.']
+ }
let pkg = args.shift()
const local = /^\.@/.test(pkg) || pkg === '.'
if (local) {
- if (this.npm.config.get('global'))
+ if (this.npm.config.get('global')) {
throw new Error('Cannot use view command in global mode.')
+ }
const dir = this.npm.prefix
const manifest = await readJson(resolve(dir, 'package.json'))
- if (!manifest.name)
+ if (!manifest.name) {
throw new Error('Invalid package.json, no "name" field')
+ }
// put the version back if it existed
pkg = `${manifest.name}${pkg.slice(1)}`
}
@@ -131,14 +124,16 @@ class View extends BaseCommand {
log.disableProgress()
const msg = await this.jsonData(reducedData, pckmnt._id)
- if (msg !== '')
+ if (msg !== '') {
console.log(msg)
+ }
}
}
async execWorkspaces (args, filters) {
- if (!args.length)
+ if (!args.length) {
args = ['.']
+ }
const pkg = args.shift()
@@ -166,22 +161,25 @@ class View extends BaseCommand {
}
if (!this.npm.config.get('json')) {
- if (wholePackument)
+ if (wholePackument) {
data.map((v) => this.prettyView(pckmnt, v[Object.keys(v)[0]]['']))
- else {
+ } else {
console.log(`${name}:`)
const msg = await this.jsonData(reducedData, pckmnt._id)
- if (msg !== '')
+ if (msg !== '') {
console.log(msg)
+ }
}
} else {
const msg = await this.jsonData(reducedData, pckmnt._id)
- if (msg !== '')
+ if (msg !== '') {
results[name] = JSON.parse(msg)
+ }
}
}
- if (Object.keys(results).length > 0)
+ if (Object.keys(results).length > 0) {
console.log(JSON.stringify(results, null, 2))
+ }
}
async getData (pkg, args) {
@@ -196,13 +194,15 @@ class View extends BaseCommand {
// get the data about this package
let version = this.npm.config.get('tag')
// rawSpec is the git url if this is from git
- if (spec.type !== 'git' && spec.rawSpec)
+ if (spec.type !== 'git' && spec.rawSpec) {
version = spec.rawSpec
+ }
const pckmnt = await packument(spec, opts)
- if (pckmnt['dist-tags'] && pckmnt['dist-tags'][version])
+ if (pckmnt['dist-tags'] && pckmnt['dist-tags'][version]) {
version = pckmnt['dist-tags'][version]
+ }
if (pckmnt.time && pckmnt.time.unpublished) {
const u = pckmnt.time.unpublished
@@ -218,15 +218,17 @@ class View extends BaseCommand {
pckmnt.versions = Object.keys(versions).sort(semver.compareLoose)
// remove readme unless we asked for it
- if (args.indexOf('readme') === -1)
+ if (args.indexOf('readme') === -1) {
delete pckmnt.readme
+ }
Object.keys(versions).forEach((v) => {
if (semver.satisfies(v, version, true)) {
args.forEach(arg => {
// remove readme unless we asked for it
- if (args.indexOf('readme') !== -1)
+ if (args.indexOf('readme') !== -1) {
delete versions[v].readme
+ }
data.push(showFields(pckmnt, versions[v], arg))
})
@@ -237,8 +239,9 @@ class View extends BaseCommand {
!this.npm.config.get('json') &&
args.length === 1 &&
args[0] === ''
- )
+ ) {
pckmnt.version = version
+ }
return [pckmnt, data]
}
@@ -254,17 +257,19 @@ class View extends BaseCommand {
versions.forEach((v) => {
const fields = Object.keys(data[v])
includeFields = includeFields || (fields.length > 1)
- if (json)
+ if (json) {
msgJson.push({})
+ }
fields.forEach((f) => {
let d = cleanup(data[v][f])
- if (fields.length === 1 && json)
+ if (fields.length === 1 && json) {
msgJson[msgJson.length - 1][f] = d
+ }
if (includeVersions || includeFields || typeof d !== 'string') {
- if (json)
+ if (json) {
msgJson[msgJson.length - 1][f] = d
- else {
+ } else {
d = inspect(d, {
showHidden: false,
depth: 5,
@@ -272,12 +277,14 @@ class View extends BaseCommand {
maxArrayLength: null,
})
}
- } else if (typeof d === 'string' && json)
+ } else if (typeof d === 'string' && json) {
d = JSON.stringify(d)
+ }
if (!json) {
- if (f && includeFields)
+ if (f && includeFields) {
f += ' = '
+ }
msg += (includeVersions ? name + '@' + v + ' ' : '') +
(includeFields ? f : '') + d + '\n'
}
@@ -289,10 +296,11 @@ class View extends BaseCommand {
const k = Object.keys(msgJson[0])[0]
msgJson = msgJson.map(m => m[k])
}
- if (msgJson.length === 1)
+ if (msgJson.length === 1) {
msg = JSON.stringify(msgJson[0], null, 2) + '\n'
- else if (msgJson.length > 1)
+ } else if (msgJson.length > 1) {
msg = JSON.stringify(msgJson, null, 2) + '\n'
+ }
}
return msg.trim()
@@ -351,10 +359,11 @@ class View extends BaseCommand {
manifest.dist.fileCount && color.yellow(manifest.dist.fileCount),
unpackedSize: unpackedSize && color.yellow(unpackedSize),
}
- if (info.license.toLowerCase().trim() === 'proprietary')
+ if (info.license.toLowerCase().trim() === 'proprietary') {
info.license = style.bright(color.red(info.license))
- else
+ } else {
info.license = color.green(info.license)
+ }
console.log('')
console.log(
@@ -364,8 +373,9 @@ class View extends BaseCommand {
' | versions: ' + info.versions
)
info.description && console.log(info.description)
- if (info.repo || info.site)
+ if (info.repo || info.site) {
info.site && console.log(color.cyan(info.site))
+ }
const warningSign = unicode ? ' ⚠️ ' : '!!'
info.deprecated && console.log(
@@ -396,8 +406,9 @@ class View extends BaseCommand {
console.log('')
console.log('dependencies:')
console.log(columns(info.deps.slice(0, maxDeps), { padding: 1 }))
- if (info.deps.length > maxDeps)
+ if (info.deps.length > maxDeps) {
console.log(`(...and ${info.deps.length - maxDeps} more.)`)
+ }
}
if (info.maintainers && info.maintainers.length) {
@@ -412,10 +423,12 @@ class View extends BaseCommand {
if (info.publisher || info.modified) {
let publishInfo = 'published'
- if (info.modified)
+ if (info.modified) {
publishInfo += ` ${info.modified}`
- if (info.publisher)
+ }
+ if (info.publisher) {
publishInfo += ` by ${info.publisher}`
+ }
console.log('')
console.log(publishInfo)
}
@@ -458,24 +471,28 @@ function showFields (data, version, fields) {
const s = queryable.query(fields)
const res = { [version.version]: s }
- if (s)
+ if (s) {
return res
+ }
}
function cleanup (data) {
- if (Array.isArray(data))
+ if (Array.isArray(data)) {
return data.map(cleanup)
+ }
- if (!data || typeof data !== 'object')
+ if (!data || typeof data !== 'object') {
return data
+ }
const keys = Object.keys(data)
if (keys.length <= 3 &&
data.name &&
(keys.length === 1 ||
(keys.length === 3 && data.email && data.url) ||
- (keys.length === 2 && (data.email || data.url))))
+ (keys.length === 2 && (data.email || data.url)))) {
data = unparsePerson(data)
+ }
return data
}
diff --git a/deps/npm/lib/commands/whoami.js b/deps/npm/lib/commands/whoami.js
index 6b6f43f016..dbf32c0e73 100644
--- a/deps/npm/lib/commands/whoami.js
+++ b/deps/npm/lib/commands/whoami.js
@@ -2,20 +2,9 @@ const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
class Whoami extends BaseCommand {
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get description () {
- return 'Display npm username'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get name () {
- return 'whoami'
- }
-
- /* istanbul ignore next - see test/lib/load-all-commands.js */
- static get params () {
- return ['registry']
- }
+ static description = 'Display npm username'
+ static name = 'whoami'
+ static params = ['registry']
async exec (args) {
const username = await getIdentity(this.npm, this.npm.flatOptions)
diff --git a/deps/npm/lib/lifecycle-cmd.js b/deps/npm/lib/lifecycle-cmd.js
index a00d58334d..e2190c2de1 100644
--- a/deps/npm/lib/lifecycle-cmd.js
+++ b/deps/npm/lib/lifecycle-cmd.js
@@ -3,9 +3,7 @@
const BaseCommand = require('./base-command.js')
class LifecycleCmd extends BaseCommand {
- static get usage () {
- return ['[-- <args>]']
- }
+ static usage = ['[-- <args>]']
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 4b7b3440ff..ecc7f0a7de 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -14,18 +14,19 @@ const timers = new Map()
// Finished timers
const timings = {}
-const processOnTimeHandler = (name) => {
+const processOnTimeHandler = name => {
timers.set(name, Date.now())
}
-const processOnTimeEndHandler = (name) => {
+const processOnTimeEndHandler = name => {
if (timers.has(name)) {
const ms = Date.now() - timers.get(name)
log.timing(name, `Completed in ${ms}ms`)
timings[name] = ms
timers.delete(name)
- } else
+ } else {
log.silly('timing', "Tried to end timer that doesn't exist:", name)
+ }
}
const { definitions, flatten, shorthands } = require('./utils/config/index.js')
@@ -113,17 +114,23 @@ class Npm extends EventEmitter {
// Options are prefixed by a hyphen-minus (-, \u2d).
// Other dash-type chars look similar but are invalid.
if (!warnedNonDashArg) {
- args.filter(arg => /^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(arg))
+ args
+ .filter(arg => /^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(arg))
.forEach(arg => {
warnedNonDashArg = true
- this.log.error('arg', 'Argument starts with non-ascii dash, this is probably invalid:', arg)
+ this.log.error(
+ 'arg',
+ 'Argument starts with non-ascii dash, this is probably invalid:',
+ arg
+ )
})
}
const workspacesEnabled = this.config.get('workspaces')
const workspacesFilters = this.config.get('workspace')
- if (workspacesEnabled === false && workspacesFilters.length > 0)
+ if (workspacesEnabled === false && workspacesFilters.length > 0) {
throw new Error('Can not use --no-workspaces and --workspace at the same time')
+ }
const filterByWorkspaces = workspacesEnabled || workspacesFilters.length > 0
// normally this would go in the constructor, but our tests don't
@@ -141,8 +148,9 @@ class Npm extends EventEmitter {
return
}
if (filterByWorkspaces) {
- if (this.config.get('global'))
+ if (this.config.get('global')) {
throw new Error('Workspaces not supported for global packages')
+ }
return command.execWorkspaces(args, this.config.get('workspace')).finally(() => {
process.emit('timeEnd', `command:${cmd}`)
@@ -159,16 +167,20 @@ class Npm extends EventEmitter {
process.emit('time', 'npm:load')
this.log.pause()
this.loadPromise = new Promise((resolve, reject) => {
- this[_load]().catch(er => er).then((er) => {
- this.loadErr = er
- if (!er && this.config.get('force'))
- this.log.warn('using --force', 'Recommended protections disabled.')
-
- process.emit('timeEnd', 'npm:load')
- if (er)
- return reject(er)
- resolve()
- })
+ this[_load]()
+ .catch(er => er)
+ .then(er => {
+ this.loadErr = er
+ if (!er && this.config.get('force')) {
+ this.log.warn('using --force', 'Recommended protections disabled.')
+ }
+
+ process.emit('timeEnd', 'npm:load')
+ if (er) {
+ return reject(er)
+ }
+ resolve()
+ })
})
}
return this.loadPromise
@@ -215,7 +227,8 @@ class Npm extends EventEmitter {
// 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] ? ' ***' : '')
+ this.title = tokrev
+ ? 'npm token revoke' + (this.argv[2] ? ' ***' : '')
: ['npm', ...this.argv].join(' ')
process.emit('timeEnd', 'npm:load:setTitle')
@@ -232,20 +245,21 @@ class Npm extends EventEmitter {
process.emit('time', 'npm:load:configScope')
const configScope = this.config.get('scope')
- if (configScope && !/^@/.test(configScope))
+ if (configScope && !/^@/.test(configScope)) {
this.config.set('scope', `@${configScope}`, this.config.find('scope'))
+ }
process.emit('timeEnd', 'npm:load:configScope')
process.emit('time', 'npm:load:projectScope')
- this.projectScope = this.config.get('scope') ||
- getProjectScope(this.prefix)
+ this.projectScope = this.config.get('scope') || getProjectScope(this.prefix)
process.emit('timeEnd', 'npm:load:projectScope')
}
get flatOptions () {
const { flat } = this.config
- if (this.command)
+ if (this.command) {
flat.npmCommand = this.command
+ }
return flat
}
@@ -298,7 +312,7 @@ class Npm extends EventEmitter {
}
get dir () {
- return (this.config.get('global')) ? this.globalDir : this.localDir
+ return this.config.get('global') ? this.globalDir : this.localDir
}
get globalBin () {
diff --git a/deps/npm/lib/search/format-package-stream.js b/deps/npm/lib/search/format-package-stream.js
index fb7d81856d..7ff44e9e20 100644
--- a/deps/npm/lib/search/format-package-stream.js
+++ b/deps/npm/lib/search/format-package-stream.js
@@ -31,8 +31,9 @@ class JSONOutputStream extends Minipass {
if (!this._didFirst) {
super.write('[\n')
this._didFirst = true
- } else
+ } else {
super.write('\n,\n')
+ }
try {
return super.write(JSON.stringify(obj))
@@ -93,8 +94,9 @@ function prettify (data, num, opts) {
}
)
output = trimToMaxWidth(output)
- if (opts.color)
+ if (opts.color) {
output = highlightSearchTerms(output, opts.args)
+ }
return output
}
diff --git a/deps/npm/lib/search/package-filter.js b/deps/npm/lib/search/package-filter.js
index 2e7d8e82ae..45a67835b8 100644
--- a/deps/npm/lib/search/package-filter.js
+++ b/deps/npm/lib/search/package-filter.js
@@ -19,13 +19,15 @@ function getWords (data, opts) {
function filterWords (data, include, exclude, opts) {
var words = getWords(data, opts)
for (var i = 0, l = include.length; i < l; i++) {
- if (!match(words, include[i]))
+ if (!match(words, include[i])) {
return false
+ }
}
for (i = 0, l = exclude.length; i < l; i++) {
- if (match(words, exclude[i]))
+ if (match(words, exclude[i])) {
return false
+ }
}
return true
diff --git a/deps/npm/lib/utils/audit-error.js b/deps/npm/lib/utils/audit-error.js
index c58c1d16e6..b4ab26fd0c 100644
--- a/deps/npm/lib/utils/audit-error.js
+++ b/deps/npm/lib/utils/audit-error.js
@@ -4,11 +4,13 @@
// returns 'true' if there was an error, false otherwise
const auditError = (npm, report) => {
- if (!report || !report.error)
+ if (!report || !report.error) {
return false
+ }
- if (npm.command !== 'audit')
+ if (npm.command !== 'audit') {
return true
+ }
const { error } = report
@@ -25,8 +27,9 @@ const auditError = (npm, report) => {
statusCode: error.statusCode,
body,
}, null, 2))
- } else
+ } else {
npm.output(body)
+ }
throw 'audit endpoint returned an error'
}
diff --git a/deps/npm/lib/utils/cleanup-log-files.js b/deps/npm/lib/utils/cleanup-log-files.js
index 13d1e50da8..8fb0fa1550 100644
--- a/deps/npm/lib/utils/cleanup-log-files.js
+++ b/deps/npm/lib/utils/cleanup-log-files.js
@@ -8,23 +8,26 @@ const { resolve } = require('path')
const rimraf = require('rimraf')
const glob = require('glob')
module.exports = (cache, max, warn) => {
- /* eslint-disable promise/param-names */
return new Promise(done => {
glob(resolve(cache, '_logs', '*-debug.log'), (er, files) => {
- if (er)
+ if (er) {
return done()
+ }
let pending = files.length - max
- if (pending <= 0)
+ if (pending <= 0) {
return done()
+ }
for (let i = 0; i < files.length - max; i++) {
- rimraf(files[i], (er) => {
- if (er)
+ rimraf(files[i], er => {
+ if (er) {
warn('log', 'failed to remove log file', files[i])
+ }
- if (--pending === 0)
+ if (--pending === 0) {
done()
+ }
})
}
})
diff --git a/deps/npm/lib/utils/completion/installed-deep.js b/deps/npm/lib/utils/completion/installed-deep.js
index 62686f9b2d..7098d81fe7 100644
--- a/deps/npm/lib/utils/completion/installed-deep.js
+++ b/deps/npm/lib/utils/completion/installed-deep.js
@@ -27,14 +27,16 @@ const installedDeep = async (npm) => {
})
const gTree = await gArb.loadActual({ global: true })
- for (const node of getValues(gTree))
+ for (const node of getValues(gTree)) {
res.add(global ? node.name : [node.name, '-g'])
+ }
if (!global) {
const arb = new Arborist({ global: false, path: prefix, workspacesEnabled })
const tree = await arb.loadActual()
- for (const node of getValues(tree))
+ for (const node of getValues(tree)) {
res.add(node.name)
+ }
}
return [...res]
diff --git a/deps/npm/lib/utils/completion/installed-shallow.js b/deps/npm/lib/utils/completion/installed-shallow.js
index 1c9b8ef5ac..686c95e632 100644
--- a/deps/npm/lib/utils/completion/installed-shallow.js
+++ b/deps/npm/lib/utils/completion/installed-shallow.js
@@ -4,8 +4,9 @@ const readdir = promisify(require('readdir-scoped-modules'))
const installedShallow = async (npm, opts) => {
const names = global => readdir(global ? npm.globalDir : npm.localDir)
const { conf: { argv: { remain } } } = opts
- if (remain.length > 3)
+ if (remain.length > 3) {
return null
+ }
const { global } = npm.flatOptions
const locals = global ? [] : await names(false)
diff --git a/deps/npm/lib/utils/config/definition.js b/deps/npm/lib/utils/config/definition.js
index 1354851326..fc46bc3d6a 100644
--- a/deps/npm/lib/utils/config/definition.js
+++ b/deps/npm/lib/utils/config/definition.js
@@ -6,12 +6,7 @@
// say "these are for registry access", "these are for
// version resolution" etc.
-const required = [
- 'type',
- 'description',
- 'default',
- 'key',
-]
+const required = ['type', 'description', 'default', 'key']
const allowed = [
'default',
@@ -44,42 +39,50 @@ class Definition {
this.envExport = true
Object.assign(this, def)
this.validate()
- if (!this.defaultDescription)
+ if (!this.defaultDescription) {
this.defaultDescription = describeValue(this.default)
- if (!this.typeDescription)
+ }
+ if (!this.typeDescription) {
this.typeDescription = describeType(this.type)
+ }
// hint is only used for non-boolean values
if (!this.hint) {
- if (this.type === Number)
+ if (this.type === Number) {
this.hint = '<number>'
- else
+ } else {
this.hint = `<${this.key}>`
+ }
}
- if (!this.usage)
+ if (!this.usage) {
this.usage = describeUsage(this)
+ }
}
validate () {
for (const req of required) {
- if (!Object.prototype.hasOwnProperty.call(this, req))
+ if (!Object.prototype.hasOwnProperty.call(this, req)) {
throw new Error(`config lacks ${req}: ${this.key}`)
+ }
}
- if (!this.key)
+ if (!this.key) {
throw new Error(`config lacks key: ${this.key}`)
+ }
for (const field of Object.keys(this)) {
- if (!allowed.includes(field))
+ if (!allowed.includes(field)) {
throw new Error(`config defines unknown field ${field}: ${this.key}`)
+ }
}
}
// a textual description of this config, suitable for help output
describe () {
const description = unindent(this.description)
- const noEnvExport = this.envExport ? '' : `
+ const noEnvExport = this.envExport
+ ? ''
+ : `
This value is not exported to the environment for child processes.
`
- const deprecated = !this.deprecated ? ''
- : `* DEPRECATED: ${unindent(this.deprecated)}\n`
+ const deprecated = !this.deprecated ? '' : `* DEPRECATED: ${unindent(this.deprecated)}\n`
return wrapAll(`#### \`${this.key}\`
* Default: ${unindent(this.defaultDescription)}
@@ -90,28 +93,32 @@ ${noEnvExport}`)
}
}
-const describeUsage = (def) => {
+const describeUsage = def => {
let key = ''
// Single type
if (!Array.isArray(def.type)) {
- if (def.short)
+ if (def.short) {
key = `-${def.short}|`
+ }
- if (def.type === Boolean && def.default !== false)
+ if (def.type === Boolean && def.default !== false) {
key = `${key}--no-${def.key}`
- else
+ } else {
key = `${key}--${def.key}`
+ }
- if (def.type !== Boolean)
+ if (def.type !== Boolean) {
key = `${key} ${def.hint}`
+ }
return key
}
key = `--${def.key}`
- if (def.short)
+ if (def.short) {
key = `-${def.short}|--${def.key}`
+ }
// Multiple types
let types = def.type
@@ -122,14 +129,15 @@ const describeUsage = (def) => {
// all non-optional params have defaults so we render everything as optional
types = types.filter(t => t !== null && t !== Array && t !== Boolean)
- if (!types.length)
+ if (!types.length) {
return key
+ }
let description
- if (!types.some(t => typeof t !== 'string'))
+ if (!types.some(t => typeof t !== 'string')) {
// Specific values, use specifics given
description = `<${types.filter(d => d).join('|')}>`
- else {
+ } else {
// Generic values, use hint
description = def.hint
}
@@ -142,17 +150,16 @@ const describeUsage = (def) => {
}
const usage = `${key} ${description}`
- if (multiple)
+ if (multiple) {
return `${usage} [${usage} ...]`
- else
+ } else {
return usage
+ }
}
const describeType = type => {
if (Array.isArray(type)) {
- const descriptions = type
- .filter(t => t !== Array)
- .map(t => describeType(t))
+ const descriptions = type.filter(t => t !== Array).map(t => describeType(t))
// [a] => "a"
// [a, b] => "a or b"
@@ -162,8 +169,7 @@ const describeType = type => {
const last = descriptions.length > 1 ? [descriptions.pop()] : []
const oxford = descriptions.length > 1 ? ', or ' : ' or '
const words = [descriptions.join(', ')].concat(last).join(oxford)
- const multiple = type.includes(Array) ? ' (can be set multiple times)'
- : ''
+ const multiple = type.includes(Array) ? ' (can be set multiple times)' : ''
return `${words}${multiple}`
}
@@ -193,8 +199,7 @@ const describeType = type => {
}
// if it's a string, quote it. otherwise, just cast to string.
-const describeValue = val =>
- typeof val === 'string' ? JSON.stringify(val) : String(val)
+const describeValue = val => (typeof val === 'string' ? JSON.stringify(val) : String(val))
const unindent = s => {
// get the first \n followed by a bunch of spaces, and pluck off
@@ -203,30 +208,44 @@ const unindent = s => {
return !match ? s.trim() : s.split(match[0]).join('\n').trim()
}
-const wrap = (s) => {
+const wrap = s => {
const cols = Math.min(Math.max(20, process.stdout.columns) || 80, 80) - 5
- return unindent(s).split(/[ \n]+/).reduce((left, right) => {
- const last = left.split('\n').pop()
- const join = last.length && last.length + right.length > cols ? '\n' : ' '
- return left + join + right
- })
+ return unindent(s)
+ .split(/[ \n]+/)
+ .reduce((left, right) => {
+ const last = left.split('\n').pop()
+ const join = last.length && last.length + right.length > cols ? '\n' : ' '
+ return left + join + right
+ })
}
const wrapAll = s => {
let inCodeBlock = false
- return s.split('\n\n').map(block => {
- if (inCodeBlock || block.startsWith('```')) {
- inCodeBlock = !block.endsWith('```')
- return block
- }
-
- if (block.charAt(0) === '*') {
- return '* ' + block.substr(1).trim().split('\n* ').map(li => {
- return wrap(li).replace(/\n/g, '\n ')
- }).join('\n* ')
- } else
- return wrap(block)
- }).join('\n\n')
+ return s
+ .split('\n\n')
+ .map(block => {
+ if (inCodeBlock || block.startsWith('```')) {
+ inCodeBlock = !block.endsWith('```')
+ return block
+ }
+
+ if (block.charAt(0) === '*') {
+ return (
+ '* ' +
+ block
+ .substr(1)
+ .trim()
+ .split('\n* ')
+ .map(li => {
+ return wrap(li).replace(/\n/g, '\n ')
+ })
+ .join('\n* ')
+ )
+ } else {
+ return wrap(block)
+ }
+ })
+ .join('\n\n')
}
module.exports = Definition
diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js
index a725ee0fa1..b47a46de85 100644
--- a/deps/npm/lib/utils/config/definitions.js
+++ b/deps/npm/lib/utils/config/definitions.js
@@ -16,8 +16,9 @@ const maybeReadFile = file => {
try {
return fs.readFileSync(file, 'utf8')
} catch (er) {
- if (er.code !== 'ENOENT')
+ if (er.code !== 'ENOENT') {
throw er
+ }
return null
}
}
@@ -27,27 +28,32 @@ const buildOmitList = obj => {
const omit = obj.omit || []
const only = obj.only
- if (/^prod(uction)?$/.test(only) || obj.production)
+ if (/^prod(uction)?$/.test(only) || obj.production) {
omit.push('dev')
- else if (obj.production === false)
+ } else if (obj.production === false) {
include.push('dev')
+ }
- if (/^dev/.test(obj.also))
+ if (/^dev/.test(obj.also)) {
include.push('dev')
+ }
- if (obj.dev)
+ if (obj.dev) {
include.push('dev')
+ }
- if (obj.optional === false)
+ if (obj.optional === false) {
omit.push('optional')
- else if (obj.optional === true)
+ } else if (obj.optional === true) {
include.push('optional')
+ }
obj.omit = [...new Set(omit)].filter(type => !include.includes(type))
obj.include = [...new Set(include)]
- if (obj.omit.includes('dev'))
+ if (obj.omit.includes('dev')) {
process.env.NODE_ENV = 'production'
+ }
return obj.omit
}
@@ -98,8 +104,9 @@ const {
const define = (key, def) => {
/* istanbul ignore if - this should never happen, prevents mistakes below */
- if (definitions[key])
+ if (definitions[key]) {
throw new Error(`defining key more than once: ${key}`)
+ }
definitions[key] = new Definition(key, def)
}
@@ -342,8 +349,9 @@ define('cache-max', {
This option has been deprecated in favor of \`--prefer-online\`
`,
flatten (key, obj, flatOptions) {
- if (obj[key] <= 0)
+ if (obj[key] <= 0) {
flatOptions.preferOnline = true
+ }
},
})
@@ -357,8 +365,9 @@ define('cache-min', {
This option has been deprecated in favor of \`--prefer-offline\`.
`,
flatten (key, obj, flatOptions) {
- if (obj[key] >= 9999)
+ if (obj[key] >= 9999) {
flatOptions.preferOffline = true
+ }
},
})
@@ -372,12 +381,14 @@ define('cafile', {
`,
flatten (key, obj, flatOptions) {
// always set to null in defaults
- if (!obj.cafile)
+ if (!obj.cafile) {
return
+ }
const raw = maybeReadFile(obj.cafile)
- if (!raw)
+ if (!raw) {
return
+ }
const delim = '-----END CERTIFICATE-----'
flatOptions.ca = raw.replace(/\r\n/g, '\n').split(delim)
@@ -806,8 +817,9 @@ define('global', {
`,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
- if (flatOptions.global)
+ if (flatOptions.global) {
flatOptions.location = 'global'
+ }
},
})
@@ -1150,8 +1162,9 @@ define('location', {
`,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
- if (flatOptions.global)
+ if (flatOptions.global) {
flatOptions.location = 'global'
+ }
},
})
@@ -1281,10 +1294,11 @@ define('noproxy', {
Also accepts a comma-delimited string.
`,
flatten (key, obj, flatOptions) {
- if (Array.isArray(obj[key]))
+ if (Array.isArray(obj[key])) {
flatOptions.noProxy = obj[key].join(',')
- else
+ } else {
flatOptions.noProxy = obj[key]
+ }
},
})
@@ -1403,8 +1417,9 @@ define('package-lock', {
`,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
- if (flatOptions.packageLockOnly)
+ if (flatOptions.packageLockOnly) {
flatOptions.packageLock = true
+ }
},
})
@@ -1423,8 +1438,9 @@ define('package-lock-only', {
`,
flatten: (key, obj, flatOptions) => {
flatten(key, obj, flatOptions)
- if (flatOptions.packageLockOnly)
+ if (flatOptions.packageLockOnly) {
flatOptions.packageLock = true
+ }
},
})
@@ -1607,8 +1623,9 @@ define('save-dev', {
`,
flatten (key, obj, flatOptions) {
if (!obj[key]) {
- if (flatOptions.saveType === 'dev')
+ if (flatOptions.saveType === 'dev') {
delete flatOptions.saveType
+ }
return
}
@@ -1640,20 +1657,23 @@ define('save-optional', {
`,
flatten (key, obj, flatOptions) {
if (!obj[key]) {
- if (flatOptions.saveType === 'optional')
+ if (flatOptions.saveType === 'optional') {
delete flatOptions.saveType
- else if (flatOptions.saveType === 'peerOptional')
+ } else if (flatOptions.saveType === 'peerOptional') {
flatOptions.saveType = 'peer'
+ }
return
}
- if (flatOptions.saveType === 'peerOptional')
+ if (flatOptions.saveType === 'peerOptional') {
return
+ }
- if (flatOptions.saveType === 'peer')
+ if (flatOptions.saveType === 'peer') {
flatOptions.saveType = 'peerOptional'
- else
+ } else {
flatOptions.saveType = 'optional'
+ }
},
})
@@ -1665,20 +1685,23 @@ define('save-peer', {
`,
flatten (key, obj, flatOptions) {
if (!obj[key]) {
- if (flatOptions.saveType === 'peer')
+ if (flatOptions.saveType === 'peer') {
delete flatOptions.saveType
- else if (flatOptions.saveType === 'peerOptional')
+ } else if (flatOptions.saveType === 'peerOptional') {
flatOptions.saveType = 'optional'
+ }
return
}
- if (flatOptions.saveType === 'peerOptional')
+ if (flatOptions.saveType === 'peerOptional') {
return
+ }
- if (flatOptions.saveType === 'optional')
+ if (flatOptions.saveType === 'optional') {
flatOptions.saveType = 'peerOptional'
- else
+ } else {
flatOptions.saveType = 'peer'
+ }
},
})
@@ -1715,8 +1738,9 @@ define('save-prod', {
`,
flatten (key, obj, flatOptions) {
if (!obj[key]) {
- if (flatOptions.saveType === 'prod')
+ if (flatOptions.saveType === 'prod') {
delete flatOptions.saveType
+ }
return
}
@@ -2085,8 +2109,9 @@ define('user-agent', {
const value = obj[key]
const ciName = obj['ci-name']
let inWorkspaces = false
- if (obj.workspaces || obj.workspace && obj.workspace.length)
+ if (obj.workspaces || obj.workspace && obj.workspace.length) {
inWorkspaces = true
+ }
flatOptions.userAgent =
value.replace(/\{node-version\}/gi, obj['node-version'])
.replace(/\{npm-version\}/gi, obj['npm-version'])
diff --git a/deps/npm/lib/utils/config/describe-all.js b/deps/npm/lib/utils/config/describe-all.js
index 23a10ae977..39f8d5fe4d 100644
--- a/deps/npm/lib/utils/config/describe-all.js
+++ b/deps/npm/lib/utils/config/describe-all.js
@@ -5,7 +5,7 @@ const describeAll = () => {
/* istanbul ignore next - typically already sorted in the definitions file,
* but this is here so that our help doc will stay consistent if we decide
* to move them around. */
- const sort = ([keya, {deprecated: depa}], [keyb, {deprecated: depb}]) => {
+ const sort = ([keya, { deprecated: depa }], [keyb, { deprecated: depb }]) => {
return depa && !depb ? 1
: !depa && depb ? -1
: localeCompare(keya, keyb)
diff --git a/deps/npm/lib/utils/config/flatten.js b/deps/npm/lib/utils/config/flatten.js
index f6d6124bdd..588d05bf0d 100644
--- a/deps/npm/lib/utils/config/flatten.js
+++ b/deps/npm/lib/utils/config/flatten.js
@@ -11,10 +11,11 @@ const definitions = require('./definitions.js')
const flatten = (obj, flat = {}) => {
for (const [key, val] of Object.entries(obj)) {
const def = definitions[key]
- if (def && def.flatten)
+ if (def && def.flatten) {
def.flatten(key, obj, flat)
- else if (/@.*:registry$/i.test(key) || /^\/\//.test(key))
+ } else if (/@.*:registry$/i.test(key) || /^\/\//.test(key)) {
flat[key] = val
+ }
}
// XXX make this the bin/npm-cli.js file explicitly instead
diff --git a/deps/npm/lib/utils/config/index.js b/deps/npm/lib/utils/config/index.js
index a24f586524..d8706d50c6 100644
--- a/deps/npm/lib/utils/config/index.js
+++ b/deps/npm/lib/utils/config/index.js
@@ -27,12 +27,14 @@ const shorthands = {
reg: ['--registry'],
}
-for (const [key, {short}] of Object.entries(definitions)) {
- if (!short)
+for (const [key, { short }] of Object.entries(definitions)) {
+ if (!short) {
continue
+ }
// can be either an array or string
- for (const s of [].concat(short))
+ for (const s of [].concat(short)) {
shorthands[s] = [`--${key}`]
+ }
}
module.exports = {
diff --git a/deps/npm/lib/utils/deref-command.js b/deps/npm/lib/utils/deref-command.js
index f45c2627e4..dd89fb5a4f 100644
--- a/deps/npm/lib/utils/deref-command.js
+++ b/deps/npm/lib/utils/deref-command.js
@@ -7,21 +7,25 @@ const abbrev = require('abbrev')
const abbrevs = abbrev(fullList)
module.exports = c => {
- if (!c || typeof c !== 'string')
+ if (!c || typeof c !== 'string') {
return ''
+ }
- if (c.match(/[A-Z]/))
+ if (c.match(/[A-Z]/)) {
c = c.replace(/([A-Z])/g, m => '-' + m.toLowerCase())
+ }
- if (plumbing.indexOf(c) !== -1)
+ 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])
+ while (aliases[a]) {
a = aliases[a]
+ }
return a || ''
}
diff --git a/deps/npm/lib/utils/did-you-mean.js b/deps/npm/lib/utils/did-you-mean.js
index 9530483098..b859abaaf5 100644
--- a/deps/npm/lib/utils/did-you-mean.js
+++ b/deps/npm/lib/utils/did-you-mean.js
@@ -4,8 +4,7 @@ const { cmdList } = require('./cmd-list.js')
const didYouMean = async (npm, path, scmd) => {
// const cmd = await npm.cmd(str)
- const close = cmdList
- .filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd)
+ const close = cmdList.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd)
let best = []
for (const str of close) {
const cmd = await npm.cmd(str)
@@ -17,22 +16,25 @@ const didYouMean = async (npm, path, scmd) => {
const { bin, scripts } = await readJson(`${path}/package.json`)
best = best.concat(
Object.keys(scripts || {})
- .filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
- !runScripts.includes(cmd))
+ .filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && !runScripts.includes(cmd))
.map(str => ` npm run ${str} # run the "${str}" package script`),
Object.keys(bin || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
+ /* eslint-disable-next-line max-len */
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)
)
} catch (_) {
// gracefully ignore not being in a folder w/ a package.json
}
- if (best.length === 0)
+ if (best.length === 0) {
return ''
+ }
- const suggestion = best.length === 1 ? `\n\nDid you mean this?\n${best[0]}`
- : `\n\nDid you mean one of these?\n${best.slice(0, 3).join('\n')}`
+ const suggestion =
+ best.length === 1
+ ? `\n\nDid you mean this?\n${best[0]}`
+ : `\n\nDid you mean one of these?\n${best.slice(0, 3).join('\n')}`
return suggestion
}
module.exports = didYouMean
diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js
index 9343d37d54..48ad4676f4 100644
--- a/deps/npm/lib/utils/error-message.js
+++ b/deps/npm/lib/utils/error-message.js
@@ -9,10 +9,12 @@ module.exports = (er, npm) => {
const short = []
const detail = []
- if (er.message)
+ if (er.message) {
er.message = replaceInfo(er.message)
- if (er.stack)
+ }
+ if (er.stack) {
er.stack = replaceInfo(er.stack)
+ }
switch (er.code) {
case 'ERESOLVE':
@@ -46,10 +48,14 @@ module.exports = (er, npm) => {
case 'EACCES':
case 'EPERM': {
- const isCachePath = typeof er.path === 'string' &&
- npm.config.loaded && er.path.startsWith(npm.config.get('cache'))
- const isCacheDest = typeof er.dest === 'string' &&
- npm.config.loaded && er.dest.startsWith(npm.config.get('cache'))
+ const isCachePath =
+ typeof er.path === 'string' &&
+ npm.config.loaded &&
+ er.path.startsWith(npm.config.get('cache'))
+ const isCacheDest =
+ typeof er.dest === 'string' &&
+ npm.config.loaded &&
+ er.dest.startsWith(npm.config.get('cache'))
const isWindows = require('./is-windows.js')
@@ -64,7 +70,9 @@ module.exports = (er, npm) => {
'previous versions of npm which has since been addressed.',
'',
'To permanently fix this problem, please run:',
- ` sudo chown -R ${process.getuid()}:${process.getgid()} ${JSON.stringify(npm.config.get('cache'))}`,
+ ` sudo chown -R ${process.getuid()}:${process.getgid()} ${JSON.stringify(
+ npm.config.get('cache')
+ )}`,
].join('\n'),
])
} else {
@@ -73,14 +81,17 @@ module.exports = (er, npm) => {
'',
[
'\nThe operation was rejected by your operating system.',
- (isWindows
- ? 'It\'s possible that the file was already in use (by a text editor or antivirus),\n' +
+ isWindows
+ /* eslint-disable-next-line max-len */
+ ? "It's possible that the file was already in use (by a text editor or antivirus),\n" +
'or that you lack permissions to access it.'
- : 'It is likely you do not have the permissions to access this file as the current user'),
+ /* eslint-disable-next-line max-len */
+ : 'It is likely you do not have the permissions to access this file as the current user',
'\nIf you believe this might be a permissions issue, please double-check the',
'permissions of the file and its containing directories, or try running',
'the command again as root/Administrator.',
- ].join('\n')])
+ ].join('\n'),
+ ])
}
break
}
@@ -89,11 +100,9 @@ module.exports = (er, npm) => {
short.push(['', er.message])
detail.push([
'',
- [
- '',
- 'Failed using git.',
- 'Please check if you have git installed and in your PATH.',
- ].join('\n'),
+ ['', 'Failed using git.', 'Please check if you have git installed and in your PATH.'].join(
+ '\n'
+ ),
])
break
@@ -101,8 +110,7 @@ module.exports = (er, npm) => {
// Check whether we ran into a conflict in our own package.json
if (er.path === resolve(npm.prefix, 'package.json')) {
const { isDiff } = require('parse-conflict-json')
- const txt = require('fs').readFileSync(er.path, 'utf8')
- .replace(/\r\n/g, '\n')
+ const txt = require('fs').readFileSync(er.path, 'utf8').replace(/\r\n/g, '\n')
if (isDiff(txt)) {
detail.push([
'',
@@ -141,17 +149,19 @@ module.exports = (er, npm) => {
} else {
// npm ERR! code E401
// npm ERR! Unable to authenticate, need: Basic
- const auth = !er.headers || !er.headers['www-authenticate'] ? []
- : er.headers['www-authenticate'].map((au) => au.split(/[,\s]+/))[0]
+ const auth =
+ !er.headers || !er.headers['www-authenticate']
+ ? []
+ : er.headers['www-authenticate'].map(au => au.split(/[,\s]+/))[0]
if (auth.includes('Bearer')) {
- short.push(['', 'Unable to authenticate, your authentication token seems to be invalid.'])
+ short.push([
+ '',
+ 'Unable to authenticate, your authentication token seems to be invalid.',
+ ])
detail.push([
'',
- [
- 'To correct this please trying logging in again with:',
- ' npm login',
- ].join('\n'),
+ ['To correct this please trying logging in again with:', ' npm login'].join('\n'),
])
} else if (auth.includes('Basic')) {
short.push(['', 'Incorrect or missing password.'])
@@ -169,8 +179,9 @@ module.exports = (er, npm) => {
' npm login',
].join('\n'),
])
- } else
+ } else {
short.push(['', er.message || er])
+ }
}
break
@@ -185,19 +196,16 @@ module.exports = (er, npm) => {
const valResult = nameValidator(pkg)
- if (valResult.validForNewPackages)
- detail.push(['404', 'You should bug the author to publish it (or use the name yourself!)'])
- else {
+ if (valResult.validForNewPackages) {
+ detail.push([
+ '404',
+ 'You should bug the author to publish it (or use the name yourself!)',
+ ])
+ } else {
detail.push(['404', 'This package name is not valid, because', ''])
- const errorsArray = [
- ...(valResult.errors || []),
- ...(valResult.warnings || []),
- ]
- errorsArray.forEach((item, idx) => detail.push([
- '404',
- ' ' + (idx + 1) + '. ' + item,
- ]))
+ const errorsArray = [...(valResult.errors || []), ...(valResult.warnings || [])]
+ errorsArray.forEach((item, idx) => detail.push(['404', ' ' + (idx + 1) + '. ' + item]))
}
detail.push(['404', '\nNote that you can also install from a'])
@@ -218,26 +226,30 @@ module.exports = (er, npm) => {
short.push(['git', ' ' + er.path])
detail.push([
'git',
- [
- 'Refusing to remove it. Update manually,',
- 'or move it out of the way first.',
- ].join('\n'),
+ ['Refusing to remove it. Update manually,', 'or move it out of the way first.'].join('\n'),
])
break
case 'EBADPLATFORM': {
- const validOs = er.required &&
- er.required.os &&
- er.required.os.join ? er.required.os.join(',') : er.required.os
- const validArch = er.required &&
- er.required.cpu &&
- er.required.cpu.join ? er.required.cpu.join(',') : er.required.cpu
+ const validOs =
+ er.required && er.required.os && er.required.os.join
+ ? er.required.os.join(',')
+ : er.required.os
+ const validArch =
+ er.required && er.required.cpu && er.required.cpu.join
+ ? er.required.cpu.join(',')
+ : er.required.cpu
const expected = { os: validOs, arch: validArch }
const actual = { os: process.platform, arch: process.arch }
short.push([
'notsup',
[
- format('Unsupported platform for %s: wanted %j (current: %j)', er.pkgid, expected, actual),
+ format(
+ 'Unsupported platform for %s: wanted %j (current: %j)',
+ er.pkgid,
+ expected,
+ actual
+ ),
].join('\n'),
])
detail.push([
@@ -283,19 +295,25 @@ module.exports = (er, npm) => {
case 'ETARGET':
short.push(['notarget', er.message])
- detail.push(['notarget', [
- 'In most cases you or one of your dependencies are requesting',
- "a package version that doesn't exist.",
- ].join('\n')])
+ detail.push([
+ 'notarget',
+ [
+ 'In most cases you or one of your dependencies are requesting',
+ "a package version that doesn't exist.",
+ ].join('\n'),
+ ])
break
case 'E403':
short.push(['403', er.message])
- detail.push(['403', [
- 'In most cases, you or one of your dependencies are requesting',
- 'a package version that is forbidden by your security policy, or',
- 'on a server you do not have access to.',
- ].join('\n')])
+ detail.push([
+ '403',
+ [
+ 'In most cases, you or one of your dependencies are requesting',
+ 'a package version that is forbidden by your security policy, or',
+ 'on a server you do not have access to.',
+ ].join('\n'),
+ ])
break
case 'EBADENGINE':
@@ -306,10 +324,11 @@ module.exports = (er, npm) => {
[
'Not compatible with your version of node/npm: ' + er.pkgid,
'Required: ' + JSON.stringify(er.required),
- 'Actual: ' + JSON.stringify({
- npm: npm.version,
- node: npm.config.loaded ? npm.config.get('node-version') : process.version,
- }),
+ 'Actual: ' +
+ JSON.stringify({
+ npm: npm.version,
+ node: npm.config.loaded ? npm.config.get('node-version') : process.version,
+ }),
].join('\n'),
])
break
@@ -363,17 +382,21 @@ module.exports = (er, npm) => {
default:
short.push(['', er.message || er])
- if (er.signal)
+ if (er.signal) {
detail.push(['signal', er.signal])
+ }
- if (er.cmd && Array.isArray(er.args))
+ if (er.cmd && Array.isArray(er.args)) {
detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]])
+ }
- if (er.stdout)
+ if (er.stdout) {
detail.push(['', er.stdout.trim()])
+ }
- if (er.stderr)
+ if (er.stderr) {
detail.push(['', er.stderr.trim()])
+ }
break
}
diff --git a/deps/npm/lib/utils/exit-handler.js b/deps/npm/lib/utils/exit-handler.js
index 7be138d2c3..5b2811468e 100644
--- a/deps/npm/lib/utils/exit-handler.js
+++ b/deps/npm/lib/utils/exit-handler.js
@@ -15,8 +15,13 @@ let wroteLogFile = false
const getLogFile = () => {
// we call this multiple times, so we need to treat it as a singleton because
// the date is part of the name
- if (!logFileName)
- logFileName = path.resolve(npm.config.get('cache'), '_logs', (new Date()).toISOString().replace(/[.:]/g, '_') + '-debug.log')
+ if (!logFileName) {
+ logFileName = path.resolve(
+ npm.config.get('cache'),
+ '_logs',
+ new Date().toISOString().replace(/[.:]/g, '_') + '-debug.log'
+ )
+ }
return logFileName
}
@@ -26,8 +31,9 @@ process.on('exit', code => {
// unfinished timer check below
process.emit('timeEnd', 'npm')
npm.log.disableProgress()
- for (const [name, timers] of npm.timers)
+ for (const [name, timers] of npm.timers) {
npm.log.verbose('unfinished npm timer', name, timers)
+ }
if (npm.config.loaded && npm.config.get('timing')) {
try {
@@ -35,12 +41,15 @@ process.on('exit', code => {
const dir = path.dirname(npm.config.get('cache'))
mkdirp.sync(dir)
- fs.appendFileSync(file, JSON.stringify({
- command: process.argv.slice(2),
- logfile: getLogFile(),
- version: npm.version,
- ...npm.timings,
- }) + '\n')
+ fs.appendFileSync(
+ file,
+ JSON.stringify({
+ command: process.argv.slice(2),
+ logfile: getLogFile(),
+ version: npm.version,
+ ...npm.timings,
+ }) + '\n'
+ )
const st = fs.lstatSync(path.dirname(npm.config.get('cache')))
fs.chownSync(dir, st.uid, st.gid)
@@ -50,10 +59,11 @@ process.on('exit', code => {
}
}
- if (!code)
+ if (!code) {
npm.log.info('ok')
- else
+ } else {
npm.log.verbose('code', code)
+ }
if (!exitHandlerCalled) {
process.exitCode = code || 1
@@ -65,19 +75,18 @@ process.on('exit', code => {
writeLogFile()
}
// In timing mode we always write the log file
- if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile)
+ if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) {
writeLogFile()
+ }
if (wroteLogFile) {
// just a line break
- if (npm.log.levels[npm.log.level] <= npm.log.levels.error)
+ if (npm.log.levels[npm.log.level] <= npm.log.levels.error) {
console.error('')
+ }
npm.log.error(
'',
- [
- 'A complete log of this run can be found in:',
- ' ' + getLogFile(),
- ].join('\n')
+ ['A complete log of this run can be found in:', ' ' + getLogFile()].join('\n')
)
}
@@ -86,7 +95,7 @@ process.on('exit', code => {
wroteLogFile = false
})
-const exitHandler = (err) => {
+const exitHandler = err => {
npm.log.disableProgress()
if (!npm.config.loaded) {
err = err || new Error('Exit prior to config file resolving.')
@@ -131,8 +140,9 @@ const exitHandler = (err) => {
for (const k of ['type', 'stack', 'statusCode', 'pkgid']) {
const v = err[k]
- if (v)
+ if (v) {
npm.log.verbose(k, replaceInfo(v))
+ }
}
npm.log.verbose('cwd', process.cwd())
@@ -145,13 +155,15 @@ const exitHandler = (err) => {
for (const k of ['code', 'syscall', 'file', 'path', 'dest', 'errno']) {
const v = err[k]
- if (v)
+ if (v) {
npm.log.error(k, v)
+ }
}
const msg = errorMessage(err, npm)
- for (const errline of [...msg.summary, ...msg.detail])
+ for (const errline of [...msg.summary, ...msg.detail]) {
npm.log.error(...errline)
+ }
if (npm.config.loaded && npm.config.get('json')) {
const error = {
@@ -164,21 +176,24 @@ const exitHandler = (err) => {
console.error(JSON.stringify(error, null, 2))
}
- if (typeof err.errno === 'number')
+ if (typeof err.errno === 'number') {
exitCode = err.errno
- else if (typeof err.code === 'number')
+ } else if (typeof err.code === 'number') {
exitCode = err.code
+ }
}
}
npm.log.verbose('exit', exitCode || 0)
- if (npm.log.level === 'silent')
+ if (npm.log.level === 'silent') {
noLog = true
+ }
// noLog is true if there was an error, including if config wasn't loaded, so
// this doesn't need a config.loaded guard
- if (exitCode && !noLog)
+ if (exitCode && !noLog) {
writeLogFile()
+ }
// 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
@@ -193,11 +208,14 @@ const writeLogFile = () => {
let logOutput = ''
npm.log.record.forEach(m => {
const p = [m.id, m.level]
- if (m.prefix)
+ if (m.prefix) {
p.push(m.prefix)
+ }
const pref = p.join(' ')
- m.message.trim().split(/\r?\n/)
+ m.message
+ .trim()
+ .split(/\r?\n/)
.map(line => (pref + ' ' + line).trim())
.forEach(line => {
logOutput += line + os.EOL
@@ -216,12 +234,10 @@ const writeLogFile = () => {
// truncate once it's been written.
npm.log.record.length = 0
wroteLogFile = true
- } catch (ex) {
-
- }
+ } catch (ex) {}
}
module.exports = exitHandler
-module.exports.setNpm = (n) => {
+module.exports.setNpm = n => {
npm = n
}
diff --git a/deps/npm/lib/utils/explain-dep.js b/deps/npm/lib/utils/explain-dep.js
index 944b4be62b..107f68549e 100644
--- a/deps/npm/lib/utils/explain-dep.js
+++ b/deps/npm/lib/utils/explain-dep.js
@@ -43,20 +43,25 @@ const printNode = (node, color) => {
} = node
const { bold, dim, green } = color ? chalk : nocolor
const extra = []
- if (extraneous)
+ if (extraneous) {
extra.push(' ' + bold(colorType('extraneous', color)))
+ }
- if (dev)
+ if (dev) {
extra.push(' ' + bold(colorType('dev', color)))
+ }
- if (optional)
+ if (optional) {
extra.push(' ' + bold(colorType('optional', color)))
+ }
- if (peer)
+ if (peer) {
extra.push(' ' + bold(colorType('peer', color)))
+ }
- if (bundled)
+ if (bundled) {
extra.push(' ' + bold(colorType('bundled', color)))
+ }
const pkgid = isWorkspace
? green(`${name}@${version}`)
@@ -67,8 +72,9 @@ const printNode = (node, color) => {
}
const explainLinksIn = ({ linksIn }, depth, color) => {
- if (!linksIn || !linksIn.length || depth <= 0)
+ if (!linksIn || !linksIn.length || depth <= 0) {
return ''
+ }
const messages = linksIn.map(link => explainNode(link, depth - 1, color))
const str = '\n' + messages.join('\n')
@@ -76,8 +82,9 @@ const explainLinksIn = ({ linksIn }, depth, color) => {
}
const explainDependents = ({ name, dependents }, depth, color) => {
- if (!dependents || !dependents.length || depth <= 0)
+ if (!dependents || !dependents.length || depth <= 0) {
return ''
+ }
const max = Math.ceil(depth / 2)
const messages = dependents.slice(0, max)
@@ -118,8 +125,9 @@ const explainEdge = ({ name, type, bundled, from, spec }, depth, color) => {
}
const explainFrom = (from, depth, color) => {
- if (!from.name && !from.version)
+ if (!from.name && !from.version) {
return 'the root project'
+ }
return printNode(from, color) +
explainDependents(from, depth - 1, color) +
diff --git a/deps/npm/lib/utils/explain-eresolve.js b/deps/npm/lib/utils/explain-eresolve.js
index b25e3e4a9c..7f6a10869c 100644
--- a/deps/npm/lib/utils/explain-eresolve.js
+++ b/deps/npm/lib/utils/explain-eresolve.js
@@ -15,20 +15,22 @@ const explain = (expl, color, depth) => {
const whileInstalling = dep && dep.whileInstalling ||
current && current.whileInstalling ||
edge && edge.from && edge.from.whileInstalling
- if (whileInstalling)
+ if (whileInstalling) {
out.push('While resolving: ' + printNode(whileInstalling, color))
+ }
// it "should" be impossible for an ERESOLVE explanation to lack both
// current and currentEdge, but better to have a less helpful error
// than a crashing failure.
- if (current)
+ if (current) {
out.push('Found: ' + explainNode(current, depth, color))
- else if (peerConflict && peerConflict.current)
+ } else if (peerConflict && peerConflict.current) {
out.push('Found: ' + explainNode(peerConflict.current, depth, color))
- else if (currentEdge)
+ } else if (currentEdge) {
out.push('Found: ' + explainEdge(currentEdge, depth, color))
- else /* istanbul ignore else - should always have one */ if (edge)
+ } else /* istanbul ignore else - should always have one */ if (edge) {
out.push('Found: ' + explainEdge(edge, depth, color))
+ }
out.push('\nCould not resolve dependency:\n' +
explainEdge(edge, depth, color))
diff --git a/deps/npm/lib/utils/format-bytes.js b/deps/npm/lib/utils/format-bytes.js
index 87fb561aab..d7cf6d144e 100644
--- a/deps/npm/lib/utils/format-bytes.js
+++ b/deps/npm/lib/utils/format-bytes.js
@@ -4,17 +4,24 @@
const formatBytes = (bytes, space = true) => {
let spacer = ''
- if (space)
+ if (space) {
spacer = ' '
+ }
- if (bytes < 1000) // B
+ if (bytes < 1000) {
+ // B
return `${bytes}${spacer}B`
+ }
- if (bytes < 1000000) // kB
+ if (bytes < 1000000) {
+ // kB
return `${(bytes / 1000).toFixed(1)}${spacer}kB`
+ }
- if (bytes < 1000000000) // MB
+ if (bytes < 1000000000) {
+ // MB
return `${(bytes / 1000000).toFixed(1)}${spacer}MB`
+ }
return `${(bytes / 1000000000).toFixed(1)}${spacer}GB`
}
diff --git a/deps/npm/lib/utils/get-identity.js b/deps/npm/lib/utils/get-identity.js
index e92a2c524e..e77c2eea4c 100644
--- a/deps/npm/lib/utils/get-identity.js
+++ b/deps/npm/lib/utils/get-identity.js
@@ -5,8 +5,9 @@ const needsAuthError = (msg) =>
module.exports = async (npm, opts = {}) => {
const { registry } = opts
- if (!registry)
+ if (!registry) {
throw Object.assign(new Error('No registry specified.'), { code: 'ENOREGISTRY' })
+ }
// First, check if we have a user/pass-based auth
const creds = npm.config.getCredentialsByURI(registry)
@@ -22,9 +23,9 @@ module.exports = async (npm, opts = {}) => {
})
const { username: usernameFromRegistry } = registryData
// Retrieved username from registry; return it
- if (usernameFromRegistry)
+ if (usernameFromRegistry) {
return usernameFromRegistry
- else {
+ } else {
// Didn't get username from registry; bad token
throw needsAuthError(
'Your auth token is no longer valid. Please login again.'
diff --git a/deps/npm/lib/utils/get-project-scope.js b/deps/npm/lib/utils/get-project-scope.js
index 3ce84d5bb0..dc1b4deba3 100644
--- a/deps/npm/lib/utils/get-project-scope.js
+++ b/deps/npm/lib/utils/get-project-scope.js
@@ -2,12 +2,14 @@ const { resolve } = require('path')
module.exports = prefix => {
try {
const { name } = require(resolve(prefix, 'package.json'))
- if (!name || typeof name !== 'string')
+ if (!name || typeof name !== 'string') {
return ''
+ }
const split = name.split('/')
- if (split.length < 2)
+ if (split.length < 2) {
return ''
+ }
const scope = split[0]
return /^@/.test(scope) ? scope : ''
diff --git a/deps/npm/lib/utils/npm-usage.js b/deps/npm/lib/utils/npm-usage.js
index d54c8ac547..b0c98b2ae6 100644
--- a/deps/npm/lib/utils/npm-usage.js
+++ b/deps/npm/lib/utils/npm-usage.js
@@ -32,8 +32,9 @@ npm@${npm.version} ${dirname(dirname(__dirname))}`
}
const allCommands = async (npm) => {
- if (npm.config.get('long'))
+ if (npm.config.get('long')) {
return usages(npm)
+ }
return ('\n ' + wrap(cmdList))
}
@@ -45,9 +46,9 @@ const wrap = (arr) => {
let l = 0
for (const c of arr.sort((a, b) => a < b ? -1 : 1)) {
- if (out[l].length + c.length + 2 < line)
+ if (out[l].length + c.length + 2 < line) {
out[l] += ', ' + c
- else {
+ } else {
out[l++] += ','
out[l] = c
}
diff --git a/deps/npm/lib/utils/open-url.js b/deps/npm/lib/utils/open-url.js
index 331ca96fa9..eed2449dcc 100644
--- a/deps/npm/lib/utils/open-url.js
+++ b/deps/npm/lib/utils/open-url.js
@@ -3,7 +3,7 @@ const opener = require('opener')
const { URL } = require('url')
// attempt to open URL in web-browser, print address otherwise:
-const open = async (npm, url, errMsg) => {
+const open = async (npm, url, errMsg, isFile) => {
url = encodeURI(url)
const browser = npm.config.get('browser')
@@ -24,21 +24,27 @@ const open = async (npm, url, errMsg) => {
return
}
- try {
- if (!/^(https?|file):$/.test(new URL(url).protocol))
- throw new Error()
- } catch (_) {
- throw new Error('Invalid URL: ' + url)
+ // We pass this in as true from the help command so we know we don't have to
+ // check the protocol
+ if (!isFile) {
+ try {
+ if (!/^https?:$/.test(new URL(url).protocol)) {
+ throw new Error()
+ }
+ } catch (_) {
+ throw new Error('Invalid URL: ' + url)
+ }
}
const command = browser === true ? null : browser
await new Promise((resolve, reject) => {
opener(url, { command }, (err) => {
if (err) {
- if (err.code === 'ENOENT')
+ if (err.code === 'ENOENT') {
printAlternateMsg()
- else
+ } else {
return reject(err)
+ }
}
return resolve()
})
diff --git a/deps/npm/lib/utils/otplease.js b/deps/npm/lib/utils/otplease.js
index ca271526cc..0e32493f9e 100644
--- a/deps/npm/lib/utils/otplease.js
+++ b/deps/npm/lib/utils/otplease.js
@@ -8,11 +8,11 @@ module.exports = otplease
function otplease (opts, fn) {
opts = { prompt, ...opts }
return Promise.resolve().then(() => fn(opts)).catch(err => {
- if (!isOtpError(err))
+ if (!isOtpError(err)) {
throw err
- else if (!process.stdin.isTTY || !process.stdout.isTTY)
+ } else if (!process.stdin.isTTY || !process.stdout.isTTY) {
throw err
- else {
+ } else {
return readUserInfo.otp(opts.prompt)
.then(otp => fn({ ...opts, otp }))
}
diff --git a/deps/npm/lib/utils/queryable.js b/deps/npm/lib/utils/queryable.js
index e10eba3b5f..ceb06bdccd 100644
--- a/deps/npm/lib/utils/queryable.js
+++ b/deps/npm/lib/utils/queryable.js
@@ -19,10 +19,10 @@ const replaceAppendSymbols = str => {
return [str]
}
-const parseKeys = (key) => {
+const parseKeys = key => {
const sqBracketItems = new Set()
sqBracketItems.add(_append)
- const parseSqBrackets = (str) => {
+ const parseSqBrackets = str => {
const index = sqBracketsMatcher(str)
// once we find square brackets, we recursively parse all these
@@ -48,11 +48,7 @@ const parseKeys = (key) => {
return [
...parseSqBrackets(preSqBracketPortion),
foundKey,
- ...(
- postSqBracketPortion
- ? parseSqBrackets(postSqBracketPortion)
- : []
- ),
+ ...(postSqBracketPortion ? parseSqBrackets(postSqBracketPortion) : []),
]
}
@@ -72,13 +68,14 @@ const parseKeys = (key) => {
for (const k of sqBracketKeys) {
// keys parsed from square brackets should just be added to list of
// resulting keys as they might have dots as part of the key
- if (sqBracketItems.has(k))
+ if (sqBracketItems.has(k)) {
res.push(k)
- else {
+ } else {
// splits the dot-sep property names and add them to the list of keys
- for (const splitKey of k.split('.'))
- /* eslint-disable-next-line no-new-wrappers */
- res.push(new String(splitKey))
+ /* eslint-disable-next-line no-new-wrappers */
+ for (const splitKey of k.split('.')) {
+ res.push(String(splitKey))
+ }
}
}
@@ -98,10 +95,9 @@ const getter = ({ data, key }) => {
for (const k of keys) {
// empty-bracket-shortcut-syntax is not supported on getter
if (k === _append) {
- throw Object.assign(
- new Error('Empty brackets are not valid syntax for retrieving values.'),
- { code: 'EINVALIDSYNTAX' }
- )
+ throw Object.assign(new Error('Empty brackets are not valid syntax for retrieving values.'), {
+ code: 'EINVALIDSYNTAX',
+ })
}
// extra logic to take into account printing array, along with its
@@ -118,8 +114,9 @@ const getter = ({ data, key }) => {
} else {
// if can't find any more values, it means it's just over
// and there's nothing to return
- if (!_data[k])
+ if (!_data[k]) {
return undefined
+ }
// otherwise sets the next value
_data = _data[k]
@@ -130,8 +127,9 @@ const getter = ({ data, key }) => {
// these are some legacy expectations from
// the old API consumed by lib/view.js
- if (Array.isArray(_data) && _data.length <= 1)
+ if (Array.isArray(_data) && _data.length <= 1) {
_data = _data[0]
+ }
return {
[key]: _data,
@@ -151,30 +149,32 @@ const setter = ({ data, key, value, force }) => {
try {
maybeIndex = Number(_key)
} catch (err) {}
- if (!Number.isNaN(maybeIndex))
+ if (!Number.isNaN(maybeIndex)) {
_key = maybeIndex
+ }
// creates new array in case key is an index
// and the array obj is not yet defined
const keyIsAnArrayIndex = _key === maybeIndex || _key === _append
const dataHasNoItems = !Object.keys(_data).length
- if (keyIsAnArrayIndex && dataHasNoItems && !Array.isArray(_data))
+ if (keyIsAnArrayIndex && dataHasNoItems && !Array.isArray(_data)) {
_data = []
+ }
// converting from array to an object is also possible, in case the
// user is using force mode, we should also convert existing arrays
// to an empty object if the current _data is an array
- if (force && Array.isArray(_data) && !keyIsAnArrayIndex)
+ if (force && Array.isArray(_data) && !keyIsAnArrayIndex) {
_data = { ..._data }
+ }
// the _append key is a special key that is used to represent
// the empty-bracket notation, e.g: arr[] -> arr[arr.length]
if (_key === _append) {
if (!Array.isArray(_data)) {
- throw Object.assign(
- new Error(`Can't use append syntax in non-Array element`),
- { code: 'ENOAPPEND' }
- )
+ throw Object.assign(new Error(`Can't use append syntax in non-Array element`), {
+ code: 'ENOAPPEND',
+ })
}
_key = _data.length
}
@@ -182,23 +182,15 @@ const setter = ({ data, key, value, force }) => {
// retrieves the next data object to recursively iterate on,
// throws if trying to override a literal value or add props to an array
const next = () => {
- const haveContents =
- !force &&
- _data[_key] != null &&
- value !== _delete
- const shouldNotOverrideLiteralValue =
- !(typeof _data[_key] === 'object')
+ const haveContents = !force && _data[_key] != null && value !== _delete
+ const shouldNotOverrideLiteralValue = !(typeof _data[_key] === 'object')
// if the next obj to recurse is an array and the next key to be
// appended to the resulting obj is not an array index, then it
// should throw since we can't append arbitrary props to arrays
const shouldNotAddPropsToArrays =
- typeof keys[0] !== 'symbol' &&
- Array.isArray(_data[_key]) &&
- Number.isNaN(Number(keys[0]))
+ typeof keys[0] !== 'symbol' && Array.isArray(_data[_key]) && Number.isNaN(Number(keys[0]))
- const overrideError =
- haveContents &&
- shouldNotOverrideLiteralValue
+ const overrideError = haveContents && shouldNotOverrideLiteralValue
if (overrideError) {
throw Object.assign(
new Error(`Property ${_key} already exists and is not an Array or Object.`),
@@ -206,14 +198,11 @@ const setter = ({ data, key, value, force }) => {
)
}
- const addPropsToArrayError =
- haveContents &&
- shouldNotAddPropsToArrays
+ const addPropsToArrayError = haveContents && shouldNotAddPropsToArrays
if (addPropsToArrayError) {
- throw Object.assign(
- new Error(`Can't add property ${key} to an Array.`),
- { code: 'ENOADDPROP' }
- )
+ throw Object.assign(new Error(`Can't add property ${key} to an Array.`), {
+ code: 'ENOADDPROP',
+ })
}
return typeof _data[_key] === 'object' ? _data[_key] || {} : {}
@@ -222,18 +211,20 @@ const setter = ({ data, key, value, force }) => {
// sets items from the parsed array of keys as objects, recurses to
// setKeys in case there are still items to be handled, otherwise it
// just sets the original value set by the user
- if (keys.length)
+ if (keys.length) {
_data[_key] = setKeys(next(), keys.shift())
- else {
+ } else {
// handles special deletion cases for obj props / array items
if (value === _delete) {
- if (Array.isArray(_data))
+ if (Array.isArray(_data)) {
_data.splice(_key, 1)
- else
+ } else {
delete _data[_key]
- } else
+ }
+ } else {
// finally, sets the value in its right place
_data[_key] = value
+ }
}
return _data
@@ -245,10 +236,9 @@ const setter = ({ data, key, value, force }) => {
class Queryable {
constructor (obj) {
if (!obj || typeof obj !== 'object') {
- throw Object.assign(
- new Error('Queryable needs an object to query properties from.'),
- { code: 'ENOQUERYABLEOBJ' }
- )
+ throw Object.assign(new Error('Queryable needs an object to query properties from.'), {
+ code: 'ENOQUERYABLEOBJ',
+ })
}
this[_data] = obj
@@ -258,28 +248,33 @@ class Queryable {
// this ugly interface here is meant to be a compatibility layer
// with the legacy API lib/view.js is consuming, if at some point
// we refactor that command then we can revisit making this nicer
- if (queries === '')
+ if (queries === '') {
return { '': this[_data] }
+ }
- const q = query => getter({
- data: this[_data],
- key: query,
- })
+ const q = query =>
+ getter({
+ data: this[_data],
+ key: query,
+ })
if (Array.isArray(queries)) {
let res = {}
- for (const query of queries)
+ for (const query of queries) {
res = { ...res, ...q(query) }
+ }
return res
- } else
+ } else {
return q(queries)
+ }
}
// return the value for a single query if found, otherwise returns undefined
get (query) {
const obj = this.query(query)
- if (obj)
+ if (obj) {
return obj[query]
+ }
}
// creates objects along the way for the provided `query` parameter
diff --git a/deps/npm/lib/utils/read-user-info.js b/deps/npm/lib/utils/read-user-info.js
index e3c4a9fbe5..993aa886f6 100644
--- a/deps/npm/lib/utils/read-user-info.js
+++ b/deps/npm/lib/utils/read-user-info.js
@@ -23,16 +23,18 @@ function read (opts) {
}
function readOTP (msg = otpPrompt, otp, isRetry) {
- if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp))
+ if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) {
return otp.replace(/\s+/g, '')
+ }
return read({ prompt: msg, default: otp || '' })
.then((otp) => readOTP(msg, otp, true))
}
function readPassword (msg = passwordPrompt, password, isRetry) {
- if (isRetry && password)
+ if (isRetry && password) {
return password
+ }
return read({ prompt: msg, silent: true, default: password || '' })
.then((password) => readPassword(msg, password, true))
@@ -41,10 +43,11 @@ function readPassword (msg = passwordPrompt, password, isRetry) {
function readUsername (msg = usernamePrompt, username, opts = {}, isRetry) {
if (isRetry && username) {
const error = userValidate.username(username)
- if (error)
+ if (error) {
opts.log && opts.log.warn(error.message)
- else
+ } else {
return Promise.resolve(username.trim())
+ }
}
return read({ prompt: msg, default: username || '' })
@@ -54,10 +57,11 @@ function readUsername (msg = usernamePrompt, username, opts = {}, isRetry) {
function readEmail (msg = emailPrompt, email, opts = {}, isRetry) {
if (isRetry && email) {
const error = userValidate.email(email)
- if (error)
+ if (error) {
opts.log && opts.log.warn(error.message)
- else
+ } else {
return email.trim()
+ }
}
return read({ prompt: msg, default: email || '' })
diff --git a/deps/npm/lib/utils/reify-finish.js b/deps/npm/lib/utils/reify-finish.js
index a9ac4c61f5..9b43abcb76 100644
--- a/deps/npm/lib/utils/reify-finish.js
+++ b/deps/npm/lib/utils/reify-finish.js
@@ -1,7 +1,7 @@
const reifyOutput = require('./reify-output.js')
const ini = require('ini')
const { writeFile } = require('fs').promises
-const {resolve} = require('path')
+const { resolve } = require('path')
const reifyFinish = async (npm, arb) => {
await saveBuiltinConfig(npm, arb)
@@ -10,18 +10,21 @@ const reifyFinish = async (npm, arb) => {
const saveBuiltinConfig = async (npm, arb) => {
const { options: { global }, actualTree } = arb
- if (!global)
+ if (!global) {
return
+ }
// if we are using a builtin config, and just installed npm as
// a top-level global package, we have to preserve that config.
const npmNode = actualTree.inventory.get('node_modules/npm')
- if (!npmNode)
+ if (!npmNode) {
return
+ }
const builtinConf = npm.config.data.get('builtin')
- if (builtinConf.loadError)
+ if (builtinConf.loadError) {
return
+ }
const content = ini.stringify(builtinConf.raw).trim() + '\n'
await writeFile(resolve(npmNode.path, 'npmrc'), content)
diff --git a/deps/npm/lib/utils/reify-output.js b/deps/npm/lib/utils/reify-output.js
index bf3fa7fb2e..7741b72200 100644
--- a/deps/npm/lib/utils/reify-output.js
+++ b/deps/npm/lib/utils/reify-output.js
@@ -92,14 +92,16 @@ const reifyOutput = (npm, arb) => {
// to get the exitCode set appropriately.
const printAuditReport = (npm, report) => {
const res = getAuditReport(npm, report)
- if (!res || !res.report)
+ if (!res || !res.report) {
return
+ }
npm.output(`\n${res.report}`)
}
const getAuditReport = (npm, report) => {
- if (!report)
+ if (!report) {
return
+ }
// when in silent mode, we print nothing. the JSON output is
// going to just JSON.stringify() the report object.
@@ -115,8 +117,9 @@ const getAuditReport = (npm, report) => {
...npm.flatOptions,
auditLevel,
})
- if (npm.command === 'audit')
+ if (npm.command === 'audit') {
process.exitCode = process.exitCode || res.exitCode
+ }
return res
}
@@ -124,43 +127,52 @@ const packagesChangedMessage = (npm, { added, removed, changed, audited }) => {
const msg = ['\n']
if (added === 0 && removed === 0 && changed === 0) {
msg.push('up to date')
- if (audited)
+ if (audited) {
msg.push(', ')
+ }
} else {
- if (added)
+ if (added) {
msg.push(`added ${added} package${added === 1 ? '' : 's'}`)
+ }
if (removed) {
- if (added)
+ if (added) {
msg.push(', ')
+ }
- if (added && !audited && !changed)
+ if (added && !audited && !changed) {
msg.push('and ')
+ }
msg.push(`removed ${removed} package${removed === 1 ? '' : 's'}`)
}
if (changed) {
- if (added || removed)
+ if (added || removed) {
msg.push(', ')
+ }
- if (!audited && (added || removed))
+ if (!audited && (added || removed)) {
msg.push('and ')
+ }
msg.push(`changed ${changed} package${changed === 1 ? '' : 's'}`)
}
- if (audited)
+ if (audited) {
msg.push(', and ')
+ }
}
- if (audited)
+ if (audited) {
msg.push(`audited ${audited} package${audited === 1 ? '' : 's'}`)
+ }
msg.push(` in ${ms(Date.now() - npm.started)}`)
npm.output(msg.join(''))
}
const packagesFundingMessage = (npm, { funding }) => {
- if (!funding)
+ if (!funding) {
return
+ }
npm.output('')
const pkg = funding === 1 ? 'package' : 'packages'
diff --git a/deps/npm/lib/utils/replace-info.js b/deps/npm/lib/utils/replace-info.js
index 7c7489bc17..e9d19ef5fb 100644
--- a/deps/npm/lib/utils/replace-info.js
+++ b/deps/npm/lib/utils/replace-info.js
@@ -5,8 +5,9 @@ function replaceInfo (arg) {
const isArray = Array.isArray(arg)
const isString = str => typeof str === 'string'
- if (!isArray && !isString(arg))
+ if (!isArray && !isString(arg)) {
return arg
+ }
const testUrlAndReplace = str => {
try {
@@ -19,8 +20,9 @@ function replaceInfo (arg) {
const args = isString(arg) ? arg.split(' ') : arg
const info = args.map(a => {
- if (isString(a) && a.indexOf(' ') > -1)
+ if (isString(a) && a.indexOf(' ') > -1) {
return a.split(' ').map(testUrlAndReplace).join(' ')
+ }
return testUrlAndReplace(a)
})
diff --git a/deps/npm/lib/utils/setup-log.js b/deps/npm/lib/utils/setup-log.js
index aaf7fa47e2..05ca38c828 100644
--- a/deps/npm/lib/utils/setup-log.js
+++ b/deps/npm/lib/utils/setup-log.js
@@ -35,28 +35,32 @@ module.exports = (config) => {
return warn(heading, ...args)
}
- if (config.get('timing') && config.get('loglevel') === 'notice')
+ if (config.get('timing') && config.get('loglevel') === 'notice') {
log.level = 'timing'
- else
+ } else {
log.level = config.get('loglevel')
+ }
log.heading = config.get('heading') || 'npm'
- if (enableColorStderr)
+ if (enableColorStderr) {
log.enableColor()
- else
+ } else {
log.disableColor()
+ }
- if (config.get('unicode'))
+ if (config.get('unicode')) {
log.enableUnicode()
- else
+ } else {
log.disableUnicode()
+ }
// if it's more than error, don't show progress
const quiet = log.levels[log.level] > log.levels.error
- if (config.get('progress') && stderrNotDumb && !quiet)
+ if (config.get('progress') && stderrNotDumb && !quiet) {
log.enableProgress()
- else
+ } else {
log.disableProgress()
+ }
}
diff --git a/deps/npm/lib/utils/split-package-names.js b/deps/npm/lib/utils/split-package-names.js
index bb6e449bac..395c2517d5 100644
--- a/deps/npm/lib/utils/split-package-names.js
+++ b/deps/npm/lib/utils/split-package-names.js
@@ -4,15 +4,17 @@ const splitPackageNames = (path) => {
return path.split('/')
// combine scoped parts
.reduce((parts, part) => {
- if (parts.length === 0)
+ 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('/'))
+ if (lastPart[0] === '@' && !lastPart.includes('/')) {
parts[parts.length - 1] += '/' + part
- else
+ } else {
parts.push(part)
+ }
return parts
}, [])
diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js
index 0ff822370d..26e7a98df6 100644
--- a/deps/npm/lib/utils/tar.js
+++ b/deps/npm/lib/utils/tar.js
@@ -14,39 +14,58 @@ const logTar = (tarball, opts = {}) => {
log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`)
log.notice('=== Tarball Contents ===')
if (tarball.files.length) {
- log.notice('', columnify(tarball.files.map((f) => {
- const bytes = formatBytes(f.size, false)
- return (/^node_modules\//.test(f.path)) ? null
- : { path: f.path, size: `${bytes}` }
- }).filter(f => f), {
- include: ['size', 'path'],
- showHeaders: false,
- }))
+ log.notice(
+ '',
+ columnify(
+ tarball.files
+ .map(f => {
+ const bytes = formatBytes(f.size, false)
+ return /^node_modules\//.test(f.path) ? null : { path: f.path, size: `${bytes}` }
+ })
+ .filter(f => f),
+ {
+ include: ['size', 'path'],
+ showHeaders: false,
+ }
+ )
+ )
}
if (tarball.bundled.length) {
log.notice('=== Bundled Dependencies ===')
- tarball.bundled.forEach((name) => log.notice('', name))
+ tarball.bundled.forEach(name => log.notice('', name))
}
log.notice('=== Tarball Details ===')
- log.notice('', columnify([
- { name: 'name:', value: tarball.name },
- { name: 'version:', value: tarball.version },
- tarball.filename && { name: 'filename:', value: tarball.filename },
- { name: 'package size:', value: formatBytes(tarball.size) },
- { name: 'unpacked size:', value: formatBytes(tarball.unpackedSize) },
- { name: 'shasum:', value: tarball.shasum },
- {
- name: 'integrity:',
- value: tarball.integrity.toString().substr(0, 20) + '[...]' + tarball.integrity.toString().substr(80),
- },
- tarball.bundled.length && { name: 'bundled deps:', value: tarball.bundled.length },
- tarball.bundled.length && { name: 'bundled files:', value: tarball.entryCount - tarball.files.length },
- tarball.bundled.length && { name: 'own files:', value: tarball.files.length },
- { name: 'total files:', value: tarball.entryCount },
- ].filter((x) => x), {
- include: ['name', 'value'],
- showHeaders: false,
- }))
+ log.notice(
+ '',
+ columnify(
+ [
+ { name: 'name:', value: tarball.name },
+ { name: 'version:', value: tarball.version },
+ tarball.filename && { name: 'filename:', value: tarball.filename },
+ { name: 'package size:', value: formatBytes(tarball.size) },
+ { name: 'unpacked size:', value: formatBytes(tarball.unpackedSize) },
+ { name: 'shasum:', value: tarball.shasum },
+ {
+ name: 'integrity:',
+ value:
+ tarball.integrity.toString().substr(0, 20) +
+ '[...]' +
+ tarball.integrity.toString().substr(80),
+ },
+ tarball.bundled.length && { name: 'bundled deps:', value: tarball.bundled.length },
+ tarball.bundled.length && {
+ name: 'bundled files:',
+ value: tarball.entryCount - tarball.files.length,
+ },
+ tarball.bundled.length && { name: 'own files:', value: tarball.files.length },
+ { name: 'total files:', value: tarball.entryCount },
+ ].filter(x => x),
+ {
+ include: ['name', 'value'],
+ showHeaders: false,
+ }
+ )
+ )
log.notice('', '')
}
@@ -81,7 +100,7 @@ const getContents = async (manifest, tarball) => {
const comparator = ({ path: a }, { path: b }) => localeCompare(a, b)
- const isUpper = (str) => {
+ const isUpper = str => {
const ch = str.charAt(0)
return ch === ch.toUpperCase()
}
diff --git a/deps/npm/lib/utils/update-notifier.js b/deps/npm/lib/utils/update-notifier.js
index 14c4fac0d5..2b45d54c81 100644
--- a/deps/npm/lib/utils/update-notifier.js
+++ b/deps/npm/lib/utils/update-notifier.js
@@ -37,8 +37,9 @@ const updateNotifier = async (npm, spec = 'latest') => {
// never check for updates in CI, when updating npm already, or opted out
if (!npm.config.get('update-notifier') ||
isGlobalNpmUpdate(npm) ||
- ciDetect())
+ ciDetect()) {
return null
+ }
// if we're on a prerelease train, then updates are coming fast
// check for a new one daily. otherwise, weekly.
@@ -46,15 +47,17 @@ const updateNotifier = async (npm, spec = 'latest') => {
const current = semver.parse(version)
// if we're on a beta train, always get the next beta
- if (current.prerelease.length)
+ if (current.prerelease.length) {
spec = `^${version}`
+ }
// while on a beta train, get updates daily
const duration = spec !== 'latest' ? DAILY : WEEKLY
// if we've already checked within the specified duration, don't check again
- if (!(await checkTimeout(npm, duration)))
+ if (!(await checkTimeout(npm, duration))) {
return null
+ }
// if they're currently using a prerelease, nudge to the next prerelease
// otherwise, nudge to latest.
@@ -67,8 +70,9 @@ const updateNotifier = async (npm, spec = 'latest') => {
}).catch(() => null)
// if pacote failed, give up
- if (!mani)
+ if (!mani) {
return null
+ }
const latest = mani.version
@@ -76,12 +80,14 @@ const updateNotifier = async (npm, spec = 'latest') => {
// and should get the updates from that release train.
// Note that this isn't another http request over the network, because
// the packument will be cached by pacote from previous request.
- if (semver.gt(version, latest) && spec === 'latest')
+ if (semver.gt(version, latest) && spec === 'latest') {
return updateNotifier(npm, `^${version}`)
+ }
// if we already have something >= the desired spec, then we're done
- if (semver.gte(version, latest))
+ if (semver.gte(version, latest)) {
return null
+ }
// ok! notify the user about this update they should get.
// The message is saved for printing at process exit so it will not get
diff --git a/deps/npm/lib/utils/usage.js b/deps/npm/lib/utils/usage.js
index 5f4eca73ea..e23e50c51c 100644
--- a/deps/npm/lib/utils/usage.js
+++ b/deps/npm/lib/utils/usage.js
@@ -3,13 +3,15 @@ const aliases = require('../utils/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)
+ if (val !== cmd) {
return p
+ }
return p.concat(c)
}, [])
- if (opt || post.length > 0)
+ if (opt || post.length > 0) {
txt += '\n\n'
+ }
if (post.length === 1) {
txt += 'alias: '
@@ -20,8 +22,9 @@ module.exports = function usage (cmd, txt, opt) {
}
if (opt) {
- if (post.length > 0)
+ if (post.length > 0) {
txt += '\n'
+ }
txt += 'common options: ' + opt
}
diff --git a/deps/npm/lib/workspaces/get-workspaces.js b/deps/npm/lib/workspaces/get-workspaces.js
index 3eb8e4865b..a59b5a6c54 100644
--- a/deps/npm/lib/workspaces/get-workspaces.js
+++ b/deps/npm/lib/workspaces/get-workspaces.js
@@ -10,18 +10,21 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot }) => {
const pkg = await rpj(resolve(path, 'package.json'))
const workspaces = await mapWorkspaces({ cwd: path, pkg })
let res = new Map()
- if (includeWorkspaceRoot)
+ if (includeWorkspaceRoot) {
res.set(pkg.name, path)
+ }
- if (!filters.length)
+ if (!filters.length) {
res = new Map([...res, ...workspaces])
+ }
for (const filterArg of filters) {
for (const [workspaceName, workspacePath] of workspaces.entries()) {
if (filterArg === workspaceName
|| resolve(path, filterArg) === workspacePath
- || minimatch(workspacePath, `${resolve(path, filterArg)}/*`))
+ || minimatch(workspacePath, `${resolve(path, filterArg)}/*`)) {
res.set(workspaceName, workspacePath)
+ }
}
}
diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1
index aa13fa70cf..7f0c422ded 100644
--- a/deps/npm/man/man1/npm-install.1
+++ b/deps/npm/man/man1/npm-install.1
@@ -69,7 +69,7 @@ into a tarball (b)\.
.RS 0
.IP \(bu 2
\fBnpm install\fP (in a package directory, no arguments):
- Install the dependencies in the local \fBnode_modules\fP folder\.
+ Install the dependencies to the local \fBnode_modules\fP folder\.
In global mode (ie, with \fB\-g\fP or \fB\-\-global\fP appended to the command),
it installs the current package context (ie, the current working
directory) as a global package\.
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index ec9ee9c106..784b338ec9 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\.1\.3 /path/to/npm
+npm@8\.1\.4 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 0b91c46df3..5bd83235ff 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -10,7 +10,7 @@ npm <command> [args]
.RE
.SS Version
.P
-8\.1\.3
+8\.1\.4
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7
index 23ee3b5778..9461ca9fc8 100644
--- a/deps/npm/man/man7/developers.7
+++ b/deps/npm/man/man7/developers.7
@@ -135,8 +135,12 @@ need to add them to \fB\|\.npmignore\fP explicitly:
.IP \(bu 2
\fB\|\.git\fP
.IP \(bu 2
+\fB\|\.gitignore\fP
+.IP \(bu 2
\fB\|\.hg\fP
.IP \(bu 2
+\fB\|\.npmignore\fP
+.IP \(bu 2
\fB\|\.npmrc\fP
.IP \(bu 2
\fB\|\.lock\-wscript\fP
diff --git a/deps/npm/node_modules/@npmcli/arborist/LICENSE b/deps/npm/node_modules/@npmcli/arborist/LICENSE
deleted file mode 100644
index 13ff5b9eac..0000000000
--- a/deps/npm/node_modules/@npmcli/arborist/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The ISC License
-
-Copyright npm, Inc.
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
----
-
-Files and metadata contained in `test/fixtures/registry-mocks/content` are
-downloaded from the public npm registry. These are the property of their
-respective owners. The use and distribution of said artifacts are covered by
-their associated licenses.
diff --git a/deps/npm/node_modules/@npmcli/arborist/LICENSE.md b/deps/npm/node_modules/@npmcli/arborist/LICENSE.md
new file mode 100644
index 0000000000..5fc208ff12
--- /dev/null
+++ b/deps/npm/node_modules/@npmcli/arborist/LICENSE.md
@@ -0,0 +1,20 @@
+<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
+
+ISC License
+
+Copyright npm, Inc.
+
+Permission to use, copy, modify, and/or distribute this
+software for any purpose with or without fee is hereby
+granted, provided that the above copyright notice and this
+permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/@npmcli/arborist/README.md b/deps/npm/node_modules/@npmcli/arborist/README.md
index cda5f8b908..4c19fab8b7 100644
--- a/deps/npm/node_modules/@npmcli/arborist/README.md
+++ b/deps/npm/node_modules/@npmcli/arborist/README.md
@@ -2,7 +2,7 @@
Inspect and manage `node_modules` trees.
-![a tree with the word ARBORIST superimposed on it](https://raw.githubusercontent.com/npm/arborist/main/logo.svg?sanitize=true)
+![a tree with the word ARBORIST superimposed on it](https://raw.githubusercontent.com/npm/arborist/main/docs/logo.svg?sanitize=true)
There's more documentation [in the notes
folder](https://github.com/npm/arborist/tree/main/notes).
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/prune.js b/deps/npm/node_modules/@npmcli/arborist/bin/prune.js
index 4809a99238..e11858c209 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/prune.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/prune.js
@@ -6,7 +6,7 @@ require('./lib/logging.js')
require('./lib/timers.js')
const printDiff = diff => {
- const {depth} = require('treeverse')
+ const { depth } = require('treeverse')
depth({
tree: diff,
visit: d => {
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/reify.js b/deps/npm/node_modules/@npmcli/arborist/bin/reify.js
index 803bac978c..9dc26d2b96 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/reify.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/reify.js
@@ -6,7 +6,7 @@ require('./lib/logging.js')
require('./lib/timers.js')
const printDiff = diff => {
- const {depth} = require('treeverse')
+ const { depth } = require('treeverse')
depth({
tree: diff,
visit: d => {
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
index 3c1cbd44ab..ae813186fb 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
@@ -2,9 +2,9 @@
const localeCompare = require('@isaacs/string-locale-compare')('en')
-const add = ({pkg, add, saveBundle, saveType, log}) => {
+const add = ({ pkg, add, saveBundle, saveType, log }) => {
for (const spec of add) {
- addSingle({pkg, spec, saveBundle, saveType, log})
+ addSingle({ pkg, spec, saveBundle, saveType, log })
}
return pkg
@@ -20,7 +20,7 @@ const saveTypeMap = new Map([
['peer', 'peerDependencies'],
])
-const addSingle = ({pkg, spec, saveBundle, saveType, log}) => {
+const addSingle = ({ pkg, spec, saveBundle, saveType, log }) => {
const { name, rawSpec } = spec
// if the user does not give us a type, we infer which type(s)
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 4071deac5a..aa37acfe52 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
@@ -31,7 +31,7 @@ const Node = require('../node.js')
const Link = require('../link.js')
const addRmPkgDeps = require('../add-rm-pkg-deps.js')
const optionalSet = require('../optional-set.js')
-const {checkEngine, checkPlatform} = require('npm-install-checks')
+const { checkEngine, checkPlatform } = require('npm-install-checks')
const relpath = require('../relpath.js')
@@ -311,7 +311,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
? Shrinkwrap.reset({
path: this.path,
lockfileVersion: this.options.lockfileVersion,
- }).then(meta => Object.assign(root, {meta}))
+ }).then(meta => Object.assign(root, { meta }))
: this.loadVirtual({ root }))
// if we don't have a lockfile to go from, then start with the
@@ -492,7 +492,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
// This returns a promise because we might not have the name yet,
// and need to call pacote.manifest to find the name.
- [_add] (tree, {add, saveType = null, saveBundle = false}) {
+ [_add] (tree, { add, saveType = null, saveBundle = false }) {
// get the name for each of the specs in the list.
// ie, doing `foo@bar` we just return foo
// but if it's a url or git, we don't know the name until we
@@ -936,7 +936,7 @@ This is a one-time fix-up, please be patient...
}
})
- tasks.push({edge, dep})
+ tasks.push({ edge, dep })
}
const placeDeps = tasks
@@ -1271,7 +1271,7 @@ This is a one-time fix-up, please be patient...
// we typically only install non-optional peers, but we have to
// factor them into the peerSet so that we can avoid conflicts
.filter(e => e.peer && !(e.valid && e.to))
- .sort(({name: a}, {name: b}) => localeCompare(a, b))
+ .sort(({ name: a }, { name: b }) => localeCompare(a, b))
for (const edge of peerEdges) {
// already placed this one, and we're happy with it.
@@ -1280,7 +1280,7 @@ This is a one-time fix-up, please be patient...
}
const parentEdge = node.parent.edgesOut.get(edge.name)
- const {isProjectRoot, isWorkspace} = node.parent.sourceReference
+ const { isProjectRoot, isWorkspace } = node.parent.sourceReference
const isMine = isProjectRoot || isWorkspace
const conflictOK = this[_force] || !isMine && !this[_strictPeerDeps]
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
index 21d4ec5a36..de625e9b76 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
@@ -26,9 +26,10 @@
// the base class, so that the overall voltron class is easier to test and
// cover, and separation of concerns can be maintained.
-const {resolve} = require('path')
-const {homedir} = require('os')
+const { resolve } = require('path')
+const { homedir } = require('os')
const procLog = require('proc-log')
+const { depth } = require('treeverse')
const { saveTypeMap } = require('../add-rm-pkg-deps.js')
const mixins = [
@@ -88,6 +89,9 @@ class Arborist extends Base {
process.emit('timeEnd', 'arborist:ctor')
}
+ // TODO: We should change these to static functions instead
+ // of methods for the next major version
+
// returns an array of the actual nodes for all the workspaces
workspaceNodes (tree, workspaces) {
return getWorkspaceNodes(tree, workspaces, this.log)
@@ -103,15 +107,15 @@ class Arborist extends Base {
}
}
}
- const set = new Set(wsNodes)
+ const wsDepSet = new Set(wsNodes)
const extraneous = new Set()
- for (const node of set) {
+ for (const node of wsDepSet) {
for (const edge of node.edgesOut.values()) {
const dep = edge.to
if (dep) {
- set.add(dep)
+ wsDepSet.add(dep)
if (dep.isLink) {
- set.add(dep.target)
+ wsDepSet.add(dep.target)
}
}
}
@@ -122,28 +126,36 @@ class Arborist extends Base {
}
}
for (const extra of extraneous) {
- set.add(extra)
+ wsDepSet.add(extra)
}
- return set
+ return wsDepSet
}
+ // returns a set of root dependencies, excluding depdencies that are
+ // exclusively workspace dependencies
excludeWorkspacesDependencySet (tree) {
- const set = new Set()
- for (const edge of tree.edgesOut.values()) {
- if (edge.type !== 'workspace' && edge.to) {
- set.add(edge.to)
- }
- }
- for (const node of set) {
- for (const edge of node.edgesOut.values()) {
- if (edge.to) {
- set.add(edge.to)
+ const rootDepSet = new Set()
+ depth({
+ tree,
+ visit: node => {
+ for (const { to } of node.edgesOut.values()) {
+ if (!to || to.isWorkspace) {
+ continue
+ }
+ for (const edgeIn of to.edgesIn.values()) {
+ if (edgeIn.from.isRoot || rootDepSet.has(edgeIn.from)) {
+ rootDepSet.add(to)
+ }
+ }
}
- }
- }
-
- return set
+ return node
+ },
+ filter: node => node,
+ getChildren: (node, tree) =>
+ [...tree.edgesOut.values()].map(edge => edge.to),
+ })
+ return rootDepSet
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
index 5d8fea8539..a232bf32b3 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
@@ -1,9 +1,9 @@
// mix-in implementing the loadActual method
-const {relative, dirname, resolve, join, normalize} = require('path')
+const { relative, dirname, resolve, join, normalize } = require('path')
const rpj = require('read-package-json-fast')
-const {promisify} = require('util')
+const { promisify } = require('util')
const readdir = promisify(require('readdir-scoped-modules'))
const walkUp = require('walk-up-path')
const ancestorPath = require('common-ancestor-path')
@@ -128,7 +128,7 @@ module.exports = cls => class ActualLoader extends cls {
pkg: {},
global,
})
- return this[_loadActualActually]({root, ignoreMissing, global})
+ return this[_loadActualActually]({ root, ignoreMissing, global })
}
// not in global mode, hidden lockfile is allowed, load root pkg too
@@ -163,7 +163,7 @@ module.exports = cls => class ActualLoader extends cls {
// we can't easily get a ref to Arborist in this module, without
// creating a circular reference, since this class is a mixin used
// to build up the Arborist class itself.
- await new this.constructor({...this.options}).loadVirtual({
+ await new this.constructor({ ...this.options }).loadVirtual({
root: this[_actualTree],
})
await this[_loadWorkspaces](this[_actualTree])
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 ed0e47daf5..7761380e9f 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
@@ -1,7 +1,7 @@
// mixin providing the loadVirtual method
const localeCompare = require('@isaacs/string-locale-compare')('en')
-const {resolve} = require('path')
+const { resolve } = require('path')
const nameFromFolder = require('@npmcli/name-from-folder')
const consistentResolve = require('../consistent-resolve.js')
@@ -97,7 +97,7 @@ module.exports = cls => class VirtualLoader extends cls {
this[checkRootEdges](s, root)
root.meta = s
this.virtualTree = root
- const {links, nodes} = this[resolveNodes](s, root)
+ const { links, nodes } = this[resolveNodes](s, root)
await this[resolveLinks](links, nodes)
if (!(s.originalLockfileVersion >= 2)) {
this[assignBundles](nodes)
@@ -208,7 +208,7 @@ module.exports = cls => class VirtualLoader extends cls {
nodes.set(location, this[loadNode](location, meta))
}
}
- return {links, nodes}
+ return { links, nodes }
}
// links is the set of metadata, and nodes is the map of non-Link nodes
@@ -240,7 +240,7 @@ module.exports = cls => class VirtualLoader extends cls {
if (!location || node.isLink && !node.target.location) {
continue
}
- const { name, parent, package: { inBundle }} = node
+ const { name, parent, package: { inBundle } } = node
if (!parent) {
continue
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
index 4f3fc1b9c3..1a05e52735 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
@@ -2,13 +2,13 @@
// bundle building needed. Called by reify, and by `npm rebuild`.
const localeCompare = require('@isaacs/string-locale-compare')('en')
-const {depth: dfwalk} = require('treeverse')
+const { depth: dfwalk } = require('treeverse')
const promiseAllRejectLate = require('promise-all-reject-late')
const rpj = require('read-package-json-fast')
const binLinks = require('bin-links')
const runScript = require('@npmcli/run-script')
const promiseCallLimit = require('promise-call-limit')
-const {resolve} = require('path')
+const { resolve } = require('path')
const {
isNodeGypPackage,
defaultGypInstallScript,
@@ -220,7 +220,7 @@ module.exports = cls => class Builder extends cls {
}
if (this[_oldMeta] === null) {
- const {root: {meta}} = node
+ const { root: { meta } } = node
this[_oldMeta] = meta && meta.loadedFromDisk &&
!(meta.originalLockfileVersion >= 2)
}
@@ -242,7 +242,7 @@ module.exports = cls => class Builder extends cls {
const pkg = await rpj(node.path + '/package.json').catch(() => ({}))
set.delete(node)
- const {scripts = {}} = pkg
+ const { scripts = {} } = pkg
node.package.scripts = scripts
return this[_addToBuildSet](node, set, true)
}
@@ -319,9 +319,9 @@ module.exports = cls => class Builder extends cls {
}
const p = runScript(runOpts).catch(er => {
const { code, signal } = er
- this.log.info('run', pkg._id, event, {code, signal})
+ this.log.info('run', pkg._id, event, { code, signal })
throw er
- }).then(({args, code, signal, stdout, stderr}) => {
+ }).then(({ args, code, signal, stdout, stderr }) => {
this.scriptsRun.add({
pkg,
path,
@@ -333,7 +333,7 @@ module.exports = cls => class Builder extends cls {
stdout,
stderr,
})
- this.log.info('run', pkg._id, event, {code, signal})
+ this.log.info('run', pkg._id, event, { code, signal })
})
await (this[_doHandleOptionalFailure]
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 978743b382..547e54ac37 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
@@ -3,15 +3,15 @@
const onExit = require('../signal-handling.js')
const pacote = require('pacote')
const AuditReport = require('../audit-report.js')
-const {subset, intersects} = require('semver')
+const { subset, intersects } = require('semver')
const npa = require('npm-package-arg')
const debug = require('../debug.js')
const walkUp = require('walk-up-path')
-const {dirname, resolve, relative} = require('path')
-const {depth: dfwalk} = require('treeverse')
+const { dirname, resolve, relative } = require('path')
+const { depth: dfwalk } = require('treeverse')
const fs = require('fs')
-const {promisify} = require('util')
+const { promisify } = require('util')
const lstat = promisify(fs.lstat)
const symlink = promisify(fs.symlink)
const mkdirp = require('mkdirp-infer-owner')
@@ -188,7 +188,7 @@ module.exports = cls => class Reifier extends cls {
// ok, we're about to start touching the fs. need to roll back
// if we get an early termination.
let reifyTerminated = null
- const removeHandler = onExit(({signal}) => {
+ const removeHandler = onExit(({ signal }) => {
// only call once. if signal hits twice, we just terminate
removeHandler()
reifyTerminated = Object.assign(new Error('process terminated'), {
@@ -352,7 +352,7 @@ module.exports = cls => class Reifier extends cls {
if (includeRootDeps) {
// add all non-workspace nodes to filterNodes
for (const tree of [this.idealTree, this.actualTree]) {
- for (const {type, to} of tree.edgesOut.values()) {
+ for (const { type, to } of tree.edgesOut.values()) {
if (type !== 'workspace' && to) {
filterNodes.push(to)
}
@@ -686,7 +686,7 @@ module.exports = cls => class Reifier extends cls {
}
[_warnDeprecated] (node) {
- const {_id, deprecated} = node.package
+ const { _id, deprecated } = node.package
if (deprecated) {
this.log.warn('deprecated', `${_id}: ${deprecated}`)
}
@@ -1159,7 +1159,7 @@ module.exports = cls => class Reifier extends cls {
const edge = addTree.edgesOut.get(name)
const pkg = addTree.package
const req = npa.resolve(name, edge.spec, addTree.realpath)
- const {rawSpec, subSpec} = req
+ const { rawSpec, subSpec } = req
const spec = subSpec ? subSpec.rawSpec : rawSpec
const child = edge.to
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
index de97cdc29e..53fc5b17ad 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
@@ -265,7 +265,7 @@ class AuditReport extends Map {
avoid: vuln.range,
avoidStrict: true,
})
- return {name, version, isSemVerMajor}
+ return { name, version, isSemVerMajor }
} catch (er) {
return false
}
@@ -285,7 +285,7 @@ class AuditReport extends Map {
}
const bulk = {}
- const {advisories} = report
+ const { advisories } = report
for (const advisory of Object.values(advisories)) {
const {
id,
@@ -296,7 +296,7 @@ class AuditReport extends Map {
module_name: name,
} = advisory
bulk[name] = bulk[name] || []
- bulk[name].push({id, url, title, severity, vulnerable_versions})
+ bulk[name].push({ id, url, title, severity, vulnerable_versions })
}
return bulk
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js b/deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js
index 95ecc8a617..2f33981419 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js
@@ -38,7 +38,7 @@ const calcDepFlagsStep = (node) => {
return calcDepFlagsStep(node.target)
}
- node.edgesOut.forEach(({peer, optional, dev, to}) => {
+ node.edgesOut.forEach(({ peer, optional, dev, to }) => {
// if the dep is missing, then its flags are already maximally unset
if (!to) {
return
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js b/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js
index 2278e25e3b..1a3ccff669 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js
@@ -78,7 +78,7 @@ class CanPlaceDep {
}
this._treeSnapshot = JSON.stringify([...target.root.inventory.entries()]
- .map(([loc, {packageName, version, resolved}]) => {
+ .map(([loc, { packageName, version, resolved }]) => {
return [loc, packageName, version, resolved]
}).sort(([a], [b]) => localeCompare(a, b)))
})
@@ -118,7 +118,7 @@ class CanPlaceDep {
debug(() => {
const treeSnapshot = JSON.stringify([...target.root.inventory.entries()]
- .map(([loc, {packageName, version, resolved}]) => {
+ .map(([loc, { packageName, version, resolved }]) => {
return [loc, packageName, version, resolved]
}).sort(([a], [b]) => localeCompare(a, b)))
/* istanbul ignore if */
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js b/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
index d80437f20c..2c837ae888 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
@@ -6,7 +6,7 @@
const semver = require('semver')
const npa = require('npm-package-arg')
-const {relative} = require('path')
+const { relative } = require('path')
const fromPath = require('./from-path.js')
const depValid = (child, requested, requestor) => {
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
index 0d17bde958..0387773c29 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
@@ -5,13 +5,13 @@
// Thus, the root Diff node is the shallowest change required
// for a given branch of the tree being mutated.
-const {depth} = require('treeverse')
-const {existsSync} = require('fs')
+const { depth } = require('treeverse')
+const { existsSync } = require('fs')
const ssri = require('ssri')
class Diff {
- constructor ({actual, ideal, filterSet, shrinkwrapInflated}) {
+ constructor ({ actual, ideal, filterSet, shrinkwrapInflated }) {
this.filterSet = filterSet
this.shrinkwrapInflated = shrinkwrapInflated
this.children = []
@@ -94,14 +94,14 @@ class Diff {
}
return depth({
- tree: new Diff({actual, ideal, filterSet, shrinkwrapInflated}),
+ tree: new Diff({ actual, ideal, filterSet, shrinkwrapInflated }),
getChildren,
leave,
})
}
}
-const getAction = ({actual, ideal}) => {
+const getAction = ({ actual, ideal }) => {
if (!ideal) {
return 'REMOVE'
}
@@ -237,7 +237,7 @@ const diffNode = ({
return
}
- const action = getAction({actual, ideal})
+ const action = getAction({ actual, ideal })
// if it's a match, then get its children
// otherwise, this is the child diff node
@@ -245,7 +245,7 @@ const diffNode = ({
if (action === 'REMOVE') {
removed.push(actual)
}
- children.push(new Diff({actual, ideal, filterSet, shrinkwrapInflated}))
+ children.push(new Diff({ actual, ideal, filterSet, shrinkwrapInflated }))
} else {
unchanged.push(ideal)
// !*! Weird dirty hack warning !*!
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/from-path.js b/deps/npm/node_modules/@npmcli/arborist/lib/from-path.js
index 08be583d1a..2a3617844c 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/from-path.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/from-path.js
@@ -3,7 +3,7 @@
// end up getting installed. directory (ie, symlink) deps also need
// to be resolved based on their targets, but that's what realpath is
-const {dirname} = require('path')
+const { dirname } = require('path')
const npa = require('npm-package-arg')
const fromPath = (node, spec) =>
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/link.js b/deps/npm/node_modules/@npmcli/arborist/lib/link.js
index 0289e04151..dcce8c0d3d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/link.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/link.js
@@ -3,7 +3,7 @@ const relpath = require('./relpath.js')
const Node = require('./node.js')
const _loadDeps = Symbol.for('Arborist.Node._loadDeps')
const _target = Symbol.for('_target')
-const {dirname} = require('path')
+const { dirname } = require('path')
// defined by Node class
const _delistFromMeta = Symbol.for('_delistFromMeta')
const _refreshLocation = Symbol.for('_refreshLocation')
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js
index a872f24805..d311b6a837 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js
@@ -32,15 +32,15 @@ const semver = require('semver')
const nameFromFolder = require('@npmcli/name-from-folder')
const Edge = require('./edge.js')
const Inventory = require('./inventory.js')
-const {normalize} = require('read-package-json-fast')
-const {getPaths: getBinPaths} = require('bin-links')
+const { normalize } = require('read-package-json-fast')
+const { getPaths: getBinPaths } = require('bin-links')
const npa = require('npm-package-arg')
const debug = require('./debug.js')
const gatherDepSet = require('./gather-dep-set.js')
const treeCheck = require('./tree-check.js')
const walkUp = require('walk-up-path')
-const {resolve, relative, dirname, basename} = require('path')
+const { resolve, relative, dirname, basename } = require('path')
const util = require('util')
const _package = Symbol('_package')
const _parent = Symbol('_parent')
@@ -291,8 +291,8 @@ class Node {
}
get hasInstallScript () {
- const {hasInstallScript, scripts} = this.package
- const {install, preinstall, postinstall} = scripts || {}
+ const { hasInstallScript, scripts } = this.package
+ const { install, preinstall, postinstall } = scripts || {}
return !!(hasInstallScript || install || preinstall || postinstall)
}
@@ -376,7 +376,7 @@ class Node {
}
if (this.root.sourceReference) {
- const {name, version} = this.root.package
+ const { name, version } = this.root.package
why.whileInstalling = {
name,
version,
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
index ba2a25b195..018e569b1d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
@@ -87,7 +87,7 @@ class ArboristNode {
// fsChildren sorted by path
if (tree.fsChildren.size) {
this.fsChildren = new Set([...tree.fsChildren]
- .sort(({path: a}, {path: b}) => localeCompare(a, b))
+ .sort(({ path: a }, { path: b }) => localeCompare(a, b))
.map(tree => printableTree(tree, path)))
}
@@ -114,7 +114,7 @@ class ArboristLink extends ArboristNode {
}
}
-const treeError = ({code, path}) => ({
+const treeError = ({ code, path }) => ({
code,
...(path ? { path } : {}),
})
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/relpath.js b/deps/npm/node_modules/@npmcli/arborist/lib/relpath.js
index 33e12ff6f6..e1960cfec0 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/relpath.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/relpath.js
@@ -1,3 +1,3 @@
-const {relative} = require('path')
+const { relative } = require('path')
const relpath = (from, to) => relative(from, to).replace(/\\/g, '/')
module.exports = relpath
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js b/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js
index a6ce867d78..5d583b1514 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/retire-path.js
@@ -1,5 +1,5 @@
const crypto = require('crypto')
-const {dirname, basename, resolve} = require('path')
+const { dirname, basename, resolve } = require('path')
// use sha1 because it's faster, and collisions extremely unlikely anyway
const pathSafeHash = s =>
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
index e7dd435ca3..2f0c0877cf 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
@@ -35,7 +35,7 @@ const mismatch = (a, b) => a && b && a !== b
const procLog = require('proc-log')
const YarnLock = require('./yarn-lock.js')
-const {promisify} = require('util')
+const { promisify } = require('util')
const rimraf = promisify(require('rimraf'))
const fs = require('fs')
const readFile = promisify(fs.readFile)
@@ -180,7 +180,7 @@ const assertNoNewer = async (path, data, lockTime, dir = path, seen = null) => {
const parent = isParent ? dir : resolve(dir, 'node_modules')
const children = dir === path
- ? Promise.resolve([{name: 'node_modules', isDirectory: () => true }])
+ ? Promise.resolve([{ name: 'node_modules', isDirectory: () => true }])
: readdir(parent, { withFileTypes: true })
return children.catch(() => [])
@@ -366,7 +366,7 @@ class Shrinkwrap {
if (fromYarn && fromYarn.version) {
// if it's the yarn or npm default registry, use the version as
// our effective spec. if it's any other kind of thing, use that.
- const {resolved, version, integrity} = fromYarn
+ const { resolved, version, integrity } = fromYarn
const isYarnReg = spec.registry && yarnRegRe.test(resolved)
const isnpmReg = spec.registry && !isYarnReg && npmRegRe.test(resolved)
const isReg = isnpmReg || isYarnReg
@@ -1062,7 +1062,7 @@ class Shrinkwrap {
}
// now we walk the children, putting them in the 'dependencies' object
- const {children} = node.target
+ const { children } = node.target
if (!children.size) {
delete lock.dependencies
} else {
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js b/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js
index d5d8f7345c..cdb59b7d4d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js
@@ -1,7 +1,7 @@
/* eslint node/no-deprecated-api: "off" */
const semver = require('semver')
-const {basename} = require('path')
-const {parse} = require('url')
+const { basename } = require('path')
+const { parse } = require('url')
module.exports = (name, tgz) => {
const base = basename(tgz)
if (!base.endsWith('.tgz')) {
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js b/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
index a818cf318e..5b1483e183 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
@@ -11,7 +11,7 @@
// @npmcli/metavuln-calculator
// - via: dependency vulns which cause this one
-const {satisfies, simplifyRange} = require('semver')
+const { satisfies, simplifyRange } = require('semver')
const semverOpt = { loose: true, includePrerelease: true }
const localeCompare = require('@isaacs/string-locale-compare')('en')
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js b/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
index 1eed066408..5119a757a7 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
@@ -30,8 +30,8 @@
const localeCompare = require('@isaacs/string-locale-compare')('en')
const consistentResolve = require('./consistent-resolve.js')
-const {dirname} = require('path')
-const {breadth} = require('treeverse')
+const { dirname } = require('path')
+const { breadth } = require('treeverse')
// sort a key/value object into a string of JSON stringified keys and vals
const sortKV = obj => Object.keys(obj)
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index dfe2b6f08f..34d38572d3 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/node_modules/@npmcli/arborist/package.json
@@ -1,15 +1,15 @@
{
"name": "@npmcli/arborist",
- "version": "4.0.4",
+ "version": "4.0.5",
"description": "Manage node_modules trees",
"dependencies": {
- "@isaacs/string-locale-compare": "^1.0.1",
+ "@isaacs/string-locale-compare": "^1.1.0",
"@npmcli/installed-package-contents": "^1.0.7",
"@npmcli/map-workspaces": "^2.0.0",
"@npmcli/metavuln-calculator": "^2.0.0",
"@npmcli/move-file": "^1.1.0",
"@npmcli/name-from-folder": "^1.0.1",
- "@npmcli/node-gyp": "^1.0.1",
+ "@npmcli/node-gyp": "^1.0.3",
"@npmcli/package-json": "^1.0.1",
"@npmcli/run-script": "^2.0.0",
"bin-links": "^2.3.0",
@@ -23,7 +23,7 @@
"npm-package-arg": "^8.1.5",
"npm-pick-manifest": "^6.1.0",
"npm-registry-fetch": "^11.0.0",
- "pacote": "^12.0.0",
+ "pacote": "^12.0.2",
"parse-conflict-json": "^1.1.1",
"proc-log": "^1.0.0",
"promise-all-reject-late": "^1.0.0",
@@ -37,11 +37,11 @@
"walk-up-path": "^1.0.0"
},
"devDependencies": {
- "@npmcli/lint": "^1.0.2",
+ "@npmcli/template-oss": "^2.3.0",
"benchmark": "^2.1.4",
"chalk": "^4.1.0",
"minify-registry-metadata": "^2.1.0",
- "tap": "^15.0.9",
+ "tap": "^15.1.2",
"tcompare": "^5.0.6"
},
"scripts": {
@@ -54,21 +54,22 @@
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"eslint": "eslint",
- "lint": "npm run npmclilint -- \"lib/**/*.*js\" \"bin/**/*.*js\" \"test/*.*js\" \"test/arborist/*.*js\"",
+ "lint": "eslint '**/*.js'",
"lintfix": "npm run lint -- --fix",
"benchmark": "node scripts/benchmark.js",
"benchclean": "rm -rf scripts/benchmark/*/",
- "npmclilint": "npmcli-lint"
+ "npmclilint": "npmcli-lint",
+ "postlint": "npm-template-check"
},
"repository": {
"type": "git",
"url": "https://github.com/npm/arborist"
},
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "author": "GitHub Inc.",
"license": "ISC",
"files": [
- "lib/**/*.js",
- "bin/**/*.js"
+ "bin",
+ "lib"
],
"main": "lib/index.js",
"bin": {
@@ -91,5 +92,10 @@
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
- }
+ },
+ "templateVersion": "2.3.0",
+ "eslintIgnore": [
+ "test/fixtures/",
+ "!test/fixtures/*.js"
+ ]
}
diff --git a/deps/npm/node_modules/@npmcli/node-gyp/package.json b/deps/npm/node_modules/@npmcli/node-gyp/package.json
index 37ecb87a2b..299a453b66 100644
--- a/deps/npm/node_modules/@npmcli/node-gyp/package.json
+++ b/deps/npm/node_modules/@npmcli/node-gyp/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/node-gyp",
- "version": "1.0.2",
+ "version": "1.0.3",
"description": "Tools for dealing with node-gyp packages",
"scripts": {
"test": "tap",
@@ -8,6 +8,10 @@
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
},
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/node-gyp.git"
+ },
"keywords": [
"npm",
"cli",
diff --git a/deps/npm/node_modules/gauge/LICENSE b/deps/npm/node_modules/gauge/LICENSE
deleted file mode 100644
index e756052969..0000000000
--- a/deps/npm/node_modules/gauge/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (c) 2014, Rebecca Turner <me@re-becca.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/LICENSE.md b/deps/npm/node_modules/gauge/LICENSE.md
new file mode 100644
index 0000000000..5fc208ff12
--- /dev/null
+++ b/deps/npm/node_modules/gauge/LICENSE.md
@@ -0,0 +1,20 @@
+<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
+
+ISC License
+
+Copyright npm, Inc.
+
+Permission to use, copy, modify, and/or distribute this
+software for any purpose with or without fee is hereby
+granted, provided that the above copyright notice and this
+permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/base-theme.js b/deps/npm/node_modules/gauge/lib/base-theme.js
index 0b67638e02..00bf5684cd 100644
--- a/deps/npm/node_modules/gauge/base-theme.js
+++ b/deps/npm/node_modules/gauge/lib/base-theme.js
@@ -4,11 +4,15 @@ var progressBar = require('./progress-bar.js')
module.exports = {
activityIndicator: function (values, theme, width) {
- if (values.spun == null) return
+ if (values.spun == null) {
+ return
+ }
return spin(theme, values.spun)
},
progressbar: function (values, theme, width) {
- if (values.completed == null) return
+ if (values.completed == null) {
+ return
+ }
return progressBar(theme, width, values.completed)
- }
+ },
}
diff --git a/deps/npm/node_modules/gauge/lib/demo.js b/deps/npm/node_modules/gauge/lib/demo.js
new file mode 100644
index 0000000000..88c03cd9a4
--- /dev/null
+++ b/deps/npm/node_modules/gauge/lib/demo.js
@@ -0,0 +1,45 @@
+var Gauge = require('./')
+var gaugeDefault = require('./themes.js')
+var onExit = require('signal-exit')
+
+var activeGauge
+
+onExit(function () {
+ activeGauge.disable()
+})
+
+var themes = gaugeDefault.getThemeNames()
+
+nextBar()
+function nextBar () {
+ var themeName = themes.shift()
+
+ console.log('Demoing output for ' + themeName)
+
+ var gt = new Gauge(process.stderr, {
+ updateInterval: 50,
+ theme: themeName,
+ cleanupOnExit: false,
+ })
+ activeGauge = gt
+
+ var progress = 0
+
+ var cnt = 0
+ var pulse = setInterval(function () {
+ gt.pulse('this is a thing that happened ' + (++cnt))
+ }, 110)
+ var prog = setInterval(function () {
+ progress += 0.04
+ gt.show(themeName + ':' + Math.round(progress * 1000), progress)
+ if (progress >= 1) {
+ clearInterval(prog)
+ clearInterval(pulse)
+ gt.disable()
+ if (themes.length) {
+ nextBar()
+ }
+ }
+ }, 100)
+ gt.show()
+}
diff --git a/deps/npm/node_modules/gauge/error.js b/deps/npm/node_modules/gauge/lib/error.js
index d9914ba533..d9914ba533 100644
--- a/deps/npm/node_modules/gauge/error.js
+++ b/deps/npm/node_modules/gauge/lib/error.js
diff --git a/deps/npm/node_modules/gauge/has-color.js b/deps/npm/node_modules/gauge/lib/has-color.js
index 16cba0eb47..16cba0eb47 100644
--- a/deps/npm/node_modules/gauge/has-color.js
+++ b/deps/npm/node_modules/gauge/lib/has-color.js
diff --git a/deps/npm/node_modules/gauge/index.js b/deps/npm/node_modules/gauge/lib/index.js
index 87a4bb9308..ce9ba7d638 100644
--- a/deps/npm/node_modules/gauge/index.js
+++ b/deps/npm/node_modules/gauge/lib/index.js
@@ -32,7 +32,7 @@ function Gauge (arg1, arg2) {
this._status = {
spun: 0,
section: '',
- subsection: ''
+ subsection: '',
}
this._paused = false // are we paused for back pressure?
this._disabled = true // are all progress bar updates disabled?
@@ -50,10 +50,10 @@ function Gauge (arg1, arg2) {
this._theme = options.theme
var theme = this._computeTheme(options.theme)
var template = options.template || [
- {type: 'progressbar', length: 20},
- {type: 'activityIndicator', kerning: 1, length: 1},
- {type: 'section', kerning: 1, default: ''},
- {type: 'subsection', kerning: 1, default: ''}
+ { type: 'progressbar', length: 20 },
+ { type: 'activityIndicator', kerning: 1, length: 1 },
+ { type: 'section', kerning: 1, default: '' },
+ { type: 'subsection', kerning: 1, default: '' },
]
this.setWriteTo(writeTo, options.tty)
var PlumbingClass = options.Plumbing || Plumbing
@@ -79,17 +79,28 @@ Gauge.prototype.isEnabled = function () {
Gauge.prototype.setTemplate = function (template) {
this._gauge.setTemplate(template)
- if (this._showing) this._requestRedraw()
+ if (this._showing) {
+ this._requestRedraw()
+ }
}
Gauge.prototype._computeTheme = function (theme) {
- if (!theme) theme = {}
+ if (!theme) {
+ theme = {}
+ }
if (typeof theme === 'string') {
theme = this._themes.getTheme(theme)
- } else if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)) {
+ } else if (
+ theme &&
+ (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
- theme = this._themes.getDefault({hasUnicode: useUnicode, hasColor: useColor, platform: theme.platform})
+ theme = this._themes.getDefault({
+ hasUnicode: useUnicode,
+ hasColor: useColor,
+ platform: theme.platform,
+ })
}
return theme
}
@@ -101,13 +112,17 @@ Gauge.prototype.setThemeset = function (themes) {
Gauge.prototype.setTheme = function (theme) {
this._gauge.setTheme(this._computeTheme(theme))
- if (this._showing) this._requestRedraw()
+ if (this._showing) {
+ this._requestRedraw()
+ }
this._theme = theme
}
Gauge.prototype._requestRedraw = function () {
this._needsRedraw = true
- if (!this._fixedFramerate) this._doRedraw()
+ if (!this._fixedFramerate) {
+ this._doRedraw()
+ }
}
Gauge.prototype.getWidth = function () {
@@ -116,25 +131,39 @@ Gauge.prototype.getWidth = function () {
Gauge.prototype.setWriteTo = function (writeTo, tty) {
var enabled = !this._disabled
- if (enabled) this.disable()
+ if (enabled) {
+ this.disable()
+ }
this._writeTo = writeTo
this._tty = tty ||
(writeTo === process.stderr && process.stdout.isTTY && process.stdout) ||
(writeTo.isTTY && writeTo) ||
this._tty
- if (this._gauge) this._gauge.setWidth(this.getWidth())
- if (enabled) this.enable()
+ if (this._gauge) {
+ this._gauge.setWidth(this.getWidth())
+ }
+ if (enabled) {
+ this.enable()
+ }
}
Gauge.prototype.enable = function () {
- if (!this._disabled) return
+ if (!this._disabled) {
+ return
+ }
this._disabled = false
- if (this._tty) this._enableEvents()
- if (this._showing) this.show()
+ if (this._tty) {
+ this._enableEvents()
+ }
+ if (this._showing) {
+ this.show()
+ }
}
Gauge.prototype.disable = function () {
- if (this._disabled) return
+ if (this._disabled) {
+ return
+ }
if (this._showing) {
this._lastUpdateAt = null
this._showing = false
@@ -142,7 +171,9 @@ Gauge.prototype.disable = function () {
this._showing = true
}
this._disabled = true
- if (this._tty) this._disableEvents()
+ if (this._tty) {
+ this._disableEvents()
+ }
}
Gauge.prototype._enableEvents = function () {
@@ -152,19 +183,29 @@ Gauge.prototype._enableEvents = function () {
this._tty.on('resize', this._$$handleSizeChange)
if (this._fixedFramerate) {
this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval)
- if (this.redrawTracker.unref) this.redrawTracker.unref()
+ if (this.redrawTracker.unref) {
+ this.redrawTracker.unref()
+ }
}
}
Gauge.prototype._disableEvents = function () {
this._tty.removeListener('resize', this._$$handleSizeChange)
- if (this._fixedFramerate) clearInterval(this.redrawTracker)
- if (this._removeOnExit) this._removeOnExit()
+ if (this._fixedFramerate) {
+ clearInterval(this.redrawTracker)
+ }
+ if (this._removeOnExit) {
+ this._removeOnExit()
+ }
}
Gauge.prototype.hide = function (cb) {
- if (this._disabled) return cb && process.nextTick(cb)
- if (!this._showing) return cb && process.nextTick(cb)
+ if (this._disabled) {
+ return cb && process.nextTick(cb)
+ }
+ if (!this._showing) {
+ return cb && process.nextTick(cb)
+ }
this._showing = false
this._doRedraw()
cb && setImmediate(cb)
@@ -181,16 +222,24 @@ Gauge.prototype.show = function (section, completed) {
this._status[key] = section[key]
}
}
- if (completed != null) this._status.completed = completed
- if (this._disabled) return
+ if (completed != null) {
+ this._status.completed = completed
+ }
+ if (this._disabled) {
+ return
+ }
this._requestRedraw()
}
Gauge.prototype.pulse = function (subsection) {
this._status.subsection = subsection || ''
this._status.spun++
- if (this._disabled) return
- if (!this._showing) return
+ if (this._disabled) {
+ return
+ }
+ if (!this._showing) {
+ return
+ }
this._requestRedraw()
}
@@ -200,10 +249,14 @@ Gauge.prototype._handleSizeChange = function () {
}
Gauge.prototype._doRedraw = function () {
- if (this._disabled || this._paused) return
+ if (this._disabled || this._paused) {
+ return
+ }
if (!this._fixedFramerate) {
var now = Date.now()
- if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) return
+ if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) {
+ return
+ }
this._lastUpdateAt = now
}
if (!this._showing && this._onScreen) {
@@ -214,7 +267,9 @@ Gauge.prototype._doRedraw = function () {
}
return this._writeTo.write(result)
}
- if (!this._showing && !this._onScreen) return
+ if (!this._showing && !this._onScreen) {
+ return
+ }
if (this._showing && !this._onScreen) {
this._onScreen = true
this._needsRedraw = true
@@ -222,7 +277,9 @@ Gauge.prototype._doRedraw = function () {
this._writeTo.write(this._gauge.hideCursor())
}
}
- if (!this._needsRedraw) return
+ if (!this._needsRedraw) {
+ return
+ }
if (!this._writeTo.write(this._gauge.show(this._status))) {
this._paused = true
this._writeTo.on('drain', callWith(this, function () {
diff --git a/deps/npm/node_modules/gauge/plumbing.js b/deps/npm/node_modules/gauge/lib/plumbing.js
index 1afb4af6d5..c4dc3e074b 100644
--- a/deps/npm/node_modules/gauge/plumbing.js
+++ b/deps/npm/node_modules/gauge/lib/plumbing.js
@@ -4,7 +4,9 @@ var renderTemplate = require('./render-template.js')
var validate = require('aproba')
var Plumbing = module.exports = function (theme, template, width) {
- if (!width) width = 80
+ if (!width) {
+ width = 80
+ }
validate('OAN', [theme, template, width])
this.showing = false
this.theme = theme
diff --git a/deps/npm/node_modules/gauge/process.js b/deps/npm/node_modules/gauge/lib/process.js
index 05e85694d7..05e85694d7 100644
--- a/deps/npm/node_modules/gauge/process.js
+++ b/deps/npm/node_modules/gauge/lib/process.js
diff --git a/deps/npm/node_modules/gauge/progress-bar.js b/deps/npm/node_modules/gauge/lib/progress-bar.js
index 1780a8a54d..184ff2500a 100644
--- a/deps/npm/node_modules/gauge/progress-bar.js
+++ b/deps/npm/node_modules/gauge/lib/progress-bar.js
@@ -6,14 +6,20 @@ var stringWidth = require('string-width')
module.exports = function (theme, width, completed) {
validate('ONN', [theme, width, completed])
- if (completed < 0) completed = 0
- if (completed > 1) completed = 1
- if (width <= 0) return ''
+ if (completed < 0) {
+ completed = 0
+ }
+ if (completed > 1) {
+ completed = 1
+ }
+ if (width <= 0) {
+ return ''
+ }
var sofar = Math.round(width * completed)
var rest = width - sofar
var template = [
- {type: 'complete', value: repeat(theme.complete, sofar), length: sofar},
- {type: 'remaining', value: repeat(theme.remaining, rest), length: rest}
+ { type: 'complete', value: repeat(theme.complete, sofar), length: sofar },
+ { type: 'remaining', value: repeat(theme.remaining, rest), length: rest },
]
return renderTemplate(width, template, theme)
}
diff --git a/deps/npm/node_modules/gauge/render-template.js b/deps/npm/node_modules/gauge/lib/render-template.js
index 9764c6e0a1..d1b52c0f48 100644
--- a/deps/npm/node_modules/gauge/render-template.js
+++ b/deps/npm/node_modules/gauge/lib/render-template.js
@@ -28,7 +28,9 @@ function postType (item) {
}
function hasPreOrPost (item, values) {
- if (!item.type) return
+ if (!item.type) {
+ return
+ }
return values[preType(item)] || values[postType(item)]
}
@@ -39,7 +41,7 @@ function generatePreAndPost (baseItem, parentValues) {
var pre = preType(item)
var post = postType(item)
if (values[pre]) {
- template.push({value: values[pre]})
+ template.push({ value: values[pre] })
values[pre] = null
}
item.minLength = null
@@ -48,7 +50,7 @@ function generatePreAndPost (baseItem, parentValues) {
template.push(item)
values[item.type] = values[item.type]
if (values[post]) {
- template.push({value: values[post]})
+ template.push({ value: values[post] })
values[post] = null
}
return function ($1, $2, length) {
@@ -71,47 +73,73 @@ function prepareItems (width, template, values) {
cloned.value = values[type]
}
}
- if (cloned.value == null || cloned.value === '') return null
+ if (cloned.value == null || cloned.value === '') {
+ return null
+ }
cloned.index = index
cloned.first = index === 0
cloned.last = index === arr.length - 1
- if (hasPreOrPost(cloned, values)) cloned.value = generatePreAndPost(cloned, values)
+ if (hasPreOrPost(cloned, values)) {
+ cloned.value = generatePreAndPost(cloned, values)
+ }
return cloned
}
- var output = template.map(cloneAndObjectify).filter(function (item) { return item != null })
+ var output = template.map(cloneAndObjectify).filter(function (item) {
+ return item != null
+ })
var remainingSpace = width
var variableCount = output.length
function consumeSpace (length) {
- if (length > remainingSpace) length = remainingSpace
+ if (length > remainingSpace) {
+ length = remainingSpace
+ }
remainingSpace -= length
}
function finishSizing (item, length) {
- if (item.finished) throw new error.Internal('Tried to finish template item that was already finished')
- if (length === Infinity) throw new error.Internal('Length of template item cannot be infinity')
- if (length != null) item.length = length
+ if (item.finished) {
+ throw new error.Internal('Tried to finish template item that was already finished')
+ }
+ if (length === Infinity) {
+ throw new error.Internal('Length of template item cannot be infinity')
+ }
+ if (length != null) {
+ item.length = length
+ }
item.minLength = null
item.maxLength = null
--variableCount
item.finished = true
- if (item.length == null) item.length = item.getBaseLength()
- if (item.length == null) throw new error.Internal('Finished template items must have a length')
+ if (item.length == null) {
+ item.length = item.getBaseLength()
+ }
+ if (item.length == null) {
+ throw new error.Internal('Finished template items must have a length')
+ }
consumeSpace(item.getLength())
}
output.forEach(function (item) {
- if (!item.kerning) return
+ if (!item.kerning) {
+ return
+ }
var prevPadRight = item.first ? 0 : output[item.index - 1].padRight
- if (!item.first && prevPadRight < item.kerning) item.padLeft = item.kerning - prevPadRight
- if (!item.last) item.padRight = item.kerning
+ if (!item.first && prevPadRight < item.kerning) {
+ item.padLeft = item.kerning - prevPadRight
+ }
+ if (!item.last) {
+ item.padRight = item.kerning
+ }
})
// Finish any that have a fixed (literal or intuited) length
output.forEach(function (item) {
- if (item.getBaseLength() == null) return
+ if (item.getBaseLength() == null) {
+ return
+ }
finishSizing(item)
})
@@ -122,34 +150,48 @@ function prepareItems (width, template, values) {
resizing = false
hunkSize = Math.round(remainingSpace / variableCount)
output.forEach(function (item) {
- if (item.finished) return
- if (!item.maxLength) return
+ if (item.finished) {
+ return
+ }
+ if (!item.maxLength) {
+ return
+ }
if (item.getMaxLength() < hunkSize) {
finishSizing(item, item.maxLength)
resizing = true
}
})
} while (resizing && resized++ < output.length)
- if (resizing) throw new error.Internal('Resize loop iterated too many times while determining maxLength')
+ if (resizing) {
+ throw new error.Internal('Resize loop iterated too many times while determining maxLength')
+ }
resized = 0
do {
resizing = false
hunkSize = Math.round(remainingSpace / variableCount)
output.forEach(function (item) {
- if (item.finished) return
- if (!item.minLength) return
+ if (item.finished) {
+ return
+ }
+ if (!item.minLength) {
+ return
+ }
if (item.getMinLength() >= hunkSize) {
finishSizing(item, item.minLength)
resizing = true
}
})
} while (resizing && resized++ < output.length)
- if (resizing) throw new error.Internal('Resize loop iterated too many times while determining minLength')
+ if (resizing) {
+ throw new error.Internal('Resize loop iterated too many times while determining minLength')
+ }
hunkSize = Math.round(remainingSpace / variableCount)
output.forEach(function (item) {
- if (item.finished) return
+ if (item.finished) {
+ return
+ }
finishSizing(item, hunkSize)
})
@@ -168,7 +210,9 @@ function renderFunction (item, values, length) {
function renderValue (item, values) {
var length = item.getBaseLength()
var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value
- if (value == null || value === '') return ''
+ if (value == null || value === '') {
+ return ''
+ }
var alignWith = align[item.align] || align.left
var leftPadding = item.padLeft ? align.left('', item.padLeft) : ''
var rightPadding = item.padRight ? align.right('', item.padRight) : ''
diff --git a/deps/npm/node_modules/gauge/set-immediate.js b/deps/npm/node_modules/gauge/lib/set-immediate.js
index 6650a485c4..6650a485c4 100644
--- a/deps/npm/node_modules/gauge/set-immediate.js
+++ b/deps/npm/node_modules/gauge/lib/set-immediate.js
diff --git a/deps/npm/node_modules/gauge/set-interval.js b/deps/npm/node_modules/gauge/lib/set-interval.js
index 576198793c..576198793c 100644
--- a/deps/npm/node_modules/gauge/set-interval.js
+++ b/deps/npm/node_modules/gauge/lib/set-interval.js
diff --git a/deps/npm/node_modules/gauge/spin.js b/deps/npm/node_modules/gauge/lib/spin.js
index 34142ee31a..34142ee31a 100644
--- a/deps/npm/node_modules/gauge/spin.js
+++ b/deps/npm/node_modules/gauge/lib/spin.js
diff --git a/deps/npm/node_modules/gauge/template-item.js b/deps/npm/node_modules/gauge/lib/template-item.js
index 4f02fefaa2..e307e9b742 100644
--- a/deps/npm/node_modules/gauge/template-item.js
+++ b/deps/npm/node_modules/gauge/lib/template-item.js
@@ -4,7 +4,9 @@ var stringWidth = require('string-width')
module.exports = TemplateItem
function isPercent (num) {
- if (typeof num !== 'string') return false
+ if (typeof num !== 'string') {
+ return false
+ }
return num.slice(-1) === '%'
}
@@ -30,7 +32,9 @@ function TemplateItem (values, outputLength) {
if (typeof values === 'string') {
this.value = values
} else {
- for (var prop in values) this[prop] = values[prop]
+ for (var prop in values) {
+ this[prop] = values[prop]
+ }
}
// Realize percents
if (isPercent(this.length)) {
@@ -49,7 +53,12 @@ TemplateItem.prototype = {}
TemplateItem.prototype.getBaseLength = function () {
var length = this.length
- if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) {
+ if (
+ length == null &&
+ typeof this.value === 'string' &&
+ this.maxLength == null &&
+ this.minLength == null
+ ) {
length = stringWidth(this.value)
}
return length
@@ -57,16 +66,22 @@ TemplateItem.prototype.getBaseLength = function () {
TemplateItem.prototype.getLength = function () {
var length = this.getBaseLength()
- if (length == null) return null
+ if (length == null) {
+ return null
+ }
return length + this.padLeft + this.padRight
}
TemplateItem.prototype.getMaxLength = function () {
- if (this.maxLength == null) return null
+ if (this.maxLength == null) {
+ return null
+ }
return this.maxLength + this.padLeft + this.padRight
}
TemplateItem.prototype.getMinLength = function () {
- if (this.minLength == null) return null
+ if (this.minLength == null) {
+ return null
+ }
return this.minLength + this.padLeft + this.padRight
}
diff --git a/deps/npm/node_modules/gauge/theme-set.js b/deps/npm/node_modules/gauge/lib/theme-set.js
index c022d61cf1..643d7dbb1d 100644
--- a/deps/npm/node_modules/gauge/theme-set.js
+++ b/deps/npm/node_modules/gauge/lib/theme-set.js
@@ -1,5 +1,4 @@
'use strict'
-var objectAssign = require('object-assign')
module.exports = function () {
return ThemeSetProto.newThemeSet()
@@ -14,7 +13,7 @@ ThemeSetProto.newTheme = function (parent, theme) {
theme = parent
parent = this.baseTheme
}
- return objectAssign({}, parent, theme)
+ return Object.assign({}, parent, theme)
}
ThemeSetProto.getThemeNames = function () {
@@ -28,13 +27,15 @@ ThemeSetProto.addTheme = function (name, parent, theme) {
ThemeSetProto.addToAllThemes = function (theme) {
var themes = this.themes
Object.keys(themes).forEach(function (name) {
- objectAssign(themes[name], theme)
+ Object.assign(themes[name], theme)
})
- objectAssign(this.baseTheme, theme)
+ Object.assign(this.baseTheme, theme)
}
ThemeSetProto.getTheme = function (name) {
- if (!this.themes[name]) throw this.newMissingThemeError(name)
+ if (!this.themes[name]) {
+ throw this.newMissingThemeError(name)
+ }
return this.themes[name]
}
@@ -46,17 +47,23 @@ ThemeSetProto.setDefault = function (opts, name) {
var platform = opts.platform == null ? 'fallback' : opts.platform
var hasUnicode = !!opts.hasUnicode
var hasColor = !!opts.hasColor
- if (!this.defaults[platform]) this.defaults[platform] = {true: {}, false: {}}
+ if (!this.defaults[platform]) {
+ this.defaults[platform] = { true: {}, false: {} }
+ }
this.defaults[platform][hasUnicode][hasColor] = name
}
ThemeSetProto.getDefault = function (opts) {
- if (!opts) opts = {}
+ if (!opts) {
+ opts = {}
+ }
var platformName = opts.platform || process.platform
var platform = this.defaults[platformName] || this.defaults.fallback
var hasUnicode = !!opts.hasUnicode
var hasColor = !!opts.hasColor
- if (!platform) throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
+ if (!platform) {
+ throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor)
+ }
if (!platform[hasUnicode][hasColor]) {
if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) {
hasUnicode = false
@@ -76,7 +83,7 @@ ThemeSetProto.getDefault = function (opts) {
if (platform[hasUnicode][hasColor]) {
return this.getTheme(platform[hasUnicode][hasColor])
} else {
- return this.getDefault(objectAssign({}, opts, {platform: 'fallback'}))
+ return this.getDefault(Object.assign({}, opts, { platform: 'fallback' }))
}
}
@@ -88,27 +95,28 @@ ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) {
return err
}
-ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) {
- var err = new Error(
- 'Could not find a gauge theme for your platform/unicode/color use combo:\n' +
+ThemeSetProto.newMissingDefaultThemeError =
+ function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) {
+ var err = new Error(
+ 'Could not find a gauge theme for your platform/unicode/color use combo:\n' +
' platform = ' + platformName + '\n' +
' hasUnicode = ' + hasUnicode + '\n' +
' hasColor = ' + hasColor)
- Error.captureStackTrace.call(err, newMissingDefaultThemeError)
- err.platform = platformName
- err.hasUnicode = hasUnicode
- err.hasColor = hasColor
- err.code = 'EMISSINGTHEME'
- return err
-}
+ Error.captureStackTrace.call(err, newMissingDefaultThemeError)
+ err.platform = platformName
+ err.hasUnicode = hasUnicode
+ err.hasColor = hasColor
+ err.code = 'EMISSINGTHEME'
+ return err
+ }
ThemeSetProto.newThemeSet = function () {
var themeset = function (opts) {
return themeset.getDefault(opts)
}
- return objectAssign(themeset, ThemeSetProto, {
- themes: objectAssign({}, this.themes),
- baseTheme: objectAssign({}, this.baseTheme),
- defaults: JSON.parse(JSON.stringify(this.defaults || {}))
+ return Object.assign(themeset, ThemeSetProto, {
+ themes: Object.assign({}, this.themes),
+ baseTheme: Object.assign({}, this.baseTheme),
+ defaults: JSON.parse(JSON.stringify(this.defaults || {})),
})
}
diff --git a/deps/npm/node_modules/gauge/themes.js b/deps/npm/node_modules/gauge/lib/themes.js
index df1184db51..1098ca0e48 100644
--- a/deps/npm/node_modules/gauge/themes.js
+++ b/deps/npm/node_modules/gauge/lib/themes.js
@@ -9,10 +9,10 @@ themes.addTheme('ASCII', {
postProgressbar: ']',
progressbarTheme: {
complete: '#',
- remaining: '.'
+ remaining: '.',
},
activityIndicatorTheme: '-\\|/',
- preSubsection: '>'
+ preSubsection: '>',
})
themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
@@ -22,8 +22,8 @@ themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
postComplete: color('reset'),
preRemaining: color('bgBrightBlack', 'brightBlack'),
remaining: '.',
- postRemaining: color('reset')
- }
+ postRemaining: color('reset'),
+ },
})
themes.addTheme('brailleSpinner', {
@@ -31,10 +31,10 @@ themes.addTheme('brailleSpinner', {
postProgressbar: '⸩',
progressbarTheme: {
complete: '#',
- remaining: '⠂'
+ remaining: '⠂',
},
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
- preSubsection: '>'
+ preSubsection: '>',
})
themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), {
@@ -44,13 +44,13 @@ themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), {
postComplete: color('reset'),
preRemaining: color('bgBrightBlack', 'brightBlack'),
remaining: '⠂',
- postRemaining: color('reset')
- }
+ postRemaining: color('reset'),
+ },
})
themes.setDefault({}, 'ASCII')
-themes.setDefault({hasColor: true}, 'colorASCII')
-themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner')
-themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner')
-themes.setDefault({platform: 'linux', hasUnicode: true}, 'brailleSpinner')
-themes.setDefault({platform: 'linux', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner')
+themes.setDefault({ hasColor: true }, 'colorASCII')
+themes.setDefault({ platform: 'darwin', hasUnicode: true }, 'brailleSpinner')
+themes.setDefault({ platform: 'darwin', hasUnicode: true, hasColor: true }, 'colorBrailleSpinner')
+themes.setDefault({ platform: 'linux', hasUnicode: true }, 'brailleSpinner')
+themes.setDefault({ platform: 'linux', hasUnicode: true, hasColor: true }, 'colorBrailleSpinner')
diff --git a/deps/npm/node_modules/gauge/wide-truncate.js b/deps/npm/node_modules/gauge/lib/wide-truncate.js
index c531bc491f..5284a699ac 100644
--- a/deps/npm/node_modules/gauge/wide-truncate.js
+++ b/deps/npm/node_modules/gauge/lib/wide-truncate.js
@@ -5,9 +5,15 @@ var stripAnsi = require('strip-ansi')
module.exports = wideTruncate
function wideTruncate (str, target) {
- if (stringWidth(str) === 0) return str
- if (target <= 0) return ''
- if (stringWidth(str) <= target) return str
+ if (stringWidth(str) === 0) {
+ return str
+ }
+ if (target <= 0) {
+ return ''
+ }
+ if (stringWidth(str) <= target) {
+ return str
+ }
// We compute the number of bytes of ansi sequences here and add
// that to our initial truncation to ensure that we don't slice one
diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts
new file mode 100644
index 0000000000..2dbf6af2b6
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts
@@ -0,0 +1,37 @@
+declare namespace ansiRegex {
+ interface Options {
+ /**
+ Match only the first ANSI escape.
+
+ @default false
+ */
+ onlyFirst: boolean;
+ }
+}
+
+/**
+Regular expression for matching ANSI escape codes.
+
+@example
+```
+import ansiRegex = require('ansi-regex');
+
+ansiRegex().test('\u001B[4mcake\u001B[0m');
+//=> true
+
+ansiRegex().test('cake');
+//=> false
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex());
+//=> ['\u001B[4m', '\u001B[0m']
+
+'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
+//=> ['\u001B[4m']
+
+'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
+//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
+```
+*/
+declare function ansiRegex(options?: ansiRegex.Options): RegExp;
+
+export = ansiRegex;
diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js
new file mode 100644
index 0000000000..616ff837d3
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/ansi-regex/index.js
@@ -0,0 +1,10 @@
+'use strict';
+
+module.exports = ({onlyFirst = false} = {}) => {
+ const pattern = [
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
+ ].join('|');
+
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
+};
diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/license b/deps/npm/node_modules/gauge/node_modules/ansi-regex/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/ansi-regex/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json b/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json
new file mode 100644
index 0000000000..017f53116a
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/ansi-regex/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "ansi-regex",
+ "version": "5.0.1",
+ "description": "Regular expression for matching ANSI escape codes",
+ "license": "MIT",
+ "repository": "chalk/ansi-regex",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd",
+ "view-supported": "node fixtures/view-codes.js"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "command-line",
+ "text",
+ "regex",
+ "regexp",
+ "re",
+ "match",
+ "test",
+ "find",
+ "pattern"
+ ],
+ "devDependencies": {
+ "ava": "^2.4.0",
+ "tsd": "^0.9.0",
+ "xo": "^0.25.3"
+ }
+}
diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts
new file mode 100644
index 0000000000..729d202051
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts
@@ -0,0 +1,17 @@
+/**
+Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
+
+@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
+
+@example
+```
+import isFullwidthCodePoint from 'is-fullwidth-code-point';
+
+isFullwidthCodePoint('谢'.codePointAt(0));
+//=> true
+
+isFullwidthCodePoint('a'.codePointAt(0));
+//=> false
+```
+*/
+export default function isFullwidthCodePoint(codePoint: number): boolean;
diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js
new file mode 100644
index 0000000000..671f97f760
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js
@@ -0,0 +1,50 @@
+/* eslint-disable yoda */
+'use strict';
+
+const isFullwidthCodePoint = codePoint => {
+ if (Number.isNaN(codePoint)) {
+ return false;
+ }
+
+ // Code points are derived from:
+ // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
+ if (
+ codePoint >= 0x1100 && (
+ codePoint <= 0x115F || // Hangul Jamo
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
+ // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
+ // CJK Unified Ideographs .. Yi Radicals
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
+ // Hangul Jamo Extended-A
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
+ // Hangul Syllables
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
+ // CJK Compatibility Ideographs
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
+ // Vertical Forms
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
+ // CJK Compatibility Forms .. Small Form Variants
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
+ // Halfwidth and Fullwidth Forms
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
+ // Kana Supplement
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
+ // Enclosed Ideographic Supplement
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
+ // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
+ )
+ ) {
+ return true;
+ }
+
+ return false;
+};
+
+module.exports = isFullwidthCodePoint;
+module.exports.default = isFullwidthCodePoint;
diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json
new file mode 100644
index 0000000000..2137e888fa
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "is-fullwidth-code-point",
+ "version": "3.0.0",
+ "description": "Check if the character represented by a given Unicode code point is fullwidth",
+ "license": "MIT",
+ "repository": "sindresorhus/is-fullwidth-code-point",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd-check"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "fullwidth",
+ "full-width",
+ "full",
+ "width",
+ "unicode",
+ "character",
+ "string",
+ "codepoint",
+ "code",
+ "point",
+ "is",
+ "detect",
+ "check"
+ ],
+ "devDependencies": {
+ "ava": "^1.3.1",
+ "tsd-check": "^0.5.0",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts b/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts
new file mode 100644
index 0000000000..12b5309751
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/string-width/index.d.ts
@@ -0,0 +1,29 @@
+declare const stringWidth: {
+ /**
+ Get the visual width of a string - the number of columns required to display it.
+
+ Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
+
+ @example
+ ```
+ import stringWidth = require('string-width');
+
+ stringWidth('a');
+ //=> 1
+
+ stringWidth('古');
+ //=> 2
+
+ stringWidth('\u001B[1m古\u001B[22m');
+ //=> 2
+ ```
+ */
+ (string: string): number;
+
+ // TODO: remove this in the next major version, refactor the whole definition to:
+ // declare function stringWidth(string: string): number;
+ // export = stringWidth;
+ default: typeof stringWidth;
+}
+
+export = stringWidth;
diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/index.js b/deps/npm/node_modules/gauge/node_modules/string-width/index.js
new file mode 100644
index 0000000000..f4d261a96a
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/string-width/index.js
@@ -0,0 +1,47 @@
+'use strict';
+const stripAnsi = require('strip-ansi');
+const isFullwidthCodePoint = require('is-fullwidth-code-point');
+const emojiRegex = require('emoji-regex');
+
+const stringWidth = string => {
+ if (typeof string !== 'string' || string.length === 0) {
+ return 0;
+ }
+
+ string = stripAnsi(string);
+
+ if (string.length === 0) {
+ return 0;
+ }
+
+ string = string.replace(emojiRegex(), ' ');
+
+ let width = 0;
+
+ for (let i = 0; i < string.length; i++) {
+ const code = string.codePointAt(i);
+
+ // Ignore control characters
+ if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) {
+ continue;
+ }
+
+ // Ignore combining characters
+ if (code >= 0x300 && code <= 0x36F) {
+ continue;
+ }
+
+ // Surrogates
+ if (code > 0xFFFF) {
+ i++;
+ }
+
+ width += isFullwidthCodePoint(code) ? 2 : 1;
+ }
+
+ return width;
+};
+
+module.exports = stringWidth;
+// TODO: remove this in the next major version
+module.exports.default = stringWidth;
diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/license b/deps/npm/node_modules/gauge/node_modules/string-width/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/string-width/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/node_modules/string-width/package.json b/deps/npm/node_modules/gauge/node_modules/string-width/package.json
new file mode 100644
index 0000000000..28ba7b4cae
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/string-width/package.json
@@ -0,0 +1,56 @@
+{
+ "name": "string-width",
+ "version": "4.2.3",
+ "description": "Get the visual width of a string - the number of columns required to display it",
+ "license": "MIT",
+ "repository": "sindresorhus/string-width",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "string",
+ "character",
+ "unicode",
+ "width",
+ "visual",
+ "column",
+ "columns",
+ "fullwidth",
+ "full-width",
+ "full",
+ "ansi",
+ "escape",
+ "codes",
+ "cli",
+ "command-line",
+ "terminal",
+ "console",
+ "cjk",
+ "chinese",
+ "japanese",
+ "korean",
+ "fixed-width"
+ ],
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "devDependencies": {
+ "ava": "^1.4.1",
+ "tsd": "^0.7.1",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts
new file mode 100644
index 0000000000..907fccc292
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts
@@ -0,0 +1,17 @@
+/**
+Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
+
+@example
+```
+import stripAnsi = require('strip-ansi');
+
+stripAnsi('\u001B[4mUnicorn\u001B[0m');
+//=> 'Unicorn'
+
+stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
+//=> 'Click'
+```
+*/
+declare function stripAnsi(string: string): string;
+
+export = stripAnsi;
diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js
new file mode 100644
index 0000000000..9a593dfcd1
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/strip-ansi/index.js
@@ -0,0 +1,4 @@
+'use strict';
+const ansiRegex = require('ansi-regex');
+
+module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/license b/deps/npm/node_modules/gauge/node_modules/strip-ansi/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/strip-ansi/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json b/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json
new file mode 100644
index 0000000000..1a41108d42
--- /dev/null
+++ b/deps/npm/node_modules/gauge/node_modules/strip-ansi/package.json
@@ -0,0 +1,54 @@
+{
+ "name": "strip-ansi",
+ "version": "6.0.1",
+ "description": "Strip ANSI escape codes from a string",
+ "license": "MIT",
+ "repository": "chalk/strip-ansi",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "strip",
+ "trim",
+ "remove",
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "devDependencies": {
+ "ava": "^2.4.0",
+ "tsd": "^0.10.0",
+ "xo": "^0.25.3"
+ }
+}
diff --git a/deps/npm/node_modules/gauge/package.json b/deps/npm/node_modules/gauge/package.json
index 5635aa179f..433958760e 100644
--- a/deps/npm/node_modules/gauge/package.json
+++ b/deps/npm/node_modules/gauge/package.json
@@ -1,66 +1,62 @@
{
"name": "gauge",
- "version": "3.0.1",
- "description": "A terminal based horizontal guage",
- "main": "index.js",
+ "version": "4.0.0",
+ "description": "A terminal based horizontal gauge",
+ "main": "lib",
"scripts": {
- "test": "standard && tap test/*.js --coverage"
+ "test": "tap",
+ "lint": "eslint '**/*.js'",
+ "postlint": "npm-template-check",
+ "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/iarna/gauge"
+ "url": "https://github.com/npm/gauge"
},
"keywords": [
"progressbar",
"progress",
"gauge"
],
- "author": "Rebecca Turner <me@re-becca.org>",
+ "author": "GitHub Inc.",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/gauge/issues"
},
"homepage": "https://github.com/npm/gauge",
"dependencies": {
+ "ansi-regex": "^5.0.1",
"aproba": "^1.0.3 || ^2.0.0",
"color-support": "^1.1.2",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.1",
- "object-assign": "^4.1.1",
"signal-exit": "^3.0.0",
- "string-width": "^1.0.1 || ^2.0.0",
- "strip-ansi": "^3.0.1 || ^4.0.0",
+ "string-width": "^4.2.3",
+ "strip-ansi": "^6.0.1",
"wide-align": "^1.1.2"
},
"devDependencies": {
- "readable-stream": "^2.0.6",
- "require-inject": "^1.4.0",
- "standard": "^11.0.1",
- "tap": "^12.0.1",
- "through2": "^2.0.0"
+ "@npmcli/template-oss": "^2.3.0",
+ "readable-stream": "^3.6.0",
+ "tap": "^15.0.10"
},
"files": [
- "base-theme.js",
- "CHANGELOG.md",
- "error.js",
- "has-color.js",
- "index.js",
- "LICENSE",
- "package.json",
- "plumbing.js",
- "process.js",
- "progress-bar.js",
- "README.md",
- "render-template.js",
- "set-immediate.js",
- "set-interval.js",
- "spin.js",
- "template-item.js",
- "theme-set.js",
- "themes.js",
- "wide-truncate.js"
+ "bin",
+ "lib"
],
"engines": {
- "node": ">=10"
- }
+ "node": "^12.13.0 || ^14.15.0 || >=16"
+ },
+ "tap": {
+ "branches": 79,
+ "statements": 89,
+ "functions": 92,
+ "lines": 90
+ },
+ "templateVersion": "2.3.0"
}
diff --git a/deps/npm/node_modules/libnpmdiff/index.js b/deps/npm/node_modules/libnpmdiff/index.js
index 2d074c3d1b..6e68e6c4c4 100644
--- a/deps/npm/node_modules/libnpmdiff/index.js
+++ b/deps/npm/node_modules/libnpmdiff/index.js
@@ -14,8 +14,9 @@ const argsError = () =>
{ code: 'EDIFFARGS' }
)
const diff = async (specs, opts = {}) => {
- if (specs.length !== 2)
+ if (specs.length !== 2) {
throw argsError()
+ }
const [
aManifest,
diff --git a/deps/npm/node_modules/libnpmdiff/lib/format-diff.js b/deps/npm/node_modules/libnpmdiff/lib/format-diff.js
index 979ce8873c..211386cb53 100644
--- a/deps/npm/node_modules/libnpmdiff/lib/format-diff.js
+++ b/deps/npm/node_modules/libnpmdiff/lib/format-diff.js
@@ -30,8 +30,9 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
b: filenames.b && filenames.b.mode,
}
- if (contents.a === contents.b && modes.a === modes.b)
+ if (contents.a === contents.b && modes.a === modes.b) {
continue
+ }
if (opts.diffNameOnly) {
res += `${filename}${EOL}`
@@ -47,18 +48,19 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
// manually build a git diff-compatible header
header(`diff --git ${names.a} ${names.b}`)
- if (modes.a === modes.b)
+ if (modes.a === modes.b) {
fileMode = filenames.a.mode
- else {
- if (modes.a && !modes.b)
+ } else {
+ if (modes.a && !modes.b) {
header(`deleted file mode ${modes.a}`)
- else if (!modes.a && modes.b)
+ } else if (!modes.a && modes.b) {
header(`new file mode ${modes.b}`)
- else {
+ } else {
header(`old mode ${modes.a}`)
header(`new mode ${modes.b}`)
}
}
+ /* eslint-disable-next-line max-len */
header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`)
if (shouldPrintPatch(filename)) {
diff --git a/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js b/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js
index aeb015c1a0..a954811407 100644
--- a/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js
+++ b/deps/npm/node_modules/libnpmdiff/lib/should-print-patch.js
@@ -5,8 +5,9 @@ const binaryExtensions = require('binary-extensions')
// we should try to print patches as long as the
// extension is not identified as binary files
const shouldPrintPatch = (path, opts = {}) => {
- if (opts.diffText)
+ if (opts.diffText) {
return true
+ }
const filename = basename(path)
const extension = (
diff --git a/deps/npm/node_modules/libnpmdiff/lib/tarball.js b/deps/npm/node_modules/libnpmdiff/lib/tarball.js
index 0c8fb177a3..4d01d69c9c 100644
--- a/deps/npm/node_modules/libnpmdiff/lib/tarball.js
+++ b/deps/npm/node_modules/libnpmdiff/lib/tarball.js
@@ -24,8 +24,9 @@ const tarball = (manifest, opts) => {
const fromNodeModules = npa(resolved).type === 'directory'
&& /node_modules[\\/](@[^\\/]+\/)?[^\\/]+[\\/]?$/.test(relative(where, resolved))
- if (fromNodeModules)
+ if (fromNodeModules) {
return nodeModulesTarball(manifest, opts)
+ }
return pacote.tarball(manifest._resolved, opts)
}
diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json
index 529fc79539..129d9b90cd 100644
--- a/deps/npm/node_modules/libnpmdiff/package.json
+++ b/deps/npm/node_modules/libnpmdiff/package.json
@@ -46,11 +46,7 @@
]
},
"devDependencies": {
- "eslint": "^7.28.0",
- "eslint-plugin-import": "^2.23.4",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-promise": "^5.1.0",
- "eslint-plugin-standard": "^5.0.0",
+ "eslint": "^8.1.0",
"tap": "^15.0.9"
},
"dependencies": {
diff --git a/deps/npm/node_modules/node-gyp/.github/workflows/visual-studio.yml b/deps/npm/node_modules/node-gyp/.github/workflows/visual-studio.yml
new file mode 100644
index 0000000000..6bb4574d63
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/.github/workflows/visual-studio.yml
@@ -0,0 +1,25 @@
+name: Tests on Windows
+on: [push, pull_request]
+jobs:
+ Tests:
+ strategy:
+ fail-fast: false
+ max-parallel: 15
+ matrix:
+ os: [windows-2022]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v2
+ - name: Install Dependencies
+ run: |
+ npm install --no-progress
+ - name: Set Windows environment
+ if: matrix.os == 'windows-latest'
+ run: |
+ echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
+ echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
+ - name: Environment Information
+ run: npx envinfo
+ - name: Run Node tests
+ run: npm test
diff --git a/deps/npm/node_modules/node-gyp/CHANGELOG.md b/deps/npm/node_modules/node-gyp/CHANGELOG.md
index ebe8c321ce..e5d1a4d065 100644
--- a/deps/npm/node_modules/node-gyp/CHANGELOG.md
+++ b/deps/npm/node_modules/node-gyp/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## [8.4.0](https://www.github.com/nodejs/node-gyp/compare/v8.3.0...v8.4.0) (2021-11-05)
+
+
+### Features
+
+* build with config.gypi from node headers ([a27dc08](https://www.github.com/nodejs/node-gyp/commit/a27dc08696911c6d81e76cc228697243069103c1))
+* support vs2022 ([#2533](https://www.github.com/nodejs/node-gyp/issues/2533)) ([5a00387](https://www.github.com/nodejs/node-gyp/commit/5a00387e5f8018264a1822f6c4d5dbf425f21cf6))
+
## [8.3.0](https://www.github.com/nodejs/node-gyp/compare/v8.2.0...v8.3.0) (2021-10-11)
diff --git a/deps/npm/node_modules/node-gyp/README.md b/deps/npm/node_modules/node-gyp/README.md
index 11ba7ab693..71eea0a942 100644
--- a/deps/npm/node_modules/node-gyp/README.md
+++ b/deps/npm/node_modules/node-gyp/README.md
@@ -85,6 +85,22 @@ Python executable, it will be used instead of any of the other configured or
builtin Python search paths. If it's not a compatible version, no further
searching will be done.
+### Build for Third Party Node.js Runtimes
+
+When building modules for thid party Node.js runtimes like Electron, which have
+different build configurations from the official Node.js distribution, you
+should use `--dist-url` or `--nodedir` flags to specify the headers of the
+runtime to build for.
+
+Also when `--dist-url` or `--nodedir` flags are passed, node-gyp will use the
+`config.gypi` shipped in the headers distribution to generate build
+configurations, which is different from the default mode that would use the
+`process.config` object of the running Node.js instance.
+
+Some old versions of Electron shipped malformed `config.gypi` in their headers
+distributions, and you might need to pass `--force-process-config` to node-gyp
+to work around configuration errors.
+
## How to Use
To compile your native addon, first go to its root directory:
@@ -198,6 +214,7 @@ Some additional resources for Node.js native addons and writing `gyp` configurat
| `--python=$path` | Set path to the Python binary
| `--msvs_version=$version` | Set Visual Studio version (Windows only)
| `--solution=$solution` | Set Visual Studio Solution version (Windows only)
+| `--force-process-config` | Force using runtime's `process.config` object to generate `config.gypi` file
## Configuration
diff --git a/deps/npm/node_modules/node-gyp/lib/configure.js b/deps/npm/node_modules/node-gyp/lib/configure.js
index 682f1e6f95..d9b8fe340e 100644
--- a/deps/npm/node_modules/node-gyp/lib/configure.js
+++ b/deps/npm/node_modules/node-gyp/lib/configure.js
@@ -97,17 +97,15 @@ function configure (gyp, argv, callback) {
process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015)
process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path
}
- createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }, (err, configPath) => {
+ createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }).then(configPath => {
configs.push(configPath)
- findConfigs(err)
+ findConfigs()
+ }).catch(err => {
+ callback(err)
})
}
- function findConfigs (err) {
- if (err) {
- return callback(err)
- }
-
+ function findConfigs () {
var name = configNames.shift()
if (!name) {
return runGyp()
diff --git a/deps/npm/node_modules/node-gyp/lib/create-config-gypi.js b/deps/npm/node_modules/node-gyp/lib/create-config-gypi.js
index 4d137e6b59..dbcb8b485c 100644
--- a/deps/npm/node_modules/node-gyp/lib/create-config-gypi.js
+++ b/deps/npm/node_modules/node-gyp/lib/create-config-gypi.js
@@ -4,19 +4,45 @@ const fs = require('graceful-fs')
const log = require('npmlog')
const path = require('path')
-function getBaseConfigGypi () {
- const config = JSON.parse(JSON.stringify(process.config))
+function parseConfigGypi (config) {
+ // translated from tools/js2c.py of Node.js
+ // 1. string comments
+ config = config.replace(/#.*/g, '')
+ // 2. join multiline strings
+ config = config.replace(/'$\s+'/mg, '')
+ // 3. normalize string literals from ' into "
+ config = config.replace(/'/g, '"')
+ return JSON.parse(config)
+}
+
+async function getBaseConfigGypi ({ gyp, nodeDir }) {
+ // try reading $nodeDir/include/node/config.gypi first when:
+ // 1. --dist-url or --nodedir is specified
+ // 2. and --force-process-config is not specified
+ const shouldReadConfigGypi = (gyp.opts.nodedir || gyp.opts['dist-url']) && !gyp.opts['force-process-config']
+ if (shouldReadConfigGypi && nodeDir) {
+ try {
+ const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi')
+ const baseConfigGypi = await fs.promises.readFile(baseConfigGypiPath)
+ return parseConfigGypi(baseConfigGypi.toString())
+ } catch (err) {
+ log.warn('read config.gypi', err.message)
+ }
+ }
+
+ // fallback to process.config if it is invalid
+ return JSON.parse(JSON.stringify(process.config))
+}
+
+async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
+ const config = await getBaseConfigGypi({ gyp, nodeDir })
if (!config.target_defaults) {
config.target_defaults = {}
}
if (!config.variables) {
config.variables = {}
}
- return config
-}
-function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
- const config = getBaseConfigGypi()
const defaults = config.target_defaults
const variables = config.variables
@@ -85,13 +111,13 @@ function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
return config
}
-function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }, callback) {
+async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) {
const configFilename = 'config.gypi'
const configPath = path.resolve(buildDir, configFilename)
log.verbose('build/' + configFilename, 'creating config file')
- const config = getCurrentConfigGypi({ gyp, nodeDir, vsInfo })
+ const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo })
// ensures that any boolean values in config.gypi get stringified
function boolsToString (k, v) {
@@ -108,12 +134,13 @@ function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }, callback) {
const json = JSON.stringify(config, boolsToString, 2)
log.verbose('build/' + configFilename, 'writing out config file: %s', configPath)
- fs.writeFile(configPath, [prefix, json, ''].join('\n'), (err) => {
- callback(err, configPath)
- })
+ await fs.promises.writeFile(configPath, [prefix, json, ''].join('\n'))
+
+ return configPath
}
module.exports = createConfigGypi
module.exports.test = {
+ parseConfigGypi: parseConfigGypi,
getCurrentConfigGypi: getCurrentConfigGypi
}
diff --git a/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js b/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js
index f2cce327e7..64af7be346 100644
--- a/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js
+++ b/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js
@@ -2,6 +2,7 @@
const log = require('npmlog')
const execFile = require('child_process').execFile
+const fs = require('fs')
const path = require('path').win32
const logWithPrefix = require('./util').logWithPrefix
const regSearchKeys = require('./util').regSearchKeys
@@ -257,6 +258,10 @@ VisualStudioFinder.prototype = {
ret.versionYear = 2019
return ret
}
+ if (ret.versionMajor === 17) {
+ ret.versionYear = 2022
+ return ret
+ }
this.log.silly('- unsupported version:', ret.versionMajor)
return {}
},
@@ -264,15 +269,20 @@ VisualStudioFinder.prototype = {
// Helper - process MSBuild information
getMSBuild: function getMSBuild (info, versionYear) {
const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base'
+ const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
if (info.packages.indexOf(pkg) !== -1) {
this.log.silly('- found VC.MSBuild.Base')
if (versionYear === 2017) {
return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')
}
if (versionYear === 2019) {
- return path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
+ return msbuildPath
}
}
+ // visual studio 2022 don't has msbuild pkg
+ if (fs.existsSync(msbuildPath)) {
+ return msbuildPath
+ }
return null
},
@@ -293,6 +303,8 @@ VisualStudioFinder.prototype = {
return 'v141'
} else if (versionYear === 2019) {
return 'v142'
+ } else if (versionYear === 2022) {
+ return 'v143'
}
this.log.silly('- invalid versionYear:', versionYear)
return null
diff --git a/deps/npm/node_modules/node-gyp/lib/node-gyp.js b/deps/npm/node_modules/node-gyp/lib/node-gyp.js
index 81fc590919..0f11185641 100644
--- a/deps/npm/node_modules/node-gyp/lib/node-gyp.js
+++ b/deps/npm/node_modules/node-gyp/lib/node-gyp.js
@@ -75,7 +75,8 @@ proto.configDefs = {
'dist-url': String, // 'install'
tarball: String, // 'install'
jobs: String, // 'build'
- thin: String // 'configure'
+ thin: String, // 'configure'
+ 'force-process-config': Boolean // 'configure'
}
/**
diff --git a/deps/npm/node_modules/node-gyp/package.json b/deps/npm/node_modules/node-gyp/package.json
index cf9af6a0ec..ea06551817 100644
--- a/deps/npm/node_modules/node-gyp/package.json
+++ b/deps/npm/node_modules/node-gyp/package.json
@@ -11,7 +11,7 @@
"bindings",
"gyp"
],
- "version": "8.3.0",
+ "version": "8.4.0",
"installVersion": 9,
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
"repository": {
diff --git a/deps/npm/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi b/deps/npm/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi
new file mode 100644
index 0000000000..e767534082
--- /dev/null
+++ b/deps/npm/node_modules/node-gyp/test/fixtures/nodedir/include/node/config.gypi
@@ -0,0 +1,6 @@
+# Test configuration
+{
+ 'variables': {
+ 'build_with_electron': true
+ }
+}
diff --git a/deps/npm/node_modules/node-gyp/test/test-configure-python.js b/deps/npm/node_modules/node-gyp/test/test-configure-python.js
index ac25f7972e..4290e7af1b 100644
--- a/deps/npm/node_modules/node-gyp/test/test-configure-python.js
+++ b/deps/npm/node_modules/node-gyp/test/test-configure-python.js
@@ -11,7 +11,10 @@ const configure = requireInject('../lib/configure', {
closeSync: function () { },
writeFile: function (file, data, cb) { cb() },
stat: function (file, cb) { cb(null, {}) },
- mkdir: function (dir, options, cb) { cb() }
+ mkdir: function (dir, options, cb) { cb() },
+ promises: {
+ writeFile: function (file, data) { return Promise.resolve(null) }
+ }
}
})
diff --git a/deps/npm/node_modules/node-gyp/test/test-create-config-gypi.js b/deps/npm/node_modules/node-gyp/test/test-create-config-gypi.js
index 933cae1326..eeac73fab1 100644
--- a/deps/npm/node_modules/node-gyp/test/test-create-config-gypi.js
+++ b/deps/npm/node_modules/node-gyp/test/test-create-config-gypi.js
@@ -1,37 +1,70 @@
'use strict'
+const path = require('path')
const { test } = require('tap')
const gyp = require('../lib/node-gyp')
const createConfigGypi = require('../lib/create-config-gypi')
-const { getCurrentConfigGypi } = createConfigGypi.test
+const { parseConfigGypi, getCurrentConfigGypi } = createConfigGypi.test
-test('config.gypi with no options', function (t) {
+test('config.gypi with no options', async function (t) {
t.plan(2)
const prog = gyp()
prog.parseArgv([])
- const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
+ const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
t.equal(config.target_defaults.default_configuration, 'Release')
t.equal(config.variables.target_arch, process.arch)
})
-test('config.gypi with --debug', function (t) {
+test('config.gypi with --debug', async function (t) {
t.plan(1)
const prog = gyp()
prog.parseArgv(['_', '_', '--debug'])
- const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
+ const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
t.equal(config.target_defaults.default_configuration, 'Debug')
})
-test('config.gypi with custom options', function (t) {
+test('config.gypi with custom options', async function (t) {
t.plan(1)
const prog = gyp()
prog.parseArgv(['_', '_', '--shared-libxml2'])
- const config = getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
+ const config = await getCurrentConfigGypi({ gyp: prog, vsInfo: {} })
t.equal(config.variables.shared_libxml2, true)
})
+
+test('config.gypi with nodedir', async function (t) {
+ t.plan(1)
+
+ const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')
+
+ const prog = gyp()
+ prog.parseArgv(['_', '_', `--nodedir=${nodeDir}`])
+
+ const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })
+ t.equal(config.variables.build_with_electron, true)
+})
+
+test('config.gypi with --force-process-config', async function (t) {
+ t.plan(1)
+
+ const nodeDir = path.join(__dirname, 'fixtures', 'nodedir')
+
+ const prog = gyp()
+ prog.parseArgv(['_', '_', '--force-process-config', `--nodedir=${nodeDir}`])
+
+ const config = await getCurrentConfigGypi({ gyp: prog, nodeDir, vsInfo: {} })
+ t.equal(config.variables.build_with_electron, undefined)
+})
+
+test('config.gypi parsing', function (t) {
+ t.plan(1)
+
+ const str = "# Some comments\n{'variables': {'multiline': 'A'\n'B'}}"
+ const config = parseConfigGypi(str)
+ t.deepEqual(config, { variables: { multiline: 'AB' } })
+})
diff --git a/deps/npm/node_modules/npmlog/LICENSE b/deps/npm/node_modules/npmlog/LICENSE
deleted file mode 100644
index 19129e315f..0000000000
--- a/deps/npm/node_modules/npmlog/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/npmlog/LICENSE.md b/deps/npm/node_modules/npmlog/LICENSE.md
new file mode 100644
index 0000000000..5fc208ff12
--- /dev/null
+++ b/deps/npm/node_modules/npmlog/LICENSE.md
@@ -0,0 +1,20 @@
+<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
+
+ISC License
+
+Copyright npm, Inc.
+
+Permission to use, copy, modify, and/or distribute this
+software for any purpose with or without fee is hereby
+granted, provided that the above copyright notice and this
+permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
+USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/deps/npm/node_modules/npmlog/log.js b/deps/npm/node_modules/npmlog/lib/log.js
index 85ab8a4c79..aec98d7bdd 100644
--- a/deps/npm/node_modules/npmlog/log.js
+++ b/deps/npm/node_modules/npmlog/lib/log.js
@@ -30,11 +30,11 @@ log.useColor = function () {
log.enableColor = function () {
colorEnabled = true
- this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
+ this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
}
log.disableColor = function () {
colorEnabled = false
- this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled})
+ this.gauge.setTheme({ hasColor: colorEnabled, hasUnicode: unicodeEnabled })
}
// default level
@@ -42,13 +42,13 @@ log.level = 'info'
log.gauge = new Gauge(stream, {
enabled: false, // no progress bars unless asked
- theme: {hasColor: log.useColor()},
+ theme: { hasColor: log.useColor() },
template: [
- {type: 'progressbar', length: 20},
- {type: 'activityIndicator', kerning: 1, length: 1},
- {type: 'section', default: ''},
+ { type: 'progressbar', length: 20 },
+ { type: 'activityIndicator', kerning: 1, length: 1 },
+ { type: 'section', default: '' },
':',
- {type: 'logline', kerning: 1, default: ''},
+ { type: 'logline', kerning: 1, default: '' },
],
})
@@ -62,12 +62,12 @@ var unicodeEnabled
log.enableUnicode = function () {
unicodeEnabled = true
- this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
+ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
}
log.disableUnicode = function () {
unicodeEnabled = false
- this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled})
+ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: unicodeEnabled })
}
log.setGaugeThemeset = function (themes) {
diff --git a/deps/npm/node_modules/npmlog/package.json b/deps/npm/node_modules/npmlog/package.json
index 960ea9250d..36abf1e443 100644
--- a/deps/npm/node_modules/npmlog/package.json
+++ b/deps/npm/node_modules/npmlog/package.json
@@ -1,33 +1,46 @@
{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "author": "GitHub Inc.",
"name": "npmlog",
"description": "logger for npm",
- "version": "5.0.1",
+ "version": "6.0.0",
"repository": {
"type": "git",
"url": "https://github.com/npm/npmlog.git"
},
- "main": "log.js",
+ "main": "lib/log.js",
"files": [
- "log.js"
+ "bin",
+ "lib"
],
"scripts": {
- "test": "tap test/*.js --branches=95",
+ "test": "tap",
"npmclilint": "npmcli-lint",
- "lint": "npm run npmclilint -- \"*.*js\" \"test/**/*.*js\"",
+ "lint": "eslint '**/*.js'",
"lintfix": "npm run lint -- --fix",
- "posttest": "npm run lint --",
- "postsnap": "npm run lintfix --"
+ "posttest": "npm run lint",
+ "postsnap": "npm run lintfix --",
+ "postlint": "npm-template-check",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "snap": "tap"
},
"dependencies": {
"are-we-there-yet": "^2.0.0",
"console-control-strings": "^1.1.0",
- "gauge": "^3.0.0",
+ "gauge": "^4.0.0",
"set-blocking": "^2.0.0"
},
"devDependencies": {
- "@npmcli/lint": "^1.0.1",
+ "@npmcli/template-oss": "^2.3.0",
"tap": "^15.0.9"
},
- "license": "ISC"
+ "license": "ISC",
+ "templateVersion": "2.3.0",
+ "engines": {
+ "node": "^12.13.0 || ^14.15.0 || >=16"
+ },
+ "tap": {
+ "branches": 95
+ }
}
diff --git a/deps/npm/node_modules/signal-exit/index.js b/deps/npm/node_modules/signal-exit/index.js
index 6b6c43acad..a79b1d2fed 100644
--- a/deps/npm/node_modules/signal-exit/index.js
+++ b/deps/npm/node_modules/signal-exit/index.js
@@ -1,163 +1,200 @@
// Note: since nyc uses this module to output coverage, any lines
// that are in the direct sync flow of nyc's outputCoverage are
// ignored, since we can never get coverage for them.
-var assert = require('assert')
-var signals = require('./signals.js')
-var isWin = /^win/i.test(process.platform)
-
-var EE = require('events')
-/* istanbul ignore if */
-if (typeof EE !== 'function') {
- EE = EE.EventEmitter
+// grab a reference to node's real process object right away
+var process = global.process
+
+const processOk = function (process) {
+ return process &&
+ typeof process === 'object' &&
+ typeof process.removeListener === 'function' &&
+ typeof process.emit === 'function' &&
+ typeof process.reallyExit === 'function' &&
+ typeof process.listeners === 'function' &&
+ typeof process.kill === 'function' &&
+ typeof process.pid === 'number' &&
+ typeof process.on === 'function'
}
-var emitter
-if (process.__signal_exit_emitter__) {
- emitter = process.__signal_exit_emitter__
+// some kind of non-node environment, just no-op
+/* istanbul ignore if */
+if (!processOk(process)) {
+ module.exports = function () {}
} else {
- emitter = process.__signal_exit_emitter__ = new EE()
- emitter.count = 0
- emitter.emitted = {}
-}
-
-// Because this emitter is a global, we have to check to see if a
-// previous version of this library failed to enable infinite listeners.
-// I know what you're about to say. But literally everything about
-// signal-exit is a compromise with evil. Get used to it.
-if (!emitter.infinite) {
- emitter.setMaxListeners(Infinity)
- emitter.infinite = true
-}
-
-module.exports = function (cb, opts) {
- assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
+ var assert = require('assert')
+ var signals = require('./signals.js')
+ var isWin = /^win/i.test(process.platform)
+
+ var EE = require('events')
+ /* istanbul ignore if */
+ if (typeof EE !== 'function') {
+ EE = EE.EventEmitter
+ }
- if (loaded === false) {
- load()
+ var emitter
+ if (process.__signal_exit_emitter__) {
+ emitter = process.__signal_exit_emitter__
+ } else {
+ emitter = process.__signal_exit_emitter__ = new EE()
+ emitter.count = 0
+ emitter.emitted = {}
}
- var ev = 'exit'
- if (opts && opts.alwaysLast) {
- ev = 'afterexit'
+ // Because this emitter is a global, we have to check to see if a
+ // previous version of this library failed to enable infinite listeners.
+ // I know what you're about to say. But literally everything about
+ // signal-exit is a compromise with evil. Get used to it.
+ if (!emitter.infinite) {
+ emitter.setMaxListeners(Infinity)
+ emitter.infinite = true
}
- var remove = function () {
- emitter.removeListener(ev, cb)
- if (emitter.listeners('exit').length === 0 &&
- emitter.listeners('afterexit').length === 0) {
- unload()
+ module.exports = function (cb, opts) {
+ /* istanbul ignore if */
+ if (!processOk(global.process)) {
+ return
}
- }
- emitter.on(ev, cb)
+ assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
- return remove
-}
+ if (loaded === false) {
+ load()
+ }
-module.exports.unload = unload
-function unload () {
- if (!loaded) {
- return
- }
- loaded = false
+ var ev = 'exit'
+ if (opts && opts.alwaysLast) {
+ ev = 'afterexit'
+ }
- signals.forEach(function (sig) {
- try {
- process.removeListener(sig, sigListeners[sig])
- } catch (er) {}
- })
- process.emit = originalProcessEmit
- process.reallyExit = originalProcessReallyExit
- emitter.count -= 1
-}
+ var remove = function () {
+ emitter.removeListener(ev, cb)
+ if (emitter.listeners('exit').length === 0 &&
+ emitter.listeners('afterexit').length === 0) {
+ unload()
+ }
+ }
+ emitter.on(ev, cb)
-function emit (event, code, signal) {
- if (emitter.emitted[event]) {
- return
+ return remove
}
- emitter.emitted[event] = true
- emitter.emit(event, code, signal)
-}
-// { <signal>: <listener fn>, ... }
-var sigListeners = {}
-signals.forEach(function (sig) {
- sigListeners[sig] = function listener () {
- // If there are no other listeners, an exit is coming!
- // Simplest way: remove us and then re-send the signal.
- // We know that this will kill the process, so we can
- // safely emit now.
- var listeners = process.listeners(sig)
- if (listeners.length === emitter.count) {
- unload()
- emit('exit', null, sig)
- /* istanbul ignore next */
- emit('afterexit', null, sig)
- /* istanbul ignore next */
- if (isWin && sig === 'SIGHUP') {
- // "SIGHUP" throws an `ENOSYS` error on Windows,
- // so use a supported signal instead
- sig = 'SIGINT'
- }
- process.kill(process.pid, sig)
+ var unload = function unload () {
+ if (!loaded || !processOk(global.process)) {
+ return
}
+ loaded = false
+
+ signals.forEach(function (sig) {
+ try {
+ process.removeListener(sig, sigListeners[sig])
+ } catch (er) {}
+ })
+ process.emit = originalProcessEmit
+ process.reallyExit = originalProcessReallyExit
+ emitter.count -= 1
}
-})
-
-module.exports.signals = function () {
- return signals
-}
+ module.exports.unload = unload
-module.exports.load = load
-
-var loaded = false
-
-function load () {
- if (loaded) {
- return
+ var emit = function emit (event, code, signal) {
+ /* istanbul ignore if */
+ if (emitter.emitted[event]) {
+ return
+ }
+ emitter.emitted[event] = true
+ emitter.emit(event, code, signal)
}
- loaded = true
-
- // This is the number of onSignalExit's that are in play.
- // It's important so that we can count the correct number of
- // listeners on signals, and don't wait for the other one to
- // handle it instead of us.
- emitter.count += 1
-
- signals = signals.filter(function (sig) {
- try {
- process.on(sig, sigListeners[sig])
- return true
- } catch (er) {
- return false
+
+ // { <signal>: <listener fn>, ... }
+ var sigListeners = {}
+ signals.forEach(function (sig) {
+ sigListeners[sig] = function listener () {
+ /* istanbul ignore if */
+ if (!processOk(global.process)) {
+ return
+ }
+ // If there are no other listeners, an exit is coming!
+ // Simplest way: remove us and then re-send the signal.
+ // We know that this will kill the process, so we can
+ // safely emit now.
+ var listeners = process.listeners(sig)
+ if (listeners.length === emitter.count) {
+ unload()
+ emit('exit', null, sig)
+ /* istanbul ignore next */
+ emit('afterexit', null, sig)
+ /* istanbul ignore next */
+ if (isWin && sig === 'SIGHUP') {
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
+ // so use a supported signal instead
+ sig = 'SIGINT'
+ }
+ /* istanbul ignore next */
+ process.kill(process.pid, sig)
+ }
}
})
- process.emit = processEmit
- process.reallyExit = processReallyExit
-}
+ module.exports.signals = function () {
+ return signals
+ }
-var originalProcessReallyExit = process.reallyExit
-function processReallyExit (code) {
- process.exitCode = code || 0
- emit('exit', process.exitCode, null)
- /* istanbul ignore next */
- emit('afterexit', process.exitCode, null)
- /* istanbul ignore next */
- originalProcessReallyExit.call(process, process.exitCode)
-}
+ var loaded = false
+
+ var load = function load () {
+ if (loaded || !processOk(global.process)) {
+ return
+ }
+ loaded = true
+
+ // This is the number of onSignalExit's that are in play.
+ // It's important so that we can count the correct number of
+ // listeners on signals, and don't wait for the other one to
+ // handle it instead of us.
+ emitter.count += 1
+
+ signals = signals.filter(function (sig) {
+ try {
+ process.on(sig, sigListeners[sig])
+ return true
+ } catch (er) {
+ return false
+ }
+ })
+
+ process.emit = processEmit
+ process.reallyExit = processReallyExit
+ }
+ module.exports.load = load
-var originalProcessEmit = process.emit
-function processEmit (ev, arg) {
- if (ev === 'exit') {
- if (arg !== undefined) {
- process.exitCode = arg
+ var originalProcessReallyExit = process.reallyExit
+ var processReallyExit = function processReallyExit (code) {
+ /* istanbul ignore if */
+ if (!processOk(global.process)) {
+ return
}
- var ret = originalProcessEmit.apply(this, arguments)
+ process.exitCode = code || /* istanbul ignore next */ 0
emit('exit', process.exitCode, null)
/* istanbul ignore next */
emit('afterexit', process.exitCode, null)
- return ret
- } else {
- return originalProcessEmit.apply(this, arguments)
+ /* istanbul ignore next */
+ originalProcessReallyExit.call(process, process.exitCode)
+ }
+
+ var originalProcessEmit = process.emit
+ var processEmit = function processEmit (ev, arg) {
+ if (ev === 'exit' && processOk(global.process)) {
+ /* istanbul ignore else */
+ if (arg !== undefined) {
+ process.exitCode = arg
+ }
+ var ret = originalProcessEmit.apply(this, arguments)
+ /* istanbul ignore next */
+ emit('exit', process.exitCode, null)
+ /* istanbul ignore next */
+ emit('afterexit', process.exitCode, null)
+ /* istanbul ignore next */
+ return ret
+ } else {
+ return originalProcessEmit.apply(this, arguments)
+ }
}
}
diff --git a/deps/npm/node_modules/signal-exit/package.json b/deps/npm/node_modules/signal-exit/package.json
index 59b0ac126d..3e6ee68c1b 100644
--- a/deps/npm/node_modules/signal-exit/package.json
+++ b/deps/npm/node_modules/signal-exit/package.json
@@ -1,13 +1,14 @@
{
"name": "signal-exit",
- "version": "3.0.3",
+ "version": "3.0.6",
"description": "when you want to fire an event no matter how a process exits.",
"main": "index.js",
"scripts": {
- "pretest": "standard",
- "test": "tap --timeout=240 ./test/*.js --cov",
- "coverage": "nyc report --reporter=text-lcov | coveralls",
- "release": "standard-version"
+ "test": "tap",
+ "snap": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags"
},
"files": [
"index.js",
@@ -29,10 +30,9 @@
"homepage": "https://github.com/tapjs/signal-exit",
"devDependencies": {
"chai": "^3.5.0",
- "coveralls": "^2.11.10",
- "nyc": "^8.1.0",
- "standard": "^8.1.0",
- "standard-version": "^2.3.0",
- "tap": "^8.0.1"
+ "coveralls": "^3.1.1",
+ "nyc": "^15.1.0",
+ "standard-version": "^9.3.1",
+ "tap": "^15.1.1"
}
}
diff --git a/deps/npm/package.json b/deps/npm/package.json
index ab525df05c..43456fef9a 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,10 +1,10 @@
{
- "version": "8.1.3",
+ "version": "8.1.4",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
"docs",
- "packages/*"
+ "workspaces/*"
],
"files": [
"index.js",
@@ -55,7 +55,7 @@
},
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
- "@npmcli/arborist": "^4.0.4",
+ "@npmcli/arborist": "^4.0.5",
"@npmcli/ci-detect": "^1.4.0",
"@npmcli/config": "^2.3.0",
"@npmcli/map-workspaces": "^2.0.0",
@@ -96,7 +96,7 @@
"mkdirp": "^1.0.4",
"mkdirp-infer-owner": "^2.0.0",
"ms": "^2.1.2",
- "node-gyp": "^8.3.0",
+ "node-gyp": "^8.4.0",
"nopt": "^5.0.0",
"npm-audit-report": "^2.1.5",
"npm-install-checks": "^4.0.0",
@@ -105,7 +105,7 @@
"npm-profile": "^5.0.3",
"npm-registry-fetch": "^11.0.0",
"npm-user-validate": "^1.0.1",
- "npmlog": "^5.0.1",
+ "npmlog": "^6.0.0",
"opener": "^1.5.2",
"pacote": "^12.0.2",
"parse-conflict-json": "^1.1.1",
@@ -198,14 +198,11 @@
"write-file-atomic"
],
"devDependencies": {
- "eslint": "^7.31.0",
- "eslint-plugin-import": "^2.23.4",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-promise": "^5.1.0",
- "eslint-plugin-standard": "^5.0.0",
+ "@npmcli/eslint-config": "^2.0.0",
+ "eslint": "^8.2.0",
"licensee": "^8.2.0",
"spawk": "^1.7.1",
- "tap": "^15.0.9"
+ "tap": "^15.1.2"
},
"scripts": {
"dumpconf": "env | grep npm | sort | uniq",
@@ -220,7 +217,7 @@
"sudotest:nocleanup": "sudo NO_TEST_CLEANUP=1 npm run test --",
"posttest": "npm run lint",
"eslint": "eslint",
- "lint": "npm run eslint -- bin docs lib scripts smoke-tests test ./*.js",
+ "lint": "npm run eslint -- bin lib scripts smoke-tests test ./*.js",
"lintfix": "npm run lint -- --fix",
"prelint": "rimraf test/npm_cache*",
"resetdeps": "bash scripts/resetdeps.sh",
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
new file mode 100644
index 0000000000..13a3f66ef7
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/commands/completion.js.test.cjs
@@ -0,0 +1,239 @@
+/* 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/completion.js TAP completion --no- flags > flags 1`] = `
+Array [
+ Array [
+ String(
+ --no-version
+ --no-versions
+ ),
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion commands with no completion > no results 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion completion cannot complete options that take a value in mid-command > does not try to complete option arguments in the middle of a command 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion completion completion > both shells 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion completion completion no known shells > no responses 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion completion completion wrong word count > no responses 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion completion of invalid command name does nothing > no results 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/completion.js TAP completion double dashes escape from flag completion > full command list 1`] = `
+Array [
+ Array [
+ String(
+ ci
+ install-ci-test
+ install
+ install-test
+ uninstall
+ cache
+ config
+ set
+ get
+ update
+ outdated
+ prune
+ pack
+ find-dupes
+ dedupe
+ hook
+ rebuild
+ link
+ publish
+ star
+ stars
+ unstar
+ adduser
+ 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
+ ping
+ pkg
+ test
+ stop
+ start
+ restart
+ run-script
+ set-script
+ completion
+ doctor
+ exec
+ explain
+ un
+ rb
+ list
+ ln
+ create
+ i
+ it
+ cit
+ up
+ c
+ s
+ se
+ tst
+ t
+ ddp
+ v
+ run
+ clean-install
+ clean-install-test
+ x
+ why
+ la
+ verison
+ ic
+ innit
+ in
+ ins
+ inst
+ insta
+ instal
+ isnt
+ isnta
+ isntal
+ install-clean
+ isntall-clean
+ hlep
+ dist-tags
+ upgrade
+ udpate
+ login
+ add-user
+ author
+ home
+ issues
+ info
+ show
+ find
+ add
+ unlink
+ remove
+ rm
+ r
+ rum
+ sit
+ urn
+ ogr
+ ),
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion filtered subcommands > filtered subcommands 1`] = `
+Array [
+ Array [
+ "public",
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion flags > flags 1`] = `
+Array [
+ Array [
+ String(
+ --version
+ --versions
+ --viewer
+ --verbose
+ --v
+ ),
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion multiple command names > multiple command names 1`] = `
+Array [
+ Array [
+ String(
+ adduser
+ access
+ audit
+ add-user
+ author
+ add
+ ),
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion single command name > single command name 1`] = `
+Array [
+ Array [
+ "config",
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP completion subcommand completion > subcommands 1`] = `
+Array [
+ Array [
+ String(
+ public
+ restricted
+ grant
+ revoke
+ ls-packages
+ ls-collaborators
+ edit
+ 2fa-required
+ 2fa-not-required
+ ),
+ ],
+]
+`
+
+exports[`test/lib/commands/completion.js TAP windows without bash > no output 1`] = `
+Array []
+`
diff --git a/deps/npm/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs
index 1bea3cafd4..5b5055d4a8 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs
@@ -5,50 +5,6 @@
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
-exports[`test/lib/commands/dist-tag.js TAP add missing args > should exit usage error message 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
-exports[`test/lib/commands/dist-tag.js TAP add missing pkg name > should exit usage error message 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
exports[`test/lib/commands/dist-tag.js TAP add new tag > should return success msg 1`] = `
+c: @scoped/another@7.7.7
`
@@ -58,87 +14,17 @@ dist-tag add 1.0.0 to @scoped/another@7.7.7
`
-exports[`test/lib/commands/dist-tag.js TAP borked cmd usage > should show usage error 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
-exports[`test/lib/commands/dist-tag.js TAP ls global > should throw basic usage 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
exports[`test/lib/commands/dist-tag.js TAP ls in current package > should list available tags for current package 1`] = `
a: 0.0.1
b: 0.5.0
latest: 1.0.0
`
-exports[`test/lib/commands/dist-tag.js TAP ls on missing name in current package > should throw usage error message 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
exports[`test/lib/commands/dist-tag.js TAP ls on missing package > should log no dist-tag found msg 1`] = `
dist-tag ls Couldn't get dist-tag data for foo@latest
`
-exports[`test/lib/commands/dist-tag.js TAP ls on missing package > should throw error message 1`] = `
-Error: No dist-tags found for foo
-`
-
exports[`test/lib/commands/dist-tag.js TAP ls on named package > should list tags for the specified package 1`] = `
a: 0.0.2
b: 0.6.0
@@ -166,28 +52,6 @@ exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should return s
-c: @scoped/another@7.7.7
`
-exports[`test/lib/commands/dist-tag.js TAP remove missing pkg name > should exit usage error message 1`] = `
-Error:
-Usage: npm dist-tag
-
-Modify package distribution tags
-
-Usage:
-npm dist-tag add <pkg>@<version> [<tag>]
-npm dist-tag rm <pkg> <tag>
-npm dist-tag ls [<pkg>]
-
-Options:
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-alias: dist-tags
-
-Run "npm help dist-tag" for more info {
- "code": "EUSAGE",
-}
-`
-
exports[`test/lib/commands/dist-tag.js TAP remove non-existing tag > should log error msg 1`] = `
dist-tag del nonexistent from @scoped/another
dist-tag del nonexistent is not a dist-tag on @scoped/another
diff --git a/deps/npm/tap-snapshots/test/lib/commands/pack.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/pack.js.test.cjs
new file mode 100644
index 0000000000..28d5d22978
--- /dev/null
+++ b/deps/npm/tap-snapshots/test/lib/commands/pack.js.test.cjs
@@ -0,0 +1,78 @@
+/* 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/pack.js TAP dry run > logs pack contents 1`] = `
+Array [
+ undefined,
+ "package: test-package@1.0.0",
+ undefined,
+ "41B package.json",
+ undefined,
+ String(
+ name: test-package
+ version: 1.0.0
+ filename: test-package-1.0.0.tgz
+ package size: 136 B
+ unpacked size: 41 B
+ shasum: a92a0679a70a450f14f98a468756948a679e4107
+ integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA==
+ total files: 1
+ ),
+ "",
+]
+`
+
+exports[`test/lib/commands/pack.js TAP should log output as valid json > logs pack contents 1`] = `
+Array []
+`
+
+exports[`test/lib/commands/pack.js TAP should log output as valid json > outputs as json 1`] = `
+Array [
+ Array [
+ Object {
+ "bundled": Array [],
+ "entryCount": 1,
+ "filename": "test-package-1.0.0.tgz",
+ "files": Array [
+ Object {
+ "mode": 420,
+ "path": "package.json",
+ "size": 41,
+ },
+ ],
+ "id": "test-package@1.0.0",
+ "integrity": "sha512-Gka9ZV/BryxkypfvMpTvLfaJE1AUi7PK1EAbYqnVzqtucf6QvUK4CFsLVzagY1GwZVx2T1jwWLgMJ+0F+FhXMA==",
+ "name": "test-package",
+ "shasum": "a92a0679a70a450f14f98a468756948a679e4107",
+ "size": 136,
+ "unpackedSize": 41,
+ "version": "1.0.0",
+ },
+ ],
+]
+`
+
+exports[`test/lib/commands/pack.js TAP should pack current directory with no arguments > logs pack contents 1`] = `
+Array [
+ undefined,
+ "package: test-package@1.0.0",
+ undefined,
+ "41B package.json",
+ undefined,
+ String(
+ name: test-package
+ version: 1.0.0
+ filename: test-package-1.0.0.tgz
+ package size: 136 B
+ unpacked size: 41 B
+ shasum: a92a0679a70a450f14f98a468756948a679e4107
+ integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA==
+ total files: 1
+ ),
+ "",
+]
+`
diff --git a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
index 6c50c92154..dec7727834 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
@@ -39,25 +39,6 @@ Array [
]
`
-exports[`test/lib/commands/publish.js TAP shows usage with wrong set of arguments > should print usage 1`] = `
-Error:
-Usage: npm publish
-
-Publish a package
-
-Usage:
-npm publish [<folder>]
-
-Options:
-[--tag <tag>] [--access <restricted|public>] [--dry-run] [--otp <otp>]
-[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
-[-ws|--workspaces] [--include-workspace-root]
-
-Run "npm help publish" for more info {
- "code": "EUSAGE",
-}
-`
-
exports[`test/lib/commands/publish.js TAP workspaces all workspaces > should output all publishes 1`] = `
Array [
"+ workspace-a@1.2.3-a",
diff --git a/deps/npm/test/bin/npx-cli.js b/deps/npm/test/bin/npx-cli.js
index 5eeee30184..b526f2dfbe 100644
--- a/deps/npm/test/bin/npx-cli.js
+++ b/deps/npm/test/bin/npx-cli.js
@@ -6,7 +6,7 @@ const npm = require.resolve('../../bin/npm-cli.js')
const logs = []
console.error = (...msg) => logs.push(msg)
-t.afterEach(() => logs.length = 0)
+t.afterEach(() => (logs.length = 0))
t.test('npx foo -> npm exec -- foo', t => {
process.argv = ['node', npx, 'foo']
@@ -39,7 +39,17 @@ t.test('npx --x=y --no-install foo -z -> npm exec --x=y -- foo -z', t => {
t.test('transform renamed options into proper values', t => {
process.argv = ['node', npx, '-y', '--shell=bash', '-p', 'foo', '-c', 'asdf']
t.mock(npx, { [cli]: () => {} })
- t.strictSame(process.argv, ['node', npm, 'exec', '--yes', '--script-shell=bash', '--package', 'foo', '--call', 'asdf'])
+ t.strictSame(process.argv, [
+ 'node',
+ npm,
+ 'exec',
+ '--yes',
+ '--script-shell=bash',
+ '--package',
+ 'foo',
+ '--call',
+ 'asdf',
+ ])
t.end()
})
diff --git a/deps/npm/test/bin/windows-shims.js b/deps/npm/test/bin/windows-shims.js
index 8d73e39f2c..8d08e603b0 100644
--- a/deps/npm/test/bin/windows-shims.js
+++ b/deps/npm/test/bin/windows-shims.js
@@ -10,9 +10,9 @@ const has = path => {
// If WSL is installed, it *has* a bash.exe, but it fails if
// there is no distro installed, so we need to detect that.
const result = spawnSync(path, ['-l', '-c', 'exit 0'])
- if (result.status === 0)
+ if (result.status === 0) {
return true
- else {
+ } else {
// print whatever error we got
throw result.error || Object.assign(new Error(String(result.stderr)), {
code: result.status,
diff --git a/deps/npm/test/coverage-map.js b/deps/npm/test/coverage-map.js
index aff7a65277..b29fcd8618 100644
--- a/deps/npm/test/coverage-map.js
+++ b/deps/npm/test/coverage-map.js
@@ -11,8 +11,9 @@ const coverageMap = (filename) => {
// this one doesn't provide any coverage nyc can track
return []
}
- if (/^test\/(lib\/|bin\/|index\.js$)/.test(filename))
+ if (/^test\/(lib\/|bin\/|index\.js$)/.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 0a7bc0e8ad..a51ec3e5bb 100644
--- a/deps/npm/test/fixtures/mock-npm.js
+++ b/deps/npm/test/fixtures/mock-npm.js
@@ -9,8 +9,9 @@ procLog.reset()
require('events').defaultMaxListeners = Infinity
const realLog = {}
-for (const level in npmlog.levels)
+for (const level in npmlog.levels) {
realLog[level] = npmlog[level]
+}
const { title, execPath } = process
@@ -24,6 +25,7 @@ const RealMockNpm = (t, otherMocks = {}) => {
mock.joinedOutput = () => {
return mock.outputs.map(o => o.join(' ')).join('\n')
}
+ mock.filteredLogs = title => mock.logs.filter(([t]) => t === title).map(([, , msg]) => msg)
const Npm = t.mock('../../lib/npm.js', otherMocks)
class MockNpm extends Npm {
constructor () {
@@ -53,8 +55,9 @@ const RealMockNpm = (t, otherMocks = {}) => {
process.removeAllListeners('time')
process.removeAllListeners('timeEnd')
npmlog.record.length = 0
- for (const level in npmlog.levels)
+ for (const level in npmlog.levels) {
npmlog[level] = realLog[level]
+ }
procLog.reset()
process.title = title
process.execPath = execPath
@@ -79,18 +82,19 @@ class MockNpm {
const config = base.config || {}
for (const attr in base) {
- if (attr !== 'config')
+ if (attr !== 'config') {
this[attr] = base[attr]
+ }
}
this.flatOptions = base.flatOptions || {}
this.config = {
// for now just set `find` to what config.find should return
// this works cause `find` is not an existing config entry
- find: (k) => ({...realConfig.defaults, ...config})[k],
- get: (k) => ({...realConfig.defaults, ...config})[k],
+ find: (k) => ({ ...realConfig.defaults, ...config })[k],
+ get: (k) => ({ ...realConfig.defaults, ...config })[k],
set: (k, v) => config[k] = v,
- list: [{ ...realConfig.defaults, ...config}],
+ list: [{ ...realConfig.defaults, ...config }],
}
if (!this.log) {
this.log = {
@@ -110,8 +114,9 @@ class MockNpm {
}
output (...msg) {
- if (this.base.output)
+ if (this.base.output) {
return this.base.output(msg)
+ }
this._mockOutputs.push(msg)
}
}
diff --git a/deps/npm/test/fixtures/sandbox.js b/deps/npm/test/fixtures/sandbox.js
index 626e2ab5c5..b012790fb5 100644
--- a/deps/npm/test/fixtures/sandbox.js
+++ b/deps/npm/test/fixtures/sandbox.js
@@ -24,8 +24,9 @@ createHook({
before: (asyncId) => {
// find the nearest parent id that has a sandbox
let parent = asyncId
- while (chain.has(parent) && !sandboxes.has(parent))
+ while (chain.has(parent) && !sandboxes.has(parent)) {
parent = chain.get(parent)
+ }
process = sandboxes.has(parent)
? sandboxes.get(parent)
@@ -201,19 +202,22 @@ class Sandbox extends EventEmitter {
// test.teardown hook
teardown () {
- if (this[_parent])
+ if (this[_parent]) {
sandboxes.delete(this[_parent])
+ }
return rimraf(this[_dirs].temp).catch(() => null)
}
// proxy get handler
[_get] (target, prop, receiver) {
- if (this[_data].has(prop))
+ if (this[_data].has(prop)) {
return this[_data].get(prop)
+ }
- if (this[prop] !== undefined)
+ if (this[prop] !== undefined) {
return Reflect.get(this, prop, this)
+ }
const actual = Reflect.get(target, prop, receiver)
if (typeof actual === 'function') {
diff --git a/deps/npm/test/lib/auth/legacy.js b/deps/npm/test/lib/auth/legacy.js
index d06f953574..7b61e9f6e9 100644
--- a/deps/npm/test/lib/auth/legacy.js
+++ b/deps/npm/test/lib/auth/legacy.js
@@ -13,8 +13,9 @@ const legacy = t.mock('../../../lib/auth/legacy.js', {
},
'npm-profile': profile,
'../../../lib/utils/open-url.js': (npm, url, msg) => {
- if (!url)
+ if (!url) {
throw Object.assign(new Error('failed open url'), { code: 'ERROR' })
+ }
},
'../../../lib/utils/read-user-info.js': read,
})
diff --git a/deps/npm/test/lib/auth/sso.js b/deps/npm/test/lib/auth/sso.js
index 11be002aee..d592205593 100644
--- a/deps/npm/test/lib/auth/sso.js
+++ b/deps/npm/test/lib/auth/sso.js
@@ -30,9 +30,9 @@ const sso = t.mock('../../../lib/auth/sso.js', {
}
},
'../../../lib/utils/otplease.js': (opts, fn) => {
- if (opts)
+ if (opts) {
return fn({ ...opts, otp: '1234' })
- else {
+ } else {
throw Object.assign(
new Error('failed retrieving otp'),
{ code: 'ERROR' }
diff --git a/deps/npm/test/lib/cli.js b/deps/npm/test/lib/cli.js
index 4e24dcd78b..d762943b47 100644
--- a/deps/npm/test/lib/cli.js
+++ b/deps/npm/test/lib/cli.js
@@ -12,8 +12,9 @@ let exitHandlerNpm = null
let exitHandlerCb
const exitHandlerMock = (...args) => {
exitHandlerCalled = args
- if (exitHandlerCb)
+ if (exitHandlerCb) {
exitHandlerCb()
+ }
}
exitHandlerMock.setNpm = npm => {
exitHandlerNpm = npm
@@ -26,15 +27,16 @@ const npmlogMock = {
info: (...msg) => logs.push(['info', ...msg]),
}
-const cliMock = (Npm) => t.mock('../../lib/cli.js', {
- '../../lib/npm.js': Npm,
- '../../lib/utils/update-notifier.js': async () => null,
- '../../lib/utils/unsupported.js': unsupportedMock,
- '../../lib/utils/exit-handler.js': exitHandlerMock,
- npmlog: npmlogMock,
-})
+const cliMock = Npm =>
+ t.mock('../../lib/cli.js', {
+ '../../lib/npm.js': Npm,
+ '../../lib/utils/update-notifier.js': async () => null,
+ '../../lib/utils/unsupported.js': unsupportedMock,
+ '../../lib/utils/exit-handler.js': exitHandlerMock,
+ npmlog: npmlogMock,
+ })
-const processMock = (proc) => {
+const processMock = proc => {
const mocked = {
...process,
on: () => {},
@@ -104,13 +106,16 @@ t.test('calling with --versions calls npm version with no args', async t => {
t.test('logged argv is sanitized', async t => {
const proc = processMock({
- argv: ['node', 'npm', 'version', 'https://username:password@npmjs.org/test_url_with_a_password'],
+ argv: [
+ 'node',
+ 'npm',
+ 'version',
+ 'https://username:password@npmjs.org/test_url_with_a_password',
+ ],
})
const { Npm } = mockNpm(t, {
'../../lib/commands/version.js': class Version {
- async exec (args) {
-
- }
+ async exec (args) {}
},
})
@@ -120,12 +125,11 @@ t.test('logged argv is sanitized', async t => {
t.equal(proc.title, 'npm')
t.strictSame(logs, [
'pause',
- ['verbose', 'cli', [
- 'node',
- 'npm',
- 'version',
- 'https://username:***@npmjs.org/test_url_with_a_password',
- ]],
+ [
+ 'verbose',
+ 'cli',
+ ['node', 'npm', 'version', 'https://username:***@npmjs.org/test_url_with_a_password'],
+ ],
['info', 'using', 'npm@%s', Npm.version],
['info', 'using', 'node@%s', process.version],
])
diff --git a/deps/npm/test/lib/commands/access.js b/deps/npm/test/lib/commands/access.js
index 6ddd21428a..fdf132aff9 100644
--- a/deps/npm/test/lib/commands/access.js
+++ b/deps/npm/test/lib/commands/access.js
@@ -36,7 +36,7 @@ t.test('completion', async t => {
testComp(['npm', 'access', 'revoke'], [])
await t.rejects(
- access.completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}),
+ access.completion({ conf: { argv: { remain: ['npm', 'access', 'foobar'] } } }),
{ message: 'foobar not recognized' }
)
})
diff --git a/deps/npm/test/lib/commands/adduser.js b/deps/npm/test/lib/commands/adduser.js
index 368d5d68a7..71d79ea935 100644
--- a/deps/npm/test/lib/commands/adduser.js
+++ b/deps/npm/test/lib/commands/adduser.js
@@ -16,8 +16,9 @@ let deletedConfig = {}
let registryOutput = ''
let setConfig = {}
const authDummy = (npm, options) => {
- if (!options.fromFlatOptions)
+ if (!options.fromFlatOptions) {
throw new Error('did not pass full flatOptions to auth function')
+ }
return Promise.resolve({
message: 'success',
@@ -40,13 +41,15 @@ const npm = {
config: {
delete: deleteMock,
get (key, where) {
- if (!where || where === 'user')
+ if (!where || where === 'user') {
return _flatOptions[key]
+ }
},
getCredentialsByURI,
async save () {
- if (failSave)
+ if (failSave) {
throw new Error('error saving user config')
+ }
},
set (key, value, where) {
setConfig = {
diff --git a/deps/npm/test/lib/commands/audit.js b/deps/npm/test/lib/commands/audit.js
index cf6d36d471..3c87c76a8f 100644
--- a/deps/npm/test/lib/commands/audit.js
+++ b/deps/npm/test/lib/commands/audit.js
@@ -1,24 +1,14 @@
const t = require('tap')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
+const { real: mockNpm } = require('../../fixtures/mock-npm')
-t.test('should audit using Arborist', t => {
+t.test('should audit using Arborist', async t => {
let ARB_ARGS = null
let AUDIT_CALLED = false
let REIFY_FINISH_CALLED = false
let AUDIT_REPORT_CALLED = false
- let OUTPUT_CALLED = false
let ARB_OBJ = null
- const npm = mockNpm({
- prefix: 'foo',
- config: {
- json: false,
- },
- output: () => {
- OUTPUT_CALLED = true
- },
- })
- const Audit = t.mock('../../../lib/commands/audit.js', {
+ const { Npm, outputs } = mockNpm(t, {
'npm-audit-report': () => {
AUDIT_REPORT_CALLED = true
return {
@@ -34,153 +24,139 @@ t.test('should audit using Arborist', t => {
this.auditReport = {}
}
},
- '../../../lib/utils/reify-finish.js': (npm, arb) => {
- if (arb !== ARB_OBJ)
+ '../../lib/utils/reify-finish.js': (npm, arb) => {
+ if (arb !== ARB_OBJ) {
throw new Error('got wrong object passed to reify-output')
+ }
REIFY_FINISH_CALLED = true
},
})
- const audit = new Audit(npm)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir()
t.test('audit', async t => {
- await audit.exec([])
- t.match(ARB_ARGS, { audit: true, path: 'foo' })
+ await npm.exec('audit', [])
+ t.match(ARB_ARGS, { audit: true, path: npm.prefix })
t.equal(AUDIT_CALLED, true, 'called audit')
t.equal(AUDIT_REPORT_CALLED, true, 'called audit report')
- t.equal(OUTPUT_CALLED, true, 'called audit report')
+ t.match(outputs, [['there are vulnerabilities']])
})
t.test('audit fix', async t => {
- await audit.exec(['fix'])
+ await npm.exec('audit', ['fix'])
t.equal(REIFY_FINISH_CALLED, true, 'called reify output')
})
-
- t.end()
})
t.test('should audit - json', async t => {
- const npm = mockNpm({
- prefix: 'foo',
- config: {
- json: true,
+ t.plan(1)
+ const { Npm } = mockNpm(t, {
+ 'npm-audit-report': (_, opts) => {
+ t.match(opts.reporter, 'json')
+ return {
+ report: 'there are vulnerabilities',
+ exitCode: 0,
+ }
},
- output: () => {},
- })
-
- const Audit = t.mock('../../../lib/commands/audit.js', {
- 'npm-audit-report': () => ({
- report: 'there are vulnerabilities',
- exitCode: 0,
- }),
'@npmcli/arborist': function () {
this.audit = () => {
this.auditReport = {}
}
},
- '../../../lib/utils/reify-output.js': () => {},
+ '../../lib/utils/reify-output.js': () => {},
})
- const audit = new Audit(npm)
-
- await audit.exec([])
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir()
+ npm.config.set('json', true)
+ await npm.exec('audit', [])
})
-t.test('report endpoint error', t => {
- for (const json of [true, false]) {
- t.test(`json=${json}`, async t => {
- const OUTPUT = []
- const LOGS = []
- const npm = mockNpm({
- prefix: 'foo',
- command: 'audit',
- config: {
- json,
- },
- flatOptions: {
- json,
- },
- log: {
- warn: (...warning) => LOGS.push(warning),
- },
- output: (...msg) => {
- OUTPUT.push(msg)
- },
- })
- const Audit = t.mock('../../../lib/commands/audit.js', {
- 'npm-audit-report': () => {
- throw new Error('should not call audit report when there are errors')
- },
- '@npmcli/arborist': function () {
- this.audit = () => {
- this.auditReport = {
- error: {
- message: 'hello, this didnt work',
- method: 'POST',
- uri: 'https://example.com/',
- headers: {
- head: ['ers'],
- },
- statusCode: 420,
- body: json ? { nope: 'lol' }
- : Buffer.from('i had a vuln but i eated it lol'),
- },
- }
- }
- },
- '../../../lib/utils/reify-output.js': () => {},
- })
- const audit = new Audit(npm)
+t.test('report endpoint error', async t => {
+ const { Npm, outputs, filteredLogs } = mockNpm(t, {
+ 'npm-audit-report': () => {
+ throw new Error('should not call audit report when there are errors')
+ },
+ '@npmcli/arborist': function () {
+ this.audit = () => {
+ this.auditReport = {
+ error: {
+ message: 'hello, this didnt work',
+ method: 'POST',
+ uri: 'https://example.com/',
+ headers: {
+ head: ['ers'],
+ },
+ statusCode: 420,
+ body: 'this is a string',
+ // body: json ? { nope: 'lol' } : Buffer.from('i had a vuln but i eated it lol'),
+ },
+ }
+ }
+ },
+ '../../lib/utils/reify-output.js': () => {},
+ })
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir()
+ // npm.config.set('json', )
+ t.test('json=false', async t => {
+ await t.rejects(npm.exec('audit', []), 'audit endpoint returned an error')
+ t.match(filteredLogs('warn'), ['hello, this didnt work'])
+ t.strictSame(outputs, [['this is a string']])
+ })
- await t.rejects(
- audit.exec([]),
- 'audit endpoint returned an error'
- )
- t.strictSame(OUTPUT, [
- [
- json ? '{\n' +
- ' "message": "hello, this didnt work",\n' +
- ' "method": "POST",\n' +
- ' "uri": "https://example.com/",\n' +
- ' "headers": {\n' +
- ' "head": [\n' +
- ' "ers"\n' +
- ' ]\n' +
- ' },\n' +
- ' "statusCode": 420,\n' +
- ' "body": {\n' +
- ' "nope": "lol"\n' +
- ' }\n' +
- '}'
- : 'i had a vuln but i eated it lol',
- ],
- ])
- t.strictSame(LOGS, [['audit', 'hello, this didnt work']])
+ t.test('json=true', async t => {
+ t.teardown(() => {
+ npm.config.set('json', false)
})
- }
- t.end()
+ npm.config.set('json', true)
+ await t.rejects(npm.exec('audit', []), 'audit endpoint returned an error')
+ t.match(filteredLogs('warn'), ['hello, this didnt work'])
+ t.strictSame(outputs, [[
+ '{\n' +
+ ' "message": "hello, this didnt work",\n' +
+ ' "method": "POST",\n' +
+ ' "uri": "https://example.com/",\n' +
+ ' "headers": {\n' +
+ ' "head": [\n' +
+ ' "ers"\n' +
+ ' ]\n' +
+ ' },\n' +
+ ' "statusCode": 420,\n' +
+ ' "body": "this is a string"\n' +
+ '}',
+ ],
+ ])
+ })
})
-t.test('completion', t => {
- const Audit = require('../../../lib/commands/audit.js')
- const audit = new Audit({})
+t.test('completion', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const audit = await npm.cmd('audit')
t.test('fix', async t => {
- t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit'] } } }), ['fix'], 'completes to fix')
- t.end()
- })
-
- t.test('subcommand fix', t => {
- t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'fix'] } } }), [], 'resolves to ?')
- t.end()
+ await t.resolveMatch(
+ audit.completion({ conf: { argv: { remain: ['npm', 'audit'] } } }),
+ ['fix'],
+ 'completes to fix'
+ )
})
- t.test('subcommand not recognized', t => {
- t.rejects(
- audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'repare'] } } }),
- { message: 'repare not recognized' }
+ t.test('subcommand fix', async t => {
+ await t.resolveMatch(
+ audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'fix'] } } }),
+ [],
+ 'resolves to ?'
)
- t.end()
})
- t.end()
+ t.test('subcommand not recognized', async t => {
+ await t.rejects(audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'repare'] } } }), {
+ message: 'repare not recognized',
+ })
+ })
})
diff --git a/deps/npm/test/lib/commands/birthday.js b/deps/npm/test/lib/commands/birthday.js
index c92f197c5f..8c95dd57b2 100644
--- a/deps/npm/test/lib/commands/birthday.js
+++ b/deps/npm/test/lib/commands/birthday.js
@@ -1,28 +1,14 @@
const t = require('tap')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
+const { real: mockNpm } = require('../../fixtures/mock-npm')
t.test('birthday', async t => {
- t.plan(4)
- const config = {
- yes: false,
- package: [],
- }
- const npm = mockNpm({
- config,
- cmd: async (cmd) => {
- t.ok(cmd, 'exec', 'calls out to exec command')
- return {
- exec: async (args) => {
- t.equal(npm.config.get('yes'), true, 'should say yes')
- t.strictSame(npm.config.get('package'), ['@npmcli/npm-birthday'],
- 'uses correct package')
- t.strictSame(args, ['npm-birthday'], 'called with correct args')
- },
- }
+ t.plan(2)
+ const { Npm } = mockNpm(t, {
+ libnpmexec: ({ args, yes }) => {
+ t.ok(yes)
+ t.match(args, ['@npmcli/npm-birthday'])
},
})
- const Birthday = require('../../../lib/commands/birthday.js')
- const birthday = new Birthday(npm)
-
- await birthday.exec([])
+ const npm = new Npm()
+ await npm.exec('birthday', [])
})
diff --git a/deps/npm/test/lib/commands/bugs.js b/deps/npm/test/lib/commands/bugs.js
index dcb36af393..dbd618b084 100644
--- a/deps/npm/test/lib/commands/bugs.js
+++ b/deps/npm/test/lib/commands/bugs.js
@@ -89,12 +89,12 @@ t.test('open bugs urls & emails', t => {
keys.forEach(pkg => {
t.test(pkg, async t => {
await bugs.exec([pkg])
- t.equal(opened[expect[pkg]], 1, 'opened expected url', {opened})
+ t.equal(opened[expect[pkg]], 1, 'opened expected url', { opened })
})
})
})
t.test('open default package if none specified', async t => {
await bugs.exec([])
- t.equal(opened['https://example.com'], 1, 'opened expected url', {opened})
+ t.equal(opened['https://example.com'], 1, 'opened expected url', { opened })
})
diff --git a/deps/npm/test/lib/commands/cache.js b/deps/npm/test/lib/commands/cache.js
index 168cfce6db..70a8ba1b20 100644
--- a/deps/npm/test/lib/commands/cache.js
+++ b/deps/npm/test/lib/commands/cache.js
@@ -56,14 +56,17 @@ const setupCacacheFixture = () => {
pkgs.forEach(pkg => addCacachePkg(...pkg))
// corrupt the packument
cacacheContent[
+ /* eslint-disable-next-line max-len */
[cacacheEntries['make-fetch-happen:request-cache:https://registry.npmjs.org/corrupted'].integrity]
].data = Buffer.from('<>>>}"')
// nuke the version dist
cacacheContent[
+ /* eslint-disable-next-line max-len */
[cacacheEntries['make-fetch-happen:request-cache:https://registry.npmjs.org/missing-dist'].integrity]
].data = Buffer.from(JSON.stringify({ versions: { '23.0.0': {} } }))
// make the version a non-object
cacacheContent[
+ /* eslint-disable-next-line max-len */
[cacacheEntries['make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version'].integrity]
].data = Buffer.from(JSON.stringify({ versions: 'hello' }))
}
@@ -87,8 +90,9 @@ const addCacachePkg = (spec, registry, publicURL) => {
const parts = npa(spec)
const ver = parts.rawSpec || '1.0.0'
let url = `${registry}/${parts.name}/-/${parts.name}-${ver}.tgz`
- if (!publicURL)
+ if (!publicURL) {
url = `${registry}/aabbcc/${contentId}`
+ }
const key = `make-fetch-happen:request-cache:${url}`
const pkey = `make-fetch-happen:request-cache:${registry}/${parts.escapedName}`
if (!packuments[parts.escapedName]) {
@@ -114,14 +118,16 @@ const cacache = {
},
get: (path, key) => {
if (cacacheEntries[key] === undefined
- || cacacheContent[cacacheEntries[key].integrity] === undefined)
+ || cacacheContent[cacacheEntries[key].integrity] === undefined) {
throw new Error()
+ }
return cacacheContent[cacacheEntries[key].integrity]
},
rm: {
entry: (path, key) => {
- if (cacacheEntries[key] === undefined)
+ if (cacacheEntries[key] === undefined) {
throw new Error()
+ }
delete cacacheEntries[key]
},
content: (path, sha) => {
@@ -243,9 +249,12 @@ t.test('cache ls', async t => {
setupCacacheFixture()
await cache.exec(['ls'])
t.strictSame(outputOutput, [
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy/staydown/-/@fritzy/staydown-3.1.1.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy%2fstaydown',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar/npm-expansion/-/@gar/npm-expansion-2.1.0.tgz',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar/npm-expansion/-/@gar/npm-expansion-3.0.0-beta.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar%2fnpm-expansion',
'make-fetch-happen:request-cache:https://registry.npmjs.org/ape-ecs',
@@ -255,8 +264,10 @@ t.test('cache ls', async t => {
'make-fetch-happen:request-cache:https://registry.npmjs.org/foo',
'make-fetch-happen:request-cache:https://registry.npmjs.org/foo/-/foo-1.2.3-beta.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-dist',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-dist/-/missing-dist-23.0.0.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version/-/missing-version-16.2.0.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/npm',
'make-fetch-happen:request-cache:https://registry.npmjs.org/npm/-/npm-1.2.0.tgz',
@@ -320,8 +331,10 @@ t.test('cache ls scoped and scoped slash', async t => {
})
await cache.exec(['ls', '@fritzy/staydown', '@gar/npm-expansion'])
t.strictSame(outputOutput, [
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy/staydown/-/@fritzy/staydown-3.1.1.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy%2fstaydown',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar/npm-expansion/-/@gar/npm-expansion-2.1.0.tgz',
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar%2fnpm-expansion',
])
@@ -345,6 +358,7 @@ t.test('cache ls missing packument dist', async t => {
await cache.exec(['ls', 'missing-dist'])
t.strictSame(outputOutput, [
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-dist',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-dist/-/missing-dist-23.0.0.tgz',
])
})
@@ -356,6 +370,7 @@ t.test('cache ls missing packument version not an object', async t => {
await cache.exec(['ls', 'missing-version'])
t.strictSame(outputOutput, [
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version',
+ /* eslint-disable-next-line max-len */
'make-fetch-happen:request-cache:https://registry.npmjs.org/missing-version/-/missing-version-16.2.0.tgz',
])
})
@@ -367,6 +382,7 @@ t.test('cache rm', async t => {
await cache.exec(['rm',
'make-fetch-happen:request-cache:https://registry.npmjs.org/webpack/-/webpack-4.44.1.tgz'])
t.strictSame(outputOutput, [
+ /* eslint-disable-next-line max-len */
'Deleted: make-fetch-happen:request-cache:https://registry.npmjs.org/webpack/-/webpack-4.44.1.tgz',
])
})
diff --git a/deps/npm/test/lib/commands/ci.js b/deps/npm/test/lib/commands/ci.js
index 8573b585a5..1091f9125b 100644
--- a/deps/npm/test/lib/commands/ci.js
+++ b/deps/npm/test/lib/commands/ci.js
@@ -52,13 +52,15 @@ t.test('should use Arborist and run-script', async t => {
// when the test is done, we assert that all timers ended
const timers = {}
const onTime = msg => {
- if (timers[msg])
+ if (timers[msg]) {
throw new Error(`saw duplicate timer: ${msg}`)
+ }
timers[msg] = true
}
const onTimeEnd = msg => {
- if (!timers[msg])
+ if (!timers[msg]) {
throw new Error(`ended timer that was not started: ${msg}`)
+ }
timers[msg] = false
}
process.on('time', onTime)
@@ -118,8 +120,9 @@ t.test('should use Arborist and run-script', async t => {
const ci = new CI(npm)
await ci.exec(null)
- for (const [msg, result] of Object.entries(timers))
+ for (const [msg, result] of Object.entries(timers)) {
t.notOk(result, `properly resolved ${msg} timer`)
+ }
t.match(timers, { 'npm-ci:rm': false }, 'saw the rimraf timer')
t.equal(actualRimrafs, expectRimrafs, 'removed the right number of things')
t.strictSame(scripts, [], 'called all scripts')
diff --git a/deps/npm/test/lib/commands/completion.js b/deps/npm/test/lib/commands/completion.js
index 7fdee06272..51212f06d8 100644
--- a/deps/npm/test/lib/commands/completion.js
+++ b/deps/npm/test/lib/commands/completion.js
@@ -2,547 +2,273 @@ const t = require('tap')
const fs = require('fs')
const path = require('path')
-const completionScript = fs.readFileSync(path.resolve(__dirname, '../../../lib/utils/completion.sh'), { encoding: 'utf8' }).replace(/^#!.*?\n/, '')
-
-const output = []
-const npmConfig = {}
-let accessCompletionError = false
-
-const npm = {
- config: {
- set: (key, value) => {
- npmConfig[key] = value
- },
- clear: () => {
- for (const key in npmConfig)
- delete npmConfig[key]
- },
- },
- cmd: (cmd) => {
- return ({
- completion: {
- completion: () => [['>>', '~/.bashrc']],
- },
- adduser: {},
- access: {
- completion: () => {
- if (accessCompletionError)
- throw new Error('access completion failed')
-
- return ['public', 'restricted']
- },
- },
- promise: {
- completion: () => Promise.resolve(['resolved_completion_promise']),
- },
- donothing: {
- completion: () => {
- return null
- },
- },
- driveaboat: {
- completion: () => {
- return ' fast'
- },
- },
- }[cmd])
- },
- output: (line) => {
- output.push(line)
- },
-}
-
-const cmdList = {
- aliases: {
- login: 'adduser',
- },
- cmdList: [
- 'access',
- 'adduser',
- 'completion',
- ],
- plumbing: [],
-}
-
-// only include a subset so that the snapshots aren't huge and
-// don't change when we add/remove config definitions.
-const definitions = require('../../../lib/utils/config/definitions.js')
-const config = {
- definitions: {
- global: definitions.global,
- browser: definitions.browser,
- registry: definitions.registry,
- },
- shorthands: {
- reg: ['--registry'],
- },
-}
-
-const deref = (cmd) => {
- return cmd
-}
-
-const Completion = t.mock('../../../lib/commands/completion.js', {
- '../../../lib/utils/cmd-list.js': cmdList,
- '../../../lib/utils/config/index.js': config,
- '../../../lib/utils/deref-command.js': deref,
- '../../../lib/utils/is-windows-shell.js': false,
-})
-const completion = new Completion(npm)
-
-t.test('completion completion', async t => {
- const home = process.env.HOME
- t.teardown(() => {
- process.env.HOME = home
- })
+const completionScript = fs
+ .readFileSync(path.resolve(__dirname, '../../../lib/utils/completion.sh'), { encoding: 'utf8' })
+ .replace(/^#!.*?\n/, '')
- process.env.HOME = t.testdir({
- '.bashrc': '',
- '.zshrc': '',
- })
+const { real: mockNpm } = require('../../fixtures/mock-npm')
- const res = await completion.completion({ w: 2 })
- t.strictSame(res, [
- ['>>', '~/.zshrc'],
- ['>>', '~/.bashrc'],
- ], 'identifies both shells')
- t.end()
-})
-
-t.test('completion completion no known shells', async t => {
- const home = process.env.HOME
- t.teardown(() => {
- process.env.HOME = home
- })
-
- process.env.HOME = t.testdir()
-
- const res = await completion.completion({ w: 2 })
- t.strictSame(res, [], 'no responses')
- t.end()
+const { Npm, outputs } = mockNpm(t, {
+ '../../lib/utils/is-windows-shell.js': false,
})
+const npm = new Npm()
+
+t.test('completion', async t => {
+ const completion = await npm.cmd('completion')
+ t.test('completion completion', async t => {
+ const home = process.env.HOME
+ t.teardown(() => {
+ process.env.HOME = home
+ })
-t.test('completion completion wrong word count', async t => {
- const res = await completion.completion({ w: 3 })
- t.strictSame(res, undefined, 'no responses')
- t.end()
-})
+ process.env.HOME = t.testdir({
+ '.bashrc': '',
+ '.zshrc': '',
+ })
-t.test('completion errors in windows without bash', async t => {
- const Compl = t.mock('../../../lib/commands/completion.js', {
- '../../../lib/utils/is-windows-shell.js': true,
+ await completion.completion({ w: 2 })
+ t.matchSnapshot(outputs, 'both shells')
})
- const compl = new Compl()
+ t.test('completion completion no known shells', async t => {
+ const home = process.env.HOME
+ t.teardown(() => {
+ process.env.HOME = home
+ })
- await t.rejects(
- compl.exec({}),
- { code: 'ENOTSUP',
- message: /completion supported only in MINGW/,
+ process.env.HOME = t.testdir()
- }, 'returns the correct error')
-})
+ await completion.completion({ w: 2 })
+ t.matchSnapshot(outputs, 'no responses')
+ })
-t.test('dump script when completion is not being attempted', async t => {
- const _write = process.stdout.write
- const _on = process.stdout.on
- t.teardown(() => {
- process.stdout.write = _write
- process.stdout.on = _on
+ t.test('completion completion wrong word count', async t => {
+ await completion.completion({ w: 3 })
+ t.matchSnapshot(outputs, 'no responses')
})
- let errorHandler
- process.stdout.on = (event, handler) => {
- errorHandler = handler
- process.stdout.on = _on
- }
-
- let data
- process.stdout.write = (chunk, callback) => {
- data = chunk
- process.stdout.write = _write
- process.nextTick(() => {
- callback()
- errorHandler({ errno: 'EPIPE' })
+ t.test('dump script when completion is not being attempted', async t => {
+ const _write = process.stdout.write
+ const _on = process.stdout.on
+ t.teardown(() => {
+ process.stdout.write = _write
+ process.stdout.on = _on
})
- }
-
- await completion.exec({})
-
- t.equal(data, completionScript, 'wrote the completion script')
-})
-t.test('dump script exits correctly when EPIPE is emitted on stdout', async t => {
- const _write = process.stdout.write
- const _on = process.stdout.on
- t.teardown(() => {
- process.stdout.write = _write
- process.stdout.on = _on
+ let errorHandler
+ process.stdout.on = (event, handler) => {
+ errorHandler = handler
+ process.stdout.on = _on
+ }
+
+ let data
+ process.stdout.write = (chunk, callback) => {
+ data = chunk
+ process.stdout.write = _write
+ process.nextTick(() => {
+ callback()
+ errorHandler({ errno: 'EPIPE' })
+ })
+ }
+
+ await completion.exec({})
+
+ t.equal(data, completionScript, 'wrote the completion script')
})
- let errorHandler
- process.stdout.on = (event, handler) => {
- errorHandler = handler
- process.stdout.on = _on
- }
-
- let data
- process.stdout.write = (chunk, callback) => {
- data = chunk
- process.stdout.write = _write
- process.nextTick(() => {
- errorHandler({ errno: 'EPIPE' })
- callback()
+ t.test('dump script exits correctly when EPIPE is emitted on stdout', async t => {
+ const _write = process.stdout.write
+ const _on = process.stdout.on
+ t.teardown(() => {
+ process.stdout.write = _write
+ process.stdout.on = _on
})
- }
- await completion.exec({})
- t.equal(data, completionScript, 'wrote the completion script')
-})
-
-// This test was only working by coincidence before, when we switch to full
-// async/await the race condition now makes it impossible to test. The root of
-// the problem is that if we override stdout.write then other things interfere
-// during testing.
-// t.test('non EPIPE errors cause failures', async t => {
-// const _write = process.stdout.write
-// const _on = process.stdout.on
-// t.teardown(() => {
-// process.stdout.write = _write
-// process.stdout.on = _on
-// })
-
-// let errorHandler
-// process.stdout.on = (event, handler) => {
-// errorHandler = handler
-// process.stdout.on = _on
-// }
-
-// let data
-// process.stdout.write = (chunk, callback) => {
-// data = chunk
-// process.stdout.write = _write
-// process.nextTick(() => {
-// errorHandler({ errno: 'ESOMETHINGELSE' })
-// callback()
-// })
-// }
-
-// await t.rejects(
-// completion.exec([]),
-// { errno: 'ESOMETHINGELSE' },
-// 'propagated error'
-// )
-// t.equal(data, completionScript, 'wrote the completion script')
-// })
-
-t.test('completion completes single command name', async t => {
- process.env.COMP_CWORD = 1
- process.env.COMP_LINE = 'npm c'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ let errorHandler
+ process.stdout.on = (event, handler) => {
+ errorHandler = handler
+ process.stdout.on = _on
+ }
+
+ let data
+ process.stdout.write = (chunk, callback) => {
+ data = chunk
+ process.stdout.write = _write
+ process.nextTick(() => {
+ errorHandler({ errno: 'EPIPE' })
+ callback()
+ })
+ }
+
+ await completion.exec({})
+ t.equal(data, completionScript, 'wrote the completion script')
})
- await completion.exec(['npm', 'c'])
- t.strictSame(output, ['completion'], 'correctly completed a command name')
-})
-
-t.test('completion completes command names', async t => {
- process.env.COMP_CWORD = 1
- process.env.COMP_LINE = 'npm a'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
- })
+ t.test('single command name', async t => {
+ process.env.COMP_CWORD = 1
+ process.env.COMP_LINE = 'npm conf'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- await completion.exec(['npm', 'a'])
- t.strictSame(output, [['access', 'adduser'].join('\n')], 'correctly completed a command name')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completion of invalid command name does nothing', async t => {
- process.env.COMP_CWORD = 1
- process.env.COMP_LINE = 'npm compute'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', 'conf'])
+ t.matchSnapshot(outputs, 'single command name')
})
- await completion.exec(['npm', 'compute'])
- t.strictSame(output, [], 'returns no results')
-})
+ t.test('multiple command names', async t => {
+ process.env.COMP_CWORD = 1
+ process.env.COMP_LINE = 'npm a'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
+
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('handles async completion function', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm promise'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', 'a'])
+ t.matchSnapshot(outputs, 'multiple command names')
})
- await completion.exec(['npm', 'promise', ''])
+ t.test('completion of invalid command name does nothing', async t => {
+ process.env.COMP_CWORD = 1
+ process.env.COMP_LINE = 'npm compute'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'promise'],
- cooked: ['npm', 'promise'],
- original: ['npm', 'promise'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, ['resolved_completion_promise'], 'resolves async completion results')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completion triggers command completions', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm access '
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', 'compute'])
+ t.matchSnapshot(outputs, 'no results')
})
- await completion.exec(['npm', 'access', ''])
+ t.test('subcommand completion', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm access '
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'access'],
- cooked: ['npm', 'access'],
- original: ['npm', 'access'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, [['public', 'restricted'].join('\n')], 'correctly completed a subcommand name')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completion triggers filtered command completions', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm access p'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', 'access', ''])
+ t.matchSnapshot(outputs, 'subcommands')
})
- await completion.exec(['npm', 'access', 'p'])
+ t.test('filtered subcommands', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm access p'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'access'],
- cooked: ['npm', 'access'],
- original: ['npm', 'access'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, ['public'], 'correctly completed a subcommand name')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completions for commands that return nested arrays are joined', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm completion '
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', 'access', 'p'])
+ t.matchSnapshot(outputs, 'filtered subcommands')
})
- await completion.exec(['npm', 'completion', ''])
+ t.test('commands with no completion', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm adduser '
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'completion'],
- cooked: ['npm', 'completion'],
- original: ['npm', 'completion'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, ['>> ~/.bashrc'], 'joins nested arrays')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completions for commands that return nothing work correctly', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm donothing '
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ // quotes around adduser are to ensure coverage when unescaping commands
+ await completion.exec(['npm', "'adduser'", ''])
+ t.matchSnapshot(outputs, 'no results')
})
- await completion.exec(['npm', 'donothing', ''])
-
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'donothing'],
- cooked: ['npm', 'donothing'],
- original: ['npm', 'donothing'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, [], 'returns nothing')
-})
+ t.test('flags', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm install --v'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
-t.test('completions for commands that return a single item work correctly', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm driveaboat '
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
- })
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
- await completion.exec(['npm', 'driveaboat', ''])
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'driveaboat'],
- cooked: ['npm', 'driveaboat'],
- original: ['npm', 'driveaboat'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, ['\' fast\''], 'returns the correctly escaped string')
-})
+ await completion.exec(['npm', 'install', '--v'])
-t.test('command completion for commands with no completion return no results', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm adduser '
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ t.matchSnapshot(outputs, 'flags')
})
- // quotes around adduser are to ensure coverage when unescaping commands
- await completion.exec(['npm', '\'adduser\'', ''])
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'adduser'],
- cooked: ['npm', 'adduser'],
- original: ['npm', 'adduser'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, [], 'correctly completed a subcommand name')
-})
+ t.test('--no- flags', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm install --no-v'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
-t.test('command completion errors propagate', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm access '
- process.env.COMP_POINT = process.env.COMP_LINE.length
- accessCompletionError = true
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
- accessCompletionError = false
- })
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
- await t.rejects(
- completion.exec(['npm', 'access', '']),
- /access completion failed/,
- 'catches the appropriate error'
- )
- t.strictSame(npmConfig, {
- argv: {
- remain: ['npm', 'access'],
- cooked: ['npm', 'access'],
- original: ['npm', 'access'],
- },
- }, 'applies command config appropriately')
- t.strictSame(output, [], 'returns no results')
-})
+ await completion.exec(['npm', 'install', '--no-v'])
-t.test('completion can complete flags', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm install --'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ t.matchSnapshot(outputs, 'flags')
})
- await completion.exec(['npm', 'install', '--'])
+ t.test('double dashes escape from flag completion', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm -- install --'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {}, 'does not apply command config')
- t.strictSame(output, [['--global', '--browser', '--registry', '--reg', '--no-global', '--no-browser'].join('\n')], 'correctly completes flag names')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('double dashes escape from flag completion', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm -- install --'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', '--', 'install', '--'])
+
+ t.matchSnapshot(outputs, 'full command list')
})
- await completion.exec(['npm', '--', 'install', '--'])
+ t.test('completion cannot complete options that take a value in mid-command', async t => {
+ process.env.COMP_CWORD = 2
+ process.env.COMP_LINE = 'npm --registry install'
+ process.env.COMP_POINT = process.env.COMP_LINE.length
- t.strictSame(npmConfig, {}, 'does not apply command config')
- t.strictSame(output, [['access', 'adduser', 'completion', 'login'].join('\n')], 'correctly completes flag names')
-})
+ t.teardown(() => {
+ delete process.env.COMP_CWORD
+ delete process.env.COMP_LINE
+ delete process.env.COMP_POINT
+ })
-t.test('completion cannot complete options that take a value in mid-command', async t => {
- process.env.COMP_CWORD = 2
- process.env.COMP_LINE = 'npm --registry install'
- process.env.COMP_POINT = process.env.COMP_LINE.length
-
- t.teardown(() => {
- delete process.env.COMP_CWORD
- delete process.env.COMP_LINE
- delete process.env.COMP_POINT
- npm.config.clear()
- output.length = 0
+ await completion.exec(['npm', '--registry', 'install'])
+ t.matchSnapshot(outputs, 'does not try to complete option arguments in the middle of a command')
})
+})
- await completion.exec(['npm', '--registry', 'install'])
- t.strictSame(npmConfig, {}, 'does not apply command config')
- t.strictSame(output, [], 'does not try to complete option arguments in the middle of a command')
+t.test('windows without bash', async t => {
+ const { Npm, outputs } = mockNpm(t, {
+ '../../lib/utils/is-windows-shell.js': true,
+ })
+ const npm = new Npm()
+ const completion = await npm.cmd('completion')
+ await t.rejects(
+ completion.exec({}),
+ { code: 'ENOTSUP', message: /completion supported only in MINGW/ },
+ 'returns the correct error'
+ )
+ t.matchSnapshot(outputs, 'no output')
})
diff --git a/deps/npm/test/lib/commands/config.js b/deps/npm/test/lib/commands/config.js
index 56ec7fd916..b37088c06b 100644
--- a/deps/npm/test/lib/commands/config.js
+++ b/deps/npm/test/lib/commands/config.js
@@ -10,25 +10,37 @@ const readFile = promisify(fs.readFile)
const Sandbox = require('../../fixtures/sandbox.js')
-t.test('config no args', async (t) => {
+t.test('config no args', async t => {
const sandbox = new Sandbox(t)
- await t.rejects(sandbox.run('config', []), {
- code: 'EUSAGE',
- }, 'rejects with usage')
+ await t.rejects(
+ sandbox.run('config', []),
+ {
+ code: 'EUSAGE',
+ },
+ 'rejects with usage'
+ )
})
-t.test('config ignores workspaces', async (t) => {
+t.test('config ignores workspaces', async t => {
const sandbox = new Sandbox(t)
- await t.rejects(sandbox.run('config', ['--workspaces']), {
- code: 'EUSAGE',
- }, 'rejects with usage')
-
- t.match(sandbox.logs.warn, [['config', 'This command does not support workspaces.']], 'logged the warning')
+ await t.rejects(
+ sandbox.run('config', ['--workspaces']),
+ {
+ code: 'EUSAGE',
+ },
+ 'rejects with usage'
+ )
+
+ t.match(
+ sandbox.logs.warn,
+ [['config', 'This command does not support workspaces.']],
+ 'logged the warning'
+ )
})
-t.test('config list', async (t) => {
+t.test('config list', async t => {
const sandbox = new Sandbox(t)
const temp = t.testdir({
@@ -51,7 +63,7 @@ t.test('config list', async (t) => {
t.matchSnapshot(sandbox.output, 'output matches snapshot')
})
-t.test('config list --long', async (t) => {
+t.test('config list --long', async t => {
const temp = t.testdir({
global: {
npmrc: 'globalloaded=yes',
@@ -73,7 +85,7 @@ t.test('config list --long', async (t) => {
t.matchSnapshot(sandbox.output, 'output matches snapshot')
})
-t.test('config list --json', async (t) => {
+t.test('config list --json', async t => {
const temp = t.testdir({
global: {
npmrc: 'globalloaded=yes',
@@ -95,15 +107,19 @@ t.test('config list --json', async (t) => {
t.matchSnapshot(sandbox.output, 'output matches snapshot')
})
-t.test('config delete no args', async (t) => {
+t.test('config delete no args', async t => {
const sandbox = new Sandbox(t)
- await t.rejects(sandbox.run('config', ['delete']), {
- code: 'EUSAGE',
- }, 'rejects with usage')
+ await t.rejects(
+ sandbox.run('config', ['delete']),
+ {
+ code: 'EUSAGE',
+ },
+ 'rejects with usage'
+ )
})
-t.test('config delete single key', async (t) => {
+t.test('config delete single key', async t => {
// location defaults to user, so we work with a userconfig
const home = t.testdir({
'.npmrc': 'foo=bar\nbar=baz',
@@ -118,7 +134,7 @@ t.test('config delete single key', async (t) => {
t.not(contents.includes('foo='), 'foo was removed on disk')
})
-t.test('config delete multiple keys', async (t) => {
+t.test('config delete multiple keys', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar\nbar=baz\nbaz=buz',
})
@@ -134,7 +150,7 @@ t.test('config delete multiple keys', async (t) => {
t.not(contents.includes('bar='), 'bar was removed on disk')
})
-t.test('config delete key --location=global', async (t) => {
+t.test('config delete key --location=global', async t => {
const global = t.testdir({
npmrc: 'foo=bar\nbar=baz',
})
@@ -148,7 +164,7 @@ t.test('config delete key --location=global', async (t) => {
t.not(contents.includes('foo='), 'foo was removed on disk')
})
-t.test('config delete key --global', async (t) => {
+t.test('config delete key --global', async t => {
const global = t.testdir({
npmrc: 'foo=bar\nbar=baz',
})
@@ -162,15 +178,19 @@ t.test('config delete key --global', async (t) => {
t.not(contents.includes('foo='), 'foo was removed on disk')
})
-t.test('config set no args', async (t) => {
+t.test('config set no args', async t => {
const sandbox = new Sandbox(t)
- await t.rejects(sandbox.run('config', ['set']), {
- code: 'EUSAGE',
- }, 'rejects with usage')
+ await t.rejects(
+ sandbox.run('config', ['set']),
+ {
+ code: 'EUSAGE',
+ },
+ 'rejects with usage'
+ )
})
-t.test('config set key', async (t) => {
+t.test('config set key', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar',
})
@@ -185,7 +205,7 @@ t.test('config set key', async (t) => {
t.ok(contents.includes('foo='), 'wrote foo to disk')
})
-t.test('config set key value', async (t) => {
+t.test('config set key value', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar',
})
@@ -200,7 +220,7 @@ t.test('config set key value', async (t) => {
t.ok(contents.includes('foo=baz'), 'wrote foo to disk')
})
-t.test('config set key=value', async (t) => {
+t.test('config set key=value', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar',
})
@@ -215,7 +235,7 @@ t.test('config set key=value', async (t) => {
t.ok(contents.includes('foo=baz'), 'wrote foo to disk')
})
-t.test('config set key1 value1 key2=value2 key3', async (t) => {
+t.test('config set key1 value1 key2=value2 key3', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar\nbar=baz\nbaz=foo',
})
@@ -233,17 +253,19 @@ t.test('config set key1 value1 key2=value2 key3', async (t) => {
t.ok(contents.includes('baz='), 'baz was written to disk')
})
-t.test('config set invalid key logs warning', async (t) => {
+t.test('config set invalid key logs warning', async t => {
const sandbox = new Sandbox(t)
// this doesn't reject, it only logs a warning
await sandbox.run('config', ['set', 'access=foo'])
- t.match(sandbox.logs.warn, [
- ['invalid config', 'access="foo"', `set in ${join(sandbox.home, '.npmrc')}`],
- ], 'logged warning')
+ t.match(
+ sandbox.logs.warn,
+ [['invalid config', 'access="foo"', `set in ${join(sandbox.home, '.npmrc')}`]],
+ 'logged warning'
+ )
})
-t.test('config set key=value --location=global', async (t) => {
+t.test('config set key=value --location=global', async t => {
const global = t.testdir({
npmrc: 'foo=bar\nbar=baz',
})
@@ -257,7 +279,7 @@ t.test('config set key=value --location=global', async (t) => {
t.not(contents.includes('foo=buzz'), 'foo was saved on disk')
})
-t.test('config set key=value --global', async (t) => {
+t.test('config set key=value --global', async t => {
const global = t.testdir({
npmrc: 'foo=bar\nbar=baz',
})
@@ -271,7 +293,7 @@ t.test('config set key=value --global', async (t) => {
t.not(contents.includes('foo=buzz'), 'foo was saved on disk')
})
-t.test('config get no args', async (t) => {
+t.test('config get no args', async t => {
const sandbox = new Sandbox(t)
await sandbox.run('config', ['get'])
@@ -285,28 +307,38 @@ t.test('config get no args', async (t) => {
t.equal(listOutput, getOutput, 'get with no args outputs list')
})
-t.test('config get single key', async (t) => {
+t.test('config get single key', async t => {
const sandbox = new Sandbox(t)
await sandbox.run('config', ['get', 'node-version'])
t.equal(sandbox.output, sandbox.config.get('node-version'), 'should get the value')
})
-t.test('config get multiple keys', async (t) => {
+t.test('config get multiple keys', async t => {
const sandbox = new Sandbox(t)
await sandbox.run('config', ['get', 'node-version', 'npm-version'])
- t.ok(sandbox.output.includes(`node-version=${sandbox.config.get('node-version')}`), 'outputs node-version')
- t.ok(sandbox.output.includes(`npm-version=${sandbox.config.get('npm-version')}`), 'outputs npm-version')
+ t.ok(
+ sandbox.output.includes(`node-version=${sandbox.config.get('node-version')}`),
+ 'outputs node-version'
+ )
+ t.ok(
+ sandbox.output.includes(`npm-version=${sandbox.config.get('npm-version')}`),
+ 'outputs npm-version'
+ )
})
-t.test('config get private key', async (t) => {
+t.test('config get private key', async t => {
const sandbox = new Sandbox(t)
- await t.rejects(sandbox.run('config', ['get', '_authToken']), '_authToken is protected', 'rejects with protected string')
+ await t.rejects(
+ sandbox.run('config', ['get', '_authToken']),
+ '_authToken is protected',
+ 'rejects with protected string'
+ )
})
-t.test('config edit', async (t) => {
+t.test('config edit', async t => {
const home = t.testdir({
'.npmrc': 'foo=bar\nbar=baz',
})
@@ -323,7 +355,11 @@ t.test('config edit', async (t) => {
await sandbox.run('config', ['edit'])
t.ok(editor.called, 'editor was spawned')
- t.same(editor.calledWith.args, [join(sandbox.home, '.npmrc')], 'editor opened the user config file')
+ t.same(
+ editor.calledWith.args,
+ [join(sandbox.home, '.npmrc')],
+ 'editor opened the user config file'
+ )
const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' })
t.ok(contents.includes('foo=bar'), 'kept foo')
@@ -331,7 +367,7 @@ t.test('config edit', async (t) => {
t.ok(contents.includes('shown below with default values'), 'appends defaults to file')
})
-t.test('config edit - editor exits non-0', async (t) => {
+t.test('config edit - editor exits non-0', async t => {
t.teardown(() => {
spawk.clean()
})
@@ -341,22 +377,31 @@ t.test('config edit - editor exits non-0', async (t) => {
const sandbox = new Sandbox(t)
sandbox.process.env.EDITOR = EDITOR
- await t.rejects(sandbox.run('config', ['edit']), {
- message: 'editor process exited with code: 1',
- }, 'rejects with error about editor code')
+ await t.rejects(
+ sandbox.run('config', ['edit']),
+ {
+ message: 'editor process exited with code: 1',
+ },
+ 'rejects with error about editor code'
+ )
t.ok(editor.called, 'editor was spawned')
- t.same(editor.calledWith.args, [join(sandbox.home, '.npmrc')], 'editor opened the user config file')
+ t.same(
+ editor.calledWith.args,
+ [join(sandbox.home, '.npmrc')],
+ 'editor opened the user config file'
+ )
})
-t.test('completion', async (t) => {
+t.test('completion', async t => {
const sandbox = new Sandbox(t)
let allKeys
const testComp = async (argv, expect) => {
t.match(await sandbox.complete('config', argv), expect, argv.join(' '))
- if (!allKeys)
+ if (!allKeys) {
allKeys = Object.keys(sandbox.config.definitions)
+ }
sandbox.reset()
}
diff --git a/deps/npm/test/lib/commands/diff.js b/deps/npm/test/lib/commands/diff.js
index 9b3e2aca51..811936fe6d 100644
--- a/deps/npm/test/lib/commands/diff.js
+++ b/deps/npm/test/lib/commands/diff.js
@@ -169,13 +169,14 @@ t.test('single arg', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'foo@2.1.4', 'should use expected spec')
t.equal(b, `file:${fooPath}`, 'should compare to cwd')
- t.match(opts, {
- ...npm.flatOptions,
- diffFiles: [
- './foo.js',
- './bar.js',
- ],
- }, 'should forward flatOptions and diffFiles')
+ t.match(
+ opts,
+ {
+ ...npm.flatOptions,
+ diffFiles: ['./foo.js', './bar.js'],
+ },
+ 'should forward flatOptions and diffFiles'
+ )
}
config.diff = ['2.1.4']
@@ -264,7 +265,7 @@ t.test('single arg', t => {
const Diff = t.mock('../../../lib/commands/diff.js', {
...mocks,
pacote: {
- packument: (spec) => {
+ packument: spec => {
t.equal(spec.name, 'bar', 'should have expected spec name')
},
},
@@ -273,7 +274,11 @@ t.test('single arg', t => {
return { version: '1.8.10' }
},
libnpmdiff: async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'bar@1.8.10', 'should have possible semver range spec')
},
})
@@ -325,7 +330,7 @@ t.test('single arg', t => {
const Diff = t.mock('../../../lib/commands/diff.js', {
...mocks,
pacote: {
- packument: (spec) => {
+ packument: spec => {
t.equal(spec.name, 'lorem', 'should have expected spec name')
},
},
@@ -334,7 +339,11 @@ t.test('single arg', t => {
return { version: '2.1.0' }
},
libnpmdiff: async ([a, b], opts) => {
- t.equal(a, `lorem@file:${resolve(path, 'globalDir/lib/node_modules/lorem')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `lorem@file:${resolve(path, 'globalDir/lib/node_modules/lorem')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'lorem@2.1.0', 'should have possible semver range spec')
},
})
@@ -364,7 +373,11 @@ t.test('single arg', t => {
})
libnpmdiff = async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'bar@2.0.0', 'should have expected comparison spec')
}
@@ -407,7 +420,7 @@ t.test('single arg', t => {
...mocks,
'../../../lib/utils/read-package-name.js': async () => 'my-project',
pacote: {
- packument: (spec) => {
+ packument: spec => {
t.equal(spec.name, 'lorem', 'should have expected spec name')
},
},
@@ -416,7 +429,11 @@ t.test('single arg', t => {
return { version: '2.2.2' }
},
libnpmdiff: async ([a, b], opts) => {
- t.equal(a, `lorem@file:${resolve(path, 'node_modules/lorem')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `lorem@file:${resolve(path, 'node_modules/lorem')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'lorem@2.2.2', 'should have expected target spec')
},
})
@@ -548,7 +565,11 @@ t.test('first arg is a qualified spec', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'bar@2.0.0', 'should set expected first spec')
- t.equal(b, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ b,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
}
npm.prefix = path
@@ -606,15 +627,20 @@ t.test('first arg is a known dependency name', async t => {
})
libnpmdiff = async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'bar@2.0.0', 'should set expected second spec')
}
npm.prefix = path
config.diff = ['bar', 'bar@2.0.0']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -645,15 +671,24 @@ t.test('first arg is a known dependency name', async t => {
})
libnpmdiff = async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
- t.equal(b, `bar-fork@file:${resolve(path, 'node_modules/bar-fork')}`, 'should target fork local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
+ t.equal(
+ b,
+ `bar-fork@file:${resolve(path, 'node_modules/bar-fork')}`,
+ 'should target fork local node_modules pkg'
+ )
}
npm.prefix = path
config.diff = ['bar', 'bar-fork']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -678,15 +713,20 @@ t.test('first arg is a known dependency name', async t => {
})
libnpmdiff = async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'bar@2.0.0', 'should use package name from first arg')
}
npm.prefix = path
config.diff = ['bar', '2.0.0']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -711,7 +751,11 @@ t.test('first arg is a known dependency name', async t => {
})
libnpmdiff = async ([a, b], opts) => {
- t.equal(a, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ a,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
t.equal(b, 'bar-fork@latest', 'should set expected second spec')
}
@@ -759,7 +803,11 @@ t.test('first arg is a valid semver range', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'bar@1.0.0', 'should use name from second arg')
- t.equal(b, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should set expected second spec from nm')
+ t.equal(
+ b,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should set expected second spec from nm'
+ )
}
npm.prefix = path
@@ -847,8 +895,9 @@ t.test('first arg is an unknown dependency name', t => {
config.diff = ['bar', 'bar@2.0.0']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -874,14 +923,19 @@ t.test('first arg is an unknown dependency name', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'bar-fork@latest', 'should use latest tag')
- t.equal(b, `bar@file:${resolve(path, 'node_modules/bar')}`, 'should target local node_modules pkg')
+ t.equal(
+ b,
+ `bar@file:${resolve(path, 'node_modules/bar')}`,
+ 'should target local node_modules pkg'
+ )
}
npm.prefix = path
config.diff = ['bar-fork', 'bar']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -895,8 +949,9 @@ t.test('first arg is an unknown dependency name', t => {
config.diff = ['bar', '^1.0.0']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -910,8 +965,9 @@ t.test('first arg is an unknown dependency name', t => {
config.diff = ['bar', 'bar-fork']
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -928,8 +984,9 @@ t.test('first arg is an unknown dependency name', t => {
npm.prefix = path
diff.exec([], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
@@ -943,10 +1000,14 @@ t.test('various options', t => {
flatOptions.diffNameOnly = true
libnpmdiff = async ([a, b], opts) => {
- t.match(opts, {
- ...npm.flatOptions,
- diffNameOnly: true,
- }, 'should forward nameOnly=true option')
+ t.match(
+ opts,
+ {
+ ...npm.flatOptions,
+ diffNameOnly: true,
+ },
+ 'should forward nameOnly=true option'
+ )
}
await diff.exec([])
@@ -960,13 +1021,14 @@ t.test('various options', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'foo@2.1.4', 'should use expected spec')
t.equal(b, 'foo@3.0.0', 'should use expected spec')
- t.match(opts, {
- ...npm.flatOptions,
- diffFiles: [
- './foo.js',
- './bar.js',
- ],
- }, 'should forward diffFiles values')
+ t.match(
+ opts,
+ {
+ ...npm.flatOptions,
+ diffFiles: ['./foo.js', './bar.js'],
+ },
+ 'should forward diffFiles values'
+ )
}
await diff.exec(['./foo.js', './bar.js'])
@@ -978,13 +1040,14 @@ t.test('various options', t => {
libnpmdiff = async ([a, b], opts) => {
t.equal(a, 'foo@latest', 'should have default spec')
t.equal(b, `file:${fooPath}`, 'should compare to cwd')
- t.match(opts, {
- ...npm.flatOptions,
- diffFiles: [
- './foo.js',
- './bar.js',
- ],
- }, 'should forward all remaining items as filenames')
+ t.match(
+ opts,
+ {
+ ...npm.flatOptions,
+ diffFiles: ['./foo.js', './bar.js'],
+ },
+ 'should forward all remaining items as filenames'
+ )
}
await diff.exec(['./foo.js', './bar.js'])
@@ -1001,15 +1064,19 @@ t.test('various options', t => {
flatOptions.diffText = true
libnpmdiff = async ([a, b], opts) => {
- t.match(opts, {
- ...npm.flatOptions,
- diffContext: 5,
- diffIgnoreWhitespace: true,
- diffNoPrefix: false,
- diffSrcPrefix: 'foo/',
- diffDstPrefix: 'bar/',
- diffText: true,
- }, 'should forward diff options')
+ t.match(
+ opts,
+ {
+ ...npm.flatOptions,
+ diffContext: 5,
+ diffIgnoreWhitespace: true,
+ diffNoPrefix: false,
+ diffSrcPrefix: 'foo/',
+ diffDstPrefix: 'bar/',
+ diffText: true,
+ },
+ 'should forward diff options'
+ )
}
await diff.exec([])
@@ -1062,10 +1129,14 @@ t.test('workspaces', t => {
npm.prefix = path
npm.localPrefix = path
await diff.execWorkspaces([], [])
- t.same(diffCalls, [
- ['workspace-a@latest', join(`file:${path}`, 'workspace-a')],
- ['workspace-b@latest', join(`file:${path}`, 'workspace-b')],
- ], 'should call libnpmdiff with workspaces params')
+ t.same(
+ diffCalls,
+ [
+ ['workspace-a@latest', join(`file:${path}`, 'workspace-a')],
+ ['workspace-b@latest', join(`file:${path}`, 'workspace-b')],
+ ],
+ 'should call libnpmdiff with workspaces params'
+ )
})
t.test('one workspace', async t => {
@@ -1076,9 +1147,11 @@ t.test('workspaces', t => {
npm.prefix = path
npm.localPrefix = path
await diff.execWorkspaces([], ['workspace-a'])
- t.same(diffCalls, [
- ['workspace-a@latest', join(`file:${path}`, 'workspace-a')],
- ], 'should call libnpmdiff with workspaces params')
+ t.same(
+ diffCalls,
+ [['workspace-a@latest', join(`file:${path}`, 'workspace-a')]],
+ 'should call libnpmdiff with workspaces params'
+ )
})
t.test('invalid workspace', async t => {
@@ -1087,14 +1160,8 @@ t.test('workspaces', t => {
}
npm.prefix = path
npm.localPrefix = path
- await t.rejects(
- diff.execWorkspaces([], ['workspace-x']),
- /No workspaces found/
- )
- await t.rejects(
- diff.execWorkspaces([], ['workspace-x']),
- /workspace-x/
- )
+ await t.rejects(diff.execWorkspaces([], ['workspace-x']), /No workspaces found/)
+ await t.rejects(diff.execWorkspaces([], ['workspace-x']), /workspace-x/)
})
t.end()
})
diff --git a/deps/npm/test/lib/commands/dist-tag.js b/deps/npm/test/lib/commands/dist-tag.js
index be66366f84..6b45dc1167 100644
--- a/deps/npm/test/lib/commands/dist-tag.js
+++ b/deps/npm/test/lib/commands/dist-tag.js
@@ -43,8 +43,9 @@ const routeMap = {
// XXX overriding this does not appear to do anything, adding t.plan to things
// that use it fails the test
let npmRegistryFetchMock = (url, opts) => {
- if (url === '/-/package/foo/dist-tags')
+ if (url === '/-/package/foo/dist-tags') {
throw new Error('no package found')
+ }
return routeMap[url]
}
@@ -52,8 +53,9 @@ let npmRegistryFetchMock = (url, opts) => {
npmRegistryFetchMock.json = async (url, opts) => routeMap[url]
const logger = (...msgs) => {
- for (const msg of [...msgs])
+ for (const msg of [...msgs]) {
log += msg + ' '
+ }
log += '\n'
}
diff --git a/deps/npm/test/lib/commands/docs.js b/deps/npm/test/lib/commands/docs.js
index 4853a7960c..a3b31bd706 100644
--- a/deps/npm/test/lib/commands/docs.js
+++ b/deps/npm/test/lib/commands/docs.js
@@ -99,14 +99,14 @@ t.test('open docs urls', t => {
const url = expect[pkg]
t.match({
[url]: 1,
- }, opened, `opened ${url}`, {opened})
+ }, opened, `opened ${url}`, { opened })
})
})
})
t.test('open default package if none specified', async t => {
await docs.exec([])
- t.equal(opened['https://example.com'], 1, 'opened expected url', {opened})
+ t.equal(opened['https://example.com'], 1, 'opened expected url', { opened })
})
t.test('workspaces', (t) => {
diff --git a/deps/npm/test/lib/commands/doctor.js b/deps/npm/test/lib/commands/doctor.js
index 9db622878c..e3ad5cc726 100644
--- a/deps/npm/test/lib/commands/doctor.js
+++ b/deps/npm/test/lib/commands/doctor.js
@@ -17,14 +17,16 @@ const output = []
let pingError
const ping = async () => {
- if (pingError)
+ if (pingError) {
throw pingError
+ }
}
let whichError = null
const which = async () => {
- if (whichError)
+ if (whichError) {
throw whichError
+ }
return '/path/to/git'
}
@@ -51,10 +53,11 @@ const logs = {
const clearLogs = (obj = logs) => {
output.length = 0
for (const key in obj) {
- if (Array.isArray(obj[key]))
+ if (Array.isArray(obj[key])) {
obj[key].length = 0
- else
+ } else {
delete obj[key]
+ }
}
}
@@ -63,31 +66,35 @@ const npm = {
registry: 'https://registry.npmjs.org/',
},
log: {
- info: (msg) => {
+ info: msg => {
logs.info.push(msg)
},
- newItem: (name) => {
+ newItem: name => {
logs[name] = {}
return {
info: (_, msg) => {
- if (!logs[name].info)
+ if (!logs[name].info) {
logs[name].info = []
+ }
logs[name].info.push(msg)
},
warn: (_, msg) => {
- if (!logs[name].warn)
+ if (!logs[name].warn) {
logs[name].warn = []
+ }
logs[name].warn.push(msg)
},
error: (_, msg) => {
- if (!logs[name].error)
+ if (!logs[name].error) {
logs[name].error = []
+ }
logs[name].error.push(msg)
},
silly: (_, msg) => {
- if (!logs[name].silly)
+ if (!logs[name].silly) {
logs[name].silly = []
+ }
logs[name].silly.push(msg)
},
completeWork: () => {},
@@ -103,7 +110,7 @@ const npm = {
},
},
version: '7.1.0',
- output: (data) => {
+ output: data => {
output.push(data)
},
}
@@ -162,18 +169,26 @@ t.test('node versions', t => {
})
await doctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -205,14 +220,18 @@ t.test('node versions', t => {
await doctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.strictSame(output, [], 'did not print output')
})
@@ -241,23 +260,27 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the ping error'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping.*not ok/, 'ping output is ok')
st.match(output, /npm -v.*ok/, 'npm -v output is ok')
st.match(output, /node -v.*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry.*ok.*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry.*ok.*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git.*ok/, 'which git output is ok')
st.match(output, /cached files.*ok/, 'cached files are ok')
st.match(output, /local node_modules.*ok/, 'local node_modules are ok')
@@ -297,18 +320,26 @@ t.test('node versions', t => {
})
await winDoctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: undefined,
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: undefined,
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cache contents\s*ok/, 'cache contents is ok')
})
@@ -337,23 +368,31 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the ping error'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
+ st.match(
+ output,
+ /npm ping\s*not ok\s*111 this error is 111/,
+ 'ping output contains trimmed error'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
- st.match(output, /npm ping\s*not ok\s*111 this error is 111/, 'ping output contains trimmed error')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -387,23 +426,27 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the ping error'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the ping error')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping\s*not ok\s*generic error/, 'ping output contains trimmed error')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -437,23 +480,27 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the out of date npm'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date npm')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*not ok/, 'npm -v output is not ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -524,8 +571,9 @@ t.test('node versions', t => {
return cb(err)
}
- if (p === join(dir, 'cache', 'baddir'))
+ if (p === join(dir, 'cache', 'baddir')) {
err = new Error('broken')
+ }
return cb(err, result)
}
@@ -577,27 +625,31 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'identified problems'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'identified problems')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [join(dir, 'cache')]: { finished: true },
+ [join(dir, 'local')]: { finished: true },
+ [join(dir, 'global')]: { finished: true },
+ [join(dir, 'localBin')]: { finished: true },
+ [join(dir, 'globalBin')]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [join(dir, 'cache')]: { finished: true },
- [join(dir, 'local')]: { finished: true },
- [join(dir, 'global')]: { finished: true },
- [join(dir, 'localBin')]: { finished: true },
- [join(dir, 'globalBin')]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*not ok/, 'cached files are not ok')
st.match(output, /local node_modules\s*not ok/, 'local node_modules are not ok')
@@ -631,23 +683,27 @@ t.test('node versions', t => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the missing git'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the missing git')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*not ok/, 'which git output is not ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -687,18 +743,26 @@ t.test('node versions', t => {
// cache verification problems get fixed and so do not throw an error
await doctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -740,18 +804,26 @@ t.test('node versions', t => {
// cache verification problems get fixed and so do not throw an error
await doctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -791,18 +863,26 @@ t.test('node versions', t => {
// cache verification problems get fixed and so do not throw an error
await doctor.exec([])
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -842,18 +922,26 @@ t.test('node versions', t => {
/Some problems found/,
'detected the non-default registry'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
+ )
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*ok/, 'node -v output is ok')
- st.match(output, /npm config get registry\s*not ok/, 'npm config get registry output is not ok')
+ st.match(
+ output,
+ /npm config get registry\s*not ok/,
+ 'npm config get registry output is not ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
@@ -901,23 +989,27 @@ t.test('outdated node version', vt => {
clearLogs()
})
- await st.rejects(
- doctor.exec([]),
- /Some problems found/,
- 'detected the out of date nodejs'
+ await st.rejects(doctor.exec([]), /Some problems found/, 'detected the out of date nodejs')
+ st.match(
+ logs,
+ {
+ checkPing: { finished: true },
+ getLatestNpmVersion: { finished: true },
+ getLatestNodejsVersion: { finished: true },
+ getGitPath: { finished: true },
+ [dir]: { finished: true },
+ verifyCachedFiles: { finished: true },
+ },
+ 'trackers all finished'
)
- st.match(logs, {
- checkPing: { finished: true },
- getLatestNpmVersion: { finished: true },
- getLatestNodejsVersion: { finished: true },
- getGitPath: { finished: true },
- [dir]: { finished: true },
- verifyCachedFiles: { finished: true },
- }, 'trackers all finished')
st.match(output, /npm ping\s*ok/, 'ping output is ok')
st.match(output, /npm -v\s*ok/, 'npm -v output is ok')
st.match(output, /node -v\s*not ok/, 'node -v output is not ok')
- st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok')
+ st.match(
+ output,
+ /npm config get registry\s*ok\s*using default/,
+ 'npm config get registry output is ok'
+ )
st.match(output, /which git\s*ok/, 'which git output is ok')
st.match(output, /cached files\s*ok/, 'cached files are ok')
st.match(output, /local node_modules\s*ok/, 'local node_modules are ok')
diff --git a/deps/npm/test/lib/commands/edit.js b/deps/npm/test/lib/commands/edit.js
index 39e1697b71..92754f2823 100644
--- a/deps/npm/test/lib/commands/edit.js
+++ b/deps/npm/test/lib/commands/edit.js
@@ -31,8 +31,9 @@ const npm = {
dir: resolve(__dirname, '../../../node_modules'),
exec: async (cmd, args) => {
rebuildArgs = args
- if (rebuildFail)
+ if (rebuildFail) {
throw rebuildFail
+ }
},
}
diff --git a/deps/npm/test/lib/commands/exec.js b/deps/npm/test/lib/commands/exec.js
index 25c1f789a9..4ab26568f1 100644
--- a/deps/npm/test/lib/commands/exec.js
+++ b/deps/npm/test/lib/commands/exec.js
@@ -60,8 +60,9 @@ const npm = mockNpm({
const RUN_SCRIPTS = []
const runScript = async opt => {
RUN_SCRIPTS.push(opt)
- if (!PROGRESS_IGNORED && PROGRESS_ENABLED)
+ if (!PROGRESS_IGNORED && PROGRESS_ENABLED) {
throw new Error('progress not disabled during run script!')
+ }
}
const MANIFESTS = {}
@@ -134,20 +135,22 @@ t.test('npx foo, bin already exists locally', async t => {
npm.localBin = resolve(path, 'node_modules', '.bin')
await exec.exec(['foo', 'one arg', 'two arg'])
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' }},
- args: ['one arg', 'two arg'],
- cache: flatOptions.cache,
- npxCache: flatOptions.npxCache,
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: {
- PATH: [npm.localBin, ...PATH].join(delimiter),
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ cache: flatOptions.cache,
+ npxCache: flatOptions.npxCache,
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: {
+ PATH: [npm.localBin, ...PATH].join(delimiter),
+ },
+ stdio: 'inherit',
},
- stdio: 'inherit',
- }])
+ ])
})
t.test('npx foo, bin already exists globally', async t => {
@@ -163,18 +166,20 @@ t.test('npx foo, bin already exists globally', async t => {
npm.globalBin = resolve(path, 'node_modules', '.bin')
await exec.exec(['foo', 'one arg', 'two arg'])
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' }},
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: {
- PATH: [npm.globalBin, ...PATH].join(delimiter),
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: {
+ PATH: [npm.globalBin, ...PATH].join(delimiter),
+ },
+ stdio: 'inherit',
},
- stdio: 'inherit',
- }])
+ ])
})
t.test('npm exec foo, already present locally', async t => {
@@ -196,23 +201,25 @@ t.test('npm exec foo, already present locally', async t => {
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no need to reify anything')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('npm exec <noargs>, run interactive shell', t => {
CI_NAME = null
const { isTTY } = process.stdin
process.stdin.isTTY = true
- t.teardown(() => process.stdin.isTTY = isTTY)
+ t.teardown(() => (process.stdin.isTTY = isTTY))
const run = async (t, doRun) => {
LOG_WARN.length = 0
@@ -226,18 +233,21 @@ t.test('npm exec <noargs>, run interactive shell', t => {
t.strictSame(ARB_REIFY, [], 'no need to reify anything')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
if (doRun) {
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'shell-cmd' } },
- args: [],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
- } else
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'shell-cmd' } },
+ args: [],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
+ },
+ ])
+ } else {
t.strictSame(RUN_SCRIPTS, [])
+ }
RUN_SCRIPTS.length = 0
}
@@ -246,9 +256,16 @@ t.test('npm exec <noargs>, run interactive shell', t => {
process.stdin.isTTY = true
await run(t, true)
t.strictSame(LOG_WARN, [])
- t.strictSame(npm._mockOutputs, [
- [`\nEntering npm script environment at location:\n${process.cwd()}\nType 'exit' or ^D when finished\n`],
- ], 'printed message about interactive shell')
+ t.strictSame(
+ npm._mockOutputs,
+ [
+ [
+ /* eslint-disable-next-line max-len */
+ `\nEntering npm script environment at location:\n${process.cwd()}\nType 'exit' or ^D when finished\n`,
+ ],
+ ],
+ 'printed message about interactive shell'
+ )
})
t.test('print message with color when tty and not in CI', async t => {
@@ -259,9 +276,16 @@ t.test('npm exec <noargs>, run interactive shell', t => {
await run(t, true)
t.strictSame(LOG_WARN, [])
- t.strictSame(npm._mockOutputs, [
- [`\u001b[0m\u001b[0m\n\u001b[0mEntering npm script environment\u001b[0m\u001b[0m at location:\u001b[0m\n\u001b[0m\u001b[2m${process.cwd()}\u001b[22m\u001b[0m\u001b[1m\u001b[22m\n\u001b[1mType 'exit' or ^D when finished\u001b[22m\n\u001b[1m\u001b[22m`],
- ], 'printed message about interactive shell')
+ t.strictSame(
+ npm._mockOutputs,
+ [
+ [
+ /* eslint-disable-next-line max-len */
+ `\u001b[0m\u001b[0m\n\u001b[0mEntering npm script environment\u001b[0m\u001b[0m at location:\u001b[0m\n\u001b[0m\u001b[2m${process.cwd()}\u001b[22m\u001b[0m\u001b[1m\u001b[22m\n\u001b[1mType 'exit' or ^D when finished\u001b[22m\n\u001b[1m\u001b[22m`,
+ ],
+ ],
+ 'printed message about interactive shell'
+ )
})
t.test('no message when not TTY', async t => {
@@ -276,9 +300,7 @@ t.test('npm exec <noargs>, run interactive shell', t => {
CI_NAME = 'travis-ci'
process.stdin.isTTY = true
await run(t, false)
- t.strictSame(LOG_WARN, [
- ['exec', 'Interactive mode disabled in CI environment'],
- ])
+ t.strictSame(LOG_WARN, [['exec', 'Interactive mode disabled in CI environment']])
t.strictSame(npm._mockOutputs, [], 'no message about interactive shell')
})
@@ -289,9 +311,11 @@ t.test('npm exec <noargs>, run interactive shell', t => {
await exec.exec([])
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: /sh|cmd/ } },
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: /sh|cmd/ } },
+ },
+ ])
LOG_WARN.length = 0
ARB_CTOR.length = 0
@@ -325,19 +349,21 @@ t.test('npm exec foo, not present locally or in central loc', async t => {
await exec.exec(['foo', 'one arg', 'two arg'])
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
- t.match(ARB_REIFY, [{add: ['foo@'], legacyPeerDeps: false}], 'need to install foo@')
+ t.match(ARB_REIFY, [{ add: ['foo@'], legacyPeerDeps: false }], 'need to install foo@')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('npm exec foo, not present locally but in central loc', async t => {
@@ -364,16 +390,18 @@ t.test('npm exec foo, not present locally but in central loc', async t => {
t.match(ARB_REIFY, [], 'no need to install again, already there')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('npm exec foo, present locally but wrong version', async t => {
@@ -400,16 +428,18 @@ t.test('npm exec foo, present locally but wrong version', async t => {
t.match(ARB_REIFY, [{ add: ['foo@2.x'], legacyPeerDeps: false }], 'need to add foo@2.x')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('npm exec --package=foo bar', async t => {
@@ -433,16 +463,18 @@ t.test('npm exec --package=foo bar', async t => {
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no need to reify anything')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'bar' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'bar' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('npm exec @foo/bar -- --some=arg, locally installed', async t => {
@@ -471,87 +503,97 @@ t.test('npm exec @foo/bar -- --some=arg, locally installed', async t => {
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no need to reify anything')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'bar' } },
- args: ['--some=arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
-})
-
-t.test('npm exec @foo/bar, with same bin alias and no unscoped named bin, locally installed', async t => {
- const foobarManifest = {
- name: '@foo/bar',
- version: '1.2.3',
- bin: {
- baz: 'corge', // pick the first one
- qux: 'corge',
- quux: 'corge',
- },
- }
- const path = t.testdir({
- node_modules: {
- '@foo/bar': {
- 'package.json': JSON.stringify(foobarManifest),
- },
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'bar' } },
+ args: ['--some=arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
},
- })
- npm.localPrefix = path
- ARB_ACTUAL_TREE[path] = {
- children: new Map([['@foo/bar', { name: '@foo/bar', version: '1.2.3' }]]),
- }
- MANIFESTS['@foo/bar'] = foobarManifest
- await exec.exec(['@foo/bar', 'one arg', 'two arg'])
- t.strictSame(MKDIRPS, [], 'no need to make any dirs')
- t.match(ARB_CTOR, [{ path }])
- t.strictSame(ARB_REIFY, [], 'no need to reify anything')
- t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'baz' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
+ ])
})
-t.test('npm exec @foo/bar, with different bin alias and no unscoped named bin, locally installed', async t => {
- const path = t.testdir()
- npm.localPrefix = path
- ARB_ACTUAL_TREE[path] = {
- children: new Map([['@foo/bar', { name: '@foo/bar', version: '1.2.3' }]]),
- }
- MANIFESTS['@foo/bar'] = {
- name: '@foo/bar',
- version: '1.2.3',
- bin: {
- foo: 'qux',
- corge: 'qux',
- baz: 'quux',
- },
- _from: 'foo@',
- _id: '@foo/bar@1.2.3',
+t.test(
+ 'npm exec @foo/bar, with same bin alias and no unscoped named bin, locally installed',
+ async t => {
+ const foobarManifest = {
+ name: '@foo/bar',
+ version: '1.2.3',
+ bin: {
+ baz: 'corge', // pick the first one
+ qux: 'corge',
+ quux: 'corge',
+ },
+ }
+ const path = t.testdir({
+ node_modules: {
+ '@foo/bar': {
+ 'package.json': JSON.stringify(foobarManifest),
+ },
+ },
+ })
+ npm.localPrefix = path
+ ARB_ACTUAL_TREE[path] = {
+ children: new Map([['@foo/bar', { name: '@foo/bar', version: '1.2.3' }]]),
+ }
+ MANIFESTS['@foo/bar'] = foobarManifest
+ await exec.exec(['@foo/bar', 'one arg', 'two arg'])
+ t.strictSame(MKDIRPS, [], 'no need to make any dirs')
+ t.match(ARB_CTOR, [{ path }])
+ t.strictSame(ARB_REIFY, [], 'no need to reify anything')
+ t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'baz' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
+ },
+ ])
}
- await t.rejects(
- exec.exec(['@foo/bar']),
- {
+)
+
+t.test(
+ 'npm exec @foo/bar, with different bin alias and no unscoped named bin, locally installed',
+ async t => {
+ const path = t.testdir()
+ npm.localPrefix = path
+ ARB_ACTUAL_TREE[path] = {
+ children: new Map([['@foo/bar', { name: '@foo/bar', version: '1.2.3' }]]),
+ }
+ MANIFESTS['@foo/bar'] = {
+ name: '@foo/bar',
+ version: '1.2.3',
+ bin: {
+ foo: 'qux',
+ corge: 'qux',
+ baz: 'quux',
+ },
+ _from: 'foo@',
+ _id: '@foo/bar@1.2.3',
+ }
+ await t.rejects(exec.exec(['@foo/bar']), {
message: 'could not determine executable to run',
pkgid: '@foo/bar@1.2.3',
- }
- )
-})
+ })
+ }
+)
t.test('run command with 2 packages, need install, verify sort', async t => {
// test both directions, should use same install dir both times
// also test the read() call here, verify that the prompts match
- const cases = [['foo', 'bar'], ['bar', 'foo']]
+ const cases = [
+ ['foo', 'bar'],
+ ['bar', 'foo'],
+ ]
t.plan(cases.length)
for (const packages of cases) {
t.test(packages.join(', '), async t => {
@@ -585,19 +627,21 @@ t.test('run command with 2 packages, need install, verify sort', async t => {
await exec.exec(['foobar', 'one arg', 'two arg'])
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
- t.match(ARB_REIFY, [{add, legacyPeerDeps: false}], 'need to install both packages')
+ t.match(ARB_REIFY, [{ add, legacyPeerDeps: false }], 'need to install both packages')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foobar' } },
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foobar' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
})
}
})
@@ -614,13 +658,10 @@ t.test('npm exec foo, no bin in package', async t => {
_from: 'foo@',
_id: 'foo@1.2.3',
}
- await t.rejects(
- exec.exec(['foo']),
- {
- message: 'could not determine executable to run',
- pkgid: 'foo@1.2.3',
- }
- )
+ await t.rejects(exec.exec(['foo']), {
+ message: 'could not determine executable to run',
+ pkgid: 'foo@1.2.3',
+ })
})
t.test('npm exec foo, many bins in package, none named foo', async t => {
@@ -639,13 +680,10 @@ t.test('npm exec foo, many bins in package, none named foo', async t => {
_from: 'foo@',
_id: 'foo@1.2.3',
}
- await t.rejects(
- exec.exec(['foo']),
- {
- message: 'could not determine executable to run',
- pkgid: 'foo@1.2.3',
- }
- )
+ await t.rejects(exec.exec(['foo']), {
+ message: 'could not determine executable to run',
+ pkgid: 'foo@1.2.3',
+ })
})
t.test('npm exec -p foo -c "ls -laF"', async t => {
@@ -666,23 +704,22 @@ t.test('npm exec -p foo -c "ls -laF"', async t => {
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no need to reify anything')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'ls -laF' } },
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH: process.env.PATH },
- stdio: 'inherit',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'ls -laF' } },
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH: process.env.PATH },
+ stdio: 'inherit',
+ },
+ ])
})
t.test('positional args and --call together is an error', async t => {
config.call = 'true'
- await t.rejects(
- exec.exec(['foo']),
- exec.usage
- )
+ await t.rejects(exec.exec(['foo']), exec.usage)
})
t.test('prompt when installs are needed if not already present and shell is a TTY', async t => {
@@ -732,141 +769,165 @@ t.test('prompt when installs are needed if not already present and shell is a TT
await exec.exec(['foobar'])
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
- t.match(ARB_REIFY, [{add, legacyPeerDeps: false}], 'need to install both packages')
+ t.match(ARB_REIFY, [{ add, legacyPeerDeps: false }], 'need to install both packages')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foobar' } },
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
- t.strictSame(READ, [{
- prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
- default: 'y',
- }])
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foobar' } },
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
+ t.strictSame(READ, [
+ {
+ prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
+ default: 'y',
+ },
+ ])
})
-t.test('skip prompt when installs are needed if not already present and shell is not a tty (multiple packages)', async t => {
- const stdoutTTY = process.stdout.isTTY
- const stdinTTY = process.stdin.isTTY
- t.teardown(() => {
- process.stdout.isTTY = stdoutTTY
- process.stdin.isTTY = stdinTTY
- CI_NAME = 'travis-ci'
- })
- process.stdout.isTTY = false
- process.stdin.isTTY = false
- CI_NAME = false
+t.test(
+ /* eslint-disable-next-line max-len */
+ 'skip prompt when installs are needed if not already present and shell is not a tty (multiple packages)',
+ async t => {
+ const stdoutTTY = process.stdout.isTTY
+ const stdinTTY = process.stdin.isTTY
+ t.teardown(() => {
+ process.stdout.isTTY = stdoutTTY
+ process.stdin.isTTY = stdinTTY
+ CI_NAME = 'travis-ci'
+ })
+ process.stdout.isTTY = false
+ process.stdin.isTTY = false
+ CI_NAME = false
- const packages = ['foo', 'bar']
- READ_RESULT = 'yolo'
+ const packages = ['foo', 'bar']
+ READ_RESULT = 'yolo'
- config.package = packages
- config.yes = undefined
+ config.package = packages
+ config.yes = undefined
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
- const path = t.testdir()
- const installDir = resolve('npx-cache-dir/07de77790e5f40f2')
- npm.localPrefix = path
- ARB_ACTUAL_TREE[path] = {
- children: new Map(),
- }
- ARB_ACTUAL_TREE[installDir] = {
- children: new Map(),
- }
- MANIFESTS.foo = {
- name: 'foo',
- version: '1.2.3',
- bin: {
- foo: 'foo',
- },
- _from: 'foo@',
- }
- MANIFESTS.bar = {
- name: 'bar',
- version: '1.2.3',
- bin: {
- bar: 'bar',
- },
- _from: 'bar@',
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
+ const path = t.testdir()
+ const installDir = resolve('npx-cache-dir/07de77790e5f40f2')
+ npm.localPrefix = path
+ ARB_ACTUAL_TREE[path] = {
+ children: new Map(),
+ }
+ ARB_ACTUAL_TREE[installDir] = {
+ children: new Map(),
+ }
+ MANIFESTS.foo = {
+ name: 'foo',
+ version: '1.2.3',
+ bin: {
+ foo: 'foo',
+ },
+ _from: 'foo@',
+ }
+ MANIFESTS.bar = {
+ name: 'bar',
+ version: '1.2.3',
+ bin: {
+ bar: 'bar',
+ },
+ _from: 'bar@',
+ }
+ await exec.exec(['foobar'])
+ t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
+ t.match(ARB_CTOR, [{ path }])
+ t.match(ARB_REIFY, [{ add, legacyPeerDeps: false }], 'need to install both packages')
+ t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
+ const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foobar' } },
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
+ t.strictSame(READ, [], 'should not have prompted')
+ t.strictSame(
+ LOG_WARN,
+ [['exec', 'The following packages were not found and will be installed: bar, foo']],
+ 'should have printed a warning'
+ )
}
- await exec.exec(['foobar'])
- t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
- t.match(ARB_CTOR, [{ path }])
- t.match(ARB_REIFY, [{add, legacyPeerDeps: false}], 'need to install both packages')
- t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foobar' } },
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
- t.strictSame(READ, [], 'should not have prompted')
- t.strictSame(LOG_WARN, [['exec', 'The following packages were not found and will be installed: bar, foo']], 'should have printed a warning')
-})
-
-t.test('skip prompt when installs are needed if not already present and shell is not a tty (single package)', async t => {
- const stdoutTTY = process.stdout.isTTY
- const stdinTTY = process.stdin.isTTY
- t.teardown(() => {
- process.stdout.isTTY = stdoutTTY
- process.stdin.isTTY = stdinTTY
- CI_NAME = 'travis-ci'
- })
- process.stdout.isTTY = false
- process.stdin.isTTY = false
- CI_NAME = false
+)
+
+t.test(
+ /* eslint-disable-next-line max-len */
+ 'skip prompt when installs are needed if not already present and shell is not a tty (single package)',
+ async t => {
+ const stdoutTTY = process.stdout.isTTY
+ const stdinTTY = process.stdin.isTTY
+ t.teardown(() => {
+ process.stdout.isTTY = stdoutTTY
+ process.stdin.isTTY = stdinTTY
+ CI_NAME = 'travis-ci'
+ })
+ process.stdout.isTTY = false
+ process.stdin.isTTY = false
+ CI_NAME = false
- const packages = ['foo']
- READ_RESULT = 'yolo'
+ const packages = ['foo']
+ READ_RESULT = 'yolo'
- config.package = packages
- config.yes = undefined
+ config.package = packages
+ config.yes = undefined
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
- const path = t.testdir()
- const installDir = resolve('npx-cache-dir/f7fbba6e0636f890')
- npm.localPrefix = path
- ARB_ACTUAL_TREE[path] = {
- children: new Map(),
- }
- ARB_ACTUAL_TREE[installDir] = {
- children: new Map(),
- }
- MANIFESTS.foo = {
- name: 'foo',
- version: '1.2.3',
- bin: {
- foo: 'foo',
- },
- _from: 'foo@',
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
+ const path = t.testdir()
+ const installDir = resolve('npx-cache-dir/f7fbba6e0636f890')
+ npm.localPrefix = path
+ ARB_ACTUAL_TREE[path] = {
+ children: new Map(),
+ }
+ ARB_ACTUAL_TREE[installDir] = {
+ children: new Map(),
+ }
+ MANIFESTS.foo = {
+ name: 'foo',
+ version: '1.2.3',
+ bin: {
+ foo: 'foo',
+ },
+ _from: 'foo@',
+ }
+ await exec.exec(['foobar'])
+ t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
+ t.match(ARB_CTOR, [{ path }])
+ t.match(ARB_REIFY, [{ add, legacyPeerDeps: false }], 'need to install the package')
+ t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
+ const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foobar' } },
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: { PATH },
+ stdio: 'inherit',
+ },
+ ])
+ t.strictSame(READ, [], 'should not have prompted')
+ t.strictSame(
+ LOG_WARN,
+ [['exec', 'The following package was not found and will be installed: foo']],
+ 'should have printed a warning'
+ )
}
- await exec.exec(['foobar'])
- t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
- t.match(ARB_CTOR, [{ path }])
- t.match(ARB_REIFY, [{add, legacyPeerDeps: false}], 'need to install the package')
- t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
- const PATH = `${resolve(installDir, 'node_modules', '.bin')}${delimiter}${process.env.PATH}`
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foobar' } },
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: { PATH },
- stdio: 'inherit',
- }])
- t.strictSame(READ, [], 'should not have prompted')
- t.strictSame(LOG_WARN, [['exec', 'The following package was not found and will be installed: foo']], 'should have printed a warning')
-})
+)
t.test('abort if prompt rejected', async t => {
const stdoutTTY = process.stdout.isTTY
@@ -911,20 +972,18 @@ t.test('abort if prompt rejected', async t => {
},
_from: 'bar@',
}
- await t.rejects(
- exec.exec(['foobar']),
- /canceled/,
- 'should be canceled'
- )
+ await t.rejects(exec.exec(['foobar']), /canceled/, 'should be canceled')
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no install performed')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
t.strictSame(RUN_SCRIPTS, [])
- t.strictSame(READ, [{
- prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
- default: 'y',
- }])
+ t.strictSame(READ, [
+ {
+ prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
+ default: 'y',
+ },
+ ])
})
t.test('abort if prompt false', async t => {
@@ -970,20 +1029,18 @@ t.test('abort if prompt false', async t => {
},
_from: 'bar@',
}
- await t.rejects(
- exec.exec(['foobar']),
- 'canceled',
- 'should be canceled'
- )
+ await t.rejects(exec.exec(['foobar']), 'canceled', 'should be canceled')
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no install performed')
t.equal(PROGRESS_ENABLED, true, 'progress re-enabled')
t.strictSame(RUN_SCRIPTS, [])
- t.strictSame(READ, [{
- prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
- default: 'y',
- }])
+ t.strictSame(READ, [
+ {
+ prompt: 'Need to install the following packages:\n bar\n foo\nOk to proceed? ',
+ default: 'y',
+ },
+ ])
})
t.test('abort if -n provided', async t => {
@@ -1028,11 +1085,7 @@ t.test('abort if -n provided', async t => {
},
_from: 'bar@',
}
- await t.rejects(
- exec.exec(['foobar']),
- /canceled/,
- 'should be canceled'
- )
+ await t.rejects(exec.exec(['foobar']), /canceled/, 'should be canceled')
t.strictSame(MKDIRPS, [installDir], 'need to make install dir')
t.match(ARB_CTOR, [{ path }])
t.strictSame(ARB_REIFY, [], 'no install performed')
@@ -1062,7 +1115,11 @@ t.test('forward legacyPeerDeps opt', async t => {
config.yes = true
flatOptions.legacyPeerDeps = true
await exec.exec(['foo'])
- t.match(ARB_REIFY, [{add: ['foo@'], legacyPeerDeps: true}], 'need to install foo@ using legacyPeerDeps opt')
+ t.match(
+ ARB_REIFY,
+ [{ add: ['foo@'], legacyPeerDeps: true }],
+ 'need to install foo@ using legacyPeerDeps opt'
+ )
})
t.test('workspaces', t => {
@@ -1101,18 +1158,20 @@ t.test('workspaces', t => {
t.test('with args, run scripts in the context of a workspace', async t => {
await exec.execWorkspaces(['foo', 'one arg', 'two arg'], ['a', 'b'])
- t.match(RUN_SCRIPTS, [{
- pkg: { scripts: { npx: 'foo' }},
- args: ['one arg', 'two arg'],
- banner: false,
- path: process.cwd(),
- stdioString: true,
- event: 'npx',
- env: {
- PATH: [npm.localBin, ...PATH].join(delimiter),
+ t.match(RUN_SCRIPTS, [
+ {
+ pkg: { scripts: { npx: 'foo' } },
+ args: ['one arg', 'two arg'],
+ banner: false,
+ path: process.cwd(),
+ stdioString: true,
+ event: 'npx',
+ env: {
+ PATH: [npm.localBin, ...PATH].join(delimiter),
+ },
+ stdio: 'inherit',
},
- stdio: 'inherit',
- }])
+ ])
})
t.test('no args, spawn interactive shell', async t => {
@@ -1122,9 +1181,18 @@ t.test('workspaces', t => {
await exec.execWorkspaces([], ['a'])
t.strictSame(LOG_WARN, [])
- t.strictSame(npm._mockOutputs, [
- [`\nEntering npm script environment in workspace a@1.0.0 at location:\n${resolve(npm.localPrefix, 'packages/a')}\nType 'exit' or ^D when finished\n`],
- ], 'printed message about interactive shell')
+ t.strictSame(
+ npm._mockOutputs,
+ [
+ [
+ `\nEntering npm script environment in workspace a@1.0.0 at location:\n${resolve(
+ npm.localPrefix,
+ 'packages/a'
+ )}\nType 'exit' or ^D when finished\n`,
+ ],
+ ],
+ 'printed message about interactive shell'
+ )
npm.color = true
flatOptions.color = true
@@ -1132,9 +1200,20 @@ t.test('workspaces', t => {
await exec.execWorkspaces([], ['a'])
t.strictSame(LOG_WARN, [])
- t.strictSame(npm._mockOutputs, [
- [`\u001b[0m\u001b[0m\n\u001b[0mEntering npm script environment\u001b[0m\u001b[0m in workspace \u001b[32ma@1.0.0\u001b[39m at location:\u001b[0m\n\u001b[0m\u001b[2m${resolve(npm.localPrefix, 'packages/a')}\u001b[22m\u001b[0m\u001b[1m\u001b[22m\n\u001b[1mType 'exit' or ^D when finished\u001b[22m\n\u001b[1m\u001b[22m`],
- ], 'printed message about interactive shell')
+ t.strictSame(
+ npm._mockOutputs,
+ [
+ [
+ /* eslint-disable-next-line max-len */
+ `\u001b[0m\u001b[0m\n\u001b[0mEntering npm script environment\u001b[0m\u001b[0m in workspace \u001b[32ma@1.0.0\u001b[39m at location:\u001b[0m\n\u001b[0m\u001b[2m${resolve(
+ npm.localPrefix,
+ 'packages/a'
+ /* eslint-disable-next-line max-len */
+ )}\u001b[22m\u001b[0m\u001b[1m\u001b[22m\n\u001b[1mType 'exit' or ^D when finished\u001b[22m\n\u001b[1m\u001b[22m`,
+ ],
+ ],
+ 'printed message about interactive shell'
+ )
})
t.end()
diff --git a/deps/npm/test/lib/commands/explore.js b/deps/npm/test/lib/commands/explore.js
index 4ae10afc69..b2e7be2136 100644
--- a/deps/npm/test/lib/commands/explore.js
+++ b/deps/npm/test/lib/commands/explore.js
@@ -11,7 +11,7 @@ const mockRPJ = async path => {
}
}
RPJ_CALLED = path
- return {some: 'package'}
+ return { some: 'package' }
}
let RUN_SCRIPT_ERROR = null
@@ -19,8 +19,9 @@ let RUN_SCRIPT_EXIT_CODE = 0
let RUN_SCRIPT_SIGNAL = null
let RUN_SCRIPT_EXEC = null
const mockRunScript = ({ pkg, banner, path, event, stdio }) => {
- if (event !== '_explore')
+ if (event !== '_explore') {
throw new Error('got wrong event name')
+ }
RUN_SCRIPT_EXEC = pkg.scripts._explore
diff --git a/deps/npm/test/lib/commands/fund.js b/deps/npm/test/lib/commands/fund.js
index 7a86389f08..b82ed93fe5 100644
--- a/deps/npm/test/lib/commands/fund.js
+++ b/deps/npm/test/lib/commands/fund.js
@@ -102,10 +102,7 @@ const nestedMultipleFundingPackages = {
'package.json': JSON.stringify({
name: 'nested-multiple-funding-packages',
version,
- funding: [
- 'https://one.example.com',
- 'https://two.example.com',
- ],
+ funding: ['https://one.example.com', 'https://two.example.com'],
dependencies: {
foo: '*',
},
@@ -129,10 +126,7 @@ const nestedMultipleFundingPackages = {
'package.json': JSON.stringify({
name: 'bar',
version,
- funding: [
- 'http://collective.example.com',
- { url: 'http://sponsors.example.com/you' },
- ],
+ funding: ['http://collective.example.com', { url: 'http://sponsors.example.com/you' }],
}),
},
},
@@ -188,25 +182,28 @@ const config = {
which: null,
}
const openUrl = async (npm, url, msg) => {
- if (url === 'http://npmjs.org')
+ if (url === 'http://npmjs.org') {
throw new Error('ERROR')
+ }
if (config.json) {
printUrl = JSON.stringify({
title: msg,
url: url,
})
- } else
+ } else {
printUrl = `${msg}:\n ${url}`
+ }
}
const Fund = t.mock('../../../lib/commands/fund.js', {
'../../../lib/utils/open-url.js': openUrl,
pacote: {
- manifest: (arg) => arg.name === 'ntl'
- ? Promise.resolve({
- funding: 'http://example.com/pacote',
- })
- : Promise.reject(new Error('ERROR')),
+ manifest: arg =>
+ arg.name === 'ntl'
+ ? Promise.resolve({
+ funding: 'http://example.com/pacote',
+ })
+ : Promise.reject(new Error('ERROR')),
},
})
const npm = mockNpm({
@@ -278,10 +275,7 @@ t.test('fund containing multi-level nested deps with no funding', async t => {
npm.prefix = t.testdir(nestedNoFundingPackages)
await fund.exec([])
- t.matchSnapshot(
- result,
- 'should omit dependencies with no funding declared'
- )
+ t.matchSnapshot(result, 'should omit dependencies with no funding declared')
t.end()
})
@@ -368,11 +362,7 @@ t.test('fund does not support global', async t => {
npm.prefix = t.testdir({})
config.global = true
- await t.rejects(
- fund.exec([]),
- { code: 'EFUNDGLOBAL' },
- 'should throw EFUNDGLOBAL error'
- )
+ await t.rejects(fund.exec([]), { code: 'EFUNDGLOBAL' }, 'should throw EFUNDGLOBAL error')
config.global = false
})
@@ -437,11 +427,7 @@ t.test('fund using symlink ref', async t => {
// using symlinked ref
await fund.exec(['./node_modules/a'])
- t.match(
- printUrl,
- 'http://example.com/a',
- 'should retrieve funding url from symlink'
- )
+ t.match(printUrl, 'http://example.com/a', 'should retrieve funding url from symlink')
printUrl = ''
result = ''
@@ -449,11 +435,7 @@ t.test('fund using symlink ref', async t => {
// using target ref
await fund.exec(['./a'])
- t.match(
- printUrl,
- 'http://example.com/a',
- 'should retrieve funding url from symlink target'
- )
+ t.match(printUrl, 'http://example.com/a', 'should retrieve funding url from symlink target')
})
t.test('fund using data from actual tree', async t => {
@@ -568,7 +550,11 @@ t.test('fund using bad which value', async t => {
await t.rejects(
fund.exec(['bar']),
- { code: 'EFUNDNUMBER', message: '`npm fund [<@scope>/]<pkg> [--which=fundingSourceNumber]` must be given a positive integer' },
+ {
+ code: 'EFUNDNUMBER',
+ /* eslint-disable-next-line max-len */
+ message: '`npm fund [<@scope>/]<pkg> [--which=fundingSourceNumber]` must be given a positive integer',
+ },
'should have bad which option error message'
)
config.which = null
@@ -595,11 +581,7 @@ t.test('fund a package throws on openUrl', async t => {
}),
})
- await t.rejects(
- fund.exec(['.']),
- { message: 'ERROR' },
- 'should throw unknown error'
- )
+ await t.rejects(fund.exec(['.']), { message: 'ERROR' }, 'should throw unknown error')
})
t.test('fund a package with type and multiple sources', async t => {
@@ -714,10 +696,7 @@ t.test('sub dep with fund info and a parent with no funding info', async t => {
'package.json': JSON.stringify({
name: 'c',
version: '1.0.0',
- funding: [
- 'http://example.com/c',
- 'http://example.com/c-other',
- ],
+ funding: ['http://example.com/c', 'http://example.com/c-other'],
}),
},
},
@@ -745,10 +724,7 @@ t.test('workspaces', async t => {
'package.json': JSON.stringify({
name: 'c',
version: '1.0.0',
- funding: [
- 'http://example.com/c',
- 'http://example.com/c-other',
- ],
+ funding: ['http://example.com/c', 'http://example.com/c-other'],
}),
},
d: {
@@ -785,14 +761,12 @@ t.test('workspaces', async t => {
await fund.execWorkspaces([], ['a'])
- t.matchSnapshot(result,
- 'should display only filtered workspace name and its deps')
+ t.matchSnapshot(result, 'should display only filtered workspace name and its deps')
result = ''
await fund.execWorkspaces([], ['./packages/a'])
- t.matchSnapshot(result,
- 'should display only filtered workspace path and its deps')
+ t.matchSnapshot(result, 'should display only filtered workspace path and its deps')
})
})
diff --git a/deps/npm/test/lib/commands/help-search.js b/deps/npm/test/lib/commands/help-search.js
index 406977b622..8d13009a22 100644
--- a/deps/npm/test/lib/commands/help-search.js
+++ b/deps/npm/test/lib/commands/help-search.js
@@ -4,7 +4,7 @@ const { fake: mockNpm } = require('../../fixtures/mock-npm')
const ansicolors = require('ansicolors')
const OUTPUT = []
-const output = (msg) => {
+const output = msg => {
OUTPUT.push(msg)
}
@@ -20,17 +20,22 @@ const npm = mockNpm({
},
usage: 'npm test usage',
exec: async () => {
- if (npmHelpErr)
+ if (npmHelpErr) {
throw npmHelpErr
+ }
},
output,
})
let globRoot = null
const globDir = {
- 'npm-exec.md': 'the exec command\nhelp has multiple lines of exec help\none of them references exec',
+ 'npm-exec.md':
+ 'the exec command\nhelp has multiple lines of exec help\none of them references exec',
+ /* eslint-disable-next-line max-len */
'npm-something.md': 'another\ncommand you run\nthat\nreferences exec\nand has multiple lines\nwith no matches\nthat will be ignored\nand another line\nthat does have exec as well',
+ /* eslint-disable-next-line max-len */
'npm-run-script.md': 'the scripted run-script command runs scripts\nand has lines\nsome of which dont match the string run\nor script\nscript',
+ /* eslint-disable-next-line max-len */
'npm-install.md': 'does a thing in a script\nif a thing does not exist in a thing you run\nto install it and run it maybe in a script',
'npm-help.md': 'will run the `help-search` command if you need to run it to help you search',
'npm-help-search.md': 'is the help search command\nthat you get if you run help-search',
@@ -39,7 +44,10 @@ const globDir = {
'npm-extra-useless.md': 'exec\nexec\nexec',
}
const glob = (p, cb) =>
- cb(null, Object.keys(globDir).map((file) => join(globRoot, file)))
+ cb(
+ null,
+ Object.keys(globDir).map(file => join(globRoot, file))
+ )
const HelpSearch = t.mock('../../../lib/commands/help-search.js', {
glob,
@@ -99,7 +107,11 @@ t.test('npm help-search long output with color', async t => {
await helpSearch.exec(['help-search'])
const highlightedText = ansicolors.bgBlack(ansicolors.red('help-search'))
- t.equal(OUTPUT.some((line) => line.includes(highlightedText)), true, 'returned highlighted search terms')
+ t.equal(
+ OUTPUT.some(line => line.includes(highlightedText)),
+ true,
+ 'returned highlighted search terms'
+ )
})
t.test('npm help-search no args', async t => {
diff --git a/deps/npm/test/lib/commands/help.js b/deps/npm/test/lib/commands/help.js
index 9ea2b9d92a..b76234d996 100644
--- a/deps/npm/test/lib/commands/help.js
+++ b/deps/npm/test/lib/commands/help.js
@@ -12,7 +12,7 @@ const OUTPUT = []
const npm = {
usage: 'test npm usage',
config: {
- get: (key) => npmConfig[key],
+ get: key => npmConfig[key],
set: (key, value) => {
npmConfig[key] = value
},
@@ -21,12 +21,13 @@ const npm = {
},
},
exec: async (cmd, args) => {
- if (cmd === 'help-search')
+ if (cmd === 'help-search') {
helpSearchArgs = args
- else if (cmd === 'help')
+ } else if (cmd === 'help') {
return { usage: 'npm help <term>' }
+ }
},
- deref: (cmd) => {},
+ deref: cmd => {},
output: msg => {
OUTPUT.push(msg)
},
@@ -89,7 +90,11 @@ t.test('npm help completion', async t => {
const threeArgs = await help.completion({ conf: { argv: { remain: ['one', 'two', 'three'] } } })
t.strictSame(threeArgs, [], 'outputs no results when more than 2 args are provided')
globErr = new Error('glob failed')
- t.rejects(help.completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate')
+ t.rejects(
+ help.completion({ conf: { argv: { remain: [] } } }),
+ /glob failed/,
+ 'glob errors propagate'
+ )
})
t.test('npm help multiple args calls search', async t => {
@@ -121,11 +126,7 @@ t.test('npm help glob errors propagate', async t => {
spawnArgs = null
})
- await t.rejects(
- help.exec(['whoami']),
- /glob failed/,
- 'glob error propagates'
- )
+ await t.rejects(help.exec(['whoami']), /glob failed/, 'glob error propagates')
})
t.test('npm help whoami', async t => {
@@ -144,10 +145,7 @@ t.test('npm help whoami', async t => {
t.test('npm help 1 install', async t => {
npmConfig.viewer = 'browser'
- globResult = [
- '/root/man/man5/install.5',
- '/root/man/man1/npm-install.1',
- ]
+ globResult = ['/root/man/man5/install.5', '/root/man/man1/npm-install.1']
t.teardown(() => {
npmConfig.viewer = undefined
@@ -164,9 +162,7 @@ t.test('npm help 1 install', async t => {
t.test('npm help 5 install', async t => {
npmConfig.viewer = 'browser'
- globResult = [
- '/root/man/man5/install.5',
- ]
+ globResult = ['/root/man/man5/install.5']
t.teardown(() => {
npmConfig.viewer = undefined
@@ -184,9 +180,7 @@ t.test('npm help 5 install', async t => {
t.test('npm help 7 config', async t => {
npmConfig.viewer = 'browser'
- globResult = [
- '/root/man/man7/config.7',
- ]
+ globResult = ['/root/man/man7/config.7']
t.teardown(() => {
npmConfig.viewer = undefined
globParam = null
@@ -218,10 +212,7 @@ t.test('npm help package.json redirects to package-json', async t => {
t.test('npm help ?(un)star', async t => {
npmConfig.viewer = 'woman'
- globResult = [
- '/root/man/man1/npm-star.1',
- '/root/man/man1/npm-unstar.1',
- ]
+ globResult = ['/root/man/man1/npm-star.1', '/root/man/man1/npm-unstar.1']
t.teardown(() => {
npmConfig.viewer = undefined
globResult = globDefaults
@@ -232,16 +223,17 @@ t.test('npm help ?(un)star', async t => {
await help.exec(['?(un)star'])
t.equal(spawnBin, 'emacsclient', 'maps woman to emacs correctly')
- t.strictSame(spawnArgs, ['-e', `(woman-find-file '/root/man/man1/npm-star.1')`], 'passes the correct arguments')
+ t.strictSame(
+ spawnArgs,
+ ['-e', `(woman-find-file '/root/man/man1/npm-star.1')`],
+ 'passes the correct arguments'
+ )
})
t.test('npm help - woman viewer propagates errors', async t => {
npmConfig.viewer = 'woman'
spawnCode = 1
- globResult = [
- '/root/man/man1/npm-star.1',
- '/root/man/man1/npm-unstar.1',
- ]
+ globResult = ['/root/man/man1/npm-star.1', '/root/man/man1/npm-unstar.1']
t.teardown(() => {
npmConfig.viewer = undefined
spawnCode = 0
@@ -256,7 +248,11 @@ t.test('npm help - woman viewer propagates errors', async t => {
'received the correct error'
)
t.equal(spawnBin, 'emacsclient', 'maps woman to emacs correctly')
- t.strictSame(spawnArgs, ['-e', `(woman-find-file '/root/man/man1/npm-star.1')`], 'passes the correct arguments')
+ t.strictSame(
+ spawnArgs,
+ ['-e', `(woman-find-file '/root/man/man1/npm-star.1')`],
+ 'passes the correct arguments'
+ )
})
t.test('npm help un*', async t => {
@@ -291,11 +287,7 @@ t.test('npm help - man viewer propagates errors', async t => {
spawnArgs = null
})
- await t.rejects(
- help.exec(['un*']),
- /help process exited with code: 1/,
- 'received correct error'
- )
+ await t.rejects(help.exec(['un*']), /help process exited with code: 1/, 'received correct error')
t.equal(spawnBin, 'man', 'calls man by default')
t.strictSame(spawnArgs, ['/root/man/man1/npm-uninstall.1'], 'passes the correct arguments')
})
diff --git a/deps/npm/test/lib/commands/hook.js b/deps/npm/test/lib/commands/hook.js
index af162e4fce..cd4b387872 100644
--- a/deps/npm/test/lib/commands/hook.js
+++ b/deps/npm/test/lib/commands/hook.js
@@ -9,7 +9,7 @@ const npm = {
loglevel: 'info',
unicode: false,
},
- output: (msg) => {
+ output: msg => {
output.push(msg)
},
}
@@ -28,13 +28,14 @@ const libnpmhook = {
hookArgs = { pkg, uri, secret, opts }
return { id: 1, name: pkg.replace(/^@/, ''), type: pkgTypes[pkg], endpoint: uri }
},
- ls: async (opts) => {
+ ls: async opts => {
hookArgs = opts
let id = 0
- if (hookResponse)
+ if (hookResponse) {
return hookResponse
+ }
- return Object.keys(pkgTypes).map((name) => ({
+ return Object.keys(pkgTypes).map(name => ({
id: ++id,
name: name.replace(/^@/, ''),
type: pkgTypes[name],
@@ -45,7 +46,12 @@ const libnpmhook = {
rm: async (id, opts) => {
hookArgs = { id, opts }
const pkg = Object.keys(pkgTypes)[0]
- return { id: 1, name: pkg.replace(/^@/, ''), type: pkgTypes[pkg], endpoint: 'https://google.com' }
+ return {
+ id: 1,
+ name: pkg.replace(/^@/, ''),
+ type: pkgTypes[pkg],
+ endpoint: 'https://google.com',
+ }
},
update: async (id, uri, secret, opts) => {
hookArgs = { id, uri, secret, opts }
@@ -61,10 +67,7 @@ const Hook = t.mock('../../../lib/commands/hook.js', {
const hook = new Hook(npm)
t.test('npm hook no args', async t => {
- await t.rejects(
- hook.exec([]),
- hook.usage, 'throws usage with no arguments'
- )
+ await t.rejects(hook.exec([]), hook.usage, 'throws usage with no arguments')
})
t.test('npm hook add', async t => {
@@ -75,12 +78,16 @@ t.test('npm hook add', async t => {
await hook.exec(['add', 'semver', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- pkg: 'semver',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'provided the correct arguments to libnpmhook')
+ t.strictSame(
+ hookArgs,
+ {
+ pkg: 'semver',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'provided the correct arguments to libnpmhook'
+ )
t.strictSame(output, ['+ semver -> https://google.com'], 'prints the correct output')
})
@@ -94,12 +101,16 @@ t.test('npm hook add - unicode output', async t => {
await hook.exec(['add', 'semver', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- pkg: 'semver',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'provided the correct arguments to libnpmhook')
+ t.strictSame(
+ hookArgs,
+ {
+ pkg: 'semver',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'provided the correct arguments to libnpmhook'
+ )
t.strictSame(output, ['+ semver ➜ https://google.com'], 'prints the correct output')
})
@@ -113,18 +124,26 @@ t.test('npm hook add - json output', async t => {
await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- pkg: '@npmcli',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'provided the correct arguments to libnpmhook')
- t.strictSame(JSON.parse(output[0]), {
- id: 1,
- name: 'npmcli',
- endpoint: 'https://google.com',
- type: 'scope',
- }, 'prints the correct json output')
+ t.strictSame(
+ hookArgs,
+ {
+ pkg: '@npmcli',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'provided the correct arguments to libnpmhook'
+ )
+ t.strictSame(
+ JSON.parse(output[0]),
+ {
+ id: 1,
+ name: 'npmcli',
+ endpoint: 'https://google.com',
+ type: 'scope',
+ },
+ 'prints the correct json output'
+ )
})
t.test('npm hook add - parseable output', async t => {
@@ -137,18 +156,26 @@ t.test('npm hook add - parseable output', async t => {
await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- pkg: '@npmcli',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'provided the correct arguments to libnpmhook')
- t.strictSame(output[0].split(/\t/), [
- 'id', 'name', 'type', 'endpoint',
- ], 'prints the correct parseable output headers')
- t.strictSame(output[1].split(/\t/), [
- '1', 'npmcli', 'scope', 'https://google.com',
- ], 'prints the correct parseable values')
+ t.strictSame(
+ hookArgs,
+ {
+ pkg: '@npmcli',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'provided the correct arguments to libnpmhook'
+ )
+ t.strictSame(
+ output[0].split(/\t/),
+ ['id', 'name', 'type', 'endpoint'],
+ 'prints the correct parseable output headers'
+ )
+ t.strictSame(
+ output[1].split(/\t/),
+ ['1', 'npmcli', 'scope', 'https://google.com'],
+ 'prints the correct parseable values'
+ )
})
t.test('npm hook add - silent output', async t => {
@@ -161,12 +188,16 @@ t.test('npm hook add - silent output', async t => {
await hook.exec(['add', '@npmcli', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- pkg: '@npmcli',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'provided the correct arguments to libnpmhook')
+ t.strictSame(
+ hookArgs,
+ {
+ pkg: '@npmcli',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'provided the correct arguments to libnpmhook'
+ )
t.strictSame(output, [], 'printed no output')
})
@@ -178,10 +209,14 @@ t.test('npm hook ls', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
t.equal(output[0], 'You have 3 hooks configured.', 'prints the correct header')
const out = require('../../../lib/utils/ansi-trim')(output[1])
t.match(out, /semver.*https:\/\/google.com.*\n.*\n.*never triggered/, 'prints package hook')
@@ -199,20 +234,26 @@ t.test('npm hook ls, no results', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
- t.equal(output[0], 'You don\'t have any hooks configured yet.', 'prints the correct result')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
+ t.equal(output[0], "You don't have any hooks configured yet.", 'prints the correct result')
})
t.test('npm hook ls, single result', async t => {
- hookResponse = [{
- id: 1,
- name: 'semver',
- type: 'package',
- endpoint: 'https://google.com',
- }]
+ hookResponse = [
+ {
+ id: 1,
+ name: 'semver',
+ type: 'package',
+ endpoint: 'https://google.com',
+ },
+ ]
t.teardown(() => {
hookResponse = null
@@ -222,10 +263,14 @@ t.test('npm hook ls, single result', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
t.equal(output[0], 'You have one hook configured.', 'prints the correct header')
const out = require('../../../lib/utils/ansi-trim')(output[1])
t.match(out, /semver.*https:\/\/google.com.*\n.*\n.*never triggered/, 'prints package hook')
@@ -241,27 +286,39 @@ t.test('npm hook ls - json output', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
const out = JSON.parse(output[0])
- t.match(out, [{
- id: 1,
- name: 'semver',
- type: 'package',
- endpoint: 'https://google.com',
- }, {
- id: 2,
- name: 'npmcli',
- type: 'scope',
- endpoint: 'https://google.com',
- }, {
- id: 3,
- name: 'npm',
- type: 'owner',
- endpoint: 'https://google.com',
- }], 'prints the correct output')
+ t.match(
+ out,
+ [
+ {
+ id: 1,
+ name: 'semver',
+ type: 'package',
+ endpoint: 'https://google.com',
+ },
+ {
+ id: 2,
+ name: 'npmcli',
+ type: 'scope',
+ endpoint: 'https://google.com',
+ },
+ {
+ id: 3,
+ name: 'npm',
+ type: 'owner',
+ endpoint: 'https://google.com',
+ },
+ ],
+ 'prints the correct output'
+ )
})
t.test('npm hook ls - parseable output', async t => {
@@ -274,16 +331,24 @@ t.test('npm hook ls - parseable output', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['id', 'name', 'type', 'endpoint', 'last_delivery'],
- ['1', 'semver', 'package', 'https://google.com', ''],
- ['2', 'npmcli', 'scope', 'https://google.com', `${now}`],
- ['3', 'npm', 'owner', 'https://google.com', ''],
- ], 'prints the correct result')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['id', 'name', 'type', 'endpoint', 'last_delivery'],
+ ['1', 'semver', 'package', 'https://google.com', ''],
+ ['2', 'npmcli', 'scope', 'https://google.com', `${now}`],
+ ['3', 'npm', 'owner', 'https://google.com', ''],
+ ],
+ 'prints the correct result'
+ )
})
t.test('npm hook ls - silent output', async t => {
@@ -296,10 +361,14 @@ t.test('npm hook ls - silent output', async t => {
await hook.exec(['ls'])
- t.strictSame(hookArgs, {
- ...npm.flatOptions,
- package: undefined,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ ...npm.flatOptions,
+ package: undefined,
+ },
+ 'received the correct arguments'
+ )
t.strictSame(output, [], 'printed no output')
})
@@ -311,13 +380,15 @@ t.test('npm hook rm', async t => {
await hook.exec(['rm', '1'])
- t.strictSame(hookArgs, {
- id: '1',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output, [
- '- semver X https://google.com',
- ], 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(output, ['- semver X https://google.com'], 'printed the correct output')
})
t.test('npm hook rm - unicode output', async t => {
@@ -330,13 +401,15 @@ t.test('npm hook rm - unicode output', async t => {
await hook.exec(['rm', '1'])
- t.strictSame(hookArgs, {
- id: '1',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output, [
- '- semver ✘ https://google.com',
- ], 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(output, ['- semver ✘ https://google.com'], 'printed the correct output')
})
t.test('npm hook rm - silent output', async t => {
@@ -349,10 +422,14 @@ t.test('npm hook rm - silent output', async t => {
await hook.exec(['rm', '1'])
- t.strictSame(hookArgs, {
- id: '1',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
t.strictSame(output, [], 'printed no output')
})
@@ -366,16 +443,24 @@ t.test('npm hook rm - json output', async t => {
await hook.exec(['rm', '1'])
- t.strictSame(hookArgs, {
- id: '1',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(JSON.parse(output[0]), {
- id: 1,
- name: 'semver',
- type: 'package',
- endpoint: 'https://google.com',
- }, 'printed correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ JSON.parse(output[0]),
+ {
+ id: 1,
+ name: 'semver',
+ type: 'package',
+ endpoint: 'https://google.com',
+ },
+ 'printed correct output'
+ )
})
t.test('npm hook rm - parseable output', async t => {
@@ -388,14 +473,22 @@ t.test('npm hook rm - parseable output', async t => {
await hook.exec(['rm', '1'])
- t.strictSame(hookArgs, {
- id: '1',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['id', 'name', 'type', 'endpoint'],
- ['1', 'semver', 'package', 'https://google.com'],
- ], 'printed correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['id', 'name', 'type', 'endpoint'],
+ ['1', 'semver', 'package', 'https://google.com'],
+ ],
+ 'printed correct output'
+ )
})
t.test('npm hook update', async t => {
@@ -406,15 +499,17 @@ t.test('npm hook update', async t => {
await hook.exec(['update', '1', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- id: '1',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output, [
- '+ semver -> https://google.com',
- ], 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(output, ['+ semver -> https://google.com'], 'printed the correct output')
})
t.test('npm hook update - unicode', async t => {
@@ -427,15 +522,17 @@ t.test('npm hook update - unicode', async t => {
await hook.exec(['update', '1', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- id: '1',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output, [
- '+ semver ➜ https://google.com',
- ], 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(output, ['+ semver ➜ https://google.com'], 'printed the correct output')
})
t.test('npm hook update - json output', async t => {
@@ -448,18 +545,26 @@ t.test('npm hook update - json output', async t => {
await hook.exec(['update', '1', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- id: '1',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(JSON.parse(output[0]), {
- id: '1',
- name: 'semver',
- type: 'package',
- endpoint: 'https://google.com',
- }, 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ JSON.parse(output[0]),
+ {
+ id: '1',
+ name: 'semver',
+ type: 'package',
+ endpoint: 'https://google.com',
+ },
+ 'printed the correct output'
+ )
})
t.test('npm hook update - parseable output', async t => {
@@ -472,16 +577,24 @@ t.test('npm hook update - parseable output', async t => {
await hook.exec(['update', '1', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- id: '1',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['id', 'name', 'type', 'endpoint'],
- ['1', 'semver', 'package', 'https://google.com'],
- ], 'printed the correct output')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['id', 'name', 'type', 'endpoint'],
+ ['1', 'semver', 'package', 'https://google.com'],
+ ],
+ 'printed the correct output'
+ )
})
t.test('npm hook update - silent output', async t => {
@@ -494,11 +607,15 @@ t.test('npm hook update - silent output', async t => {
await hook.exec(['update', '1', 'https://google.com', 'some-secret'])
- t.strictSame(hookArgs, {
- id: '1',
- uri: 'https://google.com',
- secret: 'some-secret',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
+ t.strictSame(
+ hookArgs,
+ {
+ id: '1',
+ uri: 'https://google.com',
+ secret: 'some-secret',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
t.strictSame(output, [], 'printed no output')
})
diff --git a/deps/npm/test/lib/commands/install-ci-test.js b/deps/npm/test/lib/commands/install-ci-test.js
index 2baec1e012..0828d2b24e 100644
--- a/deps/npm/test/lib/commands/install-ci-test.js
+++ b/deps/npm/test/lib/commands/install-ci-test.js
@@ -14,8 +14,9 @@ const installCITest = new InstallCITest({
ciArgs = args
ciCalled = true
}
- if (ciError)
+ if (ciError) {
throw ciError
+ }
if (cmd === 'test') {
testArgs = args
diff --git a/deps/npm/test/lib/commands/install-test.js b/deps/npm/test/lib/commands/install-test.js
index 291755bf82..223bbe106a 100644
--- a/deps/npm/test/lib/commands/install-test.js
+++ b/deps/npm/test/lib/commands/install-test.js
@@ -14,8 +14,9 @@ const installTest = new InstallTest({
installArgs = args
installCalled = true
}
- if (installError)
+ if (installError) {
throw installError
+ }
if (cmd === 'test') {
testArgs = args
diff --git a/deps/npm/test/lib/commands/install.js b/deps/npm/test/lib/commands/install.js
index 3f9c5f264a..994684596a 100644
--- a/deps/npm/test/lib/commands/install.js
+++ b/deps/npm/test/lib/commands/install.js
@@ -1,21 +1,18 @@
const t = require('tap')
+const path = require('path')
-const Install = require('../../../lib/commands/install.js')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
+const { real: mockNpm } = require('../../fixtures/mock-npm')
-t.test('should install using Arborist', (t) => {
+t.test('with args, dev=true', async t => {
const SCRIPTS = []
let ARB_ARGS = null
let REIFY_CALLED = false
let ARB_OBJ = null
- const Install = t.mock('../../../lib/commands/install.js', {
+ const { Npm, filteredLogs } = mockNpm(t, {
'@npmcli/run-script': ({ event }) => {
SCRIPTS.push(event)
},
- npmlog: {
- warn: () => {},
- },
'@npmcli/arborist': function (args) {
ARB_ARGS = args
ARB_OBJ = this
@@ -23,52 +20,86 @@ t.test('should install using Arborist', (t) => {
REIFY_CALLED = true
}
},
- '../../../lib/utils/reify-finish.js': (npm, arb) => {
- if (arb !== ARB_OBJ)
+ '../../lib/utils/reify-finish.js': (npm, arb) => {
+ if (arb !== ARB_OBJ) {
throw new Error('got wrong object passed to reify-finish')
+ }
},
})
- const npm = mockNpm({
- config: { dev: true },
- flatOptions: { global: false, auditLevel: 'low' },
- globalDir: 'path/to/node_modules/',
- prefix: 'foo',
- })
- const install = new Install(npm)
+ const npm = new Npm()
+ await npm.load()
+ // This is here because CI calls tests with `--ignore-scripts`, which config
+ // picks up from argv
+ npm.config.set('ignore-scripts', false)
+ npm.config.set('audit-level', 'low')
+ npm.config.set('dev', true)
+ // tap sets this to
+ // D:\\a\\cli\\cli\\test\\lib\\commands/tap-testdir-install-should-install-globally-using-Arborist
+ // which gets normalized elsewhere so comparative tests fail
+ npm.prefix = path.resolve(t.testdir({}))
- t.test('with args', async t => {
- await install.exec(['fizzbuzz'])
- t.match(ARB_ARGS,
- { global: false, path: 'foo', auditLevel: null },
- 'Arborist gets correct args and ignores auditLevel')
- t.equal(REIFY_CALLED, true, 'called reify')
- t.strictSame(SCRIPTS, [], 'no scripts when adding dep')
- })
+ await npm.exec('install', ['fizzbuzz'])
+ t.match(
+ filteredLogs('warn'),
+ ['Usage of the `--dev` option is deprecated. Use `--include=dev` instead.']
+ )
+ t.match(
+ ARB_ARGS,
+ { global: false, path: npm.prefix, auditLevel: null },
+ 'Arborist gets correct args and ignores auditLevel'
+ )
+ t.equal(REIFY_CALLED, true, 'called reify')
+ t.strictSame(SCRIPTS, [], 'no scripts when adding dep')
+})
+
+t.test('without args', async t => {
+ const SCRIPTS = []
+ let ARB_ARGS = null
+ let REIFY_CALLED = false
+ let ARB_OBJ = null
- t.test('just a local npm install', async t => {
- await install.exec([])
- t.match(ARB_ARGS, { global: false, path: 'foo' })
- t.equal(REIFY_CALLED, true, 'called reify')
- t.strictSame(SCRIPTS, [
- 'preinstall',
- 'install',
- 'postinstall',
- 'prepublish',
- 'preprepare',
- 'prepare',
- 'postprepare',
- ], 'exec scripts when doing local build')
+ const { Npm } = mockNpm(t, {
+ '@npmcli/run-script': ({ event }) => {
+ SCRIPTS.push(event)
+ },
+ '@npmcli/arborist': function (args) {
+ ARB_ARGS = args
+ ARB_OBJ = this
+ this.reify = () => {
+ REIFY_CALLED = true
+ }
+ },
+ '../../lib/utils/reify-finish.js': (npm, arb) => {
+ if (arb !== ARB_OBJ) {
+ throw new Error('got wrong object passed to reify-finish')
+ }
+ },
})
- t.end()
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = path.resolve(t.testdir({}))
+ npm.config.set('ignore-scripts', false)
+ await npm.exec('install', [])
+ t.match(ARB_ARGS, { global: false, path: npm.prefix })
+ t.equal(REIFY_CALLED, true, 'called reify')
+ t.strictSame(SCRIPTS, [
+ 'preinstall',
+ 'install',
+ 'postinstall',
+ 'prepublish',
+ 'preprepare',
+ 'prepare',
+ 'postprepare',
+ ], 'exec scripts when doing local build')
})
t.test('should ignore scripts with --ignore-scripts', async t => {
const SCRIPTS = []
let REIFY_CALLED = false
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
+ const { Npm } = mockNpm(t, {
+ '../../lib/utils/reify-finish.js': async () => {},
'@npmcli/run-script': ({ event }) => {
SCRIPTS.push(event)
},
@@ -78,41 +109,47 @@ t.test('should ignore scripts with --ignore-scripts', async t => {
}
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- prefix: 'foo',
- flatOptions: { global: false },
- config: {
- global: false,
- 'ignore-scripts': true,
- },
- })
- const install = new Install(npm)
- await install.exec([])
+ const npm = new Npm()
+ await npm.load()
+ npm.config.set('ignore-scripts', true)
+ npm.prefix = path.resolve(t.testdir({}))
+ await npm.exec('install', [])
t.equal(REIFY_CALLED, true, 'called reify')
t.strictSame(SCRIPTS, [], 'no scripts when adding dep')
})
t.test('should install globally using Arborist', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
- '@npmcli/arborist': function () {
- this.reify = () => {}
+ const SCRIPTS = []
+ let ARB_ARGS = null
+ let REIFY_CALLED
+ const { Npm } = mockNpm(t, {
+ '@npmcli/run-script': ({ event }) => {
+ SCRIPTS.push(event)
+ },
+ '../../lib/utils/reify-finish.js': async () => {},
+ '@npmcli/arborist': function (args) {
+ ARB_ARGS = args
+ this.reify = () => {
+ REIFY_CALLED = true
+ }
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- prefix: 'foo',
- config: { global: true },
- flatOptions: { global: true },
- })
- const install = new Install(npm)
- await install.exec([])
+ const npm = new Npm()
+ await npm.load()
+ npm.config.set('global', true)
+ npm.globalPrefix = path.resolve(t.testdir({}))
+ await npm.exec('install', [])
+ t.match(
+ ARB_ARGS,
+ { global: true, path: npm.globalPrefix }
+ )
+ t.equal(REIFY_CALLED, true, 'called reify')
+ t.strictSame(SCRIPTS, [], 'no scripts when installing globally')
})
t.test('npm i -g npm engines check success', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
+ const { Npm } = mockNpm(t, {
+ '../../lib/utils/reify-finish.js': async () => {},
'@npmcli/arborist': function () {
this.reify = () => {}
},
@@ -127,18 +164,16 @@ t.test('npm i -g npm engines check success', async t => {
},
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- config: {
- global: true,
- },
- })
- const install = new Install(npm)
- await install.exec(['npm'])
+ const npm = new Npm()
+ await npm.load()
+ npm.globalDir = t.testdir({})
+ npm.config.set('global', true)
+ await npm.exec('install', ['npm'])
+ t.ok('No exceptions happen')
})
t.test('npm i -g npm engines check failure', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
+ const { Npm } = mockNpm(t, {
pacote: {
manifest: () => {
return {
@@ -151,15 +186,12 @@ t.test('npm i -g npm engines check failure', async t => {
},
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- config: {
- global: true,
- },
- })
- const install = new Install(npm)
+ const npm = new Npm()
+ await npm.load()
+ npm.globalDir = t.testdir({})
+ npm.config.set('global', true)
await t.rejects(
- install.exec(['npm']),
+ npm.exec('install', ['npm']),
{
message: 'Unsupported engine',
pkgid: 'npm@1.2.3',
@@ -176,8 +208,8 @@ t.test('npm i -g npm engines check failure', async t => {
})
t.test('npm i -g npm engines check failure forced override', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
+ const { Npm } = mockNpm(t, {
+ '../../lib/utils/reify-finish.js': async () => {},
'@npmcli/arborist': function () {
this.reify = () => {}
},
@@ -193,19 +225,17 @@ t.test('npm i -g npm engines check failure forced override', async t => {
},
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- config: {
- force: true,
- global: true,
- },
- })
- const install = new Install(npm)
- await install.exec(['npm'])
+ const npm = new Npm()
+ await npm.load()
+ npm.globalDir = t.testdir({})
+ npm.config.set('global', true)
+ npm.config.set('force', true)
+ await npm.exec('install', ['npm'])
+ t.ok('Does not throw')
})
t.test('npm i -g npm@version engines check failure', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
+ const { Npm } = mockNpm(t, {
pacote: {
manifest: () => {
return {
@@ -218,15 +248,12 @@ t.test('npm i -g npm@version engines check failure', async t => {
},
},
})
- const npm = mockNpm({
- globalDir: 'path/to/node_modules/',
- config: {
- global: true,
- },
- })
- const install = new Install(npm)
+ const npm = new Npm()
+ await npm.load()
+ npm.globalDir = t.testdir({})
+ npm.config.set('global', true)
await t.rejects(
- install.exec(['npm@100']),
+ npm.exec('install', ['npm@100']),
{
message: 'Unsupported engine',
pkgid: 'npm@1.2.3',
@@ -242,89 +269,78 @@ t.test('npm i -g npm@version engines check failure', async t => {
)
})
-t.test('completion to folder', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
- util: {
- promisify: (fn) => fn,
- },
- fs: {
- readdir: (path) => {
- if (path === '/')
- return ['arborist']
- else
- return ['package.json']
- },
+t.test('completion', async t => {
+ const cwd = process.cwd()
+ const testdir = t.testdir({
+ arborist: {
+ 'package.json': '{}',
},
+ 'arborist.txt': 'just a file',
+ other: {},
+ })
+ t.afterEach(() => {
+ process.chdir(cwd)
})
- const install = new Install({})
- const res = await install.completion({ partialWord: '/ar' })
- const expect = process.platform === 'win32' ? '\\arborist' : '/arborist'
- t.strictSame(res, [expect], 'package dir match')
-})
-t.test('completion to folder - invalid dir', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
- util: {
- promisify: (fn) => fn,
- },
- fs: {
- readdir: () => {
- throw new Error('EONT')
- },
- },
+ t.test('completion to folder - has a match', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: './ar' })
+ t.strictSame(res, ['arborist'], 'package dir match')
})
- const install = new Install({})
- const res = await install.completion({ partialWord: 'path/to/folder' })
- t.strictSame(res, [], 'invalid dir: no matching')
-})
-t.test('completion to folder - no matches', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
- util: {
- promisify: (fn) => fn,
- },
- fs: {
- readdir: (path) => {
- return ['foobar']
- },
- },
+ t.test('completion to folder - invalid dir', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ const res = await install.completion({ partialWord: '/does/not/exist' })
+ t.strictSame(res, [], 'invalid dir: no matching')
})
- const install = new Install({})
- const res = await install.completion({ partialWord: '/pa' })
- t.strictSame(res, [], 'no name match')
-})
-t.test('completion to folder - match is not a package', async t => {
- const Install = t.mock('../../../lib/commands/install.js', {
- '../../../lib/utils/reify-finish.js': async () => {},
- util: {
- promisify: (fn) => fn,
- },
- fs: {
- readdir: (path) => {
- if (path === '/')
- return ['arborist']
- else
- throw new Error('EONT')
- },
- },
+ t.test('completion to folder - no matches', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: './pa' })
+ t.strictSame(res, [], 'no name match')
})
- const install = new Install({})
- const res = await install.completion({ partialWord: '/ar' })
- t.strictSame(res, [], 'no name match')
-})
-t.test('completion to url', async t => {
- const install = new Install({})
- const res = await install.completion({ partialWord: 'http://path/to/url' })
- t.strictSame(res, [])
-})
+ t.test('completion to folder - match is not a package', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: './othe' })
+ t.strictSame(res, [], 'no name match')
+ })
-t.test('completion', async t => {
- const install = new Install({})
- const res = await install.completion({ partialWord: 'toto' })
- t.notOk(res)
+ t.test('completion to url', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: 'http://path/to/url' })
+ t.strictSame(res, [])
+ })
+
+ t.test('no /', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: 'toto' })
+ t.notOk(res)
+ })
+
+ t.test('only /', async t => {
+ const { Npm } = mockNpm(t)
+ const npm = new Npm()
+ const install = await npm.cmd('install')
+ process.chdir(testdir)
+ const res = await install.completion({ partialWord: '/' })
+ t.strictSame(res, [])
+ })
})
diff --git a/deps/npm/test/lib/commands/link.js b/deps/npm/test/lib/commands/link.js
index 60215a0dcc..a01de0b247 100644
--- a/deps/npm/test/lib/commands/link.js
+++ b/deps/npm/test/lib/commands/link.js
@@ -29,8 +29,9 @@ const printLinks = async (opts) => {
const linkedItems = [...tree.inventory.values()]
.sort((a, b) => a.pkgid.localeCompare(b.pkgid, 'en'))
for (const item of linkedItems) {
- if (item.isLink)
+ if (item.isLink) {
res += `${item.path} -> ${item.target.path}\n`
+ }
}
return res
}
diff --git a/deps/npm/test/lib/commands/ll.js b/deps/npm/test/lib/commands/ll.js
index 9846348584..c39d433812 100644
--- a/deps/npm/test/lib/commands/ll.js
+++ b/deps/npm/test/lib/commands/ll.js
@@ -26,7 +26,8 @@ t.test('ll', t => {
})
ll.exec(['pkg'], err => {
- if (err)
+ if (err) {
throw err
+ }
})
})
diff --git a/deps/npm/test/lib/commands/logout.js b/deps/npm/test/lib/commands/logout.js
index 09dc805c99..39ef86c843 100644
--- a/deps/npm/test/lib/commands/logout.js
+++ b/deps/npm/test/lib/commands/logout.js
@@ -26,7 +26,7 @@ const mocks = {
const Logout = t.mock('../../../lib/commands/logout.js', mocks)
const logout = new Logout(npm)
-t.test('token logout', async (t) => {
+t.test('token logout', async t => {
t.teardown(() => {
delete flatOptions.token
result = null
@@ -49,7 +49,7 @@ t.test('token logout', async (t) => {
)
}
- npm.config.clearCredentialsByURI = (registry) => {
+ npm.config.clearCredentialsByURI = registry => {
t.equal(
registry,
'https://registry.npmjs.org/',
@@ -57,7 +57,7 @@ t.test('token logout', async (t) => {
)
}
- npm.config.save = (type) => {
+ npm.config.save = type => {
t.equal(type, 'user', 'should save to user config')
}
@@ -79,7 +79,7 @@ t.test('token logout', async (t) => {
)
})
-t.test('token scoped logout', async (t) => {
+t.test('token scoped logout', async t => {
t.teardown(() => {
config.scope = ''
delete flatOptions['//diff-registry.npmjs.com/:_authToken']
@@ -111,7 +111,7 @@ t.test('token scoped logout', async (t) => {
)
}
- npm.config.clearCredentialsByURI = (registry) => {
+ npm.config.clearCredentialsByURI = registry => {
t.equal(
registry,
'https://diff-registry.npmjs.com/',
@@ -120,15 +120,11 @@ t.test('token scoped logout', async (t) => {
}
npm.config.delete = (ref, type) => {
- t.equal(
- ref,
- '@myscope:registry',
- 'should delete scoped registyr from config'
- )
+ t.equal(ref, '@myscope:registry', 'should delete scoped registyr from config')
t.equal(type, 'user', 'should delete from user config')
}
- npm.config.save = (type) => {
+ npm.config.save = type => {
t.equal(type, 'user', 'should save to user config')
}
@@ -152,7 +148,7 @@ t.test('token scoped logout', async (t) => {
)
})
-t.test('user/pass logout', async (t) => {
+t.test('user/pass logout', async t => {
t.teardown(() => {
delete flatOptions['//registry.npmjs.org/:username']
delete flatOptions['//registry.npmjs.org/:_password']
@@ -183,12 +179,15 @@ t.test('user/pass logout', async (t) => {
t.test('missing credentials', async t => {
await t.rejects(
logout.exec([]),
- { code: 'ENEEDAUTH', message: /not logged in to https:\/\/registry.npmjs.org\/, so can't log out!/ },
+ {
+ code: 'ENEEDAUTH',
+ message: /not logged in to https:\/\/registry.npmjs.org\/, so can't log out!/,
+ },
'should throw with expected error code'
)
})
-t.test('ignore invalid scoped registry config', async (t) => {
+t.test('ignore invalid scoped registry config', async t => {
t.teardown(() => {
delete flatOptions.token
result = null
@@ -213,7 +212,7 @@ t.test('ignore invalid scoped registry config', async (t) => {
)
}
- npm.config.clearCredentialsByURI = (registry) => {
+ npm.config.clearCredentialsByURI = registry => {
t.equal(
registry,
'https://registry.npmjs.org/',
diff --git a/deps/npm/test/lib/commands/ls.js b/deps/npm/test/lib/commands/ls.js
index 97224a74c8..1cbcb593ff 100644
--- a/deps/npm/test/lib/commands/ls.js
+++ b/deps/npm/test/lib/commands/ls.js
@@ -122,29 +122,31 @@ const npm = mockNpm({
const ls = new LS(npm)
const redactCwd = res =>
- res && res.replace(/\\+/g, '/').replace(new RegExp(__dirname.replace(/\\+/g, '/'), 'gi'), '{CWD}')
+ res &&
+ res.replace(/\\+/g, '/').replace(new RegExp(__dirname.replace(/\\+/g, '/'), 'gi'), '{CWD}')
const redactCwdObj = obj => {
- if (Array.isArray(obj))
+ if (Array.isArray(obj)) {
return obj.map(o => redactCwdObj(o))
- else if (typeof obj === 'string')
+ } else if (typeof obj === 'string') {
return redactCwd(obj)
- else if (!obj)
+ } else if (!obj) {
return obj
- else if (typeof obj === 'object') {
+ } else if (typeof obj === 'object') {
return Object.keys(obj).reduce((o, k) => {
o[k] = redactCwdObj(obj[k])
return o
}, {})
- } else
+ } else {
return obj
+ }
}
const jsonParse = res => redactCwdObj(JSON.parse(res))
-const cleanUpResult = () => result = ''
+const cleanUpResult = () => (result = '')
-t.test('ls', (t) => {
+t.test('ls', t => {
t.beforeEach(cleanUpResult)
config.json = false
config.unicode = false
@@ -161,7 +163,10 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output tree representation of dependencies structure')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree representation of dependencies structure'
+ )
})
t.test('missing package.json', async t => {
@@ -169,7 +174,10 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output tree missing name/version of top-level package')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree missing name/version of top-level package'
+ )
})
t.test('extraneous deps', async t => {
@@ -201,7 +209,10 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
await ls.exec(['chai'])
- t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered by package and colored output')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree contaning only occurrences of filtered by package and colored output'
+ )
npm.color = false
})
@@ -220,7 +231,10 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
await ls.exec(['.'])
- t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered by package and colored output')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree contaning only occurrences of filtered by package and colored output'
+ )
config.all = true
config.depth = Infinity
process.exitCode = 0
@@ -239,7 +253,10 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
await ls.exec(['dog'])
- t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered package and its ancestors')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree contaning only occurrences of filtered package and its ancestors'
+ )
})
t.test('with multiple filter args', async t => {
@@ -264,7 +281,11 @@ t.test('ls', (t) => {
},
})
await ls.exec(['dog@*', 'chai@1.0.0'])
- t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of multiple filtered packages and their ancestors')
+ t.matchSnapshot(
+ redactCwd(result),
+ /* eslint-disable-next-line max-len */
+ 'should output tree contaning only occurrences of multiple filtered packages and their ancestors'
+ )
})
t.test('with missing filter arg', async t => {
@@ -281,11 +302,7 @@ t.test('ls', (t) => {
})
await ls.exec(['notadep'])
t.matchSnapshot(redactCwd(result), 'should output tree containing no dependencies info')
- t.equal(
- process.exitCode,
- 1,
- 'should exit with error code 1'
- )
+ t.equal(process.exitCode, 1, 'should exit with error code 1')
process.exitCode = 0
})
@@ -382,7 +399,10 @@ t.test('ls', (t) => {
},
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps and their deps only')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree containing top-level deps and their deps only'
+ )
config.all = true
config.depth = Infinity
})
@@ -404,13 +424,17 @@ t.test('ls', (t) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
t.equal(
redactCwd(err.message).replace(/\r\n/g, '\n'),
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/chai\n' +
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/foo\n' +
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
'should log missing/invalid/extraneous errors'
)
})
- t.matchSnapshot(redactCwd(result), 'should output tree containing missing, invalid, extraneous labels')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree containing missing, invalid, extraneous labels'
+ )
})
t.test('colored output', async t => {
@@ -426,11 +450,7 @@ t.test('ls', (t) => {
}),
...simpleNmFixture,
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should have error code'
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should have error code')
t.matchSnapshot(redactCwd(result), 'should output tree containing color info')
npm.color = false
})
@@ -666,7 +686,10 @@ t.test('ls', (t) => {
...diffDepTypesNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps with descriptions')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree containing top-level deps with descriptions'
+ )
config.all = true
config.depth = Infinity
config.long = false
@@ -676,11 +699,7 @@ t.test('ls', (t) => {
npm.prefix = t.testdir({
'package.json': '{broken json',
})
- await t.rejects(
- ls.exec([]),
- { code: 'EJSONPARSE' },
- 'should throw EJSONPARSE error'
- )
+ await t.rejects(ls.exec([]), { code: 'EJSONPARSE' }, 'should throw EJSONPARSE error')
t.matchSnapshot(redactCwd(result), 'should print empty result')
})
@@ -712,7 +731,10 @@ t.test('ls', (t) => {
...diffDepTypesNmFixture,
})
await t.rejects(ls.exec([]))
- t.matchSnapshot(redactCwd(result), 'should output tree signaling mismatching peer dep in problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree signaling mismatching peer dep in problems'
+ )
})
t.test('invalid deduped dep', async t => {
@@ -745,7 +767,10 @@ t.test('ls', (t) => {
},
})
await t.rejects(ls.exec([]))
- t.matchSnapshot(redactCwd(result), 'should output tree signaling mismatching peer dep in problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree signaling mismatching peer dep in problems'
+ )
npm.color = false
})
@@ -776,7 +801,10 @@ t.test('ls', (t) => {
{ code: 'ELSPROBLEMS', message: /missing: b@\^1.0.0/ },
'should list missing dep problem'
)
- t.matchSnapshot(redactCwd(result), 'should output parseable signaling missing peer dep in problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable signaling missing peer dep in problems'
+ )
})
t.test('unmet peer dep', async t => {
@@ -825,7 +853,10 @@ t.test('ls', (t) => {
{ code: 'ELSPROBLEMS', message: /invalid: optional-dep@1.0.0/ },
'should have invalid dep error msg'
)
- t.matchSnapshot(redactCwd(result), 'should output tree with empty entry for missing optional deps')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree with empty entry for missing optional deps'
+ )
npm.color = false
})
@@ -1138,6 +1169,7 @@ t.test('ls', (t) => {
name: 'abbrev',
version: '1.1.1',
from: 'git+https://github.com/isaacs/abbrev-js.git',
+ /* eslint-disable-next-line max-len */
resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
@@ -1148,6 +1180,7 @@ t.test('ls', (t) => {
version: '1.1.1',
_id: 'abbrev@1.1.1',
_from: 'git+https://github.com/isaacs/abbrev-js.git',
+ /* eslint-disable-next-line max-len */
_resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
_requested: {
type: 'git',
@@ -1191,6 +1224,7 @@ t.test('ls', (t) => {
a: {
version: '1.0.1',
resolved: 'foo@dog://b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
},
},
@@ -1244,10 +1278,7 @@ t.test('ls', (t) => {
saveSpec: null,
fetchSpec: 'latest',
},
- _requiredBy: [
- '#USER',
- '/',
- ],
+ _requiredBy: ['#USER', '/'],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
_spec: 'simple-output',
}),
@@ -1341,20 +1372,18 @@ t.test('ls', (t) => {
})
await ls.exec(['c'])
- t.matchSnapshot(redactCwd(result), 'should print tree and not duplicate child of missing items')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should print tree and not duplicate child of missing items'
+ )
})
- t.test('loading a tree containing workspaces', async (t) => {
+ t.test('loading a tree containing workspaces', async t => {
npm.localPrefix = npm.prefix = t.testdir({
'package.json': JSON.stringify({
name: 'workspaces-tree',
version: '1.0.0',
- workspaces: [
- './a',
- './b',
- './d',
- './group/*',
- ],
+ workspaces: ['./a', './b', './d', './group/*'],
}),
node_modules: {
a: t.fixture('symlink', '../a'),
@@ -1432,16 +1461,14 @@ t.test('ls', (t) => {
config.depth = 0
npm.color = true
await ls.exec([])
- t.matchSnapshot(redactCwd(result),
- 'should list workspaces properly with default configs')
+ t.matchSnapshot(redactCwd(result), 'should list workspaces properly with default configs')
config.all = false
config.depth = 0
npm.color = true
npm.flatOptions.workspacesEnabled = false
await ls.exec([])
- t.matchSnapshot(redactCwd(result),
- 'should not list workspaces with --no-workspaces')
+ t.matchSnapshot(redactCwd(result), 'should not list workspaces with --no-workspaces')
config.all = true
config.depth = Infinity
npm.color = false
@@ -1449,15 +1476,13 @@ t.test('ls', (t) => {
// --all
await ls.exec([])
- t.matchSnapshot(redactCwd(result),
- 'should list --all workspaces properly')
+ t.matchSnapshot(redactCwd(result), 'should list --all workspaces properly')
// --production
config.production = true
await ls.exec([])
- t.matchSnapshot(redactCwd(result),
- 'should list only prod deps of workspaces')
+ t.matchSnapshot(redactCwd(result), 'should list only prod deps of workspaces')
config.production = false
@@ -1468,20 +1493,20 @@ t.test('ls', (t) => {
// filter out a single workspace and its deps using workspaces filters
await ls.execWorkspaces([], ['a'])
- t.matchSnapshot(redactCwd(result),
- 'should filter using workspace config')
+ t.matchSnapshot(redactCwd(result), 'should filter using workspace config')
// filter out a workspace by parent path
await ls.execWorkspaces([], ['./group'])
- t.matchSnapshot(redactCwd(result),
- 'should filter by parent folder workspace config')
+ t.matchSnapshot(redactCwd(result), 'should filter by parent folder workspace config')
// filter by a dep within a workspaces sub tree
await ls.execWorkspaces(['bar'], ['d'])
- t.matchSnapshot(redactCwd(result),
- 'should print all tree and filter by dep within only the ws subtree')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should print all tree and filter by dep within only the ws subtree'
+ )
})
t.test('filter pkg arg using depth option', async t => {
@@ -1553,7 +1578,7 @@ t.test('ls', (t) => {
t.end()
})
-t.test('ls --parseable', (t) => {
+t.test('ls --parseable', t => {
t.beforeEach(cleanUpResult)
config.json = false
config.unicode = false
@@ -1571,7 +1596,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output parseable representation of dependencies structure')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable representation of dependencies structure'
+ )
})
t.test('missing package.json', async t => {
@@ -1579,7 +1607,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output parseable missing name/version of top-level package')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable missing name/version of top-level package'
+ )
})
t.test('extraneous deps', async t => {
@@ -1610,7 +1641,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec(['chai'])
- t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered by package')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable contaning only occurrences of filtered by package'
+ )
})
t.test('with filter arg nested dep', async t => {
@@ -1626,7 +1660,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec(['dog'])
- t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered package')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable contaning only occurrences of filtered package'
+ )
})
t.test('with multiple filter args', async t => {
@@ -1651,7 +1688,11 @@ t.test('ls --parseable', (t) => {
},
})
await ls.exec(['dog@*', 'chai@1.0.0'])
- t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of multiple filtered packages and their ancestors')
+ t.matchSnapshot(
+ redactCwd(result),
+ /* eslint-disable-next-line max-len */
+ 'should output parseable contaning only occurrences of multiple filtered packages and their ancestors'
+ )
})
t.test('with missing filter arg', async t => {
@@ -1667,7 +1708,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec(['notadep'])
- t.matchSnapshot(redactCwd(result), 'should output parseable output containing no dependencies info')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable output containing no dependencies info'
+ )
})
t.test('default --depth value should be 0', async t => {
@@ -1685,7 +1729,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output parseable output containing only top-level dependencies')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable output containing only top-level dependencies'
+ )
config.all = true
config.depth = Infinity
})
@@ -1725,7 +1772,10 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output parseable containing top-level deps and their deps only')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable containing top-level deps and their deps only'
+ )
config.all = true
config.depth = Infinity
})
@@ -1742,12 +1792,11 @@ t.test('ls --parseable', (t) => {
}),
...simpleNmFixture,
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should list dep problems'
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should list dep problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable containing top-level deps and their deps only'
)
- t.matchSnapshot(redactCwd(result), 'should output parseable containing top-level deps and their deps only')
})
t.test('--dev', async t => {
@@ -1950,12 +1999,11 @@ t.test('ls --parseable', (t) => {
}),
...simpleNmFixture,
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should list dep problems'
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should list dep problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable result containing EXTRANEOUS/INVALID labels'
)
- t.matchSnapshot(redactCwd(result), 'should output parseable result containing EXTRANEOUS/INVALID labels')
config.long = false
})
@@ -2021,7 +2069,10 @@ t.test('ls --parseable', (t) => {
...diffDepTypesNmFixture,
})
await ls.exec([])
- t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps with descriptions')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output tree containing top-level deps with descriptions'
+ )
config.all = true
config.depth = Infinity
config.long = false
@@ -2031,10 +2082,7 @@ t.test('ls --parseable', (t) => {
npm.prefix = t.testdir({
'package.json': '{broken json',
})
- await t.rejects(
- ls.exec([]),
- { code: 'EJSONPARSE' },
- 'should throw EJSONPARSE error')
+ await t.rejects(ls.exec([]), { code: 'EJSONPARSE' }, 'should throw EJSONPARSE error')
t.matchSnapshot(redactCwd(result), 'should print empty result')
})
@@ -2066,7 +2114,10 @@ t.test('ls --parseable', (t) => {
...diffDepTypesNmFixture,
})
await t.rejects(ls.exec([]))
- t.matchSnapshot(redactCwd(result), 'should output parseable signaling missing peer dep in problems')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable signaling missing peer dep in problems'
+ )
})
t.test('unmet optional dep', async t => {
@@ -2096,7 +2147,10 @@ t.test('ls --parseable', (t) => {
{ code: 'ELSPROBLEMS', message: /invalid: optional-dep@1.0.0/ },
'should have invalid dep error msg'
)
- t.matchSnapshot(redactCwd(result), 'should output parseable with empty entry for missing optional deps')
+ t.matchSnapshot(
+ redactCwd(result),
+ 'should output parseable with empty entry for missing optional deps'
+ )
})
t.test('cycle deps', async t => {
@@ -2185,6 +2239,7 @@ t.test('ls --parseable', (t) => {
'node_modules/abbrev': {
name: 'abbrev',
version: '1.1.1',
+ /* eslint-disable-next-line max-len */
resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
@@ -2195,6 +2250,7 @@ t.test('ls --parseable', (t) => {
version: '1.1.1',
_id: 'abbrev@1.1.1',
_from: 'git+https://github.com/isaacs/abbrev-js.git',
+ /* eslint-disable-next-line max-len */
_resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
_requested: {
type: 'git',
@@ -2250,10 +2306,7 @@ t.test('ls --parseable', (t) => {
saveSpec: null,
fetchSpec: 'latest',
},
- _requiredBy: [
- '#USER',
- '/',
- ],
+ _requiredBy: ['#USER', '/'],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
_spec: 'simple-output',
}),
@@ -2342,44 +2395,40 @@ t.test('ignore missing optional deps', async t => {
}),
node_modules: {
'prod-ok': {
- 'package.json': JSON.stringify({name: 'prod-ok', version: '1.2.3' }),
+ 'package.json': JSON.stringify({ name: 'prod-ok', version: '1.2.3' }),
},
'prod-wrong': {
- 'package.json': JSON.stringify({name: 'prod-wrong', version: '3.2.1' }),
+ 'package.json': JSON.stringify({ name: 'prod-wrong', version: '3.2.1' }),
},
'optional-ok': {
- 'package.json': JSON.stringify({name: 'optional-ok', version: '1.2.3' }),
+ 'package.json': JSON.stringify({ name: 'optional-ok', version: '1.2.3' }),
},
'optional-wrong': {
- 'package.json': JSON.stringify({name: 'optional-wrong', version: '3.2.1' }),
+ 'package.json': JSON.stringify({ name: 'optional-wrong', version: '3.2.1' }),
},
'peer-optional-ok': {
- 'package.json': JSON.stringify({name: 'peer-optional-ok', version: '1.2.3' }),
+ 'package.json': JSON.stringify({ name: 'peer-optional-ok', version: '1.2.3' }),
},
'peer-optional-wrong': {
- 'package.json': JSON.stringify({name: 'peer-optional-wrong', version: '3.2.1' }),
+ 'package.json': JSON.stringify({ name: 'peer-optional-wrong', version: '3.2.1' }),
},
'peer-ok': {
- 'package.json': JSON.stringify({name: 'peer-ok', version: '1.2.3' }),
+ 'package.json': JSON.stringify({ name: 'peer-ok', version: '1.2.3' }),
},
'peer-wrong': {
- 'package.json': JSON.stringify({name: 'peer-wrong', version: '3.2.1' }),
+ 'package.json': JSON.stringify({ name: 'peer-wrong', version: '3.2.1' }),
},
},
})
config.all = true
const prefix = npm.prefix.toLowerCase().replace(/\\/g, '/')
- const cleanupPaths = str =>
- str.toLowerCase().replace(/\\/g, '/').split(prefix).join('{project}')
+ const cleanupPaths = str => str.toLowerCase().replace(/\\/g, '/').split(prefix).join('{project}')
t.test('--json', async t => {
config.json = true
config.parseable = false
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' }
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' })
result = JSON.parse(result)
const problems = result.problems.map(cleanupPaths)
t.matchSnapshot(problems, 'ls --json problems')
@@ -2388,25 +2437,19 @@ t.test('ignore missing optional deps', async t => {
t.test('--parseable', async t => {
config.json = false
config.parseable = true
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' }
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' })
t.matchSnapshot(cleanupPaths(result), 'ls --parseable result')
})
t.test('human output', async t => {
config.json = false
config.parseable = false
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' }
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' })
t.matchSnapshot(cleanupPaths(result), 'ls result')
})
})
-t.test('ls --json', (t) => {
+t.test('ls --json', t => {
t.beforeEach(cleanUpResult)
config.json = true
config.parseable = false
@@ -2455,8 +2498,11 @@ t.test('ls --json', (t) => {
jsonParse(result),
{
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/chai',
+ /* eslint-disable-next-line max-len */
'extraneous: dog@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/dog',
+ /* eslint-disable-next-line max-len */
'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo',
],
dependencies: {
@@ -2464,6 +2510,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: dog@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/dog',
],
},
@@ -2471,6 +2518,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo',
],
dependencies: {
@@ -2483,6 +2531,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/chai',
],
},
@@ -2525,6 +2574,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/chai',
],
},
@@ -2557,20 +2607,14 @@ t.test('ls --json', (t) => {
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
'should log missing dep as error'
)
- t.equal(
- err.code,
- 'ELSPROBLEMS',
- 'should have ELSPROBLEMS error code'
- )
+ t.equal(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
})
t.match(
jsonParse(result),
{
name: 'test-npm-ls',
version: '1.0.0',
- problems: [
- 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
- ],
+ problems: ['missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0'],
},
'should output json containing problems info'
)
@@ -2603,11 +2647,7 @@ t.test('ls --json', (t) => {
},
'should output json contaning only occurrences of filtered by package'
)
- t.not(
- process.exitCode,
- 1,
- 'should not exit with error code 1'
- )
+ t.not(process.exitCode, 1, 'should not exit with error code 1')
})
t.test('with filter arg nested dep', async t => {
@@ -2685,6 +2725,7 @@ t.test('ls --json', (t) => {
},
},
},
+ /* eslint-disable-next-line max-len */
'should output json contaning only occurrences of multiple filtered packages and their ancestors'
)
})
@@ -2710,11 +2751,7 @@ t.test('ls --json', (t) => {
},
'should output json containing no dependencies info'
)
- t.equal(
- process.exitCode,
- 1,
- 'should exit with error code 1'
- )
+ t.equal(process.exitCode, 1, 'should exit with error code 1')
process.exitCode = 0
})
@@ -2840,18 +2877,16 @@ t.test('ls --json', (t) => {
}),
...simpleNmFixture,
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should list dep problems'
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should list dep problems')
t.same(
jsonParse(result),
{
name: 'test-npm-ls',
version: '1.0.0',
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/chai',
+ /* eslint-disable-next-line max-len */
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo',
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
],
@@ -2860,6 +2895,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
invalid: '"^2.0.0" from the root project',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo',
],
dependencies: {
@@ -2872,15 +2908,14 @@ t.test('ls --json', (t) => {
version: '1.0.0',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/chai',
],
},
ipsum: {
required: '^1.0.0',
missing: true,
- problems: [
- 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
- ],
+ problems: ['missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0'],
},
},
},
@@ -3149,7 +3184,9 @@ t.test('ls --json', (t) => {
'node_modules/@isaacs/dedupe-tests-a': {
name: '@isaacs/dedupe-tests-a',
version: '1.0.1',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
dependencies: {
'@isaacs/dedupe-tests-b': '1',
@@ -3158,20 +3195,26 @@ t.test('ls --json', (t) => {
'node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b': {
name: '@isaacs/dedupe-tests-b',
version: '1.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
},
'node_modules/@isaacs/dedupe-tests-b': {
name: '@isaacs/dedupe-tests-b',
version: '2.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
},
},
dependencies: {
'@isaacs/dedupe-tests-a': {
version: '1.0.1',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
requires: {
'@isaacs/dedupe-tests-b': '1',
@@ -3179,14 +3222,18 @@ t.test('ls --json', (t) => {
dependencies: {
'@isaacs/dedupe-tests-b': {
version: '1.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
},
},
},
'@isaacs/dedupe-tests-b': {
version: '2.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
},
},
@@ -3209,12 +3256,15 @@ t.test('ls --json', (t) => {
dependencies: {
'@isaacs/dedupe-tests-a': {
version: '1.0.1',
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
dependencies: {
'@isaacs/dedupe-tests-b': {
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
extraneous: true,
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: @isaacs/dedupe-tests-b@ {CWD}/tap-testdir-ls-ls---json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b',
],
},
@@ -3222,10 +3272,12 @@ t.test('ls --json', (t) => {
},
'@isaacs/dedupe-tests-b': {
version: '2.0.0',
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
},
},
problems: [
+ /* eslint-disable-next-line max-len */
'extraneous: @isaacs/dedupe-tests-b@ {CWD}/tap-testdir-ls-ls---json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b',
],
},
@@ -3342,6 +3394,7 @@ t.test('ls --json', (t) => {
devDependencies: {},
peerDependencies: {},
_dependencies: {},
+ /* eslint-disable-next-line max-len */
path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep/node_modules/dog',
extraneous: false,
},
@@ -3482,6 +3535,7 @@ t.test('ls --json', (t) => {
{
invalid: true,
problems: [
+ /* eslint-disable-next-line max-len */
'error in {CWD}/tap-testdir-ls-ls---json-json-read-problems: Failed to parse root package.json',
],
},
@@ -3489,14 +3543,10 @@ t.test('ls --json', (t) => {
)
})
- t.test('empty location', async (t) => {
+ t.test('empty location', async t => {
npm.prefix = t.testdir({})
await ls.exec([])
- t.same(
- jsonParse(result),
- {},
- 'should print empty json result'
- )
+ t.same(jsonParse(result), {}, 'should print empty json result')
})
t.test('unmet peer dep', async t => {
@@ -3520,17 +3570,14 @@ t.test('ls --json', (t) => {
}),
...diffDepTypesNmFixture,
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'Should have ELSPROBLEMS error code'
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'Should have ELSPROBLEMS error code')
t.same(
jsonParse(result),
{
name: 'test-npm-ls',
version: '1.0.0',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: peer-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-peer-dep/node_modules/peer-dep',
],
dependencies: {
@@ -3538,6 +3585,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
invalid: '"^2.0.0" from the root project',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: peer-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-peer-dep/node_modules/peer-dep',
],
},
@@ -3592,6 +3640,7 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: optional-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-optional-dep/node_modules/optional-dep', // mismatching optional deps get flagged in problems
],
dependencies: {
@@ -3599,6 +3648,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
invalid: '"^2.0.0" from the root project',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: optional-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-optional-dep/node_modules/optional-dep',
],
},
@@ -3743,6 +3793,7 @@ t.test('ls --json', (t) => {
version: '1.1.1',
id: 'abbrev@1.1.1',
from: 'git+https://github.com/isaacs/abbrev-js.git',
+ /* eslint-disable-next-line max-len */
resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
@@ -3753,6 +3804,7 @@ t.test('ls --json', (t) => {
version: '1.1.1',
_id: 'abbrev@1.1.1',
_from: 'git+https://github.com/isaacs/abbrev-js.git',
+ /* eslint-disable-next-line max-len */
_resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
_requested: {
type: 'git',
@@ -3776,6 +3828,7 @@ t.test('ls --json', (t) => {
dependencies: {
abbrev: {
version: '1.1.1',
+ /* eslint-disable-next-line max-len */
resolved: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
@@ -3812,10 +3865,7 @@ t.test('ls --json', (t) => {
saveSpec: null,
fetchSpec: 'latest',
},
- _requiredBy: [
- '#USER',
- '/',
- ],
+ _requiredBy: ['#USER', '/'],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
_spec: 'simple-output',
},
@@ -3838,10 +3888,7 @@ t.test('ls --json', (t) => {
saveSpec: null,
fetchSpec: 'latest',
},
- _requiredBy: [
- '#USER',
- '/',
- ],
+ _requiredBy: ['#USER', '/'],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
_spec: 'simple-output',
}),
@@ -3985,19 +4032,14 @@ t.test('show multiple invalid reasons', async t => {
},
})
- const cleanupPaths = str =>
- redactCwd(str).toLowerCase().replace(/\\/g, '/')
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should list dep problems'
- )
+ const cleanupPaths = str => redactCwd(str).toLowerCase().replace(/\\/g, '/')
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should list dep problems')
t.matchSnapshot(cleanupPaths(result), 'ls result')
})
-t.test('ls --package-lock-only', (t) => {
+t.test('ls --package-lock-only', t => {
config['package-lock-only'] = true
- t.test('ls --package-lock-only --json', (t) => {
+ t.test('ls --package-lock-only --json', t => {
t.beforeEach(cleanUpResult)
config.json = true
config.parseable = false
@@ -4188,11 +4230,7 @@ t.test('ls --package-lock-only', (t) => {
},
'should output json contaning only occurrences of filtered by package'
)
- t.equal(
- process.exitCode,
- 0,
- 'should exit with error code 0'
- )
+ t.equal(process.exitCode, 0, 'should exit with error code 0')
})
t.test('with filter arg nested dep', async t => {
@@ -4297,6 +4335,7 @@ t.test('ls --package-lock-only', (t) => {
},
},
},
+ /* eslint-disable-next-line max-len */
'should output json contaning only occurrences of multiple filtered packages and their ancestors'
)
})
@@ -4337,11 +4376,7 @@ t.test('ls --package-lock-only', (t) => {
},
'should output json containing no dependencies info'
)
- t.equal(
- process.exitCode,
- 1,
- 'should exit with error code 1'
- )
+ t.equal(process.exitCode, 1, 'should exit with error code 1')
process.exitCode = 0
})
@@ -4527,17 +4562,14 @@ t.test('ls --package-lock-only', (t) => {
},
}),
})
- await t.rejects(
- ls.exec([]),
- { code: 'ELSPROBLEMS' },
- 'should list dep problems'
- )
+ await t.rejects(ls.exec([]), { code: 'ELSPROBLEMS' }, 'should list dep problems')
t.same(
jsonParse(result),
{
name: 'test-npm-ls',
version: '1.0.0',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---package-lock-only-ls---package-lock-only---json-missing-invalid-extraneous/node_modules/foo',
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
],
@@ -4546,6 +4578,7 @@ t.test('ls --package-lock-only', (t) => {
version: '1.0.0',
invalid: '"^2.0.0" from the root project',
problems: [
+ /* eslint-disable-next-line max-len */
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---package-lock-only-ls---package-lock-only---json-missing-invalid-extraneous/node_modules/foo',
],
dependencies: {
@@ -4557,9 +4590,7 @@ t.test('ls --package-lock-only', (t) => {
ipsum: {
required: '^1.0.0',
missing: true,
- problems: [
- 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
- ],
+ problems: ['missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0'],
},
},
},
@@ -4586,7 +4617,9 @@ t.test('ls --package-lock-only', (t) => {
'node_modules/@isaacs/dedupe-tests-a': {
name: '@isaacs/dedupe-tests-a',
version: '1.0.1',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
dependencies: {
'@isaacs/dedupe-tests-b': '1',
@@ -4595,20 +4628,26 @@ t.test('ls --package-lock-only', (t) => {
'node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b': {
name: '@isaacs/dedupe-tests-b',
version: '1.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
},
'node_modules/@isaacs/dedupe-tests-b': {
name: '@isaacs/dedupe-tests-b',
version: '2.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
},
},
dependencies: {
'@isaacs/dedupe-tests-a': {
version: '1.0.1',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
requires: {
'@isaacs/dedupe-tests-b': '1',
@@ -4616,14 +4655,18 @@ t.test('ls --package-lock-only', (t) => {
dependencies: {
'@isaacs/dedupe-tests-b': {
version: '1.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
},
},
},
'@isaacs/dedupe-tests-b': {
version: '2.0.0',
+ /* eslint-disable-next-line max-len */
resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ /* eslint-disable-next-line max-len */
integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
},
},
@@ -4646,17 +4689,20 @@ t.test('ls --package-lock-only', (t) => {
dependencies: {
'@isaacs/dedupe-tests-a': {
version: '1.0.1',
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
dependencies: {
'@isaacs/dedupe-tests-b': {
version: '1.0.0',
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
},
},
},
'@isaacs/dedupe-tests-b': {
version: '2.0.0',
- resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ resolved:
+ 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
},
},
},
@@ -4716,12 +4762,12 @@ t.test('ls --package-lock-only', (t) => {
requires: true,
dependencies: {
abbrev: {
+ /* eslint-disable-next-line max-len */
version: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
from: 'abbrev@git+https://github.com/isaacs/abbrev-js.git',
},
},
- }
- ),
+ }),
})
await ls.exec([])
t.same(
@@ -4731,6 +4777,7 @@ t.test('ls --package-lock-only', (t) => {
version: '1.0.0',
dependencies: {
abbrev: {
+ /* eslint-disable-next-line max-len */
resolved: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
diff --git a/deps/npm/test/lib/commands/org.js b/deps/npm/test/lib/commands/org.js
index 16a432c27b..903b9de4f6 100644
--- a/deps/npm/test/lib/commands/org.js
+++ b/deps/npm/test/lib/commands/org.js
@@ -9,7 +9,7 @@ const npm = {
silent: false,
loglevel: 'info',
},
- output: (msg) => {
+ output: msg => {
output.push(msg)
},
}
@@ -47,28 +47,32 @@ const Org = t.mock('../../../lib/commands/org.js', {
const org = new Org(npm)
t.test('completion', async t => {
- const completion = (argv) =>
- org.completion({ conf: { argv: { remain: argv } } })
+ const completion = argv => org.completion({ conf: { argv: { remain: argv } } })
const assertions = [
- [['npm', 'org'], ['set', 'rm', 'ls']],
+ [
+ ['npm', 'org'],
+ ['set', 'rm', 'ls'],
+ ],
[['npm', 'org', 'ls'], []],
[['npm', 'org', 'add'], []],
[['npm', 'org', 'rm'], []],
[['npm', 'org', 'set'], []],
]
- for (const [argv, expected] of assertions)
+ for (const [argv, expected] of assertions) {
t.resolveMatch(completion(argv), expected, `completion for: ${argv.join(', ')}`)
+ }
- t.rejects(completion(['npm', 'org', 'flurb']), /flurb not recognized/, 'errors for unknown subcommand')
+ t.rejects(
+ completion(['npm', 'org', 'flurb']),
+ /flurb not recognized/,
+ 'errors for unknown subcommand'
+ )
})
t.test('npm org - invalid subcommand', async t => {
- await t.rejects(
- org.exec(['foo']),
- org.usage
- )
+ await t.rejects(org.exec(['foo']), org.usage)
})
t.test('npm org add', async t => {
@@ -79,13 +83,21 @@ t.test('npm org add', async t => {
await org.exec(['add', 'orgname', 'username'])
- t.strictSame(orgSetArgs, {
- org: 'orgname',
- user: 'username',
- role: 'developer',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.equal(output[0], 'Added username as developer to orgname. You now have 1 member in this org.', 'printed the correct output')
+ t.strictSame(
+ orgSetArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ role: 'developer',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.equal(
+ output[0],
+ 'Added username as developer to orgname. You now have 1 member in this org.',
+ 'printed the correct output'
+ )
})
t.test('npm org add - no org', async t => {
@@ -136,13 +148,21 @@ t.test('npm org add - more users', async t => {
})
await org.exec(['add', 'orgname', 'username'])
- t.strictSame(orgSetArgs, {
- org: 'orgname',
- user: 'username',
- role: 'developer',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.equal(output[0], 'Added username as developer to orgname. You now have 5 members in this org.', 'printed the correct output')
+ t.strictSame(
+ orgSetArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ role: 'developer',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.equal(
+ output[0],
+ 'Added username as developer to orgname. You now have 5 members in this org.',
+ 'printed the correct output'
+ )
})
t.test('npm org add - json output', async t => {
@@ -155,20 +175,28 @@ t.test('npm org add - json output', async t => {
await org.exec(['add', 'orgname', 'username'])
- t.strictSame(orgSetArgs, {
- org: 'orgname',
- user: 'username',
- role: 'developer',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(JSON.parse(output[0]), {
- org: {
- name: 'orgname',
- size: 1,
+ t.strictSame(
+ orgSetArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ role: 'developer',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ JSON.parse(output[0]),
+ {
+ org: {
+ name: 'orgname',
+ size: 1,
+ },
+ user: 'username',
+ role: 'developer',
},
- user: 'username',
- role: 'developer',
- }, 'printed the correct output')
+ 'printed the correct output'
+ )
})
t.test('npm org add - parseable output', async t => {
@@ -181,16 +209,24 @@ t.test('npm org add - parseable output', async t => {
await org.exec(['add', 'orgname', 'username'])
- t.strictSame(orgSetArgs, {
- org: 'orgname',
- user: 'username',
- role: 'developer',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['org', 'orgsize', 'user', 'role'],
- ['orgname', '1', 'username', 'developer'],
- ], 'printed the correct output')
+ t.strictSame(
+ orgSetArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ role: 'developer',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['org', 'orgsize', 'user', 'role'],
+ ['orgname', '1', 'username', 'developer'],
+ ],
+ 'printed the correct output'
+ )
})
t.test('npm org add - silent output', async t => {
@@ -203,12 +239,16 @@ t.test('npm org add - silent output', async t => {
await org.exec(['add', 'orgname', 'username'])
- t.strictSame(orgSetArgs, {
- org: 'orgname',
- user: 'username',
- role: 'developer',
- opts: npm.flatOptions,
- }, 'received the correct arguments')
+ t.strictSame(
+ orgSetArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ role: 'developer',
+ opts: npm.flatOptions,
+ },
+ 'received the correct arguments'
+ )
t.strictSame(output, [], 'prints no output')
})
@@ -221,16 +261,28 @@ t.test('npm org rm', async t => {
await org.exec(['rm', 'orgname', 'username'])
- t.strictSame(orgRmArgs, {
- org: 'orgname',
- user: 'username',
- opts: npm.flatOptions,
- }, 'libnpmorg.rm received the correct args')
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'libnpmorg.ls received the correct args')
- t.equal(output[0], 'Successfully removed username from orgname. You now have 0 members in this org.', 'printed the correct output')
+ t.strictSame(
+ orgRmArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.rm received the correct args'
+ )
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.ls received the correct args'
+ )
+ t.equal(
+ output[0],
+ 'Successfully removed username from orgname. You now have 0 members in this org.',
+ 'printed the correct output'
+ )
})
t.test('npm org rm - no org', async t => {
@@ -254,11 +306,7 @@ t.test('npm org rm - no user', async t => {
output.length = 0
})
- await t.rejects(
- org.exec(['rm', 'orgname']),
- /`username` is required/,
- 'threw the correct error'
- )
+ await t.rejects(org.exec(['rm', 'orgname']), /`username` is required/, 'threw the correct error')
})
t.test('npm org rm - one user left', async t => {
@@ -275,16 +323,28 @@ t.test('npm org rm - one user left', async t => {
await org.exec(['rm', 'orgname', 'username'])
- t.strictSame(orgRmArgs, {
- org: 'orgname',
- user: 'username',
- opts: npm.flatOptions,
- }, 'libnpmorg.rm received the correct args')
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'libnpmorg.ls received the correct args')
- t.equal(output[0], 'Successfully removed username from orgname. You now have 1 member in this org.', 'printed the correct output')
+ t.strictSame(
+ orgRmArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.rm received the correct args'
+ )
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.ls received the correct args'
+ )
+ t.equal(
+ output[0],
+ 'Successfully removed username from orgname. You now have 1 member in this org.',
+ 'printed the correct output'
+ )
})
t.test('npm org rm - json output', async t => {
@@ -298,21 +358,33 @@ t.test('npm org rm - json output', async t => {
await org.exec(['rm', 'orgname', 'username'])
- t.strictSame(orgRmArgs, {
- org: 'orgname',
- user: 'username',
- opts: npm.flatOptions,
- }, 'libnpmorg.rm received the correct args')
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'libnpmorg.ls received the correct args')
- t.strictSame(JSON.parse(output[0]), {
- user: 'username',
- org: 'orgname',
- userCount: 0,
- deleted: true,
- }, 'printed the correct output')
+ t.strictSame(
+ orgRmArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.rm received the correct args'
+ )
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.ls received the correct args'
+ )
+ t.strictSame(
+ JSON.parse(output[0]),
+ {
+ user: 'username',
+ org: 'orgname',
+ userCount: 0,
+ deleted: true,
+ },
+ 'printed the correct output'
+ )
})
t.test('npm org rm - parseable output', async t => {
@@ -326,19 +398,31 @@ t.test('npm org rm - parseable output', async t => {
await org.exec(['rm', 'orgname', 'username'])
- t.strictSame(orgRmArgs, {
- org: 'orgname',
- user: 'username',
- opts: npm.flatOptions,
- }, 'libnpmorg.rm received the correct args')
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'libnpmorg.ls received the correct args')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['user', 'org', 'userCount', 'deleted'],
- ['username', 'orgname', '0', 'true'],
- ], 'printed the correct output')
+ t.strictSame(
+ orgRmArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.rm received the correct args'
+ )
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.ls received the correct args'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['user', 'org', 'userCount', 'deleted'],
+ ['username', 'orgname', '0', 'true'],
+ ],
+ 'printed the correct output'
+ )
})
t.test('npm org rm - silent output', async t => {
@@ -352,15 +436,23 @@ t.test('npm org rm - silent output', async t => {
await org.exec(['rm', 'orgname', 'username'])
- t.strictSame(orgRmArgs, {
- org: 'orgname',
- user: 'username',
- opts: npm.flatOptions,
- }, 'libnpmorg.rm received the correct args')
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'libnpmorg.ls received the correct args')
+ t.strictSame(
+ orgRmArgs,
+ {
+ org: 'orgname',
+ user: 'username',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.rm received the correct args'
+ )
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'libnpmorg.ls received the correct args'
+ )
t.strictSame(output, [], 'printed no output')
})
@@ -378,10 +470,14 @@ t.test('npm org ls', async t => {
await org.exec(['ls', 'orgname'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
const out = ansiTrim(output[0])
t.match(out, /one.*developer/, 'contains the developer member')
t.match(out, /two.*admin/, 'contains the admin member')
@@ -401,10 +497,14 @@ t.test('npm org ls - user filter', async t => {
await org.exec(['ls', 'orgname', 'username'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
const out = ansiTrim(output[0])
t.match(out, /username.*admin/, 'contains the filtered member')
t.notMatch(out, /missing.*admin/, 'does not contain other members')
@@ -422,10 +522,14 @@ t.test('npm org ls - user filter, missing user', async t => {
await org.exec(['ls', 'orgname', 'username'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
const out = ansiTrim(output[0])
t.notMatch(out, /username/, 'does not contain the requested member')
t.notMatch(out, /missing.*admin/, 'does not contain other members')
@@ -437,11 +541,7 @@ t.test('npm org ls - no org', async t => {
output.length = 0
})
- await t.rejects(
- org.exec(['ls']),
- /`orgname` is required/,
- 'throws the correct error'
- )
+ await t.rejects(org.exec(['ls']), /`orgname` is required/, 'throws the correct error')
})
t.test('npm org ls - json output', async t => {
@@ -460,10 +560,14 @@ t.test('npm org ls - json output', async t => {
await org.exec(['ls', 'orgname'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
t.strictSame(JSON.parse(output[0]), orgList, 'prints the correct output')
})
@@ -483,16 +587,24 @@ t.test('npm org ls - parseable output', async t => {
await org.exec(['ls', 'orgname'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
- t.strictSame(output.map(line => line.split(/\t/)), [
- ['user', 'role'],
- ['one', 'developer'],
- ['two', 'admin'],
- ['three', 'owner'],
- ], 'printed the correct output')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
+ t.strictSame(
+ output.map(line => line.split(/\t/)),
+ [
+ ['user', 'role'],
+ ['one', 'developer'],
+ ['two', 'admin'],
+ ['three', 'owner'],
+ ],
+ 'printed the correct output'
+ )
})
t.test('npm org ls - silent output', async t => {
@@ -511,9 +623,13 @@ t.test('npm org ls - silent output', async t => {
await org.exec(['ls', 'orgname'])
- t.strictSame(orgLsArgs, {
- org: 'orgname',
- opts: npm.flatOptions,
- }, 'receieved the correct args')
+ t.strictSame(
+ orgLsArgs,
+ {
+ org: 'orgname',
+ opts: npm.flatOptions,
+ },
+ 'receieved the correct args'
+ )
t.strictSame(output, [], 'printed no output')
})
diff --git a/deps/npm/test/lib/commands/outdated.js b/deps/npm/test/lib/commands/outdated.js
index 1841ea9b17..245e93039c 100644
--- a/deps/npm/test/lib/commands/outdated.js
+++ b/deps/npm/test/lib/commands/outdated.js
@@ -55,8 +55,9 @@ const packument = spec => {
},
}
- if (spec.name === 'eta')
+ if (spec.name === 'eta') {
throw new Error('There is an error with this package.')
+ }
if (!mocks[spec.name]) {
const err = new Error()
diff --git a/deps/npm/test/lib/commands/owner.js b/deps/npm/test/lib/commands/owner.js
index c9d936d47b..8645b349f8 100644
--- a/deps/npm/test/lib/commands/owner.js
+++ b/deps/npm/test/lib/commands/owner.js
@@ -211,8 +211,9 @@ t.test('owner add <user> <pkg>', async t => {
'should contain expected new owners, adding requested user'
)
return {}
- } else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => {
t.equal(spec.name, '@npmcli/map-workspaces', 'should use expect pkg name')
@@ -250,10 +251,11 @@ t.test('owner add <user> cwd package', async t => {
email: 'foo@github.com',
name: 'foo',
}
- } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1')
+ } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1') {
return {}
- else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
@@ -290,8 +292,9 @@ t.test('owner add <user> <pkg> already an owner', async t => {
email: 'ruyadorno@hotmail.com',
name: 'ruyadorno',
}
- } else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => {
return {
@@ -314,12 +317,13 @@ t.test('owner add <user> <pkg> fails to retrieve user', async t => {
readPackageNameResponse =
npmFetch.json = async (uri, opts) => {
// retrieve borked user info from couchdb request
- if (uri === '/-/user/org.couchdb.user:foo')
+ if (uri === '/-/user/org.couchdb.user:foo') {
return { ok: false }
- else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1')
+ } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1') {
return {}
- else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
@@ -356,8 +360,9 @@ t.test('owner add <user> <pkg> fails to PUT updates', async t => {
message: "I'm a teapot",
},
}
- } else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
@@ -391,8 +396,9 @@ t.test('owner add <user> <pkg> fails to retrieve user info', async t => {
new Error("I'm a teapot"),
{ status: 418 }
)
- } else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
@@ -422,10 +428,11 @@ t.test('owner add <user> <pkg> no previous maintainers property from server', as
email: 'foo@github.com',
name: 'foo',
}
- } else if (uri === '/@npmcli%2fno-owners-pkg/-rev/1-foobaaa1')
+ } else if (uri === '/@npmcli%2fno-owners-pkg/-rev/1-foobaaa1') {
return {}
- else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => {
return {
@@ -512,8 +519,9 @@ t.test('owner rm <user> <pkg>', async t => {
'should contain expected new owners, removing requested user'
)
return {}
- } else
+ } else {
t.fail(`unexpected fetch json call to: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => {
t.equal(spec.name, '@npmcli/map-workspaces', 'should use expect pkg name')
@@ -556,10 +564,11 @@ t.test('owner rm <user> <pkg> not a current owner', async t => {
email: 'foo@github.com',
name: 'foo',
}
- } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1')
+ } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1') {
return {}
- else
+ } else {
t.fail(`unexpected fetch json call to: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => {
return {
@@ -588,10 +597,11 @@ t.test('owner rm <user> cwd package', async t => {
email: 'ruyadorno@hotmail.com',
name: 'ruyadorno',
}
- } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1')
+ } else if (uri === '/@npmcli%2fmap-workspaces/-rev/1-foobaaa1') {
return {}
- else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
@@ -619,8 +629,9 @@ t.test('owner rm <user> only user', async t => {
email: 'ruyadorno@hotmail.com',
name: 'ruyadorno',
}
- } else
+ } else {
t.fail(`unexpected fetch json call to uri: ${uri}`)
+ }
}
pacote.packument = async (spec, opts) => ({
_rev: '1-foobaaa1',
diff --git a/deps/npm/test/lib/commands/pack.js b/deps/npm/test/lib/commands/pack.js
index 6a5749623c..bc88772086 100644
--- a/deps/npm/test/lib/commands/pack.js
+++ b/deps/npm/test/lib/commands/pack.js
@@ -1,321 +1,134 @@
const t = require('tap')
-const { fake: mockNpm } = require('../../fixtures/mock-npm')
-const pacote = require('pacote')
+const { real: mockNpm } = require('../../fixtures/mock-npm')
const path = require('path')
+const fs = require('fs')
-const OUTPUT = []
-const output = (...msg) => OUTPUT.push(msg)
-
-const libnpmpack = async (spec, opts) => {
- if (!opts)
- throw new Error('expected options object')
-
- return ''
-}
-const mockPacote = {
- manifest: (spec) => {
- if (spec.type === 'directory')
- return pacote.manifest(spec)
- const m = {
- name: spec.name || 'test-package',
- version: spec.version || '1.0.0-test',
- }
- m._id = `${m.name}@${m.version}`
- return m
- },
-}
-
-t.afterEach(() => OUTPUT.length = 0)
+const cwd = process.cwd()
+t.afterEach(t => {
+ process.chdir(cwd)
+})
t.test('should pack current directory with no arguments', async t => {
- let tarballFileName
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => {
- tarballFileName = file
- cb()
- },
- },
- })
- const npm = mockNpm({
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([])
- const filename = `npm-${require('../../../package.json').version}.tgz`
- t.strictSame(OUTPUT, [[filename]])
- t.strictSame(tarballFileName, path.resolve(filename))
+ const { Npm, outputs, filteredLogs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
+ 'package.json': JSON.stringify({
+ name: 'test-package',
+ version: '1.0.0',
+ }),
+ })
+ process.chdir(npm.prefix)
+ await npm.exec('pack', [])
+ const filename = 'test-package-1.0.0.tgz'
+ t.strictSame(outputs, [[filename]])
+ t.matchSnapshot(filteredLogs('notice'), 'logs pack contents')
+ t.ok(fs.statSync(path.resolve(npm.prefix, filename)))
})
t.test('follows pack-destination config', async t => {
- let tarballFileName
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => {
- tarballFileName = file
- cb()
- },
- },
- })
- const npm = mockNpm({
- config: {
- 'pack-destination': '/tmp/test',
- },
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([])
-
- const filename = `npm-${require('../../../package.json').version}.tgz`
- t.strictSame(OUTPUT, [[filename]])
- t.strictSame(tarballFileName, path.resolve('/tmp/test', filename))
-})
-
-t.test('should pack given directory', async t => {
- const testDir = t.testdir({
+ const { Npm, outputs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
'package.json': JSON.stringify({
- name: 'my-cool-pkg',
+ name: 'test-package',
version: '1.0.0',
- }, null, 2),
- })
-
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- config: {
- unicode: true,
- json: false,
- 'dry-run': true,
- },
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([testDir])
-
- const filename = 'my-cool-pkg-1.0.0.tgz'
- t.strictSame(OUTPUT, [[filename]])
+ }),
+ 'tar-destination': {},
+ })
+ process.chdir(npm.prefix)
+ npm.config.set('pack-destination', path.join(npm.prefix, 'tar-destination'))
+ await npm.exec('pack', [])
+ const filename = 'test-package-1.0.0.tgz'
+ t.strictSame(outputs, [[filename]])
+ t.ok(fs.statSync(path.resolve(npm.prefix, 'tar-destination', filename)))
})
t.test('should pack given directory for scoped package', async t => {
- const testDir = t.testdir({
+ const { Npm, outputs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
'package.json': JSON.stringify({
- name: '@cool/my-pkg',
+ name: '@npm/test-package',
version: '1.0.0',
- }, null, 2),
+ }),
})
-
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- config: {
- unicode: true,
- json: false,
- 'dry-run': true,
- },
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([testDir])
-
- const filename = 'cool-my-pkg-1.0.0.tgz'
- t.strictSame(OUTPUT, [[filename]])
-})
-
-t.test('should log pack contents', async t => {
- const Pack = t.mock('../../../lib/commands/pack.js', {
- '../../../lib/utils/tar.js': {
- ...require('../../../lib/utils/tar.js'),
- logTar: () => {
- t.ok(true, 'logTar is called')
- },
- },
- libnpmpack,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- config: {
- unicode: false,
- json: false,
- 'dry-run': false,
- },
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([])
-
- const filename = `npm-${require('../../../package.json').version}.tgz`
- t.strictSame(OUTPUT, [[filename]])
+ process.chdir(npm.prefix)
+ await npm.exec('pack', [])
+ const filename = 'npm-test-package-1.0.0.tgz'
+ t.strictSame(outputs, [[filename]])
+ t.ok(fs.statSync(path.resolve(npm.prefix, filename)))
})
t.test('should log output as valid json', async t => {
- const testDir = t.testdir({
+ const { Npm, outputs, filteredLogs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
'package.json': JSON.stringify({
- name: 'my-cool-pkg',
+ name: 'test-package',
version: '1.0.0',
- main: './index.js',
- }, null, 2),
- 'README.md': 'text',
- 'index.js': 'void',
- })
-
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- '../../../lib/utils/tar.js': {
- getContents: async () => ({
- id: '@ruyadorno/redact@1.0.0',
- name: '@ruyadorno/redact',
- version: '1.0.0',
- size: 2450,
- unpackedSize: 4911,
- shasum: '044c7574639b923076069d6e801e2d1866430f17',
- // mocks exactly how ssri Integrity works:
- integrity: {
- sha512: [
- {
- source: 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
- digest: 'JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
- algorithm: 'sha512',
- options: [],
- },
- ],
- toJSON () {
- return 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ=='
- },
- },
- filename: '@ruyadorno/redact-1.0.0.tgz',
- files: [
- { path: 'LICENSE', size: 1113, mode: 420 },
- { path: 'README.md', size: 2639, mode: 420 },
- { path: 'index.js', size: 719, mode: 493 },
- { path: 'package.json', size: 440, mode: 420 },
- ],
- entryCount: 4,
- bundled: [],
- }),
- },
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- config: {
- unicode: true,
- json: true,
- 'dry-run': true,
- },
- output,
- })
- const pack = new Pack(npm)
-
- await pack.exec([testDir])
+ }),
+ })
+ process.chdir(npm.prefix)
+ npm.config.set('json', true)
+ await npm.exec('pack', [])
+ const filename = 'test-package-1.0.0.tgz'
+ t.matchSnapshot(outputs.map(JSON.parse), 'outputs as json')
+ t.matchSnapshot(filteredLogs('notice'), 'logs pack contents')
+ t.ok(fs.statSync(path.resolve(npm.prefix, filename)))
+})
- t.match(JSON.parse(OUTPUT), [{
- id: '@ruyadorno/redact@1.0.0',
- name: '@ruyadorno/redact',
- version: '1.0.0',
- size: 2450,
- unpackedSize: 4911,
- shasum: '044c7574639b923076069d6e801e2d1866430f17',
- integrity: 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
- filename: '@ruyadorno/redact-1.0.0.tgz',
- files: [
- { path: 'LICENSE' },
- { path: 'README.md' },
- { path: 'index.js' },
- { path: 'package.json' },
- ],
- entryCount: 4,
- }], 'pack details output as valid json')
+t.test('dry run', async t => {
+ const { Npm, outputs, filteredLogs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
+ 'package.json': JSON.stringify({
+ name: 'test-package',
+ version: '1.0.0',
+ }),
+ })
+ npm.config.set('dry-run', true)
+ process.chdir(npm.prefix)
+ await npm.exec('pack', [])
+ const filename = 'test-package-1.0.0.tgz'
+ t.strictSame(outputs, [[filename]])
+ t.matchSnapshot(filteredLogs('notice'), 'logs pack contents')
+ t.throws(() => fs.statSync(path.resolve(npm.prefix, filename)))
})
t.test('invalid packument', async t => {
- const mockPacote = {
- manifest: () => {
- return {}
- },
- }
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- pacote: mockPacote,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- config: {
- unicode: true,
- json: false,
- 'dry-run': true,
- },
- output,
+ const { Npm, outputs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = t.testdir({
+ 'package.json': '{}',
})
- const pack = new Pack(npm)
+ process.chdir(npm.prefix)
await t.rejects(
- pack.exec([]),
- 'Invalid package, must have name and version'
+ npm.exec('pack', []),
+ /Invalid package, must have name and version/
)
- t.strictSame(OUTPUT, [])
+ t.strictSame(outputs, [])
})
-t.test('workspaces', (t) => {
- const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'workspaces-test',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b'],
- }, null, 2),
+t.test('workspaces', async t => {
+ const { Npm, outputs } = mockNpm(t)
+ const npm = new Npm()
+ await npm.load()
+ npm.prefix = 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',
@@ -329,61 +142,28 @@ t.test('workspaces', (t) => {
}),
},
})
- const Pack = t.mock('../../../lib/commands/pack.js', {
- libnpmpack,
- pacote: mockPacote,
- npmlog: {
- notice: () => {},
- showProgress: () => {},
- clearProgress: () => {},
- },
- fs: {
- writeFile: (file, data, cb) => cb(),
- },
- })
- const npm = mockNpm({
- localPrefix: testDir,
- config: {
- unicode: false,
- json: false,
- 'dry-run': false,
- },
- output,
- })
- const pack = new Pack(npm)
-
+ npm.config.set('workspaces', true)
t.test('all workspaces', async t => {
- await pack.execWorkspaces([], [])
-
- t.strictSame(OUTPUT, [
- ['workspace-a-1.0.0.tgz'],
- ['workspace-b-1.0.0.tgz'],
- ])
+ process.chdir(npm.prefix)
+ await npm.exec('pack', [])
+ t.strictSame(outputs, [['workspace-a-1.0.0.tgz'], ['workspace-b-1.0.0.tgz']])
})
t.test('all workspaces, `.` first arg', async t => {
- await pack.execWorkspaces(['.'], [])
-
- t.strictSame(OUTPUT, [
- ['workspace-a-1.0.0.tgz'],
- ['workspace-b-1.0.0.tgz'],
- ])
+ process.chdir(npm.prefix)
+ await npm.exec('pack', ['.'])
+ t.strictSame(outputs, [['workspace-a-1.0.0.tgz'], ['workspace-b-1.0.0.tgz']])
})
t.test('one workspace', async t => {
- await pack.execWorkspaces([], ['workspace-a'])
-
- t.strictSame(OUTPUT, [
- ['workspace-a-1.0.0.tgz'],
- ])
+ process.chdir(npm.prefix)
+ await npm.exec('pack', ['workspace-a'])
+ t.strictSame(outputs, [['workspace-a-1.0.0.tgz']])
})
t.test('specific package', async t => {
- await pack.execWorkspaces(['abbrev'], [])
-
- t.strictSame(OUTPUT, [
- ['abbrev-1.0.0-test.tgz'],
- ])
+ process.chdir(npm.prefix)
+ await npm.exec('pack', [npm.prefix])
+ t.strictSame(outputs, [['workspaces-test-1.0.0.tgz']])
})
- t.end()
})
diff --git a/deps/npm/test/lib/commands/profile.js b/deps/npm/test/lib/commands/profile.js
index 0a3680cf15..6554ca89e4 100644
--- a/deps/npm/test/lib/commands/profile.js
+++ b/deps/npm/test/lib/commands/profile.js
@@ -34,10 +34,8 @@ const mocks = {
'qrcode-terminal': { generate: (url, cb) => cb() },
'cli-table3': class extends Array {
toString () {
- return this
- .filter(Boolean)
- .map(i => [...Object.entries(i)]
- .map(i => i.join(': ')))
+ return this.filter(Boolean)
+ .map(i => [...Object.entries(i)].map(i => i.join(': ')))
.join('\n')
}
},
@@ -78,10 +76,7 @@ const Profile = t.mock('../../../lib/commands/profile.js', mocks)
const profile = new Profile(npm)
t.test('no args', async t => {
- await t.rejects(
- profile.exec([]),
- profile.usage
- )
+ await t.rejects(profile.exec([]), profile.usage)
})
t.test('profile get no args', t => {
@@ -100,10 +95,7 @@ t.test('profile get no args', t => {
t.test('default output', async t => {
await profile.exec(['get'])
- t.matchSnapshot(
- result,
- 'should output table with contents'
- )
+ t.matchSnapshot(result, 'should output table with contents')
})
t.test('--json', async t => {
@@ -111,21 +103,14 @@ t.test('profile get no args', t => {
await profile.exec(['get'])
- t.same(
- JSON.parse(result),
- userProfile,
- 'should output json profile result'
- )
+ t.same(JSON.parse(result), userProfile, 'should output json profile result')
})
t.test('--parseable', async t => {
config.parseable = true
await profile.exec(['get'])
- t.matchSnapshot(
- result,
- 'should output all profile info as parseable result'
- )
+ t.matchSnapshot(result, 'should output all profile info as parseable result')
})
t.test('no tfa enabled', async t => {
@@ -145,10 +130,7 @@ t.test('profile get no args', t => {
const profile = new Profile(npm)
await profile.exec(['get'])
- t.matchSnapshot(
- result,
- 'should output expected profile values'
- )
+ t.matchSnapshot(result, 'should output expected profile values')
})
t.test('unverified email', async t => {
@@ -169,10 +151,7 @@ t.test('profile get no args', t => {
await profile.exec(['get'])
- t.matchSnapshot(
- result,
- 'should output table with contents'
- )
+ t.matchSnapshot(result, 'should output table with contents')
})
t.test('profile has cidr_whitelist item', async t => {
@@ -193,10 +172,7 @@ t.test('profile get no args', t => {
await profile.exec(['get'])
- t.matchSnapshot(
- result,
- 'should output table with contents'
- )
+ t.matchSnapshot(result, 'should output table with contents')
})
t.end()
@@ -218,11 +194,7 @@ t.test('profile get <key>', t => {
t.test('default output', async t => {
await profile.exec(['get', 'name'])
- t.equal(
- result,
- 'foo',
- 'should output value result'
- )
+ t.equal(result, 'foo', 'should output value result')
})
t.test('--json', async t => {
@@ -242,10 +214,7 @@ t.test('profile get <key>', t => {
await profile.exec(['get', 'name'])
- t.matchSnapshot(
- result,
- 'should output parseable result value'
- )
+ t.matchSnapshot(result, 'should output parseable result value')
})
t.end()
@@ -267,10 +236,7 @@ t.test('profile get multiple args', t => {
t.test('default output', async t => {
await profile.exec(['get', 'name', 'email', 'github'])
- t.matchSnapshot(
- result,
- 'should output all keys'
- )
+ t.matchSnapshot(result, 'should output all keys')
})
t.test('--json', async t => {
@@ -278,11 +244,7 @@ t.test('profile get multiple args', t => {
await profile.exec(['get', 'name', 'email', 'github'])
- t.same(
- JSON.parse(result),
- userProfile,
- 'should output json profile result and ignore args'
- )
+ t.same(JSON.parse(result), userProfile, 'should output json profile result and ignore args')
})
t.test('--parseable', async t => {
@@ -290,19 +252,13 @@ t.test('profile get multiple args', t => {
await profile.exec(['get', 'name', 'email', 'github'])
- t.matchSnapshot(
- result,
- 'should output parseable profile value results'
- )
+ t.matchSnapshot(result, 'should output parseable profile value results')
})
t.test('comma separated', async t => {
await profile.exec(['get', 'name,email,github'])
- t.matchSnapshot(
- result,
- 'should output all keys'
- )
+ t.matchSnapshot(result, 'should output all keys')
})
t.end()
@@ -371,11 +327,7 @@ t.test('profile set <key> <value>', t => {
const profile = new Profile(npm)
await profile.exec(['set', 'fullname', 'Lorem Ipsum'])
- t.equal(
- result,
- 'Set\nfullname\nto\nLorem Ipsum',
- 'should output set key success msg'
- )
+ t.equal(result, 'Set\nfullname\nto\nLorem Ipsum', 'should output set key success msg')
})
t.test('--json', async t => {
@@ -413,10 +365,7 @@ t.test('profile set <key> <value>', t => {
await profile.exec(['set', 'fullname', 'Lorem Ipsum'])
- t.matchSnapshot(
- result,
- 'should output parseable set key success msg'
- )
+ t.matchSnapshot(result, 'should output parseable set key success msg')
})
t.end()
@@ -437,11 +386,7 @@ t.test('profile set <key> <value>', t => {
},
'should set new value to email'
)
- t.match(
- conf,
- npm.flatOptions,
- 'should forward flatOptions config'
- )
+ t.match(conf, npm.flatOptions, 'should forward flatOptions config')
return {
...userProfile,
...newUser,
@@ -456,11 +401,7 @@ t.test('profile set <key> <value>', t => {
const profile = new Profile(npm)
await profile.exec(['set', 'email', 'foo@npmjs.com'])
- t.equal(
- result,
- 'Set\nemail\nto\nfoo@npmjs.com',
- 'should output set key success msg'
- )
+ t.equal(result, 'Set\nemail\nto\nfoo@npmjs.com', 'should output set key success msg')
})
t.test('change password', async t => {
@@ -481,11 +422,7 @@ t.test('profile set <key> <value>', t => {
},
'should set new password'
)
- t.match(
- conf,
- npm.flatOptions,
- 'should forward flatOptions config'
- )
+ t.match(conf, npm.flatOptions, 'should forward flatOptions config')
return {
...userProfile,
}
@@ -494,18 +431,17 @@ t.test('profile set <key> <value>', t => {
const readUserInfo = {
async password (label) {
- if (label === 'Current password: ')
+ if (label === 'Current password: ') {
t.ok('should interactively ask for password confirmation')
- else if (label === 'New password: ')
+ } else if (label === 'New password: ') {
t.ok('should interactively ask for new password')
- else if (label === ' Again: ')
+ } else if (label === ' Again: ') {
t.ok('should interactively ask for new password confirmation')
- else
+ } else {
throw new Error('Unexpected label: ' + label)
+ }
- return label === 'Current password: '
- ? 'currentpassword1234'
- : 'newpassword1234'
+ return label === 'Current password: ' ? 'currentpassword1234' : 'newpassword1234'
},
}
@@ -518,11 +454,7 @@ t.test('profile set <key> <value>', t => {
await profile.exec(['set', 'password'])
- t.equal(
- result,
- 'Set\npassword',
- 'should output set password success msg'
- )
+ t.equal(result, 'Set\npassword', 'should output set password success msg')
})
t.test('password confirmation mismatch', async t => {
@@ -548,9 +480,7 @@ t.test('profile set <key> <value>', t => {
case 'Current password: ':
return 'currentpassword1234'
case 'New password: ':
- return passwordPromptCount < 3
- ? 'password-that-will-not-be-confirmed'
- : 'newpassword'
+ return passwordPromptCount < 3 ? 'password-that-will-not-be-confirmed' : 'newpassword'
case ' Again: ':
return 'newpassword'
default:
@@ -583,11 +513,7 @@ t.test('profile set <key> <value>', t => {
await profile.exec(['set', 'password'])
- t.equal(
- result,
- 'Set\npassword',
- 'should output set password success msg'
- )
+ t.equal(result, 'Set\npassword', 'should output set password success msg')
})
t.end()
@@ -616,7 +542,7 @@ t.test('enable-2fa', t => {
await t.rejects(
profile.exec(['enable-2fa', 'auth-only']),
'Enabling two-factor authentication is an interactive ' +
- 'operation and JSON output mode is not available',
+ 'operation and JSON output mode is not available',
'should throw no support msg'
)
})
@@ -627,7 +553,7 @@ t.test('enable-2fa', t => {
await t.rejects(
profile.exec(['enable-2fa', 'auth-only']),
'Enabling two-factor authentication is an interactive ' +
- 'operation and parseable output mode is not available',
+ 'operation and parseable output mode is not available',
'should throw no support msg'
)
})
@@ -657,8 +583,8 @@ t.test('enable-2fa', t => {
await t.rejects(
profile.exec(['enable-2fa', 'auth-only']),
'Your registry https://registry.npmjs.org/ does ' +
- 'not seem to support bearer tokens. Bearer tokens ' +
- 'are required for two-factor authentication',
+ 'not seem to support bearer tokens. Bearer tokens ' +
+ 'are required for two-factor authentication',
'should throw no support msg'
)
})
@@ -684,8 +610,8 @@ t.test('enable-2fa', t => {
await t.rejects(
profile.exec(['enable-2fa', 'auth-only']),
'Your registry https://registry.npmjs.org/ does ' +
- 'not seem to support bearer tokens. Bearer tokens ' +
- 'are required for two-factor authentication',
+ 'not seem to support bearer tokens. Bearer tokens ' +
+ 'are required for two-factor authentication',
'should throw no support msg'
)
})
@@ -700,8 +626,7 @@ t.test('enable-2fa', t => {
await t.rejects(
profile.exec(['enable-2fa', 'auth-only']),
- 'You need to be logged in to registry ' +
- 'https://registry.npmjs.org/ in order to enable 2fa'
+ 'You need to be logged in to registry ' + 'https://registry.npmjs.org/ in order to enable 2fa'
)
})
@@ -709,7 +634,7 @@ t.test('enable-2fa', t => {
t.plan(10)
// mock legacy basic auth style
- npm.config.getCredentialsByURI = (reg) => {
+ npm.config.getCredentialsByURI = reg => {
t.equal(reg, flatOptions.registry, 'should use expected registry')
return { auth: Buffer.from('foo:bar').toString('base64') }
}
@@ -717,7 +642,7 @@ t.test('enable-2fa', t => {
t.equal(registry, flatOptions.registry, 'should set expected registry')
t.equal(token, 'token', 'should set expected token')
}
- npm.config.save = (type) => {
+ npm.config.save = type => {
t.equal(type, 'user', 'should save to user config')
}
@@ -839,10 +764,7 @@ t.test('enable-2fa', t => {
)
return {
...userProfile,
- tfa: [
- '123456',
- '789101',
- ],
+ tfa: ['123456', '789101'],
}
}
@@ -863,7 +785,7 @@ t.test('enable-2fa', t => {
}
const qrcode = {
- // eslint-disable-next-line standard/no-callback-literal
+ /* eslint-disable-next-line node/no-callback-literal */
generate: (url, cb) => cb('qrcode'),
}
@@ -877,10 +799,7 @@ t.test('enable-2fa', t => {
await profile.exec(['enable-2fa', 'auth-only'])
- t.matchSnapshot(
- result,
- 'should output 2fa enablement success msgs'
- )
+ t.matchSnapshot(result, 'should output 2fa enablement success msgs')
})
t.test('from token and set otp, retrieves invalid otp', async t => {
@@ -934,7 +853,7 @@ t.test('enable-2fa', t => {
flatOptions.otp = '123456'
flatOptions.otp = '123456'
- npm.config.getCredentialsByURI = (reg) => {
+ npm.config.getCredentialsByURI = reg => {
return { token: 'token' }
}
@@ -976,7 +895,7 @@ t.test('enable-2fa', t => {
})
t.test('missing tfa from user profile', async t => {
- npm.config.getCredentialsByURI = (reg) => {
+ npm.config.getCredentialsByURI = reg => {
return { token: 'token' }
}
@@ -1021,7 +940,7 @@ t.test('enable-2fa', t => {
})
t.test('defaults to auth-and-writes permission if no mode specified', async t => {
- npm.config.getCredentialsByURI = (reg) => {
+ npm.config.getCredentialsByURI = reg => {
return { token: 'token' }
}
@@ -1085,11 +1004,7 @@ t.test('disable-2fa', t => {
const profile = new Profile(npm)
await profile.exec(['disable-2fa'])
- t.equal(
- result,
- 'Two factor authentication not enabled.',
- 'should output already disalbed msg'
- )
+ t.equal(result, 'Two factor authentication not enabled.', 'should output already disalbed msg')
})
t.test('requests otp', t => {
@@ -1143,11 +1058,7 @@ t.test('disable-2fa', t => {
const profile = new Profile(npm)
await profile.exec(['disable-2fa'])
- t.equal(
- result,
- 'Two factor authentication disabled.',
- 'should output already disabled msg'
- )
+ t.equal(result, 'Two factor authentication disabled.', 'should output already disabled msg')
})
t.test('--json', async t => {
@@ -1162,11 +1073,7 @@ t.test('disable-2fa', t => {
await profile.exec(['disable-2fa'])
- t.same(
- JSON.parse(result),
- { tfa: false },
- 'should output json already disabled msg'
- )
+ t.same(JSON.parse(result), { tfa: false }, 'should output json already disabled msg')
})
t.test('--parseable', async t => {
@@ -1181,11 +1088,7 @@ t.test('disable-2fa', t => {
await profile.exec(['disable-2fa'])
- t.equal(
- result,
- 'tfa\tfalse',
- 'should output parseable already disabled msg'
- )
+ t.equal(result, 'tfa\tfalse', 'should output parseable already disabled msg')
})
t.end()
@@ -1240,11 +1143,7 @@ t.test('disable-2fa', t => {
await profile.exec(['disable-2fa'])
- t.equal(
- result,
- 'Two factor authentication disabled.',
- 'should output already disalbed msg'
- )
+ t.equal(result, 'Two factor authentication disabled.', 'should output already disalbed msg')
})
t.end()
@@ -1260,11 +1159,7 @@ t.test('unknown subcommand', async t => {
t.test('completion', t => {
const testComp = async ({ t, argv, expect, title }) => {
- t.resolveMatch(
- profile.completion({ conf: { argv: { remain: argv } } }),
- expect,
- title
- )
+ t.resolveMatch(profile.completion({ conf: { argv: { remain: argv } } }), expect, title)
}
t.test('npm profile autocomplete', async t => {
@@ -1306,7 +1201,8 @@ t.test('completion', t => {
t.test('npm profile unknown subcommand autocomplete', async t => {
t.rejects(
profile.completion({ conf: { argv: { remain: ['npm', 'profile', 'asdf'] } } }),
- { message: 'asdf not recognized' }, 'should throw unknown cmd error'
+ { message: 'asdf not recognized' },
+ 'should throw unknown cmd error'
)
t.end()
})
diff --git a/deps/npm/test/lib/commands/publish.js b/deps/npm/test/lib/commands/publish.js
index 6c444e5f7f..5f4fb40106 100644
--- a/deps/npm/test/lib/commands/publish.js
+++ b/deps/npm/test/lib/commands/publish.js
@@ -9,84 +9,102 @@ const fs = require('fs')
const log = require('npmlog')
log.level = 'silent'
-t.cleanSnapshot = (data) => {
+t.cleanSnapshot = data => {
return data.replace(/^ *"gitHead": .*$\n/gm, '')
}
-const {definitions} = require('../../../lib/utils/config')
+const { definitions } = require('../../../lib/utils/config')
const defaults = Object.entries(definitions).reduce((defaults, [key, def]) => {
defaults[key] = def.default
return defaults
}, {})
-t.afterEach(() => log.level = 'silent')
+t.afterEach(() => (log.level = 'silent'))
-t.test('should publish with libnpmpublish, passing through flatOptions and respecting publishConfig.registry', async t => {
- t.plan(6)
+t.test(
+ /* eslint-disable-next-line max-len */
+ 'should publish with libnpmpublish, passing through flatOptions and respecting publishConfig.registry',
+ async t => {
+ t.plan(6)
- const registry = 'https://some.registry'
- const publishConfig = { registry }
- const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- publishConfig,
- }, null, 2),
- })
+ const registry = 'https://some.registry'
+ const publishConfig = { registry }
+ const testDir = t.testdir({
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ publishConfig,
+ },
+ null,
+ 2
+ ),
+ })
- const Publish = t.mock('../../../lib/commands/publish.js', {
- // verify that we do NOT remove publishConfig if it was there originally
- // and then removed during the script/pack process
- libnpmpack: async () => {
- fs.writeFileSync(`${testDir}/package.json`, JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }))
- return Buffer.from('')
- },
- libnpmpublish: {
- publish: (manifest, tarData, opts) => {
- t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest')
- t.type(tarData, Buffer, 'tarData is a buffer')
- t.ok(opts, 'gets opts object')
- t.same(opts.customValue, true, 'flatOptions values are passed through')
- t.same(opts.registry, registry, 'publishConfig.registry is passed through')
+ const Publish = t.mock('../../../lib/commands/publish.js', {
+ // verify that we do NOT remove publishConfig if it was there originally
+ // and then removed during the script/pack process
+ libnpmpack: async () => {
+ fs.writeFileSync(
+ `${testDir}/package.json`,
+ JSON.stringify({
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ })
+ )
+ return Buffer.from('')
},
- },
- })
- const npm = mockNpm({
- flatOptions: {
- customValue: true,
- workspacesEnabled: true,
- },
- })
- npm.config.getCredentialsByURI = (uri) => {
- t.same(uri, registry, 'gets credentials for expected registry')
- return { token: 'some.registry.token' }
- }
- const publish = new Publish(npm)
+ libnpmpublish: {
+ publish: (manifest, tarData, opts) => {
+ t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest')
+ t.type(tarData, Buffer, 'tarData is a buffer')
+ t.ok(opts, 'gets opts object')
+ t.same(opts.customValue, true, 'flatOptions values are passed through')
+ t.same(opts.registry, registry, 'publishConfig.registry is passed through')
+ },
+ },
+ })
+ const npm = mockNpm({
+ flatOptions: {
+ customValue: true,
+ workspacesEnabled: true,
+ },
+ })
+ npm.config.getCredentialsByURI = uri => {
+ t.same(uri, registry, 'gets credentials for expected registry')
+ return { token: 'some.registry.token' }
+ }
+ const publish = new Publish(npm)
- await publish.exec([testDir])
-})
+ await publish.exec([testDir])
+ }
+)
t.test('re-loads publishConfig.registry if added during script process', async t => {
t.plan(5)
const registry = 'https://some.registry'
const publishConfig = { registry }
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
})
const Publish = t.mock('../../../lib/commands/publish.js', {
libnpmpack: async () => {
- fs.writeFileSync(`${testDir}/package.json`, JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- publishConfig,
- }))
+ fs.writeFileSync(
+ `${testDir}/package.json`,
+ JSON.stringify({
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ publishConfig,
+ })
+ )
return Buffer.from('')
},
libnpmpublish: {
@@ -99,7 +117,7 @@ t.test('re-loads publishConfig.registry if added during script process', async t
},
})
const npm = mockNpm()
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -112,10 +130,14 @@ t.test('if loglevel=info and json, should not output package contents', async t
t.plan(3)
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
})
log.level = 'info'
@@ -140,7 +162,7 @@ t.test('if loglevel=info and json, should not output package contents', async t
t.pass('output is called')
},
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -149,96 +171,109 @@ t.test('if loglevel=info and json, should not output package contents', async t
await publish.exec([testDir])
})
-t.test('if loglevel=silent and dry-run, should not output package contents or publish or validate credentials, should log tarball contents', async t => {
- t.plan(1)
+t.test(
+ /* eslint-disable-next-line max-len */
+ 'if loglevel=silent and dry-run, should not output package contents or publish or validate credentials, should log tarball contents',
+ async t => {
+ t.plan(1)
- const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
- })
+ const testDir = t.testdir({
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
+ })
- log.level = 'silent'
- const Publish = t.mock('../../../lib/commands/publish.js', {
- '../../../lib/utils/tar.js': {
- getContents: () => ({
- id: 'someid',
- }),
- logTar: () => {
- t.pass('logTar is called')
+ log.level = 'silent'
+ const Publish = t.mock('../../../lib/commands/publish.js', {
+ '../../../lib/utils/tar.js': {
+ getContents: () => ({
+ id: 'someid',
+ }),
+ logTar: () => {
+ t.pass('logTar is called')
+ },
},
- },
- libnpmpublish: {
- publish: () => {
- throw new Error('should not call libnpmpublish in dry run')
+ libnpmpublish: {
+ publish: () => {
+ throw new Error('should not call libnpmpublish in dry run')
+ },
},
- },
- })
- const npm = mockNpm({
- config: { 'dry-run': true },
- output: () => {
- throw new Error('should not output in dry run mode')
- },
- })
- npm.config.getCredentialsByURI = () => {
- throw new Error('should not call getCredentialsByURI in dry run')
- }
-
- const publish = new Publish(npm)
-
- await publish.exec([testDir])
-})
+ })
+ const npm = mockNpm({
+ config: { 'dry-run': true },
+ output: () => {
+ throw new Error('should not output in dry run mode')
+ },
+ })
+ npm.config.getCredentialsByURI = () => {
+ throw new Error('should not call getCredentialsByURI in dry run')
+ }
-t.test('if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents', async t => {
- t.plan(2)
+ const publish = new Publish(npm)
- const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
- })
+ await publish.exec([testDir])
+ }
+)
+
+t.test(
+ /* eslint-disable-next-line max-len */
+ 'if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents',
+ async t => {
+ t.plan(2)
+
+ const testDir = t.testdir({
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
+ })
- log.level = 'info'
- const Publish = t.mock('../../../lib/commands/publish.js', {
- '../../../lib/utils/tar.js': {
- getContents: () => ({
- id: 'someid',
- }),
- logTar: () => {
- t.pass('logTar is called')
+ log.level = 'info'
+ const Publish = t.mock('../../../lib/commands/publish.js', {
+ '../../../lib/utils/tar.js': {
+ getContents: () => ({
+ id: 'someid',
+ }),
+ logTar: () => {
+ t.pass('logTar is called')
+ },
},
- },
- libnpmpublish: {
- publish: () => {
- throw new Error('should not call libnpmpublish in dry run')
+ libnpmpublish: {
+ publish: () => {
+ throw new Error('should not call libnpmpublish in dry run')
+ },
},
- },
- })
- const npm = mockNpm({
- config: { 'dry-run': true },
- output: () => {
- t.pass('output fn is called')
- },
- })
- npm.config.getCredentialsByURI = () => {
- throw new Error('should not call getCredentialsByURI in dry run')
- }
- const publish = new Publish(npm)
+ })
+ const npm = mockNpm({
+ config: { 'dry-run': true },
+ output: () => {
+ t.pass('output fn is called')
+ },
+ })
+ npm.config.getCredentialsByURI = () => {
+ throw new Error('should not call getCredentialsByURI in dry run')
+ }
+ const publish = new Publish(npm)
- await publish.exec([testDir])
-})
+ await publish.exec([testDir])
+ }
+)
t.test('shows usage with wrong set of arguments', async t => {
t.plan(1)
const Publish = t.mock('../../../lib/commands/publish.js')
const publish = new Publish({})
- await t.rejects(
- publish.exec(['a', 'b', 'c']),
- publish.usage
- )
+ await t.rejects(publish.exec(['a', 'b', 'c']), publish.usage)
})
t.test('throws when invalid tag', async t => {
@@ -270,26 +305,33 @@ t.test('can publish a tarball', async t => {
},
})
const tar = require('tar')
- tar.c({
- cwd: testDir,
- file: `${testDir}/tarball/package.tgz`,
- sync: true,
- }, ['package'])
+ tar.c(
+ {
+ cwd: testDir,
+ file: `${testDir}/tarball/package.tgz`,
+ sync: true,
+ },
+ ['package']
+ )
const tarFile = fs.readFileSync(`${testDir}/tarball/package.tgz`)
const Publish = t.mock('../../../lib/commands/publish.js', {
libnpmpublish: {
publish: (manifest, tarData, opts) => {
- t.match(manifest, {
- name: 'my-cool-tarball',
- version: '1.2.3',
- }, 'sent manifest to lib pub')
+ t.match(
+ manifest,
+ {
+ name: 'my-cool-tarball',
+ version: '1.2.3',
+ },
+ 'sent manifest to lib pub'
+ )
t.strictSame(tarData, tarFile, 'sent the tarball data to lib pub')
},
},
})
const npm = mockNpm()
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -302,7 +344,7 @@ t.test('should check auth for default registry', async t => {
t.plan(2)
const Publish = t.mock('../../../lib/commands/publish.js')
const npm = mockNpm()
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
return {}
}
@@ -322,7 +364,7 @@ t.test('should check auth for configured registry', async t => {
const npm = mockNpm({
flatOptions: { registry },
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return {}
}
@@ -339,17 +381,21 @@ t.test('should check auth for scope specific registry', async t => {
t.plan(2)
const registry = 'https://some.registry'
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: '@npm/my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: '@npm/my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
})
const Publish = t.mock('../../../lib/commands/publish.js')
const npm = mockNpm({
flatOptions: { '@npm:registry': registry },
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return {}
}
@@ -366,10 +412,14 @@ t.test('should use auth for scope specific registry', async t => {
t.plan(3)
const registry = 'https://some.registry'
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: '@npm/my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: '@npm/my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
})
const Publish = t.mock('../../../lib/commands/publish.js', {
@@ -383,7 +433,7 @@ t.test('should use auth for scope specific registry', async t => {
const npm = mockNpm({
flatOptions: { '@npm:registry': registry },
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -398,11 +448,15 @@ t.test('read registry only from publishConfig', async t => {
const registry = 'https://some.registry'
const publishConfig = { registry }
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- publishConfig,
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ publishConfig,
+ },
+ null,
+ 2
+ ),
})
const Publish = t.mock('../../../lib/commands/publish.js', {
@@ -414,7 +468,7 @@ t.test('read registry only from publishConfig', async t => {
},
})
const npm = mockNpm()
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -430,18 +484,24 @@ t.test('able to publish after if encountered multiple configs', async t => {
const tag = 'better-tag'
const publishConfig = { registry }
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- publishConfig,
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ publishConfig,
+ },
+ null,
+ 2
+ ),
})
const configList = [defaults]
- configList.unshift(Object.assign(Object.create(configList[0]), {
- registry: `https://other.registry`,
- tag: 'some-tag',
- }))
+ configList.unshift(
+ Object.assign(Object.create(configList[0]), {
+ registry: `https://other.registry`,
+ tag: 'some-tag',
+ })
+ )
configList.unshift(Object.assign(Object.create(configList[0]), { tag }))
const Publish = t.mock('../../../lib/commands/publish.js', {
@@ -460,7 +520,7 @@ t.test('able to publish after if encountered multiple configs', async t => {
config: {
get: key => configList[0][key],
list: configList,
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.same(uri, registry, 'gets credentials for expected registry')
return { token: 'some.registry.token' }
},
@@ -470,13 +530,17 @@ t.test('able to publish after if encountered multiple configs', async t => {
await publish.exec([testDir])
})
-t.test('workspaces', (t) => {
+t.test('workspaces', t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
+ },
+ null,
+ 2
+ ),
'workspace-a': {
'package.json': JSON.stringify({
name: 'workspace-a',
@@ -508,7 +572,7 @@ t.test('workspaces', (t) => {
})
const Publish = t.mock('../../../lib/commands/publish.js', {
'../../../lib/utils/tar.js': {
- getContents: (manifest) => ({
+ getContents: manifest => ({
id: manifest._id,
}),
logTar: () => {},
@@ -520,12 +584,12 @@ t.test('workspaces', (t) => {
},
})
const npm = mockNpm({
- output: (o) => {
+ output: o => {
outputs.push(o)
},
})
npm.localPrefix = testDir
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
return { token: 'some.registry.token' }
}
const publish = new Publish(npm)
@@ -545,14 +609,8 @@ t.test('workspaces', (t) => {
})
t.test('invalid workspace', async t => {
- await t.rejects(
- publish.execWorkspaces([], ['workspace-x']),
- /No workspaces found/
- )
- await t.rejects(
- publish.execWorkspaces([], ['workspace-x']),
- /workspace-x/
- )
+ await t.rejects(publish.execWorkspaces([], ['workspace-x']), /No workspaces found/)
+ await t.rejects(publish.execWorkspaces([], ['workspace-x']), /workspace-x/)
})
t.test('json', async t => {
@@ -598,7 +656,7 @@ t.test('private workspaces', async t => {
})
const mocks = {
'../../../lib/utils/tar.js': {
- getContents: (manifest) => ({
+ getContents: manifest => ({
id: manifest._id,
}),
logTar: () => {},
@@ -606,22 +664,19 @@ t.test('private workspaces', async t => {
libnpmpublish: {
publish: (manifest, tarballData, opts) => {
if (manifest.private) {
- throw Object.assign(
- new Error('private pkg'),
- { code: 'EPRIVATE' }
- )
+ throw Object.assign(new Error('private pkg'), { code: 'EPRIVATE' })
}
publishes.push(manifest)
},
},
}
const npm = mockNpm({
- output: (o) => {
+ output: o => {
outputs.push(o)
},
})
npm.localPrefix = testDir
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
return { token: 'some.registry.token' }
}
@@ -635,6 +690,7 @@ t.test('private workspaces', async t => {
t.equal(title, 'publish', 'should use publish warn title')
t.match(
msg,
+ /* eslint-disable-next-line max-len */
'Skipping workspace \u001b[32m@npmcli/a\u001b[39m, marked as \u001b[1mprivate\u001b[22m',
'should display skip private workspace warn msg'
)
@@ -678,8 +734,9 @@ t.test('private workspaces', async t => {
...mocks,
libnpmpublish: {
publish: (manifest, tarballData, opts) => {
- if (manifest.private)
+ if (manifest.private) {
throw new Error('ERR')
+ }
publishes.push(manifest)
},
@@ -691,11 +748,7 @@ t.test('private workspaces', async t => {
})
const publish = new Publish(npm)
- await t.rejects(
- publish.execWorkspaces([], []),
- /ERR/,
- 'should throw unexpected error'
- )
+ await t.rejects(publish.execWorkspaces([], []), /ERR/, 'should throw unexpected error')
})
t.end()
@@ -703,21 +756,25 @@ t.test('private workspaces', async t => {
t.test('runs correct lifecycle scripts', async t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- scripts: {
- prepublishOnly: 'echo test prepublishOnly',
- prepublish: 'echo test prepublish', // should NOT run this one
- publish: 'echo test publish',
- postpublish: 'echo test postpublish',
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ scripts: {
+ prepublishOnly: 'echo test prepublishOnly',
+ prepublish: 'echo test prepublish', // should NOT run this one
+ publish: 'echo test publish',
+ postpublish: 'echo test postpublish',
+ },
},
- }, null, 2),
+ null,
+ 2
+ ),
})
const scripts = []
const Publish = t.mock('../../../lib/commands/publish.js', {
- '@npmcli/run-script': (args) => {
+ '@npmcli/run-script': args => {
scripts.push(args)
},
'../../../lib/utils/tar.js': {
@@ -739,7 +796,7 @@ t.test('runs correct lifecycle scripts', async t => {
t.pass('output is called')
},
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
@@ -754,10 +811,14 @@ t.test('runs correct lifecycle scripts', async t => {
t.test('does not run scripts on --ignore-scripts', async t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'my-cool-pkg',
- version: '1.0.0',
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'my-cool-pkg',
+ version: '1.0.0',
+ },
+ null,
+ 2
+ ),
})
const Publish = t.mock('../../../lib/commands/publish.js', {
@@ -784,7 +845,7 @@ t.test('does not run scripts on --ignore-scripts', async t => {
t.pass('output is called')
},
})
- npm.config.getCredentialsByURI = (uri) => {
+ npm.config.getCredentialsByURI = uri => {
t.same(uri, npm.config.get('registry'), 'gets credentials for expected registry')
return { token: 'some.registry.token' }
}
diff --git a/deps/npm/test/lib/commands/repo.js b/deps/npm/test/lib/commands/repo.js
index 9a7c4a9509..4e61047b4e 100644
--- a/deps/npm/test/lib/commands/repo.js
+++ b/deps/npm/test/lib/commands/repo.js
@@ -233,7 +233,7 @@ t.test('open repo urls', t => {
const url = expect[pkg]
t.match({
[url]: 1,
- }, opened, `opened ${url}`, {opened})
+ }, opened, `opened ${url}`, { opened })
t.end()
})
})
@@ -263,7 +263,7 @@ t.test('fail if cannot figure out repo url', t => {
t.test('open default package if none specified', async t => {
npm.localPrefix = pkgDirs
await npm.exec('repo', [])
- t.equal(opened['https://example.com/thispkg'], 1, 'opened expected url', {opened})
+ t.equal(opened['https://example.com/thispkg'], 1, 'opened expected url', { opened })
})
t.test('workspaces', t => {
diff --git a/deps/npm/test/lib/commands/run-script.js b/deps/npm/test/lib/commands/run-script.js
index 6b3b40055c..e421c655ef 100644
--- a/deps/npm/test/lib/commands/run-script.js
+++ b/deps/npm/test/lib/commands/run-script.js
@@ -2,12 +2,9 @@ const t = require('tap')
const { resolve } = require('path')
const { fake: mockNpm } = require('../../fixtures/mock-npm')
-const normalizePath = p => p
- .replace(/\\+/g, '/')
- .replace(/\r\n/g, '\n')
+const normalizePath = p => p.replace(/\\+/g, '/').replace(/\r\n/g, '\n')
-const cleanOutput = (str) => normalizePath(str)
- .replace(normalizePath(process.cwd()), '{CWD}')
+const cleanOutput = str => normalizePath(str).replace(normalizePath(process.cwd()), '{CWD}')
const RUN_SCRIPTS = []
const flatOptions = {
@@ -23,7 +20,7 @@ const npm = mockNpm({
localPrefix: __dirname,
flatOptions,
config,
- cmd: (c) => {
+ cmd: c => {
return { description: `test ${c} description` }
},
output: (...msg) => output.push(msg),
@@ -50,11 +47,14 @@ t.afterEach(() => {
const getRS = windows => {
const RunScript = t.mock('../../../lib/commands/run-script.js', {
- '@npmcli/run-script': Object.assign(async opts => {
- RUN_SCRIPTS.push(opts)
- }, {
- isServerPackage: require('@npmcli/run-script').isServerPackage,
- }),
+ '@npmcli/run-script': Object.assign(
+ async opts => {
+ RUN_SCRIPTS.push(opts)
+ },
+ {
+ isServerPackage: require('@npmcli/run-script').isServerPackage,
+ }
+ ),
npmlog,
'../../../lib/utils/is-windows-shell.js': windows,
})
@@ -69,26 +69,29 @@ t.test('completion', t => {
const dir = t.testdir()
npm.localPrefix = dir
t.test('already have a script name', async t => {
- const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}})
+ const res = await runScript.completion({ conf: { argv: { remain: ['npm', 'run', 'x'] } } })
t.equal(res, undefined)
t.end()
})
t.test('no package.json', async t => {
- const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ const res = await runScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, [])
t.end()
})
t.test('has package.json, no scripts', async t => {
writeFileSync(`${dir}/package.json`, JSON.stringify({}))
- const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ const res = await runScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, [])
t.end()
})
t.test('has package.json, with scripts', async t => {
- writeFileSync(`${dir}/package.json`, JSON.stringify({
- scripts: { hello: 'echo hello', world: 'echo world' },
- }))
- const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ writeFileSync(
+ `${dir}/package.json`,
+ JSON.stringify({
+ scripts: { hello: 'echo hello', world: 'echo world' },
+ })
+ )
+ const res = await runScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, ['hello', 'world'])
t.end()
})
@@ -98,14 +101,8 @@ t.test('completion', t => {
t.test('fail if no package.json', async t => {
t.plan(2)
npm.localPrefix = t.testdir()
- await t.rejects(
- runScript.exec([]),
- { code: 'ENOENT' }
- )
- await t.rejects(
- runScript.exec(['test']),
- { code: 'ENOENT' }
- )
+ await t.rejects(runScript.exec([]), { code: 'ENOENT' })
+ await t.rejects(runScript.exec(['test']), { code: 'ENOENT' })
})
t.test('default env, start, and restart scripts', t => {
@@ -123,7 +120,7 @@ t.test('default env, start, and restart scripts', t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x', version: '1.2.3', _id: 'x@1.2.3', scripts: {}},
+ pkg: { name: 'x', version: '1.2.3', _id: 'x@1.2.3', scripts: {} },
event: 'start',
},
])
@@ -160,12 +157,14 @@ t.test('default env, start, and restart scripts', t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
env: 'SET',
- } },
+ },
+ },
event: 'env',
},
])
@@ -181,12 +180,14 @@ t.test('default env, start, and restart scripts', t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
restart: 'npm stop --if-present && npm start',
- } },
+ },
+ },
event: 'restart',
},
])
@@ -236,7 +237,8 @@ t.test('non-default env script', t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
@@ -258,30 +260,15 @@ t.test('try to run missing script', t => {
}),
})
t.test('no suggestions', async t => {
- await t.rejects(
- runScript.exec(['notevenclose']),
- 'Missing script: "notevenclose"'
- )
+ await t.rejects(runScript.exec(['notevenclose']), 'Missing script: "notevenclose"')
})
t.test('script suggestions', async t => {
- await t.rejects(
- runScript.exec(['helo']),
- /Missing script: "helo"/
- )
- await t.rejects(
- runScript.exec(['helo']),
- /npm run hello/
- )
+ await t.rejects(runScript.exec(['helo']), /Missing script: "helo"/)
+ await t.rejects(runScript.exec(['helo']), /npm run hello/)
})
t.test('bin suggestions', async t => {
- await t.rejects(
- runScript.exec(['goodneght']),
- /Missing script: "goodneght"/
- )
- await t.rejects(
- runScript.exec(['goodneght']),
- /npm exec goodnight/
- )
+ await t.rejects(runScript.exec(['goodneght']), /Missing script: "goodneght"/)
+ await t.rejects(runScript.exec(['goodneght']), /npm exec goodnight/)
})
t.test('with --if-present', async t => {
config['if-present'] = true
@@ -313,12 +300,14 @@ t.test('run pre/post hooks', async t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
env: 'env',
- } },
+ },
+ },
event: 'env',
},
{ event: 'postenv' },
@@ -348,14 +337,16 @@ t.test('skip pre/post hooks when using ignoreScripts', async t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
preenv: 'echo before the env',
postenv: 'echo after the env',
env: 'env',
- } },
+ },
+ },
banner: true,
event: 'env',
},
@@ -392,12 +383,14 @@ t.test('run silent', async t => {
scriptShell: undefined,
stdio: 'inherit',
stdioString: true,
- pkg: { name: 'x',
+ pkg: {
+ name: 'x',
version: '1.2.3',
_id: 'x@1.2.3',
scripts: {
env: 'env',
- } },
+ },
+ },
event: 'env',
banner: false,
},
@@ -426,16 +419,20 @@ t.test('list scripts', t => {
t.test('no args', async t => {
await runScript.exec([])
- t.strictSame(output, [
- ['Lifecycle scripts included in x@1.2.3:'],
- [' test\n exit 2'],
- [' start\n node server.js'],
- [' stop\n node kill-server.js'],
- ['\navailable via `npm run-script`:'],
- [' preenv\n echo before the env'],
- [' postenv\n echo after the env'],
- [''],
- ], 'basic report')
+ t.strictSame(
+ output,
+ [
+ ['Lifecycle scripts included in x@1.2.3:'],
+ [' test\n exit 2'],
+ [' start\n node server.js'],
+ [' stop\n node kill-server.js'],
+ ['\navailable via `npm run-script`:'],
+ [' preenv\n echo before the env'],
+ [' postenv\n echo after the env'],
+ [''],
+ ],
+ 'basic report'
+ )
})
t.test('silent', async t => {
@@ -646,32 +643,28 @@ t.test('workspaces', t => {
await runScript.execWorkspaces([], [])
t.strictSame(output, [
[
+ /* eslint-disable-next-line max-len */
'\u001b[1mScripts\u001b[22m available in \x1B[32ma@1.0.0\x1B[39m via `\x1B[34mnpm run-script\x1B[39m`:',
],
[' glorp\n \x1B[2mecho a doing the glerp glop\x1B[22m'],
[''],
[
+ /* eslint-disable-next-line max-len */
'\u001b[1mScripts\u001b[22m available in \x1B[32mb@2.0.0\x1B[39m via `\x1B[34mnpm run-script\x1B[39m`:',
],
[' glorp\n \x1B[2mecho b doing the glerp glop\x1B[22m'],
[''],
- [
- '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32mc@1.0.0\x1B[39m:',
- ],
+ ['\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32mc@1.0.0\x1B[39m:'],
[' test\n \x1B[2mexit 0\x1B[22m'],
[' posttest\n \x1B[2mecho posttest\x1B[22m'],
['\navailable via `\x1B[34mnpm run-script\x1B[39m`:'],
[' lorem\n \x1B[2mecho c lorem\x1B[22m'],
[''],
- [
- '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32md@1.0.0\x1B[39m:',
- ],
+ ['\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32md@1.0.0\x1B[39m:'],
[' test\n \x1B[2mexit 0\x1B[22m'],
[' posttest\n \x1B[2mecho posttest\x1B[22m'],
[''],
- [
- '\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32me\x1B[39m:',
- ],
+ ['\x1B[0m\x1B[1mLifecycle scripts\x1B[22m\x1B[0m included in \x1B[32me\x1B[39m:'],
[' test\n \x1B[2mexit 0\x1B[22m'],
[' start\n \x1B[2mecho start something\x1B[22m'],
[''],
@@ -684,27 +677,27 @@ t.test('workspaces', t => {
t.strictSame(output, [
[
'{\n' +
- ' "a": {\n' +
- ' "glorp": "echo a doing the glerp glop"\n' +
- ' },\n' +
- ' "b": {\n' +
- ' "glorp": "echo b doing the glerp glop"\n' +
- ' },\n' +
- ' "c": {\n' +
- ' "test": "exit 0",\n' +
- ' "posttest": "echo posttest",\n' +
- ' "lorem": "echo c lorem"\n' +
- ' },\n' +
- ' "d": {\n' +
- ' "test": "exit 0",\n' +
- ' "posttest": "echo posttest"\n' +
- ' },\n' +
- ' "e": {\n' +
- ' "test": "exit 0",\n' +
- ' "start": "echo start something"\n' +
- ' },\n' +
- ' "noscripts": {}\n' +
- '}',
+ ' "a": {\n' +
+ ' "glorp": "echo a doing the glerp glop"\n' +
+ ' },\n' +
+ ' "b": {\n' +
+ ' "glorp": "echo b doing the glerp glop"\n' +
+ ' },\n' +
+ ' "c": {\n' +
+ ' "test": "exit 0",\n' +
+ ' "posttest": "echo posttest",\n' +
+ ' "lorem": "echo c lorem"\n' +
+ ' },\n' +
+ ' "d": {\n' +
+ ' "test": "exit 0",\n' +
+ ' "posttest": "echo posttest"\n' +
+ ' },\n' +
+ ' "e": {\n' +
+ ' "test": "exit 0",\n' +
+ ' "start": "echo start something"\n' +
+ ' },\n' +
+ ' "noscripts": {}\n' +
+ '}',
],
])
})
@@ -765,7 +758,7 @@ t.test('workspaces', t => {
t.test('missing scripts in all workspaces', async t => {
const LOG = []
- npmlog.error = (err) => {
+ npmlog.error = err => {
LOG.push(String(err))
}
await t.rejects(
@@ -777,51 +770,60 @@ t.test('workspaces', t => {
process.exitCode = 0 // clean exit code
t.match(RUN_SCRIPTS, [])
- t.strictSame(LOG.map(cleanOutput), [
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: a@1.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/a',
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: b@2.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/b',
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: c@1.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/c',
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: d@1.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/d',
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: e',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/e',
- 'Lifecycle script `missing-script` failed with error:',
- 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: noscripts@1.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/noscripts',
- ], 'should log error msgs for each workspace script')
+ t.strictSame(
+ LOG.map(cleanOutput),
+ [
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: a@1.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/a',
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: b@2.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/b',
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: c@1.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/c',
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: d@1.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/d',
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: e',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/e',
+ 'Lifecycle script `missing-script` failed with error:',
+ 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: noscripts@1.0.0',
+ /* eslint-disable-next-line max-len */
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/noscripts',
+ ],
+ 'should log error msgs for each workspace script'
+ )
})
t.test('missing scripts in some workspaces', async t => {
const LOG = []
- npmlog.error = (err) => {
+ npmlog.error = err => {
LOG.push(String(err))
}
await runScript.execWorkspaces(['test'], ['a', 'b', 'c', 'd'])
t.match(RUN_SCRIPTS, [])
- t.strictSame(LOG.map(cleanOutput), [
- 'Lifecycle script `test` failed with error:',
- 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: a@1.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/a',
- 'Lifecycle script `test` failed with error:',
- 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run',
- ' in workspace: b@2.0.0',
- ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/b',
- ], 'should log error msgs for each workspace script')
+ t.strictSame(
+ LOG.map(cleanOutput),
+ [
+ 'Lifecycle script `test` failed with error:',
+ 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: a@1.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/a',
+ 'Lifecycle script `test` failed with error:',
+ 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run',
+ ' in workspace: b@2.0.0',
+ ' at location: {CWD}/test/lib/commands/tap-testdir-run-script-workspaces/packages/b',
+ ],
+ 'should log error msgs for each workspace script'
+ )
})
t.test('no workspaces when filtering by user args', async t => {
@@ -866,8 +868,9 @@ t.test('workspaces', t => {
t.test('failed workspace run with succeeded runs', async t => {
const RunScript = t.mock('../../../lib/commands/run-script.js', {
'@npmcli/run-script': async opts => {
- if (opts.pkg.name === 'a')
+ if (opts.pkg.name === 'a') {
throw new Error('ERR')
+ }
RUN_SCRIPTS.push(opts)
},
diff --git a/deps/npm/test/lib/commands/search.js b/deps/npm/test/lib/commands/search.js
index a58d5afb9d..c8dbc1b3b7 100644
--- a/deps/npm/test/lib/commands/search.js
+++ b/deps/npm/test/lib/commands/search.js
@@ -69,8 +69,9 @@ t.test('search <name>', async t => {
})
const search = new Search(npm)
- for (const i of libnpmsearchResultFixture)
+ for (const i of libnpmsearchResultFixture) {
src.write(i)
+ }
src.end()
@@ -96,8 +97,9 @@ t.test('search <name> --json', async t => {
})
const search = new Search(npm)
- for (const i of libnpmsearchResultFixture)
+ for (const i of libnpmsearchResultFixture) {
src.write(i)
+ }
src.end()
await search.exec(['libnpm'])
diff --git a/deps/npm/test/lib/commands/set-script.js b/deps/npm/test/lib/commands/set-script.js
index 0684ed3a24..592a2431c2 100644
--- a/deps/npm/test/lib/commands/set-script.js
+++ b/deps/npm/test/lib/commands/set-script.js
@@ -24,14 +24,14 @@ const setScript = new SetScript(npm)
t.test('completion', t => {
t.test('already have a script name', async t => {
npm.localPrefix = t.testdir({})
- const res = await setScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}})
+ const res = await setScript.completion({ conf: { argv: { remain: ['npm', 'run', 'x'] } } })
t.equal(res, undefined)
t.end()
})
t.test('no package.json', async t => {
npm.localPrefix = t.testdir({})
- const res = await setScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ const res = await setScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, [])
t.end()
})
@@ -40,7 +40,7 @@ t.test('completion', t => {
npm.localPrefix = t.testdir({
'package.json': JSON.stringify({}),
})
- const res = await setScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ const res = await setScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, [])
t.end()
})
@@ -51,7 +51,7 @@ t.test('completion', t => {
scripts: { hello: 'echo hello', world: 'echo world' },
}),
})
- const res = await setScript.completion({conf: {argv: {remain: ['npm', 'run']}}})
+ const res = await setScript.completion({ conf: { argv: { remain: ['npm', 'run'] } } })
t.strictSame(res, ['hello', 'world'])
t.end()
})
@@ -116,7 +116,7 @@ t.test('creates scripts object', async t => {
await setScript.exec(['arg1', 'arg2'])
const contents = fs.readFileSync(resolve(npm.localPrefix, 'package.json'))
- t.ok(parseJSON(contents), {scripts: {arg1: 'arg2'}})
+ t.ok(parseJSON(contents), { scripts: { arg1: 'arg2' } })
})
t.test('warns when overwriting', async t => {
diff --git a/deps/npm/test/lib/commands/set.js b/deps/npm/test/lib/commands/set.js
index f7d2841ea0..a57ea1a540 100644
--- a/deps/npm/test/lib/commands/set.js
+++ b/deps/npm/test/lib/commands/set.js
@@ -8,21 +8,25 @@ t.skip('npm set', async t => {
await npm.load()
t.test('no args', async t => {
- t.rejects(
- npm.exec('set', []),
- /Usage:/,
- 'prints usage'
- )
+ t.rejects(npm.exec('set', []), /Usage:/, 'prints usage')
})
t.test('test-config-item', async t => {
npm.localPrefix = t.testdir({})
- t.not(npm.config.get('test-config-item', 'project'), 'test config value', 'config is not already new value')
+ t.not(
+ npm.config.get('test-config-item', 'project'),
+ 'test config value',
+ 'config is not already new value'
+ )
// This will write to ~/.npmrc!
// Don't unskip until we can write to project level
await npm.exec('set', ['test-config-item=test config value'])
t.equal(joinedOutput(), '', 'outputs nothing')
- t.equal(npm.config.get('test-config-item', 'project'), 'test config value', 'config is set to new value')
+ t.equal(
+ npm.config.get('test-config-item', 'project'),
+ 'test config value',
+ 'config is set to new value'
+ )
})
})
@@ -31,8 +35,9 @@ t.skip('npm set', async t => {
let configArgs = null
const npm = {
exec: async (cmd, args) => {
- if (cmd === 'config')
+ if (cmd === 'config') {
configArgs = args
+ }
},
}
@@ -40,10 +45,7 @@ const Set = t.mock('../../../lib/commands/set.js')
const set = new Set(npm)
t.test('npm set - no args', async t => {
- await t.rejects(
- set.exec([]),
- set.usage
- )
+ await t.rejects(set.exec([]), set.usage)
})
t.test('npm set', async t => {
diff --git a/deps/npm/test/lib/commands/shrinkwrap.js b/deps/npm/test/lib/commands/shrinkwrap.js
index 112aa0a28a..db4021abd6 100644
--- a/deps/npm/test/lib/commands/shrinkwrap.js
+++ b/deps/npm/test/lib/commands/shrinkwrap.js
@@ -7,42 +7,40 @@ const { real: mockNpm } = require('../../fixtures/mock-npm')
// stringifying to remove escaped values like \\"
// This also doesn't reorder the keys of the object
// like tap does by default which is nice in this case
-t.formatSnapshot = (obj) => JSON.stringify(obj, (k, v) => {
- try {
- return JSON.parse(v)
- } catch (_) {}
- return v
-}, 2)
+t.formatSnapshot = obj =>
+ JSON.stringify(
+ obj,
+ (k, v) => {
+ try {
+ return JSON.parse(v)
+ } catch (_) {}
+ return v
+ },
+ 2
+ )
// Run shrinkwrap against a specified testdir with config items
// and make some assertions that should always be true. Sets
// the results on t.context for use in child tests
-const shrinkwrap = async (
- t,
- testdir = {},
- config = {},
- mocks = {}
-) => {
- const { Npm, logs } = mockNpm(t, mocks)
+const shrinkwrap = async (t, testdir = {}, config = {}, mocks = {}) => {
+ const { Npm, filteredLogs } = mockNpm(t, mocks)
const npm = new Npm()
await npm.load()
npm.localPrefix = t.testdir(testdir)
- if (config.lockfileVersion)
+ if (config.lockfileVersion) {
npm.config.set('lockfile-version', config.lockfileVersion)
- if (config.global)
+ }
+ if (config.global) {
npm.config.set('global', config.global)
+ }
await npm.exec('shrinkwrap', [])
const newFile = resolve(npm.localPrefix, 'npm-shrinkwrap.json')
const oldFile = resolve(npm.localPrefix, 'package-lock.json')
- const notices = logs
- .filter(([title]) => title === 'notice')
- .map(([,, msg]) => msg)
- const warnings = logs
- .filter(([title]) => title === 'warn')
- .map(([,, msg]) => msg)
+ const notices = filteredLogs('notice')
+ const warnings = filteredLogs('warn')
t.notOk(fs.existsSync(oldFile), 'package-lock is always deleted')
t.same(warnings, [], 'no warnings')
@@ -76,29 +74,29 @@ const shrinkwrapMatrix = async (t, file, assertions) => {
existingDir = { node_modules: { '.package-lock.json': existing } }
}
- await t.test('ancient', async (t) => {
+ await t.test('ancient', async t => {
await shrinkwrap(t, ancientDir)
t.match(t.context, assertions.ancient)
t.matchSnapshot(t.context)
})
- await t.test('ancient upgrade', async (t) => {
+ await t.test('ancient upgrade', async t => {
await shrinkwrap(t, ancientDir, upgrade)
t.match(t.context, assertions.ancientUpgrade)
t.matchSnapshot(t.context)
})
if (existingDir) {
- await t.test('existing', async (t) => {
+ await t.test('existing', async t => {
await shrinkwrap(t, existingDir)
t.match(t.context, assertions.existing)
t.matchSnapshot(t.context)
})
- await t.test('existing upgrade', async (t) => {
+ await t.test('existing upgrade', async t => {
await shrinkwrap(t, existingDir, upgrade)
t.match(t.context, assertions.existingUpgrade)
t.matchSnapshot(t.context)
})
- await t.test('existing downgrade', async (t) => {
+ await t.test('existing downgrade', async t => {
await shrinkwrap(t, existingDir, downgrade)
t.match(t.context, assertions.existingDowngrade)
t.matchSnapshot(t.context)
@@ -107,101 +105,116 @@ const shrinkwrapMatrix = async (t, file, assertions) => {
}
const NOTICES = {
- CREATED: (v = '') =>
- [`created a lockfile as npm-shrinkwrap.json${v && ` with version ${v}`}`],
- RENAMED: (v = '') =>
- [`package-lock.json has been renamed to npm-shrinkwrap.json${v && ` and updated to version ${v}`}`],
- UPDATED: (v = '') =>
- [`npm-shrinkwrap.json updated to version ${v}`],
- SAME: () =>
- [`npm-shrinkwrap.json up to date`],
+ CREATED: (v = '') => [`created a lockfile as npm-shrinkwrap.json${v && ` with version ${v}`}`],
+ RENAMED: (v = '') => [
+ `package-lock.json has been renamed to npm-shrinkwrap.json${
+ v && ` and updated to version ${v}`
+ }`,
+ ],
+ UPDATED: (v = '') => [`npm-shrinkwrap.json updated to version ${v}`],
+ SAME: () => [`npm-shrinkwrap.json up to date`],
}
-t.test('with nothing', t => shrinkwrapMatrix(t, null, {
- ancient: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.CREATED(2),
- },
- ancientUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.CREATED(3),
- },
-}))
-
-t.test('with package-lock.json', t => shrinkwrapMatrix(t, 'package-lock', {
- ancient: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.RENAMED(2),
- },
- ancientUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.RENAMED(3),
- },
- existing: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.RENAMED(),
- },
- existingUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.RENAMED(3),
- },
- existingDowngrade: {
- shrinkwrap: { lockfileVersion: 1 },
- logs: NOTICES.RENAMED(1),
- },
-}))
-
-t.test('with npm-shrinkwrap.json', t => shrinkwrapMatrix(t, 'npm-shrinkwrap', {
- ancient: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.UPDATED(2),
- },
- ancientUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.UPDATED(3),
- },
- existing: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.SAME(),
- },
- existingUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.UPDATED(3),
- },
- existingDowngrade: {
- shrinkwrap: { lockfileVersion: 1 },
- logs: NOTICES.UPDATED(1),
- },
-}))
-
-t.test('with hidden lockfile', t => shrinkwrapMatrix(t, 'hidden-lockfile', {
- ancient: {
- shrinkwrap: { lockfileVersion: 1 },
- logs: NOTICES.CREATED(),
- },
- ancientUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.CREATED(),
- },
- existing: {
- shrinkwrap: { lockfileVersion: 2 },
- logs: NOTICES.CREATED(),
- },
- existingUpgrade: {
- shrinkwrap: { lockfileVersion: 3 },
- logs: NOTICES.CREATED(3),
- },
- existingDowngrade: {
- shrinkwrap: { lockfileVersion: 1 },
- logs: NOTICES.CREATED(1),
- },
-}))
+t.test('with nothing', t =>
+ shrinkwrapMatrix(t, null, {
+ ancient: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.CREATED(2),
+ },
+ ancientUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.CREATED(3),
+ },
+ })
+)
+
+t.test('with package-lock.json', t =>
+ shrinkwrapMatrix(t, 'package-lock', {
+ ancient: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.RENAMED(2),
+ },
+ ancientUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.RENAMED(3),
+ },
+ existing: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.RENAMED(),
+ },
+ existingUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.RENAMED(3),
+ },
+ existingDowngrade: {
+ shrinkwrap: { lockfileVersion: 1 },
+ logs: NOTICES.RENAMED(1),
+ },
+ })
+)
+
+t.test('with npm-shrinkwrap.json', t =>
+ shrinkwrapMatrix(t, 'npm-shrinkwrap', {
+ ancient: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.UPDATED(2),
+ },
+ ancientUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.UPDATED(3),
+ },
+ existing: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.SAME(),
+ },
+ existingUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.UPDATED(3),
+ },
+ existingDowngrade: {
+ shrinkwrap: { lockfileVersion: 1 },
+ logs: NOTICES.UPDATED(1),
+ },
+ })
+)
+
+t.test('with hidden lockfile', t =>
+ shrinkwrapMatrix(t, 'hidden-lockfile', {
+ ancient: {
+ shrinkwrap: { lockfileVersion: 1 },
+ logs: NOTICES.CREATED(),
+ },
+ ancientUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.CREATED(),
+ },
+ existing: {
+ shrinkwrap: { lockfileVersion: 2 },
+ logs: NOTICES.CREATED(),
+ },
+ existingUpgrade: {
+ shrinkwrap: { lockfileVersion: 3 },
+ logs: NOTICES.CREATED(3),
+ },
+ existingDowngrade: {
+ shrinkwrap: { lockfileVersion: 1 },
+ logs: NOTICES.CREATED(1),
+ },
+ })
+)
t.test('throws in global mode', async t => {
- t.rejects(shrinkwrap(t, {}, {
- global: true,
- }), {
- message: '`npm shrinkwrap` does not work for global packages',
- code: 'ESHRINKWRAPGLOBAL',
- })
+ t.rejects(
+ shrinkwrap(
+ t,
+ {},
+ {
+ global: true,
+ }
+ ),
+ {
+ message: '`npm shrinkwrap` does not work for global packages',
+ code: 'ESHRINKWRAPGLOBAL',
+ }
+ )
})
diff --git a/deps/npm/test/lib/commands/team.js b/deps/npm/test/lib/commands/team.js
index c374d15d80..96260835fa 100644
--- a/deps/npm/test/lib/commands/team.js
+++ b/deps/npm/test/lib/commands/team.js
@@ -388,8 +388,8 @@ t.test('completion', t => {
})
t.test('npm team unknown subcommand autocomplete', async t => {
- t.rejects(completion({conf: {argv: {remain: ['npm', 'team', 'missing-subcommand'] } } }),
- {message: 'missing-subcommand not recognized'}, 'should throw a a not recognized error'
+ t.rejects(completion({ conf: { argv: { remain: ['npm', 'team', 'missing-subcommand'] } } }),
+ { message: 'missing-subcommand not recognized' }, 'should throw a a not recognized error'
)
t.end()
diff --git a/deps/npm/test/lib/commands/token.js b/deps/npm/test/lib/commands/token.js
index c598c366cf..6d0dc9d7e0 100644
--- a/deps/npm/test/lib/commands/token.js
+++ b/deps/npm/test/lib/commands/token.js
@@ -21,16 +21,17 @@ const Token = t.mock('../../../lib/commands/token.js', {
const token = new Token(npm)
-const tokenWithMocks = (mockRequests) => {
+const tokenWithMocks = mockRequests => {
for (const mod in mockRequests) {
- if (mod === 'npm')
+ if (mod === 'npm') {
mockRequests.npm = { ...npm, ...mockRequests.npm }
- else {
- if (typeof mockRequests[mod] === 'function')
+ } else {
+ if (typeof mockRequests[mod] === 'function') {
mocks[mod] = mockRequests[mod]
- else {
- for (const key in mockRequests[mod])
+ } else {
+ for (const key in mockRequests[mod]) {
mocks[mod][key] = mockRequests[mod][key]
+ }
}
}
}
@@ -38,11 +39,12 @@ const tokenWithMocks = (mockRequests) => {
const reset = () => {
for (const mod in mockRequests) {
if (mod !== 'npm') {
- if (typeof mockRequests[mod] === 'function')
+ if (typeof mockRequests[mod] === 'function') {
mocks[mod] = () => {}
- else {
- for (const key in mockRequests[mod])
+ } else {
+ for (const key in mockRequests[mod]) {
delete mocks[mod][key]
+ }
}
}
}
@@ -52,7 +54,7 @@ const tokenWithMocks = (mockRequests) => {
return [token, reset]
}
-t.test('completion', (t) => {
+t.test('completion', t => {
t.plan(5)
const testComp = (argv, expect) => {
@@ -64,10 +66,9 @@ t.test('completion', (t) => {
testComp(['npm', 'token', 'revoke'], [])
testComp(['npm', 'token', 'create'], [])
- t.rejects(
- token.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }),
- { message: 'foobar not recognize' }
- )
+ t.rejects(token.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }), {
+ message: 'foobar not recognize',
+ })
})
t.test('token foobar', async t => {
@@ -76,7 +77,7 @@ t.test('token foobar', async t => {
const [, reset] = tokenWithMocks({
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'shows a gauge')
},
},
@@ -85,51 +86,51 @@ t.test('token foobar', async t => {
t.teardown(reset)
- await t.rejects(
- token.exec(['foobar']),
- /foobar is not a recognized subcommand/
- )
+ await t.rejects(token.exec(['foobar']), /foobar is not a recognized subcommand/)
})
t.test('token list', async t => {
t.plan(14)
const now = new Date().toISOString()
- const tokens = [{
- key: 'abcd1234abcd1234',
- token: 'efgh5678efgh5678',
- cidr_whitelist: null,
- readonly: false,
- created: now,
- updated: now,
- }, {
- key: 'abcd1256',
- token: 'hgfe8765',
- cidr_whitelist: ['192.168.1.1/32'],
- readonly: true,
- created: now,
- updated: now,
- }]
+ const tokens = [
+ {
+ key: 'abcd1234abcd1234',
+ token: 'efgh5678efgh5678',
+ cidr_whitelist: null,
+ readonly: false,
+ created: now,
+ updated: now,
+ },
+ {
+ key: 'abcd1256',
+ token: 'hgfe8765',
+ cidr_whitelist: ['192.168.1.1/32'],
+ readonly: true,
+ created: now,
+ updated: now,
+ },
+ ]
const [token, reset] = tokenWithMocks({
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', otp: '123456' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
},
},
profile: {
- listTokens: (conf) => {
+ listTokens: conf => {
t.same(conf.auth, { token: 'thisisnotarealtoken', otp: '123456' })
return tokens
},
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token')
},
},
@@ -138,7 +139,7 @@ t.test('token list', async t => {
t.equal(msg, 'getting list')
},
},
- output: (spec) => {
+ output: spec => {
const lines = spec.split(/\r?\n/)
t.match(lines[3], ' abcd123 ', 'includes the trimmed key')
t.match(lines[3], ' efgh56… ', 'includes the trimmed token')
@@ -161,34 +162,40 @@ t.test('token list json output', async t => {
t.plan(7)
const now = new Date().toISOString()
- const tokens = [{
- key: 'abcd1234abcd1234',
- token: 'efgh5678efgh5678',
- cidr_whitelist: null,
- readonly: false,
- created: now,
- updated: now,
- }]
+ const tokens = [
+ {
+ key: 'abcd1234abcd1234',
+ token: 'efgh5678efgh5678',
+ cidr_whitelist: null,
+ readonly: false,
+ created: now,
+ updated: now,
+ },
+ ]
const [token, reset] = tokenWithMocks({
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', json: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { username: 'foo', password: 'bar' }
},
},
},
profile: {
- listTokens: (conf) => {
- t.same(conf.auth, { basic: { username: 'foo', password: 'bar' } }, 'passes the correct auth')
+ listTokens: conf => {
+ t.same(
+ conf.auth,
+ { basic: { username: 'foo', password: 'bar' } },
+ 'passes the correct auth'
+ )
return tokens
},
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token')
},
},
@@ -197,7 +204,7 @@ t.test('token list json output', async t => {
t.equal(msg, 'getting list')
},
},
- output: (spec) => {
+ output: spec => {
t.type(spec, 'string', 'is called with a string')
const parsed = JSON.parse(spec)
t.match(parsed, tokens, 'prints the json parsed tokens')
@@ -213,21 +220,24 @@ t.test('token list parseable output', async t => {
t.plan(11)
const now = new Date().toISOString()
- const tokens = [{
- key: 'abcd1234abcd1234',
- token: 'efgh5678efgh5678',
- cidr_whitelist: null,
- readonly: false,
- created: now,
- updated: now,
- }, {
- key: 'efgh5678ijkl9101',
- token: 'hgfe8765',
- cidr_whitelist: ['192.168.1.1/32'],
- readonly: true,
- created: now,
- updated: now,
- }]
+ const tokens = [
+ {
+ key: 'abcd1234abcd1234',
+ token: 'efgh5678efgh5678',
+ cidr_whitelist: null,
+ readonly: false,
+ created: now,
+ updated: now,
+ },
+ {
+ key: 'efgh5678ijkl9101',
+ token: 'hgfe8765',
+ cidr_whitelist: ['192.168.1.1/32'],
+ readonly: true,
+ created: now,
+ updated: now,
+ },
+ ]
let callCount = 0
@@ -235,21 +245,25 @@ t.test('token list parseable output', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', parseable: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { auth: Buffer.from('foo:bar').toString('base64') }
},
},
},
profile: {
- listTokens: (conf) => {
- t.same(conf.auth, { basic: { username: 'foo', password: 'bar' } }, 'passes the correct auth')
+ listTokens: conf => {
+ t.same(
+ conf.auth,
+ { basic: { username: 'foo', password: 'bar' } },
+ 'passes the correct auth'
+ )
return tokens
},
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token')
},
},
@@ -258,15 +272,34 @@ t.test('token list parseable output', async t => {
t.equal(msg, 'getting list')
},
},
- output: (spec) => {
+ output: spec => {
++callCount
t.type(spec, 'string', 'is called with a string')
- if (callCount === 1)
- t.equal(spec, ['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t'), 'prints header')
- else if (callCount === 2)
- t.equal(spec, [tokens[0].key, tokens[0].token, tokens[0].created, tokens[0].readonly, ''].join('\t'), 'prints token info')
- else
- t.equal(spec, [tokens[1].key, tokens[1].token, tokens[1].created, tokens[1].readonly, tokens[1].cidr_whitelist.join(',')].join('\t'), 'prints token info')
+ if (callCount === 1) {
+ t.equal(
+ spec,
+ ['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t'),
+ 'prints header'
+ )
+ } else if (callCount === 2) {
+ t.equal(
+ spec,
+ [tokens[0].key, tokens[0].token, tokens[0].created, tokens[0].readonly, ''].join('\t'),
+ 'prints token info'
+ )
+ } else {
+ t.equal(
+ spec,
+ [
+ tokens[1].key,
+ tokens[1].token,
+ tokens[1].created,
+ tokens[1].readonly,
+ tokens[1].cidr_whitelist.join(','),
+ ].join('\t'),
+ 'prints token info'
+ )
+ }
},
})
@@ -282,7 +315,7 @@ t.test('token revoke', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return {}
},
@@ -290,7 +323,7 @@ t.test('token revoke', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -306,17 +339,15 @@ t.test('token revoke', async t => {
},
},
profile: {
- listTokens: (conf) => {
+ listTokens: conf => {
t.same(conf.auth, {}, 'passes the correct empty auth')
- return Promise.resolve([
- { key: 'abcd1234' },
- ])
+ return Promise.resolve([{ key: 'abcd1234' }])
},
- removeToken: (key) => {
+ removeToken: key => {
t.equal(key, 'abcd1234', 'deletes the correct token')
},
},
- output: (spec) => {
+ output: spec => {
t.equal(spec, 'Removed 1 token')
},
})
@@ -333,7 +364,7 @@ t.test('token revoke multiple tokens', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -341,7 +372,7 @@ t.test('token revoke multiple tokens', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -357,16 +388,13 @@ t.test('token revoke multiple tokens', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234' },
- { key: 'efgh5678' },
- ]),
- removeToken: (key) => {
+ listTokens: () => Promise.resolve([{ key: 'abcd1234' }, { key: 'efgh5678' }]),
+ removeToken: key => {
// this will run twice
t.ok(['abcd1234', 'efgh5678'].includes(key), 'deletes the correct token')
},
},
- output: (spec) => {
+ output: spec => {
t.equal(spec, 'Removed 2 tokens')
},
})
@@ -383,7 +411,7 @@ t.test('token revoke json output', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', json: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -391,7 +419,7 @@ t.test('token revoke json output', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -407,14 +435,12 @@ t.test('token revoke json output', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234' },
- ]),
- removeToken: (key) => {
+ listTokens: () => Promise.resolve([{ key: 'abcd1234' }]),
+ removeToken: key => {
t.equal(key, 'abcd1234', 'deletes the correct token')
},
},
- output: (spec) => {
+ output: spec => {
t.type(spec, 'string', 'is given a string')
const parsed = JSON.parse(spec)
t.same(parsed, ['abcd1234'], 'logs the token as json')
@@ -433,7 +459,7 @@ t.test('token revoke parseable output', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', parseable: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -441,7 +467,7 @@ t.test('token revoke parseable output', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -457,14 +483,12 @@ t.test('token revoke parseable output', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234' },
- ]),
- removeToken: (key) => {
+ listTokens: () => Promise.resolve([{ key: 'abcd1234' }]),
+ removeToken: key => {
t.equal(key, 'abcd1234', 'deletes the correct token')
},
},
- output: (spec) => {
+ output: spec => {
t.equal(spec, 'abcd1234', 'logs the token as a string')
},
})
@@ -481,7 +505,7 @@ t.test('token revoke by token', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -489,7 +513,7 @@ t.test('token revoke by token', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -505,14 +529,12 @@ t.test('token revoke by token', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234', token: 'efgh5678' },
- ]),
- removeToken: (key) => {
+ listTokens: () => Promise.resolve([{ key: 'abcd1234', token: 'efgh5678' }]),
+ removeToken: key => {
t.equal(key, 'efgh5678', 'passes through user input')
},
},
- output: (spec) => {
+ output: spec => {
t.equal(spec, 'Removed 1 token')
},
})
@@ -528,7 +550,7 @@ t.test('token revoke requires an id', async t => {
const [token, reset] = tokenWithMocks({
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token')
},
},
@@ -537,10 +559,7 @@ t.test('token revoke requires an id', async t => {
t.teardown(reset)
- await t.rejects(
- token.exec(['rm']),
- /`<tokenKey>` argument is required/
- )
+ await t.rejects(token.exec(['rm']), /`<tokenKey>` argument is required/)
})
t.test('token revoke ambiguous id errors', async t => {
@@ -550,7 +569,7 @@ t.test('token revoke ambiguous id errors', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -558,7 +577,7 @@ t.test('token revoke ambiguous id errors', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -574,19 +593,13 @@ t.test('token revoke ambiguous id errors', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234' },
- { key: 'abcd5678' },
- ]),
+ listTokens: () => Promise.resolve([{ key: 'abcd1234' }, { key: 'abcd5678' }]),
},
})
t.teardown(reset)
- await t.rejects(
- token.exec(['rm', 'abcd']),
- /Token ID "abcd" was ambiguous/
- )
+ await t.rejects(token.exec(['rm', 'abcd']), /Token ID "abcd" was ambiguous/)
})
t.test('token revoke unknown id errors', async t => {
@@ -596,7 +609,7 @@ t.test('token revoke unknown id errors', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -604,7 +617,7 @@ t.test('token revoke unknown id errors', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -620,18 +633,13 @@ t.test('token revoke unknown id errors', async t => {
},
},
profile: {
- listTokens: () => Promise.resolve([
- { key: 'abcd1234' },
- ]),
+ listTokens: () => Promise.resolve([{ key: 'abcd1234' }]),
},
})
t.teardown(reset)
- await t.rejects(
- token.exec(['rm', 'efgh']),
- /Unknown token id or value "efgh"./
- )
+ await t.rejects(token.exec(['rm', 'efgh']), /Unknown token id or value "efgh"./)
})
t.test('token create', async t => {
@@ -642,9 +650,12 @@ t.test('token create', async t => {
const [token, reset] = tokenWithMocks({
npm: {
- flatOptions: { registry: 'https://registry.npmjs.org', cidr: ['10.0.0.0/8', '192.168.1.0/24'] },
+ flatOptions: {
+ registry: 'https://registry.npmjs.org',
+ cidr: ['10.0.0.0/8', '192.168.1.0/24'],
+ },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -652,7 +663,7 @@ t.test('token create', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -679,7 +690,7 @@ t.test('token create', async t => {
}
},
},
- output: (spec) => {
+ output: spec => {
const lines = spec.split(/\r?\n/)
t.match(lines[1], 'token')
t.match(lines[1], 'efgh5678', 'prints the whole token')
@@ -706,7 +717,7 @@ t.test('token create json output', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', json: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -714,7 +725,7 @@ t.test('token create json output', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -741,10 +752,14 @@ t.test('token create json output', async t => {
}
},
},
- output: (spec) => {
+ output: spec => {
t.type(spec, 'string', 'outputs a string')
const parsed = JSON.parse(spec)
- t.same(parsed, { token: 'efgh5678', created: now, readonly: false, cidr_whitelist: [] }, 'outputs the correct object')
+ t.same(
+ parsed,
+ { token: 'efgh5678', created: now, readonly: false, cidr_whitelist: [] },
+ 'outputs the correct object'
+ )
},
})
@@ -764,7 +779,7 @@ t.test('token create parseable output', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', parseable: true },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -772,7 +787,7 @@ t.test('token create parseable output', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -799,16 +814,17 @@ t.test('token create parseable output', async t => {
}
},
},
- output: (spec) => {
+ output: spec => {
++callCount
- if (callCount === 1)
+ if (callCount === 1) {
t.match(spec, 'token\tefgh5678', 'prints the token')
- else if (callCount === 2)
+ } else if (callCount === 2) {
t.match(spec, `created\t${now}`, 'prints the created timestamp')
- else if (callCount === 3)
+ } else if (callCount === 3) {
t.match(spec, 'readonly\tfalse', 'prints the readonly flag')
- else
+ } else {
t.match(spec, 'cidr_whitelist\t', 'prints the cidr whitelist')
+ }
},
})
@@ -826,7 +842,7 @@ t.test('token create ipv6 cidr', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', cidr: '::1/128' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -834,7 +850,7 @@ t.test('token create ipv6 cidr', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
@@ -848,7 +864,10 @@ t.test('token create ipv6 cidr', async t => {
await t.rejects(
token.exec(['create']),
- { code: 'EINVALIDCIDR', message: /CIDR whitelist can only contain IPv4 addresses, ::1\/128 is IPv6/ },
+ {
+ code: 'EINVALIDCIDR',
+ message: /CIDR whitelist can only contain IPv4 addresses, ::1\/128 is IPv6/,
+ },
'returns correct error'
)
})
@@ -862,7 +881,7 @@ t.test('token create invalid cidr', async t => {
npm: {
flatOptions: { registry: 'https://registry.npmjs.org', cidr: 'apple/cider' },
config: {
- getCredentialsByURI: (uri) => {
+ getCredentialsByURI: uri => {
t.equal(uri, 'https://registry.npmjs.org', 'requests correct registry')
return { token: 'thisisnotarealtoken' }
},
@@ -870,7 +889,7 @@ t.test('token create invalid cidr', async t => {
},
log: {
gauge: {
- show: (name) => {
+ show: name => {
t.equal(name, 'token', 'starts a gauge')
},
},
diff --git a/deps/npm/test/lib/commands/unpublish.js b/deps/npm/test/lib/commands/unpublish.js
index 7e6b5755c7..6ac2067531 100644
--- a/deps/npm/test/lib/commands/unpublish.js
+++ b/deps/npm/test/lib/commands/unpublish.js
@@ -150,10 +150,11 @@ t.test('unpublish <pkg>@version', async t => {
npm.log = {
silly (title, key, value) {
t.equal(title, 'unpublish', 'should silly log args')
- if (key === 'spec')
+ if (key === 'spec') {
t.match(value, { name: 'pkg', rawSpec: '1.0.0' })
- else
+ } else {
t.equal(value, 'pkg@1.0.0', 'should log originally passed arg')
+ }
},
}
@@ -337,7 +338,7 @@ t.test('completion', async t => {
const testComp =
async (t, { unpublish, argv, partialWord, expect, title }) => {
const res = await unpublish.completion(
- {conf: {argv: {remain: argv}}, partialWord}
+ { conf: { argv: { remain: argv } }, partialWord }
)
t.strictSame(res, expect, title || argv.join(' '))
}
diff --git a/deps/npm/test/lib/commands/version.js b/deps/npm/test/lib/commands/version.js
index 3b3f76f759..6603b58106 100644
--- a/deps/npm/test/lib/commands/version.js
+++ b/deps/npm/test/lib/commands/version.js
@@ -14,8 +14,9 @@ const npm = mockNpm({
prefix: '',
version: '1.0.0',
output: (...msg) => {
- for (const m of msg)
+ for (const m of msg) {
result.push(m)
+ }
},
})
const mocks = {
@@ -47,11 +48,13 @@ t.test('no args', async t => {
t.same(
result,
- [{
- 'test-version-no-args': '3.2.1',
- node: '1.0.0',
- npm: '1.0.0',
- }],
+ [
+ {
+ 'test-version-no-args': '3.2.1',
+ node: '1.0.0',
+ npm: '1.0.0',
+ },
+ ],
'should output expected values for various versions in npm'
)
})
@@ -70,16 +73,10 @@ t.test('completion', async t => {
t.strictSame(res, expect, argv.join(' '))
}
- await testComp(['npm', 'version'], [
- 'major',
- 'minor',
- 'patch',
- 'premajor',
- 'preminor',
- 'prepatch',
- 'prerelease',
- 'from-git',
- ])
+ await testComp(
+ ['npm', 'version'],
+ ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease', 'from-git']
+ )
await testComp(['npm', 'version', 'major'], [])
t.end()
@@ -93,10 +90,12 @@ t.test('failure reading package.json', async t => {
t.same(
result,
- [{
- npm: '1.0.0',
- node: '1.0.0',
- }],
+ [
+ {
+ npm: '1.0.0',
+ node: '1.0.0',
+ },
+ ],
'should not have package name on returning object'
)
})
@@ -108,11 +107,7 @@ t.test('--json option', async t => {
Object.defineProperty(process, 'versions', { value: {} })
await version.exec([])
- t.same(
- result,
- ['{\n "npm": "1.0.0"\n}'],
- 'should return json stringified result'
- )
+ t.same(result, ['{\n "npm": "1.0.0"\n}'], 'should return json stringified result')
})
t.test('with one arg', async t => {
@@ -144,11 +139,15 @@ t.test('workspaces', async t => {
t.test('no args, all workspaces', async t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'workspaces-test',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b'],
- }, null, 2),
+ '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',
@@ -166,21 +165,31 @@ t.test('workspaces', async t => {
npm.prefix = testDir
const version = new Version(npm)
await version.execWorkspaces([], [])
- t.same(result, [{
- 'workspaces-test': '1.0.0',
- 'workspace-a': '1.0.0',
- 'workspace-b': '1.0.0',
- npm: '1.0.0',
- }], 'outputs includes main package and workspace versions')
+ t.same(
+ result,
+ [
+ {
+ 'workspaces-test': '1.0.0',
+ 'workspace-a': '1.0.0',
+ 'workspace-b': '1.0.0',
+ npm: '1.0.0',
+ },
+ ],
+ 'outputs includes main package and workspace versions'
+ )
})
t.test('no args, single workspaces', async t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'workspaces-test',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b'],
- }, null, 2),
+ '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',
@@ -198,20 +207,30 @@ t.test('workspaces', async t => {
npm.prefix = testDir
const version = new Version(npm)
await version.execWorkspaces([], ['workspace-a'])
- t.same(result, [{
- 'workspaces-test': '1.0.0',
- 'workspace-a': '1.0.0',
- npm: '1.0.0',
- }], 'outputs includes main package and requested workspace versions')
+ t.same(
+ result,
+ [
+ {
+ 'workspaces-test': '1.0.0',
+ 'workspace-a': '1.0.0',
+ npm: '1.0.0',
+ },
+ ],
+ 'outputs includes main package and requested workspace versions'
+ )
})
t.test('no args, all workspaces, workspace with missing name or version', async t => {
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'workspaces-test',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
- }, null, 2),
+ 'package.json': JSON.stringify(
+ {
+ name: 'workspaces-test',
+ version: '1.0.0',
+ workspaces: ['workspace-a', 'workspace-b', 'workspace-c'],
+ },
+ null,
+ 2
+ ),
'workspace-a': {
'package.json': JSON.stringify({
name: 'workspace-a',
@@ -233,21 +252,31 @@ t.test('workspaces', async t => {
npm.prefix = testDir
const version = new Version(npm)
await version.execWorkspaces([], [])
- t.same(result, [{
- 'workspaces-test': '1.0.0',
- 'workspace-a': '1.0.0',
- npm: '1.0.0',
- }], 'outputs includes main package and valid workspace versions')
+ t.same(
+ result,
+ [
+ {
+ 'workspaces-test': '1.0.0',
+ 'workspace-a': '1.0.0',
+ npm: '1.0.0',
+ },
+ ],
+ 'outputs includes main package and valid workspace versions'
+ )
})
t.test('with one arg, all workspaces', async t => {
const libNpmVersionArgs = []
const testDir = t.testdir({
- 'package.json': JSON.stringify({
- name: 'workspaces-test',
- version: '1.0.0',
- workspaces: ['workspace-a', 'workspace-b'],
- }, null, 2),
+ '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',
@@ -273,7 +302,11 @@ t.test('workspaces', async t => {
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.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.test('too many args', async t => {
diff --git a/deps/npm/test/lib/commands/view.js b/deps/npm/test/lib/commands/view.js
index 116930aff4..728787ec4a 100644
--- a/deps/npm/test/lib/commands/view.js
+++ b/deps/npm/test/lib/commands/view.js
@@ -21,11 +21,13 @@ const cleanLogs = () => {
const yesterday = new Date(Date.now() - 1000 * 60 * 60 * 25)
const packument = (nv, opts) => {
- if (!opts.fullMetadata)
+ if (!opts.fullMetadata) {
throw new Error('must fetch fullMetadata')
+ }
- if (!opts.preferOnline)
+ if (!opts.preferOnline) {
throw new Error('must fetch with preferOnline')
+ }
const mocks = {
red: {
@@ -192,8 +194,9 @@ const packument = (nv, opts) => {
license: {},
dependencies: (() => {
const deps = {}
- for (let i = 0; i < 25; i++)
+ for (let i = 0; i < 25; i++) {
deps[i] = '1.0.0'
+ }
return deps
})(),
@@ -255,8 +258,9 @@ const packument = (nv, opts) => {
},
},
}
- if (nv.type === 'git')
+ if (nv.type === 'git') {
return mocks[nv.hosted.project]
+ }
return mocks[nv.name]
}
@@ -528,7 +532,7 @@ t.test('throws when unpublished', async t => {
const view = new View(npm)
await t.rejects(
view.exec(['red']),
- { code: 'E404'}
+ { code: 'E404' }
)
})
@@ -654,7 +658,7 @@ t.test('no registry completion', async t => {
},
})
const view = new View(npm)
- const res = await view.completion({conf: { argv: { remain: ['npm', 'view'] } } })
+ const res = await view.completion({ conf: { argv: { remain: ['npm', 'view'] } } })
t.notOk(res, 'there is no package completion')
t.end()
})
diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js
index e9d61f9c1f..f813e50b22 100644
--- a/deps/npm/test/lib/load-all-commands.js
+++ b/deps/npm/test/lib/load-all-commands.js
@@ -20,12 +20,17 @@ t.test('load each command', async t => {
for (const cmd of cmdList.sort((a, b) => a.localeCompare(b, 'en'))) {
t.test(cmd, async t => {
const impl = await npm.cmd(cmd)
- if (impl.completion)
+ if (impl.completion) {
t.type(impl.completion, 'function', 'completion, if present, is a function')
+ }
t.type(impl.exec, 'function', 'implementation has an exec function')
t.type(impl.execWorkspaces, 'function', 'implementation has an execWorkspaces function')
t.equal(util.inspect(impl.exec), '[AsyncFunction: exec]', 'exec function is async')
- t.equal(util.inspect(impl.execWorkspaces), '[AsyncFunction: execWorkspaces]', 'execWorkspaces function is async')
+ t.equal(
+ util.inspect(impl.execWorkspaces),
+ '[AsyncFunction: execWorkspaces]',
+ 'execWorkspaces function is async'
+ )
t.ok(impl.description, 'implementation has a description')
t.ok(impl.name, 'implementation has a name')
t.match(impl.usage, cmd, 'usage contains the command')
diff --git a/deps/npm/test/lib/load-all.js b/deps/npm/test/lib/load-all.js
index b6b2b6adc4..fb45331ba9 100644
--- a/deps/npm/test/lib/load-all.js
+++ b/deps/npm/test/lib/load-all.js
@@ -5,9 +5,9 @@ const { real: mockNpm } = require('../fixtures/mock-npm')
const full = process.env.npm_lifecycle_event === 'check-coverage'
-if (!full)
+if (!full) {
t.pass('nothing to do here, not checking for full coverage')
-else {
+} else {
const { Npm } = mockNpm(t)
const npm = new Npm()
diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js
index dc9640c062..1ccd26e375 100644
--- a/deps/npm/test/lib/npm.js
+++ b/deps/npm/test/lib/npm.js
@@ -18,8 +18,9 @@ for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) {
['test', 'run-script'].some(i => i === event),
'should match "npm test" or "npm run test"'
)
- } else
+ } else {
t.match(process.env[env], /^(run-script|exec)$/)
+ }
}
delete process.env[env]
}
@@ -42,8 +43,9 @@ const bePosix = () => {
const argv = [...process.argv]
t.afterEach(() => {
- for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e)))
+ for (const env of Object.keys(process.env).filter(e => /^npm_/.test(e))) {
delete process.env[env]
+ }
process.env.npm_config_cache = CACHE
process.argv = argv
Object.defineProperty(process, 'platform', {
diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js
index 15b43715f4..f6813a8bc0 100644
--- a/deps/npm/test/lib/utils/config/definitions.js
+++ b/deps/npm/test/lib/utils/config/definitions.js
@@ -19,8 +19,9 @@ const definitions = require(defpath)
// Tie the definitions to a snapshot so that if they change we are forced to
// update snapshots, which rebuilds the docs
-for (const key of Object.keys(definitions))
+for (const key of Object.keys(definitions)) {
t.matchSnapshot(definitions[key].describe(), `config description for ${key}`)
+}
const isWin = '../../../../lib/utils/is-windows.js'
@@ -184,7 +185,7 @@ t.test('cache', t => {
const flat = {}
defsNix.cache.flatten('cache', { cache: '/some/cache/value' }, flat)
- const {join} = require('path')
+ const { join } = require('path')
t.equal(flat.cache, join('/some/cache/value', '_cacache'))
t.equal(flat.npxCache, join('/some/cache/value', '_npx'))
@@ -199,8 +200,8 @@ t.test('flatteners that populate flat.omit array', t => {
// ignored if setting is not dev or development
obj.also = 'ignored'
definitions.also.flatten('also', obj, flat)
- t.strictSame(obj, {also: 'ignored', omit: [], include: []}, 'nothing done')
- t.strictSame(flat, {omit: []}, 'nothing done')
+ t.strictSame(obj, { also: 'ignored', omit: [], include: [] }, 'nothing done')
+ t.strictSame(flat, { omit: [] }, 'nothing done')
obj.also = 'development'
definitions.also.flatten('also', obj, flat)
@@ -227,10 +228,10 @@ t.test('flatteners that populate flat.omit array', t => {
const flat = {}
const obj = { include: ['dev'] }
definitions.include.flatten('include', obj, flat)
- t.strictSame(flat, {omit: []}, 'not omitting anything')
+ t.strictSame(flat, { omit: [] }, 'not omitting anything')
obj.omit = ['optional', 'dev']
definitions.include.flatten('include', obj, flat)
- t.strictSame(flat, {omit: ['optional']}, 'only omitting optional')
+ t.strictSame(flat, { omit: ['optional'] }, 'only omitting optional')
t.end()
})
@@ -254,12 +255,12 @@ t.test('flatteners that populate flat.omit array', t => {
obj.only = 'prod'
definitions.only.flatten('only', obj, flat)
- t.strictSame(flat, {omit: ['dev']}, 'omit dev when --only=prod')
+ t.strictSame(flat, { omit: ['dev'] }, 'omit dev when --only=prod')
obj.include = ['dev']
flat.omit = []
definitions.only.flatten('only', obj, flat)
- t.strictSame(flat, {omit: []}, 'do not omit when included')
+ t.strictSame(flat, { omit: [] }, 'do not omit when included')
t.end()
})
@@ -283,7 +284,7 @@ t.test('flatteners that populate flat.omit array', t => {
optional: true,
include: ['optional'],
}, 'include optional when set')
- t.strictSame(flat, {omit: []}, 'nothing to omit in flatOptions')
+ t.strictSame(flat, { omit: [] }, 'nothing to omit in flatOptions')
delete obj.include
obj.optional = false
@@ -293,21 +294,21 @@ t.test('flatteners that populate flat.omit array', t => {
optional: false,
include: [],
}, 'omit optional when set false')
- t.strictSame(flat, {omit: ['optional']}, 'omit optional when set false')
+ t.strictSame(flat, { omit: ['optional'] }, 'omit optional when set false')
t.end()
})
t.test('production', t => {
const flat = {}
- const obj = {production: true}
+ const obj = { production: true }
definitions.production.flatten('production', obj, flat)
t.strictSame(obj, {
production: true,
omit: ['dev'],
include: [],
}, '--production sets --omit=dev')
- t.strictSame(flat, {omit: ['dev']}, '--production sets --omit=dev')
+ t.strictSame(flat, { omit: ['dev'] }, '--production sets --omit=dev')
delete obj.omit
obj.production = false
@@ -328,14 +329,14 @@ t.test('flatteners that populate flat.omit array', t => {
include: ['dev'],
omit: [],
}, 'omit and include dev')
- t.strictSame(flat, {omit: []}, 'do not omit dev when included')
+ t.strictSame(flat, { omit: [] }, 'do not omit dev when included')
t.end()
})
t.test('dev', t => {
const flat = {}
- const obj = {dev: true}
+ const obj = { dev: true }
definitions.dev.flatten('dev', obj, flat)
t.strictSame(obj, {
dev: true,
@@ -355,7 +356,7 @@ t.test('cache-max', t => {
t.strictSame(flat, {}, 'no effect if not <= 0')
obj['cache-max'] = 0
definitions['cache-max'].flatten('cache-max', obj, flat)
- t.strictSame(flat, {preferOnline: true}, 'preferOnline if <= 0')
+ t.strictSame(flat, { preferOnline: true }, 'preferOnline if <= 0')
t.end()
})
@@ -366,7 +367,7 @@ t.test('cache-min', t => {
t.strictSame(flat, {}, 'no effect if not >= 9999')
obj['cache-min'] = 9999
definitions['cache-min'].flatten('cache-min', obj, flat)
- t.strictSame(flat, {preferOffline: true}, 'preferOffline if >=9999')
+ t.strictSame(flat, { preferOffline: true }, 'preferOffline if >=9999')
t.end()
})
@@ -378,19 +379,19 @@ t.test('color', t => {
const obj = { color: 'always' }
definitions.color.flatten('color', obj, flat)
- t.strictSame(flat, {color: true}, 'true when --color=always')
+ t.strictSame(flat, { color: true }, 'true when --color=always')
obj.color = false
definitions.color.flatten('color', obj, flat)
- t.strictSame(flat, {color: false}, 'true when --no-color')
+ t.strictSame(flat, { color: false }, 'true when --no-color')
process.stdout.isTTY = false
obj.color = true
definitions.color.flatten('color', obj, flat)
- t.strictSame(flat, {color: false}, 'no color when stdout not tty')
+ t.strictSame(flat, { color: false }, 'no color when stdout not tty')
process.stdout.isTTY = true
definitions.color.flatten('color', obj, flat)
- t.strictSame(flat, {color: true}, '--color turns on color when stdout is tty')
+ t.strictSame(flat, { color: true }, '--color turns on color when stdout is tty')
delete process.env.NO_COLOR
const defsAllowColor = t.mock(defpath)
@@ -421,7 +422,7 @@ t.test('retry options', t => {
const flat = {}
obj[config] = 99
definitions[config].flatten(config, obj, flat)
- t.strictSame(flat, {retry: {[option]: 99}}, msg)
+ t.strictSame(flat, { retry: { [option]: 99 } }, msg)
delete obj[config]
}
t.end()
@@ -442,7 +443,7 @@ t.test('search options', t => {
const flat = {}
obj[config] = 99
definitions[config].flatten(config, obj, flat)
- t.strictSame(flat, { search: { limit: 20, [option]: 99 }}, msg)
+ t.strictSame(flat, { search: { limit: 20, [option]: 99 } }, msg)
delete obj[config]
}
@@ -515,18 +516,18 @@ t.test('shrinkwrap/package-lock', t => {
const obj = { shrinkwrap: false }
const flat = {}
definitions.shrinkwrap.flatten('shrinkwrap', obj, flat)
- t.strictSame(flat, {packageLock: false})
+ t.strictSame(flat, { packageLock: false })
obj.shrinkwrap = true
definitions.shrinkwrap.flatten('shrinkwrap', obj, flat)
- t.strictSame(flat, {packageLock: true})
+ t.strictSame(flat, { packageLock: true })
delete obj.shrinkwrap
obj['package-lock'] = false
definitions['package-lock'].flatten('package-lock', obj, flat)
- t.strictSame(flat, {packageLock: false})
+ t.strictSame(flat, { packageLock: false })
obj['package-lock'] = true
definitions['package-lock'].flatten('package-lock', obj, flat)
- t.strictSame(flat, {packageLock: true})
+ t.strictSame(flat, { packageLock: true })
t.end()
})
@@ -550,7 +551,7 @@ t.test('defaultTag', t => {
const obj = { tag: 'next' }
const flat = {}
definitions.tag.flatten('tag', obj, flat)
- t.strictSame(flat, {defaultTag: 'next'})
+ t.strictSame(flat, { defaultTag: 'next' })
t.end()
})
@@ -558,7 +559,7 @@ t.test('timeout', t => {
const obj = { 'fetch-timeout': 123 }
const flat = {}
definitions['fetch-timeout'].flatten('fetch-timeout', obj, flat)
- t.strictSame(flat, {timeout: 123})
+ t.strictSame(flat, { timeout: 123 })
t.end()
})
@@ -573,10 +574,10 @@ t.test('saveType', t => {
t.strictSame(flat, {}, 'remove if false and set to prod')
flat.saveType = 'dev'
definitions['save-prod'].flatten('save-prod', obj, flat)
- t.strictSame(flat, {saveType: 'dev'}, 'ignore if false and not already prod')
+ t.strictSame(flat, { saveType: 'dev' }, 'ignore if false and not already prod')
obj['save-prod'] = true
definitions['save-prod'].flatten('save-prod', obj, flat)
- t.strictSame(flat, {saveType: 'prod'}, 'set to prod if true')
+ t.strictSame(flat, { saveType: 'prod' }, 'set to prod if true')
t.end()
})
@@ -591,10 +592,10 @@ t.test('saveType', t => {
flat.saveType = 'prod'
obj['save-dev'] = false
definitions['save-dev'].flatten('save-dev', obj, flat)
- t.strictSame(flat, {saveType: 'prod'}, 'ignore if false and not already dev')
+ t.strictSame(flat, { saveType: 'prod' }, 'ignore if false and not already dev')
obj['save-dev'] = true
definitions['save-dev'].flatten('save-dev', obj, flat)
- t.strictSame(flat, {saveType: 'dev'}, 'set to dev if true')
+ t.strictSame(flat, { saveType: 'dev' }, 'set to dev if true')
t.end()
})
@@ -602,40 +603,40 @@ t.test('saveType', t => {
const obj = { 'save-bundle': true }
const flat = {}
definitions['save-bundle'].flatten('save-bundle', obj, flat)
- t.strictSame(flat, {saveBundle: true}, 'set the saveBundle flag')
+ t.strictSame(flat, { saveBundle: true }, 'set the saveBundle flag')
obj['save-bundle'] = false
definitions['save-bundle'].flatten('save-bundle', obj, flat)
- t.strictSame(flat, {saveBundle: false}, 'unset the saveBundle flag')
+ t.strictSame(flat, { saveBundle: false }, 'unset the saveBundle flag')
obj['save-bundle'] = true
obj['save-peer'] = true
definitions['save-bundle'].flatten('save-bundle', obj, flat)
- t.strictSame(flat, {saveBundle: false}, 'false if save-peer is set')
+ t.strictSame(flat, { saveBundle: false }, 'false if save-peer is set')
t.end()
})
t.test('save-peer', t => {
- const obj = { 'save-peer': false}
+ const obj = { 'save-peer': false }
const flat = {}
definitions['save-peer'].flatten('save-peer', obj, flat)
t.strictSame(flat, {}, 'no effect if false and not yet set')
obj['save-peer'] = true
definitions['save-peer'].flatten('save-peer', obj, flat)
- t.strictSame(flat, {saveType: 'peer'}, 'set saveType to peer if unset')
+ t.strictSame(flat, { saveType: 'peer' }, 'set saveType to peer if unset')
flat.saveType = 'optional'
definitions['save-peer'].flatten('save-peer', obj, flat)
- t.strictSame(flat, {saveType: 'peerOptional'}, 'set to peerOptional if optional already')
+ t.strictSame(flat, { saveType: 'peerOptional' }, 'set to peerOptional if optional already')
definitions['save-peer'].flatten('save-peer', obj, flat)
- t.strictSame(flat, {saveType: 'peerOptional'}, 'no effect if already peerOptional')
+ t.strictSame(flat, { saveType: 'peerOptional' }, 'no effect if already peerOptional')
obj['save-peer'] = false
definitions['save-peer'].flatten('save-peer', obj, flat)
- t.strictSame(flat, {saveType: 'optional'}, 'switch peerOptional to optional if false')
+ t.strictSame(flat, { saveType: 'optional' }, 'switch peerOptional to optional if false')
obj['save-peer'] = false
flat.saveType = 'peer'
@@ -646,25 +647,25 @@ t.test('saveType', t => {
})
t.test('save-optional', t => {
- const obj = { 'save-optional': false}
+ const obj = { 'save-optional': false }
const flat = {}
definitions['save-optional'].flatten('save-optional', obj, flat)
t.strictSame(flat, {}, 'no effect if false and not yet set')
obj['save-optional'] = true
definitions['save-optional'].flatten('save-optional', obj, flat)
- t.strictSame(flat, {saveType: 'optional'}, 'set saveType to optional if unset')
+ t.strictSame(flat, { saveType: 'optional' }, 'set saveType to optional if unset')
flat.saveType = 'peer'
definitions['save-optional'].flatten('save-optional', obj, flat)
- t.strictSame(flat, {saveType: 'peerOptional'}, 'set to peerOptional if peer already')
+ t.strictSame(flat, { saveType: 'peerOptional' }, 'set to peerOptional if peer already')
definitions['save-optional'].flatten('save-optional', obj, flat)
- t.strictSame(flat, {saveType: 'peerOptional'}, 'no effect if already peerOptional')
+ t.strictSame(flat, { saveType: 'peerOptional' }, 'no effect if already peerOptional')
obj['save-optional'] = false
definitions['save-optional'].flatten('save-optional', obj, flat)
- t.strictSame(flat, {saveType: 'peer'}, 'switch peerOptional to peer if false')
+ t.strictSame(flat, { saveType: 'peer' }, 'switch peerOptional to peer if false')
flat.saveType = 'optional'
definitions['save-optional'].flatten('save-optional', obj, flat)
diff --git a/deps/npm/test/lib/utils/error-message.js b/deps/npm/test/lib/utils/error-message.js
index aec4c3a199..1959b9217a 100644
--- a/deps/npm/test/lib/utils/error-message.js
+++ b/deps/npm/test/lib/utils/error-message.js
@@ -215,10 +215,11 @@ t.test('args are cleaned', t => {
t.test('eacces/eperm', t => {
const runTest = (windows, loaded, cachePath, cacheDest) => t => {
- if (windows)
+ if (windows) {
beWindows()
- else
+ } else {
bePosix()
+ }
const path = `${cachePath ? CACHE : '/not/cache/dir'}/path`
const dest = `${cacheDest ? CACHE : '/not/cache/dir'}/dest`
@@ -229,10 +230,11 @@ t.test('eacces/eperm', t => {
stack: 'dummy stack trace',
})
verboseLogs.length = 0
- if (loaded)
+ if (loaded) {
t.matchSnapshot(errorMessage(er, npm))
- else
+ } else {
t.matchSnapshot(errorMessage(er, unloadedNpm))
+ }
t.matchSnapshot(verboseLogs)
t.end()
@@ -243,7 +245,7 @@ t.test('eacces/eperm', t => {
for (const loaded of [true, false]) {
for (const cachePath of [true, false]) {
for (const cacheDest of [true, false]) {
- const m = JSON.stringify({windows, loaded, cachePath, cacheDest})
+ const m = JSON.stringify({ windows, loaded, cachePath, cacheDest })
t.test(m, runTest(windows, loaded, cachePath, cacheDest))
}
}
diff --git a/deps/npm/test/lib/utils/exit-handler.js b/deps/npm/test/lib/utils/exit-handler.js
index f749387502..adc7c3f4e9 100644
--- a/deps/npm/test/lib/utils/exit-handler.js
+++ b/deps/npm/test/lib/utils/exit-handler.js
@@ -38,13 +38,10 @@ t.before(async () => {
npm.config.set('cache', cacheFolder)
})
-t.test('bootstrap tap before cutting off process ref', (t) => {
- t.ok('ok')
- t.end()
-})
-
// cut off process from script so that it won't quit the test runner
-// while trying to run through the myriad of cases
+// while trying to run through the myriad of cases. need to make it
+// have all the functions signal-exit relies on so that it doesn't
+// nerf itself, thinking global.process is broken or gone.
const _process = process
process = Object.assign(
new EventEmitter(),
@@ -62,6 +59,9 @@ process = Object.assign(
} },
stderr: { write () {} },
hrtime: _process.hrtime,
+ kill: () => {},
+ reallyExit: (code) => process.exit(code),
+ pid: 123456,
}
)
diff --git a/deps/npm/test/lib/utils/open-url.js b/deps/npm/test/lib/utils/open-url.js
index 36724d0adf..1bf47d8bba 100644
--- a/deps/npm/test/lib/utils/open-url.js
+++ b/deps/npm/test/lib/utils/open-url.js
@@ -8,7 +8,7 @@ const npm = {
browser: true,
},
config: {
- get: (k) => npm._config[k],
+ get: k => npm._config[k],
set: (k, v) => {
npm._config[k] = v
},
@@ -29,7 +29,7 @@ const openUrl = t.mock('../../../lib/utils/open-url.js', {
opener,
})
-t.test('opens a url', async (t) => {
+t.test('opens a url', async t => {
t.teardown(() => {
openerUrl = null
openerOpts = null
@@ -41,31 +41,67 @@ t.test('opens a url', async (t) => {
t.same(OUTPUT, [], 'printed no output')
})
-t.test('returns error for non-https and non-file url', async (t) => {
+t.test('returns error for non-https url', async t => {
t.teardown(() => {
openerUrl = null
openerOpts = null
OUTPUT.length = 0
})
- await t.rejects(openUrl(npm, 'ftp://www.npmjs.com', 'npm home'), /Invalid URL/, 'got the correct error')
+ await t.rejects(
+ openUrl(npm, 'ftp://www.npmjs.com', 'npm home'),
+ /Invalid URL/,
+ 'got the correct error'
+ )
t.equal(openerUrl, null, 'did not open')
t.same(openerOpts, null, 'did not open')
t.same(OUTPUT, [], 'printed no output')
})
-t.test('returns error for non-parseable url', async (t) => {
+t.test('returns error for file url', async t => {
t.teardown(() => {
openerUrl = null
openerOpts = null
OUTPUT.length = 0
})
- await t.rejects(openUrl(npm, 'git+ssh://user@host:repo.git', 'npm home'), /Invalid URL/, 'got the correct error')
+ await t.rejects(
+ openUrl(npm, 'file:///usr/local/bin/ls', 'npm home'),
+ /Invalid URL/,
+ 'got the correct error'
+ )
t.equal(openerUrl, null, 'did not open')
t.same(openerOpts, null, 'did not open')
t.same(OUTPUT, [], 'printed no output')
})
-t.test('encodes non-URL-safe characters in url provided', async (t) => {
+t.test('file url allowed if explicitly asked for', async t => {
+ t.teardown(() => {
+ openerUrl = null
+ openerOpts = null
+ OUTPUT.length = 0
+ })
+ await openUrl(npm, 'file:///man/page/npm-install', 'npm home', true)
+ t.equal(openerUrl, 'file:///man/page/npm-install', 'opened the given url')
+ t.same(openerOpts, { command: null }, 'passed command as null (the default)')
+ t.same(OUTPUT, [], 'printed no output')
+})
+
+t.test('returns error for non-parseable url', async t => {
+ t.teardown(() => {
+ openerUrl = null
+ openerOpts = null
+ OUTPUT.length = 0
+ })
+ await t.rejects(
+ openUrl(npm, 'git+ssh://user@host:repo.git', 'npm home'),
+ /Invalid URL/,
+ 'got the correct error'
+ )
+ t.equal(openerUrl, null, 'did not open')
+ t.same(openerOpts, null, 'did not open')
+ t.same(OUTPUT, [], 'printed no output')
+})
+
+t.test('encodes non-URL-safe characters in url provided', async t => {
t.teardown(() => {
openerUrl = null
openerOpts = null
@@ -77,7 +113,7 @@ t.test('encodes non-URL-safe characters in url provided', async (t) => {
t.same(OUTPUT, [], 'printed no output')
})
-t.test('opens a url with the given browser', async (t) => {
+t.test('opens a url with the given browser', async t => {
npm.config.set('browser', 'chrome')
t.teardown(() => {
openerUrl = null
@@ -91,7 +127,7 @@ t.test('opens a url with the given browser', async (t) => {
t.same(OUTPUT, [], 'printed no output')
})
-t.test('prints where to go when browser is disabled', async (t) => {
+t.test('prints where to go when browser is disabled', async t => {
npm.config.set('browser', false)
t.teardown(() => {
openerUrl = null
@@ -107,7 +143,7 @@ t.test('prints where to go when browser is disabled', async (t) => {
t.matchSnapshot(OUTPUT[0][0], 'printed expected message')
})
-t.test('prints where to go when browser is disabled and json is enabled', async (t) => {
+t.test('prints where to go when browser is disabled and json is enabled', async t => {
npm.config.set('browser', false)
npm.config.set('json', true)
t.teardown(() => {
@@ -125,7 +161,7 @@ t.test('prints where to go when browser is disabled and json is enabled', async
t.matchSnapshot(OUTPUT[0][0], 'printed expected message')
})
-t.test('prints where to go when given browser does not exist', async (t) => {
+t.test('prints where to go when given browser does not exist', async t => {
npm.config.set('browser', 'firefox')
openerResult = Object.assign(new Error('failed'), { code: 'ENOENT' })
t.teardown(() => {
@@ -142,7 +178,7 @@ t.test('prints where to go when given browser does not exist', async (t) => {
t.matchSnapshot(OUTPUT[0][0], 'printed expected message')
})
-t.test('handles unknown opener error', async (t) => {
+t.test('handles unknown opener error', async t => {
npm.config.set('browser', 'firefox')
openerResult = Object.assign(new Error('failed'), { code: 'ENOBRIAN' })
t.teardown(() => {
diff --git a/deps/npm/test/lib/utils/otplease.js b/deps/npm/test/lib/utils/otplease.js
index fb9476120e..b3711965c2 100644
--- a/deps/npm/test/lib/utils/otplease.js
+++ b/deps/npm/test/lib/utils/otplease.js
@@ -20,8 +20,9 @@ t.test('prompts for otp for EOTP', async (t) => {
let runs = 0
const fn = async (opts) => {
- if (++runs === 1)
+ if (++runs === 1) {
throw Object.assign(new Error('nope'), { code: 'EOTP' })
+ }
t.equal(opts.some, 'prop', 'carried original options')
t.equal(opts.otp, '1234', 'received the otp')
diff --git a/deps/npm/test/lib/utils/pulse-till-done.js b/deps/npm/test/lib/utils/pulse-till-done.js
index c1d7902c06..acbf66396a 100644
--- a/deps/npm/test/lib/utils/pulse-till-done.js
+++ b/deps/npm/test/lib/utils/pulse-till-done.js
@@ -4,8 +4,9 @@ let pulseStarted = null
const npmlog = {
gauge: {
pulse: () => {
- if (pulseStarted)
+ if (pulseStarted) {
pulseStarted()
+ }
},
},
}
diff --git a/deps/npm/test/lib/utils/read-user-info.js b/deps/npm/test/lib/utils/read-user-info.js
index 5d937ff78a..35101f1d70 100644
--- a/deps/npm/test/lib/utils/read-user-info.js
+++ b/deps/npm/test/lib/utils/read-user-info.js
@@ -14,14 +14,16 @@ const npmlog = {
const npmUserValidate = {
username: (username) => {
- if (username === 'invalid')
+ if (username === 'invalid') {
return new Error('invalid username')
+ }
return null
},
email: (email) => {
- if (email.startsWith('invalid'))
+ if (email.startsWith('invalid')) {
return new Error('invalid email')
+ }
return null
},
diff --git a/deps/npm/test/lib/utils/reify-finish.js b/deps/npm/test/lib/utils/reify-finish.js
index b66d5bcd3b..b565034058 100644
--- a/deps/npm/test/lib/utils/reify-finish.js
+++ b/deps/npm/test/lib/utils/reify-finish.js
@@ -10,7 +10,7 @@ const npm = {
const builtinConfMock = {
loadError: new Error('no builtin config'),
- raw: { hasBuiltinConfig: true, x: 'y', nested: { foo: 'bar' }},
+ raw: { hasBuiltinConfig: true, x: 'y', nested: { foo: 'bar' } },
}
const reifyOutput = () => {}
@@ -22,8 +22,9 @@ const fs = {
promises: realFs.promises && {
...realFs.promises,
writeFile: async (path, data) => {
- if (!expectWrite)
+ if (!expectWrite) {
throw new Error('did not expect to write builtin config file')
+ }
return realFs.promises.writeFile(path, data)
},
},
@@ -69,7 +70,7 @@ t.test('should write if everything above passes', async t => {
await reifyFinish(npm, {
options: { global: true },
actualTree: {
- inventory: new Map([['node_modules/npm', {path}]]),
+ inventory: new Map([['node_modules/npm', { path }]]),
},
})
// windowwwwwwssss!!!!!
diff --git a/deps/npm/test/lib/utils/reify-output.js b/deps/npm/test/lib/utils/reify-output.js
index 3ffbdf86a2..9a1bffb403 100644
--- a/deps/npm/test/lib/utils/reify-output.js
+++ b/deps/npm/test/lib/utils/reify-output.js
@@ -97,8 +97,9 @@ t.test('no message when funding config is false', (t) => {
})
settings.fund = false
npm.output = out => {
- if (out.endsWith('looking for funding'))
+ if (out.endsWith('looking for funding')) {
t.fail('should not print funding info', { actual: out })
+ }
}
reifyOutput(npm, {
@@ -283,8 +284,9 @@ t.test('showing and not showing audit report', async t => {
delete npm.flatOptions.auditLevel
npm.command = command
// only set exitCode back if we're passing tests
- if (t.passing())
+ if (t.passing()) {
process.exitCode = exitCode
+ }
})
process.exitCode = 0
@@ -312,8 +314,9 @@ t.test('showing and not showing audit report', async t => {
delete npm.flatOptions.auditLevel
npm.command = command
// only set exitCode back if we're passing tests
- if (t.passing())
+ if (t.passing()) {
process.exitCode = exitCode
+ }
})
process.exitCode = 0
@@ -368,11 +371,13 @@ t.test('packages changed message', t => {
],
},
}
- for (let i = 0; i < added; i++)
+ for (let i = 0; i < added; i++) {
mock.diff.children.push({ action: 'ADD', ideal: { location: 'loc' } })
+ }
- for (let i = 0; i < removed; i++)
+ for (let i = 0; i < removed; i++) {
mock.diff.children.push({ action: 'REMOVE', actual: { location: 'loc' } })
+ }
for (let i = 0; i < changed; i++) {
const actual = { location: 'loc' }
@@ -395,8 +400,9 @@ t.test('packages changed message', t => {
for (const removed of [0, 1, 2]) {
for (const changed of [0, 1, 2]) {
for (const audited of [0, 1, 2]) {
- for (const json of [true, false])
+ for (const json of [true, false]) {
cases.push([added, removed, changed, audited, json, 'install'])
+ }
}
}
}
@@ -407,8 +413,9 @@ t.test('packages changed message', t => {
cases.push([0, 0, 0, 2, false, 'audit'])
t.plan(cases.length)
- for (const [added, removed, changed, audited, json, command] of cases)
+ for (const [added, removed, changed, audited, json, command] of cases) {
testCase(t, added, removed, changed, audited, json, command)
+ }
t.end()
})
diff --git a/deps/npm/test/lib/utils/split-package-names.js b/deps/npm/test/lib/utils/split-package-names.js
index 82b8f55783..5fe1e6cd8d 100644
--- a/deps/npm/test/lib/utils/split-package-names.js
+++ b/deps/npm/test/lib/utils/split-package-names.js
@@ -11,7 +11,8 @@ t.test('splitPackageNames', t => {
['@npmcli/one/semver', '@npmcli/one/node_modules/semver'],
]
- for (const [input, expected] of assertions)
+ for (const [input, expected] of assertions) {
t.equal(splitPackageNames(input), expected, `split ${input} correctly`)
+ }
t.end()
})
diff --git a/deps/npm/test/lib/utils/update-notifier.js b/deps/npm/test/lib/utils/update-notifier.js
index dc0a64ff46..78ff93825e 100644
--- a/deps/npm/test/lib/utils/update-notifier.js
+++ b/deps/npm/test/lib/utils/update-notifier.js
@@ -21,13 +21,17 @@ const pacote = {
process.exit(1)
}
MANIFEST_REQUEST.push(spec)
- if (PACOTE_ERROR)
+ if (PACOTE_ERROR) {
throw PACOTE_ERROR
+ }
return {
- version: spec === 'npm@latest' ? CURRENT_VERSION
- : /-/.test(spec) ? CURRENT_BETA
- : NEXT_VERSION,
+ version:
+ spec === 'npm@latest'
+ ? CURRENT_VERSION
+ : /-/.test(spec)
+ ? CURRENT_BETA
+ : NEXT_VERSION,
}
},
}
@@ -36,7 +40,7 @@ const npm = {
flatOptions,
log: { useColor: () => true },
version: CURRENT_VERSION,
- config: { get: (k) => k !== 'global' },
+ config: { get: k => k !== 'global' },
command: 'view',
argv: ['npm'],
}
@@ -54,7 +58,9 @@ const fs = {
...require('fs'),
stat: (path, cb) => {
if (basename(path) !== '_update-notifier-last-checked') {
- console.error(new Error('should only write to notifier last checked file'))
+ console.error(
+ new Error('should only write to notifier last checked file')
+ )
process.exit(1)
}
process.nextTick(() => cb(STAT_ERROR, { mtime: new Date(STAT_MTIME) }))
@@ -65,7 +71,9 @@ const fs = {
process.exit(1)
}
if (basename(path) !== '_update-notifier-last-checked') {
- console.error(new Error('should only write to notifier last checked file'))
+ console.error(
+ new Error('should only write to notifier last checked file')
+ )
process.exit(1)
}
process.nextTick(() => cb(WRITE_ERROR))
@@ -93,30 +101,39 @@ const runUpdateNotifier = async npm => {
t.test('situations in which we do not notify', t => {
t.test('nothing to do if notifier disabled', async t => {
- t.equal(await runUpdateNotifier({
- ...npm,
- config: { get: (k) => k !== 'update-notifier' },
- }), null)
+ t.equal(
+ await runUpdateNotifier({
+ ...npm,
+ config: { get: k => k !== 'update-notifier' },
+ }),
+ null
+ )
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
t.test('do not suggest update if already updating', async t => {
- t.equal(await runUpdateNotifier({
- ...npm,
- flatOptions: { ...flatOptions, global: true },
- command: 'install',
- argv: ['npm'],
- }), null)
+ t.equal(
+ await runUpdateNotifier({
+ ...npm,
+ flatOptions: { ...flatOptions, global: true },
+ command: 'install',
+ argv: ['npm'],
+ }),
+ null
+ )
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
t.test('do not suggest update if already updating with spec', async t => {
- t.equal(await runUpdateNotifier({
- ...npm,
- flatOptions: { ...flatOptions, global: true },
- command: 'install',
- argv: ['npm@latest'],
- }), null)
+ t.equal(
+ await runUpdateNotifier({
+ ...npm,
+ flatOptions: { ...flatOptions, global: true },
+ command: 'install',
+ argv: ['npm@latest'],
+ }),
+ null
+ )
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
@@ -161,14 +178,14 @@ t.test('situations in which we do not notify', t => {
t.test('only check weekly for GA releases', async t => {
// One week (plus five minutes to account for test environment fuzziness)
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + (1000 * 60 * 5)
+ STAT_MTIME = Date.now() - 1000 * 60 * 60 * 24 * 7 + 1000 * 60 * 5
t.equal(await runUpdateNotifier(npm), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
t.test('only check daily for betas', async t => {
// One day (plus five minutes to account for test environment fuzziness)
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + (1000 * 60 * 5)
+ STAT_MTIME = Date.now() - 1000 * 60 * 60 * 24 + 1000 * 60 * 5
t.equal(await runUpdateNotifier({ ...npm, version: HAVE_BETA }), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
@@ -180,42 +197,70 @@ t.test('notification situations', t => {
t.test('new beta available', async t => {
const version = HAVE_BETA
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
t.strictSame(MANIFEST_REQUEST, [`npm@^${version}`, `npm@^${version}`])
})
t.test('patch to next version', async t => {
const version = NEXT_PATCH
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
- t.strictSame(MANIFEST_REQUEST, ['npm@latest', `npm@^${version}`, 'npm@latest', `npm@^${version}`])
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
+ t.strictSame(MANIFEST_REQUEST, [
+ 'npm@latest',
+ `npm@^${version}`,
+ 'npm@latest',
+ `npm@^${version}`,
+ ])
})
t.test('minor to next version', async t => {
const version = NEXT_MINOR
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
- t.strictSame(MANIFEST_REQUEST, ['npm@latest', `npm@^${version}`, 'npm@latest', `npm@^${version}`])
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
+ t.strictSame(MANIFEST_REQUEST, [
+ 'npm@latest',
+ `npm@^${version}`,
+ 'npm@latest',
+ `npm@^${version}`,
+ ])
})
t.test('patch to current', async t => {
const version = CURRENT_PATCH
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
t.strictSame(MANIFEST_REQUEST, ['npm@latest', 'npm@latest'])
})
t.test('minor to current', async t => {
const version = CURRENT_MINOR
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
t.strictSame(MANIFEST_REQUEST, ['npm@latest', 'npm@latest'])
})
t.test('major to current', async t => {
const version = CURRENT_MAJOR
t.matchSnapshot(await runUpdateNotifier({ ...npm, version }), 'color')
- t.matchSnapshot(await runUpdateNotifier({ ...npmNoColor, version }), 'no color')
+ t.matchSnapshot(
+ await runUpdateNotifier({ ...npmNoColor, version }),
+ 'no color'
+ )
t.strictSame(MANIFEST_REQUEST, ['npm@latest', 'npm@latest'])
})
diff --git a/deps/npm/test/lib/workspaces/get-workspaces.js b/deps/npm/test/lib/workspaces/get-workspaces.js
index 0f51d95fcb..0d1bba3144 100644
--- a/deps/npm/test/lib/workspaces/get-workspaces.js
+++ b/deps/npm/test/lib/workspaces/get-workspaces.js
@@ -11,8 +11,9 @@ const cleanOutput = (str, path) => normalizePath(str)
const clean = (res, path) => {
const cleaned = new Map()
- for (const [key, value] of res.entries())
+ for (const [key, value] of res.entries()) {
cleaned.set(key, cleanOutput(value, path))
+ }
return cleaned
}