diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 2e313801aaea14..3ad752bcac4c97 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -160,7 +160,7 @@

Description

the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

-
npm@8.3.0 /path/to/npm
+
npm@8.3.1 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 6fb69cf3a8b022..044d90faec666b 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -149,7 +149,7 @@

Table of contents

npm <command> [args]
 

Version

-

8.3.0

+

8.3.1

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/lib/commands/unpublish.js b/deps/npm/lib/commands/unpublish.js index 578890025d2249..85c366381cc7af 100644 --- a/deps/npm/lib/commands/unpublish.js +++ b/deps/npm/lib/commands/unpublish.js @@ -9,6 +9,10 @@ const log = require('../utils/log-shim') const otplease = require('../utils/otplease.js') const getIdentity = require('../utils/get-identity.js') +const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' + +'It will block from republishing a new version for 24 hours.\n' + +'Run with --force to do this.' + const BaseCommand = require('../base-command.js') class Unpublish extends BaseCommand { static description = 'Remove a package from the registry' @@ -16,6 +20,11 @@ class Unpublish extends BaseCommand { static params = ['dry-run', 'force', 'workspace', 'workspaces'] static usage = ['[<@scope>/][@]'] + async getKeysOfVersions (name, opts) { + const json = await npmFetch.json(npa(name).escapedName, opts) + return Object.keys(json.versions) + } + async completion (args) { const { partialWord, conf } = args @@ -44,8 +53,7 @@ class Unpublish extends BaseCommand { return pkgs } - const json = await npmFetch.json(npa(pkgs[0]).escapedName, opts) - const versions = Object.keys(json.versions) + const versions = await this.getKeysOfVersions(pkgs[0], opts) if (!versions.length) { return pkgs } else { @@ -97,12 +105,26 @@ class Unpublish extends BaseCommand { const { name, version, publishConfig } = manifest const pkgJsonSpec = npa.resolve(name, version) const optsWithPub = { ...opts, publishConfig } + + const versions = await this.getKeysOfVersions(name, optsWithPub) + if (versions.length === 1 && !force) { + throw this.usageError( + LAST_REMAINING_VERSION_ERROR + ) + } + if (!dryRun) { await otplease(opts, opts => libunpub(pkgJsonSpec, optsWithPub)) } pkgName = name pkgVersion = version ? `@${version}` : '' } else { + const versions = await this.getKeysOfVersions(spec.name, opts) + if (versions.length === 1 && !force) { + throw this.usageError( + LAST_REMAINING_VERSION_ERROR + ) + } if (!dryRun) { await otplease(opts, opts => libunpub(spec, opts)) } diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index e6786f2a04ccea..400e41ba630e3d 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "December 2021" "" "" +.TH "NPM\-ACCESS" "1" "January 2022" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 859088196eef33..43273a5c7f6ab2 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "December 2021" "" "" +.TH "NPM\-ADDUSER" "1" "January 2022" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SS Synopsis diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1 index 9279f1f6e815ab..23ad2c4f5e35eb 100644 --- a/deps/npm/man/man1/npm-audit.1 +++ b/deps/npm/man/man1/npm-audit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-AUDIT" "1" "December 2021" "" "" +.TH "NPM\-AUDIT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-audit\fR \- Run a security audit .SS Synopsis diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index fa1abc087e1193..a9fcca68865566 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "December 2021" "" "" +.TH "NPM\-BIN" "1" "January 2022" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 857b78727ad09d..97431843d22977 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "December 2021" "" "" +.TH "NPM\-BUGS" "1" "January 2022" "" "" .SH "NAME" \fBnpm-bugs\fR \- Report bugs for a package in a web browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 0ae5e8251e159d..e696f17f7a8f7e 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "December 2021" "" "" +.TH "NPM\-CACHE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SS Synopsis diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1 index fdd6edbdc03805..df1f1c9831e8aa 100644 --- a/deps/npm/man/man1/npm-ci.1 +++ b/deps/npm/man/man1/npm-ci.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CI" "1" "December 2021" "" "" +.TH "NPM\-CI" "1" "January 2022" "" "" .SH "NAME" \fBnpm-ci\fR \- Install a project with a clean slate .SS Synopsis diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index 93b7785ec905ff..7ac09937c939e1 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "December 2021" "" "" +.TH "NPM\-COMPLETION" "1" "January 2022" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 8b667c03d9c9ca..ce13c858854129 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "December 2021" "" "" +.TH "NPM\-CONFIG" "1" "January 2022" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SS Synopsis diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index dff883b8270510..959b3ffb6d0272 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "December 2021" "" "" +.TH "NPM\-DEDUPE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication in the package tree .SS Synopsis diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index f83b46a156dbbc..36b93d8d8b8855 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "December 2021" "" "" +.TH "NPM\-DEPRECATE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-diff.1 b/deps/npm/man/man1/npm-diff.1 index e730b597a6ee32..995391d15f470c 100644 --- a/deps/npm/man/man1/npm-diff.1 +++ b/deps/npm/man/man1/npm-diff.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIFF" "1" "December 2021" "" "" +.TH "NPM\-DIFF" "1" "January 2022" "" "" .SH "NAME" \fBnpm-diff\fR \- The registry diff command .SS Synopsis diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index e2bd3c0e28d5a4..bc37884fab8534 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "December 2021" "" "" +.TH "NPM\-DIST\-TAG" "1" "January 2022" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SS Synopsis diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index d0f2ce82c2d771..d794821a7cbdb0 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "December 2021" "" "" +.TH "NPM\-DOCS" "1" "January 2022" "" "" .SH "NAME" \fBnpm-docs\fR \- Open documentation for a package in a web browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1 index 3b863eddab456c..49bfe6e2ddaf60 100644 --- a/deps/npm/man/man1/npm-doctor.1 +++ b/deps/npm/man/man1/npm-doctor.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCTOR" "1" "December 2021" "" "" +.TH "NPM\-DOCTOR" "1" "January 2022" "" "" .SH "NAME" \fBnpm-doctor\fR \- Check your npm environment .SS Synopsis diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 4d3bf1711d15cd..e20c8af84383c7 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "December 2021" "" "" +.TH "NPM\-EDIT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1 index 545d799306ae12..46140f0993ee9e 100644 --- a/deps/npm/man/man1/npm-exec.1 +++ b/deps/npm/man/man1/npm-exec.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXEC" "1" "December 2021" "" "" +.TH "NPM\-EXEC" "1" "January 2022" "" "" .SH "NAME" \fBnpm-exec\fR \- Run a command from a local or remote npm package .SS Synopsis diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1 index 91a66ff3f53591..7467b24a155782 100644 --- a/deps/npm/man/man1/npm-explain.1 +++ b/deps/npm/man/man1/npm-explain.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLAIN" "1" "December 2021" "" "" +.TH "NPM\-EXPLAIN" "1" "January 2022" "" "" .SH "NAME" \fBnpm-explain\fR \- Explain installed packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 79e4e5a7dfb7bb..1c4f90deb90ab3 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "December 2021" "" "" +.TH "NPM\-EXPLORE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-find-dupes.1 b/deps/npm/man/man1/npm-find-dupes.1 index bd157ab7fd347e..162dcf0d443588 100644 --- a/deps/npm/man/man1/npm-find-dupes.1 +++ b/deps/npm/man/man1/npm-find-dupes.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FIND\-DUPES" "1" "December 2021" "" "" +.TH "NPM\-FIND\-DUPES" "1" "January 2022" "" "" .SH "NAME" \fBnpm-find-dupes\fR \- Find duplication in the package tree .SS Synopsis diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index 488dd168c62400..5a45391788f69c 100644 --- a/deps/npm/man/man1/npm-fund.1 +++ b/deps/npm/man/man1/npm-fund.1 @@ -1,4 +1,4 @@ -.TH "NPM\-FUND" "1" "December 2021" "" "" +.TH "NPM\-FUND" "1" "January 2022" "" "" .SH "NAME" \fBnpm-fund\fR \- Retrieve funding information .SS Synopsis diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 8566e38185acdc..299ae9e5945972 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "December 2021" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "January 2022" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SS Synopsis diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 260a253fedef3c..d84fbb58849ba8 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "December 2021" "" "" +.TH "NPM\-HELP" "1" "January 2022" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SS Synopsis diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1 index 609604155b369b..4c3bd994398e8f 100644 --- a/deps/npm/man/man1/npm-hook.1 +++ b/deps/npm/man/man1/npm-hook.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HOOK" "1" "December 2021" "" "" +.TH "NPM\-HOOK" "1" "January 2022" "" "" .SH "NAME" \fBnpm-hook\fR \- Manage registry hooks .SS Synopsis diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 8119ff10fda318..7a540d2b14185a 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "December 2021" "" "" +.TH "NPM\-INIT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-init\fR \- Create a package\.json file .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1 index 5b2e09cf1c285f..acc190c20b6661 100644 --- a/deps/npm/man/man1/npm-install-ci-test.1 +++ b/deps/npm/man/man1/npm-install-ci-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL\-CI\-TEST" "1" "December 2021" "" "" +.TH "NPM\-INSTALL\-CI\-TEST" "1" "January 2022" "" "" .SH "NAME" \fBnpm-install-ci-test\fR \- Install a project with a clean slate and run tests .SS Synopsis diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index 451ae94e87c6e3..3f1a07292fa0b0 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL\-TEST" "1" "December 2021" "" "" +.TH "NPM\-INSTALL\-TEST" "1" "January 2022" "" "" .SH "NAME" \fBnpm-install-test\fR \- Install package(s) and run tests .SS Synopsis diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index cf93650b30a53c..d6f5c5f07bbe34 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "December 2021" "" "" +.TH "NPM\-INSTALL" "1" "January 2022" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index b15ac7bce6d624..3e7efd00ebbb18 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "December 2021" "" "" +.TH "NPM\-LINK" "1" "January 2022" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SS Synopsis diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 17534e845fc3ef..7be9d44c006bea 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "December 2021" "" "" +.TH "NPM\-LOGOUT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 61db54629dc7e4..2b0338e3f30867 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "December 2021" "" "" +.TH "NPM\-LS" "1" "January 2022" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SS Synopsis @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@8\.3\.0 /path/to/npm +npm@8\.3\.1 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 3ca826bd6c75c2..8c147767fbfa18 100644 --- a/deps/npm/man/man1/npm-org.1 +++ b/deps/npm/man/man1/npm-org.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ORG" "1" "December 2021" "" "" +.TH "NPM\-ORG" "1" "January 2022" "" "" .SH "NAME" \fBnpm-org\fR \- Manage orgs .SS Synopsis diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index e596e77c346d96..947037359c8d51 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "December 2021" "" "" +.TH "NPM\-OUTDATED" "1" "January 2022" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 289d67a66886f0..13937da64848cf 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "December 2021" "" "" +.TH "NPM\-OWNER" "1" "January 2022" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SS Synopsis diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 42ab2fa74f2bba..9f0e0d8bc78463 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "December 2021" "" "" +.TH "NPM\-PACK" "1" "January 2022" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 885cbd837d449f..82a42a75716465 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "December 2021" "" "" +.TH "NPM\-PING" "1" "January 2022" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-pkg.1 b/deps/npm/man/man1/npm-pkg.1 index dcb6a8bb4d728b..db5e89d1304514 100644 --- a/deps/npm/man/man1/npm-pkg.1 +++ b/deps/npm/man/man1/npm-pkg.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PKG" "1" "December 2021" "" "" +.TH "NPM\-PKG" "1" "January 2022" "" "" .SH "NAME" \fBnpm-pkg\fR \- Manages your package\.json .SS Synopsis diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 259b85e7ee9ca0..7219fbecd13d8a 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "December 2021" "" "" +.TH "NPM\-PREFIX" "1" "January 2022" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SS Synopsis diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1 index 176afb69c24155..7fe66a033ef14b 100644 --- a/deps/npm/man/man1/npm-profile.1 +++ b/deps/npm/man/man1/npm-profile.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PROFILE" "1" "December 2021" "" "" +.TH "NPM\-PROFILE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-profile\fR \- Change settings on your registry profile .SS Synopsis diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index 54204593ff5fbe..37d62b460273f2 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "December 2021" "" "" +.TH "NPM\-PRUNE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index ca9a3041bfd4bc..80e66f59c30926 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "December 2021" "" "" +.TH "NPM\-PUBLISH" "1" "January 2022" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 5b0e96d04b864a..7f4dd0934111f6 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "December 2021" "" "" +.TH "NPM\-REBUILD" "1" "January 2022" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 178816429ad91c..31fb205ece5158 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "December 2021" "" "" +.TH "NPM\-REPO" "1" "January 2022" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SS Synopsis diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 37060c2b6f508d..549e531902ad65 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "December 2021" "" "" +.TH "NPM\-RESTART" "1" "January 2022" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index 9ac47bbeb38208..4b9816bfd59662 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "December 2021" "" "" +.TH "NPM\-ROOT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SS Synopsis diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 22b80dbf024242..6587e358824948 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "December 2021" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SS Synopsis diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 5b16ae5babc62c..80e6eb14e260f8 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "December 2021" "" "" +.TH "NPM\-SEARCH" "1" "January 2022" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-set-script.1 b/deps/npm/man/man1/npm-set-script.1 index 960d5d81fa8a2d..1d45353ddbdbaf 100644 --- a/deps/npm/man/man1/npm-set-script.1 +++ b/deps/npm/man/man1/npm-set-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SET\-SCRIPT" "1" "December 2021" "" "" +.TH "NPM\-SET\-SCRIPT" "1" "January 2022" "" "" .SH "NAME" \fBnpm-set-script\fR \- Set tasks in the scripts section of package\.json .SS Synopsis diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 166ec5da10362a..1a407c697ac307 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "December 2021" "" "" +.TH "NPM\-SHRINKWRAP" "1" "January 2022" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication .SS Synopsis diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 7b580abec8daf1..705cc9fbc3a618 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "December 2021" "" "" +.TH "NPM\-STAR" "1" "January 2022" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 3cf9bdc96ea2f0..20af164e278f4d 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "December 2021" "" "" +.TH "NPM\-STARS" "1" "January 2022" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SS Synopsis diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 66b9a935ff96ad..314d3914fc1feb 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "December 2021" "" "" +.TH "NPM\-START" "1" "January 2022" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index daf293986b6568..1bfa7443897b4a 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "December 2021" "" "" +.TH "NPM\-STOP" "1" "January 2022" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index a75060f1b2ec01..0ce06f382655be 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "December 2021" "" "" +.TH "NPM\-TEAM" "1" "January 2022" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SS Synopsis diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 44e0d716c8903b..e71fef4ab041c0 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "December 2021" "" "" +.TH "NPM\-TEST" "1" "January 2022" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1 index a1ff1bc88318fd..968fee9305c635 100644 --- a/deps/npm/man/man1/npm-token.1 +++ b/deps/npm/man/man1/npm-token.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TOKEN" "1" "December 2021" "" "" +.TH "NPM\-TOKEN" "1" "January 2022" "" "" .SH "NAME" \fBnpm-token\fR \- Manage your authentication tokens .SS Synopsis diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index f1015a4174b8d5..66aef70b046e9e 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "December 2021" "" "" +.TH "NPM\-UNINSTALL" "1" "January 2022" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SS Synopsis diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 052d7ef4c46a17..41e8bee4da4b21 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "December 2021" "" "" +.TH "NPM\-UNPUBLISH" "1" "January 2022" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1 index ef9fe6e386660c..5fc5316a865ee4 100644 --- a/deps/npm/man/man1/npm-unstar.1 +++ b/deps/npm/man/man1/npm-unstar.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNSTAR" "1" "December 2021" "" "" +.TH "NPM\-UNSTAR" "1" "January 2022" "" "" .SH "NAME" \fBnpm-unstar\fR \- Remove an item from your favorite packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 4188dda6b1ab9f..b5afea48f73c6d 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "December 2021" "" "" +.TH "NPM\-UPDATE" "1" "January 2022" "" "" .SH "NAME" \fBnpm-update\fR \- Update packages .SS Synopsis diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 73fcf0bdfa9d82..38e9f9af68d54e 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "December 2021" "" "" +.TH "NPM\-VERSION" "1" "January 2022" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SS Synopsis diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 4ff00fa93403b3..5d2fdadfaf6b11 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "December 2021" "" "" +.TH "NPM\-VIEW" "1" "January 2022" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SS Synopsis diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index bd3aea36aa9165..60d67c543b18a9 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "December 2021" "" "" +.TH "NPM\-WHOAMI" "1" "January 2022" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SS Synopsis diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 1ee03685317a08..875c883fcf060e 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "December 2021" "" "" +.TH "NPM" "1" "January 2022" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis @@ -10,7 +10,7 @@ npm [args] .RE .SS Version .P -8\.3\.0 +8\.3\.1 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index f210e94f0981de..aee52e51203a1b 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "December 2021" "" "" +.TH "NPX" "1" "January 2022" "" "" .SH "NAME" \fBnpx\fR \- Run a command from a local or remote npm package .SS Synopsis diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5 index 7b0161242f911d..3c449d41eef97e 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "December 2021" "" "" +.TH "FOLDERS" "5" "January 2022" "" "" .SH "NAME" \fBfolders\fR \- Folder Structures Used by npm .SS Description diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5 index 1879e6557f568b..432d11eda9ef44 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "December 2021" "" "" +.TH "INSTALL" "5" "January 2022" "" "" .SH "NAME" \fBinstall\fR \- Download and install node and npm .SS Description diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5 index 05f6cf4fd8b8c2..01216bd0fdc5c3 100644 --- a/deps/npm/man/man5/npm-shrinkwrap-json.5 +++ b/deps/npm/man/man5/npm-shrinkwrap-json.5 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP\.JSON" "5" "December 2021" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "January 2022" "" "" .SH "NAME" \fBnpm-shrinkwrap.json\fR \- A publishable lockfile .SS Description diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index 33f011e7958385..983294e9c20ee0 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "December 2021" "" "" +.TH "NPMRC" "5" "January 2022" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SS Description diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 6306a8cb6c3285..2695e041e7e047 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "December 2021" "" "" +.TH "PACKAGE\.JSON" "5" "January 2022" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SS Description diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5 index 22cccd59d326bf..98de34c0c59e10 100644 --- a/deps/npm/man/man5/package-lock-json.5 +++ b/deps/npm/man/man5/package-lock-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\-LOCK\.JSON" "5" "December 2021" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "January 2022" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SS Description diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index c366ec1bef6196..2e05f320075441 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "December 2021" "" "" +.TH "CONFIG" "7" "January 2022" "" "" .SH "NAME" \fBconfig\fR \- More than you probably want to know about npm configuration .SS Description diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7 index 017beab9daa03e..9deb251a185f08 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "December 2021" "" "" +.TH "DEVELOPERS" "7" "January 2022" "" "" .SH "NAME" \fBdevelopers\fR \- Developer Guide .SS Description diff --git a/deps/npm/man/man7/logging.7 b/deps/npm/man/man7/logging.7 index 9098c38849590f..0818e0debc0ef8 100644 --- a/deps/npm/man/man7/logging.7 +++ b/deps/npm/man/man7/logging.7 @@ -1,4 +1,4 @@ -.TH "LOGGING" "7" "December 2021" "" "" +.TH "LOGGING" "7" "January 2022" "" "" .SH "NAME" \fBLogging\fR \- Why, What & How we Log .SS Description diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index 32941be2f6f1f4..6790323a4f79d4 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "December 2021" "" "" +.TH "ORGS" "7" "January 2022" "" "" .SH "NAME" \fBorgs\fR \- Working with Teams & Orgs .SS Description diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7 index 3f5a28edcd01cb..8f0851011681c4 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "December 2021" "" "" +.TH "REGISTRY" "7" "January 2022" "" "" .SH "NAME" \fBregistry\fR \- The JavaScript Package Registry .SS Description diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7 index daf28731842eac..17a7d3dacb0965 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "December 2021" "" "" +.TH "REMOVAL" "7" "January 2022" "" "" .SH "NAME" \fBremoval\fR \- Cleaning the Slate .SS Synopsis diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7 index d4702277a7bacb..b1fd4d17f1149e 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "December 2021" "" "" +.TH "SCOPE" "7" "January 2022" "" "" .SH "NAME" \fBscope\fR \- Scoped packages .SS Description diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 2c121b1f4adfdd..33b70e92ca3bef 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "December 2021" "" "" +.TH "SCRIPTS" "7" "January 2022" "" "" .SH "NAME" \fBscripts\fR \- How npm handles the "scripts" field .SS Description diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index c809092741f842..a4c3eef8bebc80 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "December 2021" "" "" +.TH "WORKSPACES" "7" "January 2022" "" "" .SH "NAME" \fBworkspaces\fR \- Working with workspaces .SS Description diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index 2f0c0877cf8e0f..a7a68c98c6d6d1 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -1085,18 +1085,29 @@ class Shrinkwrap { return lock } - save (options = {}) { + toJSON () { if (!this.data) { - throw new Error('run load() before saving data') + throw new Error('run load() before getting or setting data') } + return this.commit() + } + + toString (options = {}) { + const data = this.toJSON() const { format = true } = options const defaultIndent = this.indent || 2 const indent = format === true ? defaultIndent : format || 0 const eol = format ? this.newline || '\n' : '' - const data = this.commit() - const json = stringify(data, swKeyOrder, indent).replace(/\n/g, eol) + return stringify(data, swKeyOrder, indent).replace(/\n/g, eol) + } + + save (options = {}) { + if (!this.data) { + throw new Error('run load() before saving data') + } + const json = this.toString(options) return Promise.all([ writeFile(this.filename, json).catch(er => { if (this.hiddenLockfile) { diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index cea3d5ecd7e4e5..ac2922bc9655d5 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "4.1.1", + "version": "4.2.0", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", @@ -37,7 +37,7 @@ "walk-up-path": "^1.0.0" }, "devDependencies": { - "@npmcli/template-oss": "^2.3.1", + "@npmcli/template-oss": "^2.4.2", "benchmark": "^2.1.4", "chalk": "^4.1.0", "minify-registry-metadata": "^2.1.0", @@ -94,9 +94,11 @@ "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" }, - "templateVersion": "2.3.1", "eslintIgnore": [ "test/fixtures/", "!test/fixtures/*.js" - ] + ], + "templateOSS": { + "version": "2.4.3" + } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index e52f7a14f7d7ce..293fad2ec56c37 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -401,6 +401,20 @@ class Config { } } + // Returns true if the value is coming directly from the source defined + // in default definitions, if the current value for the key config is + // coming from any other different source, returns false + isDefault (key) { + const [defaultType, ...types] = [...confTypes] + const defaultData = this.data.get(defaultType).data + + return hasOwnProperty(defaultData, key) + && types.every(type => { + const typeData = this.data.get(type).data + return !hasOwnProperty(typeData, key) + }) + } + invalidHandler (k, val, type, source, where) { this.log.warn( 'invalid config', diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index 299202ec2d0faa..83d8a349d224dc 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "2.3.2", + "version": "2.4.0", "files": [ "lib" ], diff --git a/deps/npm/node_modules/agentkeepalive/History.md b/deps/npm/node_modules/agentkeepalive/History.md index ea47ddcfe100db..00cb65f5db3c63 100644 --- a/deps/npm/node_modules/agentkeepalive/History.md +++ b/deps/npm/node_modules/agentkeepalive/History.md @@ -1,4 +1,13 @@ +4.2.0 / 2021-12-31 +================== + +**fixes** + * [[`f418c67`](http://github.com/node-modules/agentkeepalive/commit/f418c67a63c061c7261592d4553bc455e0b0d306)] - fix: change `freeSocketTimeout` default value to 4000 (#102) (fengmk2 <>) + +**others** + * [[`bc2a1ce`](http://github.com/node-modules/agentkeepalive/commit/bc2a1cea0884b4d18b0d244bf00006d9107963df)] - doc(readme): making `timeout`'s default clear (#100) (Aaron <>) + 4.1.4 / 2021-02-05 ================== diff --git a/deps/npm/node_modules/agentkeepalive/lib/agent.js b/deps/npm/node_modules/agentkeepalive/lib/agent.js index d0294a69f429ca..a7065b5e5d1ad3 100644 --- a/deps/npm/node_modules/agentkeepalive/lib/agent.js +++ b/deps/npm/node_modules/agentkeepalive/lib/agent.js @@ -31,9 +31,10 @@ class Agent extends OriginalAgent { constructor(options) { options = options || {}; options.keepAlive = options.keepAlive !== false; - // default is keep-alive and 15s free socket timeout + // default is keep-alive and 4s free socket timeout + // see https://medium.com/ssense-tech/reduce-networking-errors-in-nodejs-23b4eb9f2d83 if (options.freeSocketTimeout === undefined) { - options.freeSocketTimeout = 15000; + options.freeSocketTimeout = 4000; } // Legacy API: keepAliveTimeout should be rename to `freeSocketTimeout` if (options.keepAliveTimeout) { @@ -51,8 +52,8 @@ class Agent extends OriginalAgent { // Sets the socket to timeout after timeout milliseconds of inactivity on the socket. // By default is double free socket timeout. if (options.timeout === undefined) { - // make sure socket default inactivity timeout >= 30s - options.timeout = Math.max(options.freeSocketTimeout * 2, 30000); + // make sure socket default inactivity timeout >= 8s + options.timeout = Math.max(options.freeSocketTimeout * 2, 8000); } // support humanize format diff --git a/deps/npm/node_modules/agentkeepalive/package.json b/deps/npm/node_modules/agentkeepalive/package.json index 9027d554d1b6cc..aba00ea14847a1 100644 --- a/deps/npm/node_modules/agentkeepalive/package.json +++ b/deps/npm/node_modules/agentkeepalive/package.json @@ -1,6 +1,6 @@ { "name": "agentkeepalive", - "version": "4.1.4", + "version": "4.2.0", "description": "Missing keepalive http.Agent", "main": "index.js", "browser": "browser.js", @@ -59,7 +59,7 @@ "os": { "github": "linux" }, - "version": "8, 10, 12, 14" + "version": "8, 10, 12, 14, 16" }, "author": "fengmk2 (https://fengmk2.com)", "license": "MIT" diff --git a/deps/npm/node_modules/hosted-git-info/git-host-info.js b/deps/npm/node_modules/hosted-git-info/git-host-info.js index d4919344c77bf1..ba55248e7d62d3 100644 --- a/deps/npm/node_modules/hosted-git-info/git-host-info.js +++ b/deps/npm/node_modules/hosted-git-info/git-host-info.js @@ -139,6 +139,36 @@ gitHosts.gist = Object.assign({}, defaults, { } }) +gitHosts.sourcehut = Object.assign({}, defaults, { + protocols: ['git+ssh:', 'https:'], + domain: 'git.sr.ht', + treepath: 'tree', + browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`, + filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`, + httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`, + bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`, + docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split('/', 4) + + // tarball url + if (['archive'].includes(aux)) { + return + } + + if (project && project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (!user || !project) { + return + } + + return { user, project, committish: url.hash.slice(1) } + } +}) + const names = Object.keys(gitHosts) gitHosts.byShortcut = {} gitHosts.byDomain = {} diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json index b7e2ee28e5b117..b145e62240805d 100644 --- a/deps/npm/node_modules/hosted-git-info/package.json +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -1,6 +1,6 @@ { "name": "hosted-git-info", - "version": "4.0.2", + "version": "4.1.0", "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", "main": "index.js", "repository": { @@ -34,7 +34,7 @@ "devDependencies": { "standard": "^16.0.3", "standard-version": "^9.1.0", - "tap": "^14.11.0" + "tap": "^15.1.6" }, "files": [ "index.js", @@ -46,7 +46,6 @@ }, "tap": { "color": 1, - "coverage": true, - "esm": false + "coverage": true } } diff --git a/deps/npm/node_modules/is-core-module/core.json b/deps/npm/node_modules/is-core-module/core.json index 5cd90d1732b6b4..8f4ad128989662 100644 --- a/deps/npm/node_modules/is-core-module/core.json +++ b/deps/npm/node_modules/is-core-module/core.json @@ -83,6 +83,8 @@ "node:querystring": [">= 14.18 && < 15", ">= 16"], "readline": true, "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", "repl": true, "node:repl": [">= 14.18 && < 15", ">= 16"], "smalloc": ">= 0.11.5 && < 3", diff --git a/deps/npm/node_modules/is-core-module/package.json b/deps/npm/node_modules/is-core-module/package.json index 2b58b2332cd8e0..78470592517bb9 100644 --- a/deps/npm/node_modules/is-core-module/package.json +++ b/deps/npm/node_modules/is-core-module/package.json @@ -1,6 +1,6 @@ { "name": "is-core-module", - "version": "2.7.0", + "version": "2.8.0", "description": "Is this specifier a node.js core module?", "main": "index.js", "sideEffects": false, diff --git a/deps/npm/node_modules/is-core-module/test/index.js b/deps/npm/node_modules/is-core-module/test/index.js index 392678e85c6846..b688cd22f645f3 100644 --- a/deps/npm/node_modules/is-core-module/test/index.js +++ b/deps/npm/node_modules/is-core-module/test/index.js @@ -6,7 +6,7 @@ var semver = require('semver'); var isCore = require('../'); var data = require('../core.json'); -var supportsNodePrefix = semver.satisfies(process.versions.node, '>= 16', { includePrerelease: true }); +var supportsNodePrefix = semver.satisfies(process.versions.node, '^14.18 || >= 16', { includePrerelease: true }); test('core modules', function (t) { t.test('isCore()', function (st) { diff --git a/deps/npm/node_modules/libnpmaccess/README.md b/deps/npm/node_modules/libnpmaccess/README.md new file mode 100644 index 00000000000000..c079344597968a --- /dev/null +++ b/deps/npm/node_modules/libnpmaccess/README.md @@ -0,0 +1,247 @@ +# libnpmaccess + +[![npm version](https://img.shields.io/npm/v/libnpmaccess.svg)](https://npm.im/libnpmaccess) +[![license](https://img.shields.io/npm/l/libnpmaccess.svg)](https://npm.im/libnpmaccess) +[![GitHub Actions](https://github.com/npm/libnpmaccess/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmaccess/actions?query=workflow%3A%22Node+CI%22) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmaccess/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmaccess?branch=latest) + +[`libnpmaccess`](https://github.com/npm/libnpmaccess) is a Node.js +library that provides programmatic access to the guts of the npm CLI's `npm +access` command and its various subcommands. This includes managing account 2FA, +listing packages and permissions, looking at package collaborators, and defining +package permissions for users, orgs, and teams. + +## Example + +```javascript +const access = require('libnpmaccess') + +// List all packages @zkat has access to on the npm registry. +console.log(Object.keys(await access.lsPackages('zkat'))) +``` + +## Table of Contents + +* [Installing](#install) +* [Example](#example) +* [Contributing](#contributing) +* [API](#api) + * [access opts](#opts) + * [`public()`](#public) + * [`restricted()`](#restricted) + * [`grant()`](#grant) + * [`revoke()`](#revoke) + * [`tfaRequired()`](#tfa-required) + * [`tfaNotRequired()`](#tfa-not-required) + * [`lsPackages()`](#ls-packages) + * [`lsPackages.stream()`](#ls-packages-stream) + * [`lsCollaborators()`](#ls-collaborators) + * [`lsCollaborators.stream()`](#ls-collaborators-stream) + +### Install + +`$ npm install libnpmaccess` + +### API + +#### `opts` for `libnpmaccess` commands + +`libnpmaccess` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmaccess` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> access.public(spec, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. + +Makes package described by `spec` public. + +##### Example + +```javascript +await access.public('@foo/bar', {token: 'myregistrytoken'}) +// `@foo/bar` is now public +``` + +#### `> access.restricted(spec, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. + +Makes package described by `spec` private/restricted. + +##### Example + +```javascript +await access.restricted('@foo/bar', {token: 'myregistrytoken'}) +// `@foo/bar` is now private +``` + +#### `> access.grant(spec, team, permissions, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. `team` must be a fully-qualified team name, in the `scope:team` +format, with or without the `@` prefix, and the team must be a valid team within +that scope. `permissions` must be one of `'read-only'` or `'read-write'`. + +Grants `read-only` or `read-write` permissions for a certain package to a team. + +##### Example + +```javascript +await access.grant('@foo/bar', '@foo:myteam', 'read-write', { + token: 'myregistrytoken' +}) +// `@foo/bar` is now read/write enabled for the @foo:myteam team. +``` + +#### `> access.revoke(spec, team, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. `team` must be a fully-qualified team name, in the `scope:team` +format, with or without the `@` prefix, and the team must be a valid team within +that scope. `permissions` must be one of `'read-only'` or `'read-write'`. + +Removes access to a package from a certain team. + +##### Example + +```javascript +await access.revoke('@foo/bar', '@foo:myteam', { + token: 'myregistrytoken' +}) +// @foo:myteam can no longer access `@foo/bar` +``` + +#### `> access.tfaRequired(spec, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. + +Makes it so publishing or managing a package requires using 2FA tokens to +complete operations. + +##### Example + +```javascript +await access.tfaRequires('lodash', {token: 'myregistrytoken'}) +// Publishing or changing dist-tags on `lodash` now require OTP to be enabled. +``` + +#### `> access.tfaNotRequired(spec, [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. + +Disabled the package-level 2FA requirement for `spec`. Note that you will need +to pass in an `otp` token in `opts` in order to complete this operation. + +##### Example + +```javascript +await access.tfaNotRequired('lodash', {otp: '123654', token: 'myregistrytoken'}) +// Publishing or editing dist-tags on `lodash` no longer requires OTP to be +// enabled. +``` + +#### `> access.lsPackages(entity, [opts]) -> Promise` + +`entity` must be either a valid org or user name, or a fully-qualified team name +in the `scope:team` format, with or without the `@` prefix. + +Lists out packages a user, org, or team has access to, with corresponding +permissions. Packages that the access token does not have access to won't be +listed. + +In order to disambiguate between users and orgs, two requests may end up being +made when listing orgs or users. + +For a streamed version of these results, see +[`access.lsPackages.stream()`](#ls-package-stream). + +##### Example + +```javascript +await access.lsPackages('zkat', { + token: 'myregistrytoken' +}) +// Lists all packages `@zkat` has access to on the registry, and the +// corresponding permissions. +``` + +#### `> access.lsPackages.stream(scope, [team], [opts]) -> Stream` + +`entity` must be either a valid org or user name, or a fully-qualified team name +in the `scope:team` format, with or without the `@` prefix. + +Streams out packages a user, org, or team has access to, with corresponding +permissions, with each stream entry being formatted like `[packageName, +permissions]`. Packages that the access token does not have access to won't be +listed. + +In order to disambiguate between users and orgs, two requests may end up being +made when listing orgs or users. + +The returned stream is a valid `asyncIterator`. + +##### Example + +```javascript +for await (let [pkg, perm] of access.lsPackages.stream('zkat')) { + console.log('zkat has', perm, 'access to', pkg) +} +// zkat has read-write access to eggplant +// zkat has read-only access to @npmcorp/secret +``` + +#### `> access.lsCollaborators(spec, [user], [opts]) -> Promise` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. `user` must be a valid user name, with or without the `@` +prefix. + +Lists out access privileges for a certain package. Will only show permissions +for packages to which you have at least read access. If `user` is passed in, the +list is filtered only to teams _that_ user happens to belong to. + +For a streamed version of these results, see [`access.lsCollaborators.stream()`](#ls-collaborators-stream). + +##### Example + +```javascript +await access.lsCollaborators('@npm/foo', 'zkat', { + token: 'myregistrytoken' +}) +// Lists all teams with access to @npm/foo that @zkat belongs to. +``` + +#### `> access.lsCollaborators.stream(spec, [user], [opts]) -> Stream` + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. `user` must be a valid user name, with or without the `@` +prefix. + +Stream out access privileges for a certain package, with each entry in `[user, +permissions]` format. Will only show permissions for packages to which you have +at least read access. If `user` is passed in, the list is filtered only to teams +_that_ user happens to belong to. + +The returned stream is a valid `asyncIterator`. + +##### Example + +```javascript +for await (let [usr, perm] of access.lsCollaborators.stream('npm')) { + console.log(usr, 'has', perm, 'access to npm') +} +// zkat has read-write access to npm +// iarna has read-write access to npm +``` diff --git a/deps/npm/node_modules/libnpmaccess/index.js b/deps/npm/node_modules/libnpmaccess/lib/index.js similarity index 95% rename from deps/npm/node_modules/libnpmaccess/index.js rename to deps/npm/node_modules/libnpmaccess/lib/index.js index 883110b2899186..925f742921ad46 100644 --- a/deps/npm/node_modules/libnpmaccess/index.js +++ b/deps/npm/node_modules/libnpmaccess/lib/index.js @@ -36,7 +36,7 @@ function setAccess (spec, access, opts = {}) { ...opts, method: 'POST', body: { access }, - spec + spec, }).then(() => true) }) } @@ -47,7 +47,9 @@ cmd.grant = (spec, entity, permissions, opts = {}) => { const { scope, team } = splitEntity(entity) validate('OSSSO', [spec, scope, team, permissions, opts]) if (permissions !== 'read-write' && permissions !== 'read-only') { - throw new Error('`permissions` must be `read-write` or `read-only`. Got `' + permissions + '` instead') + throw new Error( + '`permissions` must be `read-write` or `read-only`. Got `' + + permissions + '` instead') } const uri = `/-/team/${eu(scope)}/${eu(team)}/package` return npmFetch(uri, { @@ -56,7 +58,7 @@ cmd.grant = (spec, entity, permissions, opts = {}) => { body: { package: spec.name, permissions }, scope, spec, - ignoreBody: true + ignoreBody: true, }) .then(() => true) }) @@ -74,7 +76,7 @@ cmd.revoke = (spec, entity, opts = {}) => { body: { package: spec.name }, scope, spec, - ignoreBody: true + ignoreBody: true, }) .then(() => true) }) @@ -106,7 +108,7 @@ cmd.lsPackages.stream = (entity, opts = {}) => { const nextOpts = { ...opts, query: { format: 'cli' }, - mapJSON + mapJSON, } const ret = new Minipass({ objectMode: true }) npmFetch.json.stream(uri, '*', nextOpts) @@ -153,7 +155,7 @@ cmd.lsCollaborators.stream = (spec, user, opts) => { return npmFetch.json.stream(uri, '*', { ...opts, query: { format: 'cli', user: user || undefined }, - mapJSON + mapJSON, }) } @@ -169,7 +171,7 @@ function setRequires2fa (spec, required, opts = {}) { method: 'POST', body: { publish_requires_tfa: required }, spec, - ignoreBody: true + ignoreBody: true, }).then(() => true) }) } diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 23d4b444ca0701..8d2ba3ad765fd2 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,20 +1,26 @@ { "name": "libnpmaccess", - "version": "4.0.3", + "version": "5.0.0", "description": "programmatic library for `npm access` commands", - "author": "Kat Marchán ", + "author": "GitHub Inc.", "license": "ISC", + "main": "lib/index.js", "scripts": { "preversion": "npm test", "postversion": "npm publish", "postpublish": "git push origin --follow-tags", - "lint": "standard", - "test": "tap" + "lint": "eslint '**/*.js'", + "test": "tap", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "posttest": "npm run lint" }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "nock": "^12.0.1", - "standard": "^14.3.0", - "tap": "^14.11.0" + "tap": "^15.1.0" }, "repository": { "type": "git", @@ -29,9 +35,16 @@ "npm-registry-fetch": "^11.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "tap": { "check-coverage": true + }, + "files": [ + "bin", + "lib" + ], + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmaccess/test/fixtures/tnock.js b/deps/npm/node_modules/libnpmaccess/test/fixtures/tnock.js deleted file mode 100644 index 00b6e160e10192..00000000000000 --- a/deps/npm/node_modules/libnpmaccess/test/fixtures/tnock.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict' - -const nock = require('nock') - -module.exports = tnock -function tnock (t, host) { - const server = nock(host) - t.tearDown(function () { - server.done() - }) - return server -} diff --git a/deps/npm/node_modules/libnpmaccess/test/index.js b/deps/npm/node_modules/libnpmaccess/test/index.js deleted file mode 100644 index c6d939c3d8c55c..00000000000000 --- a/deps/npm/node_modules/libnpmaccess/test/index.js +++ /dev/null @@ -1,417 +0,0 @@ -'use strict' - -const t = require('tap') -const tnock = require('./fixtures/tnock.js') - -const access = require('../index.js') - -const REG = 'http://localhost:1337' -const OPTS = { - registry: REG -} - -t.test('access public', t => { - tnock(t, REG).post( - '/-/package/%40foo%2Fbar/access', { access: 'public' } - ).reply(200) - return access.public('@foo/bar', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access public - failure', t => { - tnock(t, REG).post( - '/-/package/%40foo%2Fbar/access', { access: 'public' } - ).reply(418) - return access.public('@foo/bar', OPTS) - .catch(err => { - t.equals(err.statusCode, 418, 'fails with code from registry') - }) -}) - -t.test('access restricted', t => { - tnock(t, REG).post( - '/-/package/%40foo%2Fbar/access', { access: 'restricted' } - ).reply(200) - return access.restricted('@foo/bar', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access restricted - failure', t => { - tnock(t, REG).post( - '/-/package/%40foo%2Fbar/access', { access: 'restricted' } - ).reply(418) - return access.restricted('@foo/bar', OPTS) - .catch(err => { - t.equals(err.statusCode, 418, 'fails with code from registry') - }) -}) - -t.test('access 2fa-required', t => { - tnock(t, REG).post('/-/package/%40foo%2Fbar/access', { - publish_requires_tfa: true - }).reply(200, { ok: true }) - return access.tfaRequired('@foo/bar', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access 2fa-not-required', t => { - tnock(t, REG).post('/-/package/%40foo%2Fbar/access', { - publish_requires_tfa: false - }).reply(200, { ok: true }) - return access.tfaNotRequired('@foo/bar', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access grant basic read-write', t => { - tnock(t, REG).put('/-/team/myorg/myteam/package', { - package: '@foo/bar', - permissions: 'read-write' - }).reply(201) - return access.grant( - '@foo/bar', 'myorg:myteam', 'read-write', OPTS - ).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access grant basic read-only', t => { - tnock(t, REG).put('/-/team/myorg/myteam/package', { - package: '@foo/bar', - permissions: 'read-only' - }).reply(201) - return access.grant( - '@foo/bar', 'myorg:myteam', 'read-only', OPTS - ).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access grant bad perm', t => { - return access.grant( - '@foo/bar', 'myorg:myteam', 'unknown', OPTS - ).then(ret => { - throw new Error('should not have succeeded') - }, err => { - t.match( - err.message, - /must be.*read-write.*read-only/, - 'only read-write and read-only are accepted' - ) - }) -}) - -t.test('access grant no entity', t => { - return access.grant( - '@foo/bar', undefined, 'read-write', OPTS - ).then(ret => { - throw new Error('should not have succeeded') - }, err => { - t.match( - err.message, - /Expected string/, - 'passing undefined entity gives useful error' - ) - }) -}) - -t.test('access grant basic unscoped', t => { - tnock(t, REG).put('/-/team/myorg/myteam/package', { - package: 'bar', - permissions: 'read-write' - }).reply(201) - return access.grant( - 'bar', 'myorg:myteam', 'read-write', OPTS - ).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access grant no opts passed', t => { - // NOTE: mocking real url, because no opts variable means `registry` value - // will be defauled to real registry url - tnock(t, 'https://registry.npmjs.org') - .put('/-/team/myorg/myteam/package', { - package: 'bar', - permissions: 'read-write' - }) - .reply(201) - return access.grant('bar', 'myorg:myteam', 'read-write') - .then(ret => { - t.equals(ret, true, 'request succeeded') - }) -}) - -t.test('access revoke basic', t => { - tnock(t, REG).delete('/-/team/myorg/myteam/package', { - package: '@foo/bar' - }).reply(200) - return access.revoke('@foo/bar', 'myorg:myteam', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access revoke basic unscoped', t => { - tnock(t, REG).delete('/-/team/myorg/myteam/package', { - package: 'bar' - }).reply(200, { accessChanged: true }) - return access.revoke('bar', 'myorg:myteam', OPTS).then(ret => { - t.deepEqual(ret, true, 'request succeeded') - }) -}) - -t.test('access revoke no opts passed', t => { - // NOTE: mocking real url, because no opts variable means `registry` value - // will be defauled to real registry url - tnock(t, 'https://registry.npmjs.org') - .delete('/-/team/myorg/myteam/package', { - package: 'bar' - }) - .reply(201) - return access.revoke('bar', 'myorg:myteam') - .then(ret => { - t.equals(ret, true, 'request succeeded') - }) -}) - -t.test('ls-packages on team', t => { - const serverPackages = { - '@foo/bar': 'write', - '@foo/util': 'read', - '@foo/other': 'shrödinger' - } - const clientPackages = { - '@foo/bar': 'read-write', - '@foo/util': 'read-only', - '@foo/other': 'shrödinger' - } - tnock(t, REG).get( - '/-/team/myorg/myteam/package?format=cli' - ).reply(200, serverPackages) - return access.lsPackages('myorg:myteam', OPTS).then(data => { - t.deepEqual(data, clientPackages, 'got client package info') - }) -}) - -t.test('ls-packages on org', t => { - const serverPackages = { - '@foo/bar': 'write', - '@foo/util': 'read', - '@foo/other': 'shrödinger' - } - const clientPackages = { - '@foo/bar': 'read-write', - '@foo/util': 'read-only', - '@foo/other': 'shrödinger' - } - tnock(t, REG).get( - '/-/org/myorg/package?format=cli' - ).reply(200, serverPackages) - return access.lsPackages('myorg', OPTS).then(data => { - t.deepEqual(data, clientPackages, 'got client package info') - }) -}) - -t.test('ls-packages on user', t => { - const serverPackages = { - '@foo/bar': 'write', - '@foo/util': 'read', - '@foo/other': 'shrödinger' - } - const clientPackages = { - '@foo/bar': 'read-write', - '@foo/util': 'read-only', - '@foo/other': 'shrödinger' - } - const srv = tnock(t, REG) - srv.get('/-/org/myuser/package?format=cli').reply(404, { error: 'not found' }) - srv.get('/-/user/myuser/package?format=cli').reply(200, serverPackages) - return access.lsPackages('myuser', OPTS).then(data => { - t.deepEqual(data, clientPackages, 'got client package info') - }) -}) - -t.test('ls-packages error on team', t => { - tnock(t, REG).get('/-/team/myorg/myteam/package?format=cli').reply(404) - return access.lsPackages('myorg:myteam', OPTS).then( - () => { throw new Error('should not have succeeded') }, - err => t.equal(err.code, 'E404', 'spit out 404 directly if team provided') - ) -}) - -t.test('ls-packages error on user', t => { - const srv = tnock(t, REG) - srv.get('/-/org/myuser/package?format=cli').reply(404, { error: 'not found' }) - srv.get('/-/user/myuser/package?format=cli').reply(404, { error: 'not found' }) - return access.lsPackages('myuser', OPTS).then( - () => { throw new Error('should not have succeeded') }, - err => t.equal(err.code, 'E404', 'spit out 404 if both reqs fail') - ) -}) - -t.test('ls-packages bad response', t => { - tnock(t, REG).get( - '/-/team/myorg/myteam/package?format=cli' - ).reply(200, JSON.stringify(null)) - return access.lsPackages('myorg:myteam', OPTS).then(data => { - t.deepEqual(data, null, 'succeeds with null') - }) -}) - -t.test('ls-packages stream', t => { - const serverPackages = { - '@foo/bar': 'write', - '@foo/util': 'read', - '@foo/other': 'shrödinger' - } - const clientPackages = [ - ['@foo/bar', 'read-write'], - ['@foo/util', 'read-only'], - ['@foo/other', 'shrödinger'] - ] - tnock(t, REG).get( - '/-/team/myorg/myteam/package?format=cli' - ).reply(200, serverPackages) - return access.lsPackages.stream('myorg:myteam', OPTS) - .collect() - .then(data => { - t.deepEqual(data, clientPackages, 'got streamed client package info') - }) -}) - -t.test('ls-packages stream no opts', t => { - const serverPackages = { - '@foo/bar': 'write', - '@foo/util': 'read', - '@foo/other': 'shrödinger' - } - const clientPackages = [ - ['@foo/bar', 'read-write'], - ['@foo/util', 'read-only'], - ['@foo/other', 'shrödinger'] - ] - // NOTE: mocking real url, because no opts variable means `registry` value - // will be defauled to real registry url - tnock(t, 'https://registry.npmjs.org') - .get('/-/team/myorg/myteam/package?format=cli') - .reply(200, serverPackages) - return access.lsPackages.stream('myorg:myteam') - .collect() - .then(data => { - t.deepEqual(data, clientPackages, 'got streamed client package info') - }) -}) - -t.test('ls-collaborators', t => { - const serverCollaborators = { - 'myorg:myteam': 'write', - 'myorg:anotherteam': 'read', - 'myorg:thirdteam': 'special-case' - } - const clientCollaborators = { - 'myorg:myteam': 'read-write', - 'myorg:anotherteam': 'read-only', - 'myorg:thirdteam': 'special-case' - } - tnock(t, REG).get( - '/-/package/%40foo%2Fbar/collaborators?format=cli' - ).reply(200, serverCollaborators) - return access.lsCollaborators('@foo/bar', OPTS).then(data => { - t.deepEqual(data, clientCollaborators, 'got collaborators') - }) -}) - -t.test('ls-collaborators stream', t => { - const serverCollaborators = { - 'myorg:myteam': 'write', - 'myorg:anotherteam': 'read', - 'myorg:thirdteam': 'special-case' - } - const clientCollaborators = [ - ['myorg:myteam', 'read-write'], - ['myorg:anotherteam', 'read-only'], - ['myorg:thirdteam', 'special-case'] - ] - tnock(t, REG).get( - '/-/package/%40foo%2Fbar/collaborators?format=cli' - ).reply(200, serverCollaborators) - return access.lsCollaborators.stream('@foo/bar', OPTS) - .collect() - .then(data => { - t.deepEqual(data, clientCollaborators, 'got collaborators') - }) -}) - -t.test('ls-collaborators w/scope', t => { - const serverCollaborators = { - 'myorg:myteam': 'write', - 'myorg:anotherteam': 'read', - 'myorg:thirdteam': 'special-case' - } - const clientCollaborators = { - 'myorg:myteam': 'read-write', - 'myorg:anotherteam': 'read-only', - 'myorg:thirdteam': 'special-case' - } - tnock(t, REG).get( - '/-/package/%40foo%2Fbar/collaborators?format=cli&user=zkat' - ).reply(200, serverCollaborators) - return access.lsCollaborators('@foo/bar', 'zkat', OPTS).then(data => { - t.deepEqual(data, clientCollaborators, 'got collaborators') - }) -}) - -t.test('ls-collaborators w/o scope', t => { - const serverCollaborators = { - 'myorg:myteam': 'write', - 'myorg:anotherteam': 'read', - 'myorg:thirdteam': 'special-case' - } - const clientCollaborators = { - 'myorg:myteam': 'read-write', - 'myorg:anotherteam': 'read-only', - 'myorg:thirdteam': 'special-case' - } - tnock(t, REG).get( - '/-/package/bar/collaborators?format=cli&user=zkat' - ).reply(200, serverCollaborators) - return access.lsCollaborators('bar', 'zkat', OPTS).then(data => { - t.deepEqual(data, clientCollaborators, 'got collaborators') - }) -}) - -t.test('ls-collaborators bad response', t => { - tnock(t, REG).get( - '/-/package/%40foo%2Fbar/collaborators?format=cli' - ).reply(200, JSON.stringify(null)) - return access.lsCollaborators('@foo/bar', null, OPTS).then(data => { - t.deepEqual(data, null, 'succeeds with null') - }) -}) - -t.test('error on non-registry specs', t => { - const resolve = () => { throw new Error('should not succeed') } - const reject = err => t.match( - err.message, /spec.*must be a registry spec/, 'registry spec required' - ) - return Promise.all([ - access.public('githubusername/reponame').then(resolve, reject), - access.restricted('foo/bar').then(resolve, reject), - access.grant('foo/bar', 'myorg', 'myteam', 'read-only').then(resolve, reject), - access.revoke('foo/bar', 'myorg', 'myteam').then(resolve, reject), - access.lsCollaborators('foo/bar').then(resolve, reject), - access.tfaRequired('foo/bar').then(resolve, reject), - access.tfaNotRequired('foo/bar').then(resolve, reject) - ]) -}) - -t.test('edit', t => { - t.equal(typeof access.edit, 'function', 'access.edit exists') - t.throws(() => { - access.edit() - }, /Not implemented/, 'directly throws NIY message') - t.done() -}) diff --git a/deps/npm/node_modules/libnpmdiff/index.js b/deps/npm/node_modules/libnpmdiff/lib/index.js similarity index 89% rename from deps/npm/node_modules/libnpmdiff/index.js rename to deps/npm/node_modules/libnpmdiff/lib/index.js index 6e68e6c4c43769..10532c1990dc4a 100644 --- a/deps/npm/node_modules/libnpmdiff/index.js +++ b/deps/npm/node_modules/libnpmdiff/lib/index.js @@ -1,8 +1,8 @@ const pacote = require('pacote') -const formatDiff = require('./lib/format-diff.js') -const getTarball = require('./lib/tarball.js') -const untar = require('./lib/untar.js') +const formatDiff = require('./format-diff.js') +const getTarball = require('./tarball.js') +const untar = require('./untar.js') // TODO: we test this condition in the diff command // so this error probably doesnt need to be here. Or diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json index 129d9b90cd7fe6..24846f39cf4fb5 100644 --- a/deps/npm/node_modules/libnpmdiff/package.json +++ b/deps/npm/node_modules/libnpmdiff/package.json @@ -1,14 +1,15 @@ { "name": "libnpmdiff", - "version": "2.0.4", + "version": "3.0.0", "description": "The registry diff", "repository": "https://github.com/npm/libnpmdiff", + "main": "lib/index.js", "files": [ - "index.js", + "bin", "lib" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "keywords": [ "npm", @@ -28,24 +29,21 @@ "license": "ISC", "scripts": { "eslint": "eslint", - "lint": "npm run eslint -- index.js \"lib/**/*.js\" \"test/*.js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", - "test": "tap test/*.js", + "test": "tap", "posttest": "npm run lint", - "snap": "tap test/*.js", + "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "npm-template-check" }, "tap": { "check-coverage": true }, - "standard": { - "ignore": [ - "/tap-snapshots/" - ] - }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "eslint": "^8.1.0", "tap": "^15.0.9" }, @@ -58,5 +56,8 @@ "npm-package-arg": "^8.1.4", "pacote": "^12.0.0", "tar": "^6.1.0" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmexec/README.md b/deps/npm/node_modules/libnpmexec/README.md new file mode 100644 index 00000000000000..a48552714d5e6b --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/README.md @@ -0,0 +1,50 @@ +# libnpmexec + +[![npm version](https://img.shields.io/npm/v/libnpmexec.svg)](https://npm.im/libnpmexec) +[![license](https://img.shields.io/npm/l/libnpmexec.svg)](https://npm.im/libnpmexec) +[![GitHub Actions](https://github.com/npm/libnpmexec/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmexec/actions?query=workflow%3Anode-ci) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmexec/badge.svg?branch=main)](https://coveralls.io/github/npm/libnpmexec?branch=main) + +The `npm exec` (`npx`) Programmatic API + +## Install + +`npm install libnpmexec` + +## Usage: + +```js +const libexec = require('libnpmexec') +await libexec({ + args: ['yosay', 'Bom dia!'], + cache: '~/.npm/_cacache', + npxCache: '~/.npm/_npx', + yes: true, +}) +``` + +## API: + +### `libexec(opts)` + +- `opts`: + - `args`: List of pkgs to execute **Array**, defaults to `[]` + - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string. + - `cache`: The path location to where the npm cache folder is placed **String** + - `npxCache`: The path location to where the npx cache folder is placed **String** + - `color`: Output should use color? **Boolean**, defaults to `false` + - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found. + - `locationMsg`: Overrides "at location" message when entering interactive mode **String** + - `log`: Sets an optional logger **Object**, defaults to `proc-log` module usage. + - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string. + - `output`: A function to print output to **Function** + - `packages`: A list of packages to be used (possibly fetch from the registry) **Array**, defaults to `[]` + - `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.` + - `runPath`: Location to where to execute the script **String**, defaults to `.` + - `scriptShell`: Default shell to be used **String**, defaults to `sh` on POSIX systems, `process.env.ComSpec` OR `cmd` on Windows + - `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean** + - `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object** + +## LICENSE + +[ISC](./LICENSE) diff --git a/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js index 4fb534f7dfe125..77466938762d08 100644 --- a/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js +++ b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js @@ -3,8 +3,9 @@ const crypto = require('crypto') const { resolve } = require('path') const cacheInstallDir = ({ npxCache, packages }) => { - if (!npxCache) + if (!npxCache) { throw new Error('Must provide a valid npxCache path') + } // only packages not found in ${prefix}/node_modules return resolve(npxCache, getHash(packages)) diff --git a/deps/npm/node_modules/libnpmexec/lib/file-exists.js b/deps/npm/node_modules/libnpmexec/lib/file-exists.js index a115be14b00427..05dddc89f08f9b 100644 --- a/deps/npm/node_modules/libnpmexec/lib/file-exists.js +++ b/deps/npm/node_modules/libnpmexec/lib/file-exists.js @@ -13,11 +13,13 @@ const localFileExists = async (dir, binName, root = '/') => { for (const path of walkUp(resolve(dir))) { const binDir = resolve(path, 'node_modules', '.bin') - if (await fileExists(resolve(binDir, binName))) + if (await fileExists(resolve(binDir, binName))) { return binDir + } - if (path.toLowerCase() === root) + if (path.toLowerCase() === root) { return false + } } return false diff --git a/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js b/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js index 038095b5023007..8ebc0e7a18bd25 100644 --- a/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js +++ b/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js @@ -3,13 +3,15 @@ const getBinFromManifest = (mani) => { // otherwise if there's 1 bin or all bin value is the same (alias), use // that, otherwise fail const bin = mani.bin || {} - if (new Set(Object.values(bin)).size === 1) + if (new Set(Object.values(bin)).size === 1) { return Object.keys(bin)[0] + } // XXX probably a util to parse this better? const name = mani.name.replace(/^@[^/]+\//, '') - if (bin[name]) + if (bin[name]) { return name + } // XXX need better error message throw Object.assign(new Error('could not determine executable to run'), { diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js index 3f1463d767a8e0..facafb035d3289 100644 --- a/deps/npm/node_modules/libnpmexec/lib/index.js +++ b/deps/npm/node_modules/libnpmexec/lib/index.js @@ -59,8 +59,9 @@ const exec = async (opts) => { }) // nothing to maybe install, skip the arborist dance - if (!call && !args.length && !packages.length) + if (!call && !args.length && !packages.length) { return await _run() + } const needPackageCommandSwap = args.length && !packages.length // if there's an argument and no package has been explicitly asked for @@ -79,8 +80,9 @@ const exec = async (opts) => { binExists = true } - if (binExists) + if (binExists) { return await _run() + } packages.push(args[0]) } @@ -109,8 +111,9 @@ const exec = async (opts) => { }) })) - if (needPackageCommandSwap) + if (needPackageCommandSwap) { args[0] = getBinFromManifest(manis[0]) + } // figure out whether we need to install stuff, or if local is fine const localArb = new Arborist({ @@ -150,8 +153,9 @@ const exec = async (opts) => { if (add.length) { if (!yes) { // set -n to always say no - if (yes === false) + if (yes === false) { throw new Error('canceled') + } if (noTTY() || ciDetect()) { log.warn('exec', `The following package${ @@ -165,11 +169,13 @@ const exec = async (opts) => { const prompt = `Need to install the following packages:\n${ addList }Ok to proceed? ` - if (typeof log.clearProgress === 'function') + if (typeof log.clearProgress === 'function') { log.clearProgress() + } const confirm = await read({ prompt, default: 'y' }) - if (confirm.trim().toLowerCase().charAt(0) !== 'y') + if (confirm.trim().toLowerCase().charAt(0) !== 'y') { throw new Error('canceled') + } } } await arb.reify({ diff --git a/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js b/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js index 47146809609923..aec1281e3a4bf9 100644 --- a/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js +++ b/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js @@ -3,12 +3,14 @@ const manifestMissing = ({ tree, manifest }) => { // true means we need to install it const child = tree.children.get(manifest.name) // if no child, we have to load it - if (!child) + if (!child) { return true + } // if no version/tag specified, allow whatever's there - if (manifest._from === `${manifest.name}@`) + if (manifest._from === `${manifest.name}@`) { return false + } // otherwise the version has to match what we WOULD get return child.version !== manifest.version diff --git a/deps/npm/node_modules/libnpmexec/lib/run-script.js b/deps/npm/node_modules/libnpmexec/lib/run-script.js index 819dacb8baee86..851f5c60bd0f10 100644 --- a/deps/npm/node_modules/libnpmexec/lib/run-script.js +++ b/deps/npm/node_modules/libnpmexec/lib/run-script.js @@ -41,16 +41,18 @@ const run = async ({ }, } - if (log && log.disableProgress) + if (log && log.disableProgress) { log.disableProgress() + } try { if (script === scriptShell) { const isTTY = !noTTY() if (isTTY) { - if (ciDetect()) + if (ciDetect()) { return log.warn('exec', 'Interactive mode disabled in CI environment') + } locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}` @@ -78,8 +80,9 @@ const run = async ({ stdio: 'inherit', }) } finally { - if (log && log.enableProgress) + if (log && log.enableProgress) { log.enableProgress() + } } } diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json index 3a03bd6cba03cf..8c8812a651a053 100644 --- a/deps/npm/node_modules/libnpmexec/package.json +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -1,7 +1,8 @@ { "name": "libnpmexec", - "version": "3.0.1", + "version": "3.0.2", "files": [ + "bin", "lib" ], "main": "lib/index.js", @@ -28,25 +29,24 @@ ], "license": "ISC", "scripts": { - "lint": "eslint lib/*.js", - "pretest": "npm run lint", - "test": "tap test/*.js", - "snap": "tap test/*.js", + "lint": "eslint '**/*.js'", + "posttest": "npm run lint", + "test": "tap", + "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix" }, "tap": { "color": true, - "check-coverage": true + "check-coverage": true, + "files": "test/*.js" }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "bin-links": "^2.2.1", - "eslint": "^7.24.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-standard": "^5.0.0", "tap": "^15.0.6" }, "dependencies": { @@ -61,5 +61,8 @@ "read": "^1.0.7", "read-package-json-fast": "^2.0.2", "walk-up-path": "^1.0.0" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmfund/README.md b/deps/npm/node_modules/libnpmfund/README.md new file mode 100644 index 00000000000000..8ab663f634d6fb --- /dev/null +++ b/deps/npm/node_modules/libnpmfund/README.md @@ -0,0 +1,132 @@ +# libnpmfund + +[![npm version](https://img.shields.io/npm/v/libnpmfund.svg)](https://npm.im/libnpmfund) +[![license](https://img.shields.io/npm/l/libnpmfund.svg)](https://npm.im/libnpmfund) +[![GitHub Actions](https://github.com/npm/libnpmfund/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmfund/actions?query=workflow%3Anode-ci) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmfund/badge.svg?branch=master)](https://coveralls.io/github/npm/libnpmfund?branch=master) + +[`libnpmfund`](https://github.com/npm/libnpmfund) is a Node.js library for +retrieving **funding** information for packages installed using +[`arborist`](https://github.com/npm/arborist). + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) +* [LICENSE](#license) + +## Example + +```js +const { read } = require('libnpmfund') + +const fundingInfo = await read() +console.log( + JSON.stringify(fundingInfo, null, 2) +) +// => { + length: 2, + name: 'foo', + version: '1.0.0', + funding: { url: 'https://example.com' }, + dependencies: { + bar: { + version: '1.0.0', + funding: { url: 'http://collective.example.com' } + } + } +} +``` + +## Install + +`$ npm install libnpmfund` + +### Contributing + +The npm team enthusiastically welcomes contributions and project participation! +There's a bunch of things you can do if you want to contribute! The +[Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) +outlines the process for community interaction and contribution. Please don't +hesitate to jump in if you'd like to, or even ask us questions if something +isn't clear. + +All participants and maintainers in this project are expected to follow the +[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and just +generally be excellent to each other. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. + +Happy hacking! + +### API + +##### `> fund.read([opts]) -> Promise` + +Reads **funding** info from a npm install and returns a promise for a +tree object that only contains packages in which funding info is defined. + +Options: + +- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over +any obj definition and just returns an obj containing `{ length }` - useful for +things such as printing a `6 packages are looking for funding` msg. +- `workspaces`: `Array` List of workspaces names to filter for, +the result will only include a subset of the resulting tree that includes +only the nodes that are children of the listed workspaces names. +- `path`, `registry` and more [Arborist](https://github.com/npm/arborist/) options. + +##### `> fund.readTree(tree, [opts]) -> Promise` + +Reads **funding** info from a given install tree and returns a tree object +that only contains packages in which funding info is defined. + +- `tree`: An [`arborist`](https://github.com/npm/arborist) tree to be used, e.g: + +```js +const Arborist = require('@npmcli/arborist') +const { readTree } = require('libnpmfund') + +const arb = new Arborist({ path: process.cwd() }) +const tree = await arb.loadActual() + +return readTree(tree, { countOnly: false }) +``` + +Options: + +- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over +any obj definition and just returns an obj containing `{ length }` - useful for +things such as printing a `6 packages are looking for funding` msg. + +##### `> fund.normalizeFunding(funding) -> Object` + +From a `funding` ``, retrieves normalized funding objects +containing a `url` property. + +e.g: + +```js +normalizeFunding('http://example.com') +// => { + url: 'http://example.com' +} +``` + +##### `> fund.isValidFunding(funding) -> Boolean` + +Returns `` if `funding` is a valid funding object, e.g: + +```js +isValidFunding({ foo: 'not a valid funding obj' }) +// => false + +isValidFunding('http://example.com') +// => true +``` + +## LICENSE + +[ISC](./LICENSE) diff --git a/deps/npm/node_modules/libnpmfund/index.js b/deps/npm/node_modules/libnpmfund/lib/index.js similarity index 88% rename from deps/npm/node_modules/libnpmfund/index.js rename to deps/npm/node_modules/libnpmfund/lib/index.js index 37bc1dd0b79165..a3d2d8223ca4e0 100644 --- a/deps/npm/node_modules/libnpmfund/index.js +++ b/deps/npm/node_modules/libnpmfund/lib/index.js @@ -15,11 +15,13 @@ function normalizeFunding (funding) { // Is the value of a `funding` property of a `package.json` // a valid type+url for `npm fund` to display? function isValidFunding (funding) { - if (!funding) + if (!funding) { return false + } - if (Array.isArray(funding)) + if (Array.isArray(funding)) { return funding.every(f => !Array.isArray(f) && isValidFunding(f)) + } try { var parsed = new URL(funding.url || funding) @@ -30,8 +32,9 @@ function isValidFunding (funding) { if ( parsed.protocol !== 'https:' && parsed.protocol !== 'http:' - ) + ) { return false + } return Boolean(parsed.host) } @@ -53,8 +56,9 @@ function readTree (tree, opts) { function tracked (name, version) { const key = String(name) + String(version) - if (seen.has(key)) + if (seen.has(key)) { return true + } seen.add(key) } @@ -89,30 +93,36 @@ function readTree (tree, opts) { function getFundingDependencies (tree) { const edges = tree && tree.edgesOut && tree.edgesOut.values() - if (!edges) + if (!edges) { return empty() + } const directDepsWithFunding = Array.from(edges).map(edge => { - if (!edge || !edge.to) + if (!edge || !edge.to) { return empty() + } const node = edge.to.target || edge.to - if (!node.package) + if (!node.package) { return empty() + } - if (filterSet && filterSet.size > 0 && !filterSet.has(node)) + if (filterSet && filterSet.size > 0 && !filterSet.has(node)) { return empty() + } const { name, funding, version } = node.package // avoids duplicated items within the funding tree - if (tracked(name, version)) + if (tracked(name, version)) { return empty() + } const fundingItem = {} - if (version) + if (version) { fundingItem.version = version + } attachFundingInfo(fundingItem, funding) @@ -126,8 +136,9 @@ function readTree (tree, opts) { (res, { node, fundingItem }, i) => { if (!fundingItem || fundingItem.length === 0 || - !node) + !node) { return res + } // recurse const transitiveDependencies = node.edgesOut && @@ -136,17 +147,18 @@ function readTree (tree, opts) { // if we're only counting items there's no need // to add all the data to the resulting object - if (countOnly) + if (countOnly) { return null + } if (hasDependencies(transitiveDependencies)) { fundingItem.dependencies = retrieveDependencies(transitiveDependencies) } - if (isValidFunding(fundingItem.funding)) + if (isValidFunding(fundingItem.funding)) { res[node.package.name] = fundingItem - else if (hasDependencies(fundingItem.dependencies)) { + } else if (hasDependencies(fundingItem.dependencies)) { res[_trailingDependencies] = Object.assign( empty(), @@ -170,11 +182,13 @@ function readTree (tree, opts) { (tree && tree.name) result.name = name || (tree && tree.path) - if (tree && tree.package && tree.package.version) + if (tree && tree.package && tree.package.version) { result.version = tree.package.version + } - if (tree && tree.package && tree.package.funding) + if (tree && tree.package && tree.package.funding) { result.funding = normalizeFunding(tree.package.funding) + } result.dependencies = retrieveDependencies(treeDependencies) } diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json index 2bd47419936445..4b7ffc8f30843f 100644 --- a/deps/npm/node_modules/libnpmfund/package.json +++ b/deps/npm/node_modules/libnpmfund/package.json @@ -1,8 +1,10 @@ { "name": "libnpmfund", - "version": "2.0.1", + "version": "2.0.2", + "main": "lib/index.js", "files": [ - "index.js" + "bin", + "lib" ], "description": "Programmatic API for npm fund", "repository": "https://github.com/npm/libnpmfund", @@ -15,7 +17,7 @@ "fund", "gitfund" ], - "author": "npm Inc. ", + "author": "GitHub Inc.", "contributors": [ { "name": "Ruy Adorno", @@ -26,29 +28,21 @@ "license": "ISC", "scripts": { "eslint": "eslint", - "lint": "npm run eslint -- index.js test.js", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", "posttest": "npm run lint", "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "postlint": "npm-template-check" }, "tap": { "check-coverage": true }, - "standard": { - "ignore": [ - "/tap-snapshots/" - ] - }, "devDependencies": { - "eslint": "^7.26.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-standard": "^5.0.0", + "@npmcli/template-oss": "^2.4.2", "tap": "^15.0.9" }, "dependencies": { @@ -56,5 +50,8 @@ }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmhook/README.md b/deps/npm/node_modules/libnpmhook/README.md new file mode 100644 index 00000000000000..ce6e8c1a519898 --- /dev/null +++ b/deps/npm/node_modules/libnpmhook/README.md @@ -0,0 +1,271 @@ +# libnpmhook + +[![npm version](https://img.shields.io/npm/v/libnpmhook.svg)](https://npm.im/libnpmhook) +[![license](https://img.shields.io/npm/l/libnpmhook.svg)](https://npm.im/libnpmhook) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmhook/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmhook?branch=latest) + +[`libnpmhook`](https://github.com/npm/libnpmhook) is a Node.js library for +programmatically managing the npm registry's server-side hooks. + +For a more general introduction to managing hooks, see [the introductory blog +post](https://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm). + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) + * [hook opts](#opts) + * [`add()`](#add) + * [`rm()`](#rm) + * [`ls()`](#ls) + * [`ls.stream()`](#ls-stream) + * [`update()`](#update) + +## Example + +```js +const hooks = require('libnpmhook') + +console.log(await hooks.ls('mypkg', {token: 'deadbeef'})) +// array of hook objects on `mypkg`. +``` + +## Install + +`$ npm install libnpmhook` + +### API + +#### `opts` for `libnpmhook` commands + +`libnpmhook` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmhook` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> hooks.add(name, endpoint, secret, [opts]) -> Promise` + +`name` is the name of the package, org, or user/org scope to watch. The type is +determined by the name syntax: `'@foo/bar'` and `'foo'` are treated as packages, +`@foo` is treated as a scope, and `~user` is treated as an org name or scope. +Each type will attach to different events. + +The `endpoint` should be a fully-qualified http URL for the endpoint the hook +will send its payload to when it fires. `secret` is a shared secret that the +hook will send to that endpoint to verify that it's actually coming from the +registry hook. + +The returned Promise resolves to the full hook object that was created, +including its generated `id`. + +See also: [`POST +/v1/hooks/hook`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#post-v1hookshook) + +##### Example + +```javascript +await hooks.add('~zkat', 'https://example.com/api/added', 'supersekrit', { + token: 'myregistrytoken', + otp: '694207' +}) + +=> + +{ id: '16f7xoal', + username: 'zkat', + name: 'zkat', + endpoint: 'https://example.com/api/added', + secret: 'supersekrit', + type: 'owner', + created: '2018-08-21T20:05:25.125Z', + updated: '2018-08-21T20:05:25.125Z', + deleted: false, + delivered: false, + last_delivery: null, + response_code: 0, + status: 'active' } +``` + +#### `> hooks.find(id, [opts]) -> Promise` + +Returns the hook identified by `id`. + +The returned Promise resolves to the full hook object that was found, or error +with `err.code` of `'E404'` if it didn't exist. + +See also: [`GET +/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hookshookid) + +##### Example + +```javascript +await hooks.find('16f7xoal', {token: 'myregistrytoken'}) + +=> + +{ id: '16f7xoal', + username: 'zkat', + name: 'zkat', + endpoint: 'https://example.com/api/added', + secret: 'supersekrit', + type: 'owner', + created: '2018-08-21T20:05:25.125Z', + updated: '2018-08-21T20:05:25.125Z', + deleted: false, + delivered: false, + last_delivery: null, + response_code: 0, + status: 'active' } +``` + +#### `> hooks.rm(id, [opts]) -> Promise` + +Removes the hook identified by `id`. + +The returned Promise resolves to the full hook object that was removed, if it +existed, or `null` if no such hook was there (instead of erroring). + +See also: [`DELETE +/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#delete-v1hookshookid) + +##### Example + +```javascript +await hooks.rm('16f7xoal', { + token: 'myregistrytoken', + otp: '694207' +}) + +=> + +{ id: '16f7xoal', + username: 'zkat', + name: 'zkat', + endpoint: 'https://example.com/api/added', + secret: 'supersekrit', + type: 'owner', + created: '2018-08-21T20:05:25.125Z', + updated: '2018-08-21T20:05:25.125Z', + deleted: true, + delivered: false, + last_delivery: null, + response_code: 0, + status: 'active' } + +// Repeat it... +await hooks.rm('16f7xoal', { + token: 'myregistrytoken', + otp: '694207' +}) + +=> null +``` + +#### `> hooks.update(id, endpoint, secret, [opts]) -> Promise` + +The `id` should be a hook ID from a previously-created hook. + +The `endpoint` should be a fully-qualified http URL for the endpoint the hook +will send its payload to when it fires. `secret` is a shared secret that the +hook will send to that endpoint to verify that it's actually coming from the +registry hook. + +The returned Promise resolves to the full hook object that was updated, if it +existed. Otherwise, it will error with an `'E404'` error code. + +See also: [`PUT +/v1/hooks/hook/:id`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#put-v1hookshookid) + +##### Example + +```javascript +await hooks.update('16fxoal', 'https://example.com/api/other', 'newsekrit', { + token: 'myregistrytoken', + otp: '694207' +}) + +=> + +{ id: '16f7xoal', + username: 'zkat', + name: 'zkat', + endpoint: 'https://example.com/api/other', + secret: 'newsekrit', + type: 'owner', + created: '2018-08-21T20:05:25.125Z', + updated: '2018-08-21T20:14:41.964Z', + deleted: false, + delivered: false, + last_delivery: null, + response_code: 0, + status: 'active' } +``` + +#### `> hooks.ls([opts]) -> Promise` + +Resolves to an array of hook objects associated with the account you're +authenticated as. + +Results can be further filtered with three values that can be passed in through +`opts`: + +* `opts.package` - filter results by package name +* `opts.limit` - maximum number of hooks to return +* `opts.offset` - pagination offset for results (use with `opts.limit`) + +See also: + * [`hooks.ls.stream()`](#ls-stream) + * [`GET +/v1/hooks`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hooks) + +##### Example + +```javascript +await hooks.ls({token: 'myregistrytoken'}) + +=> +[ + { id: '16f7xoal', ... }, + { id: 'wnyf98a1', ... }, + ... +] +``` + +#### `> hooks.ls.stream([opts]) -> Stream` + +Returns a stream of hook objects associated with the account you're +authenticated as. The returned stream is a valid `Symbol.asyncIterator` on +`node@>=10`. + +Results can be further filtered with three values that can be passed in through +`opts`: + +* `opts.package` - filter results by package name +* `opts.limit` - maximum number of hooks to return +* `opts.offset` - pagination offset for results (use with `opts.limit`) + +See also: + * [`hooks.ls()`](#ls) + * [`GET +/v1/hooks`](https://github.com/npm/registry/blob/master/docs/hooks/endpoints.md#get-v1hooks) + +##### Example + +```javascript +for await (let hook of hooks.ls.stream({token: 'myregistrytoken'})) { + console.log('found hook:', hook.id) +} + +=> +// outputs: +// found hook: 16f7xoal +// found hook: wnyf98a1 +``` diff --git a/deps/npm/node_modules/libnpmhook/index.js b/deps/npm/node_modules/libnpmhook/lib/index.js similarity index 92% rename from deps/npm/node_modules/libnpmhook/index.js rename to deps/npm/node_modules/libnpmhook/lib/index.js index 262fcc083a6e6f..7cd18261d84827 100644 --- a/deps/npm/node_modules/libnpmhook/index.js +++ b/deps/npm/node_modules/libnpmhook/lib/index.js @@ -18,7 +18,7 @@ cmd.add = (name, endpoint, secret, opts = {}) => { return fetch.json('/-/npm/v1/hooks/hook', { ...opts, method: 'POST', - body: { type, name, endpoint, secret } + body: { type, name, endpoint, secret }, }) } @@ -26,7 +26,7 @@ cmd.rm = (id, opts = {}) => { validate('SO', [id, opts]) return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, { ...opts, - method: 'DELETE' + method: 'DELETE', }).catch(err => { if (err.code === 'E404') { return null @@ -41,7 +41,7 @@ cmd.update = (id, endpoint, secret, opts = {}) => { return fetch.json(`/-/npm/v1/hooks/hook/${eu(id)}`, { ...opts, method: 'PUT', - body: {endpoint, secret} + body: { endpoint, secret }, }) } @@ -64,7 +64,7 @@ cmd.ls.stream = (opts = {}) => { query: { package: pkg, limit, - offset - } + offset, + }, }) } diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index 40951245a9ea3b..a46de40ac9828a 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,18 +1,24 @@ { "name": "libnpmhook", - "version": "6.0.3", + "version": "7.0.0", "description": "programmatic API for managing npm registry hooks", - "main": "index.js", + "main": "lib/index.js", "files": [ - "*.js", + "bin", "lib" ], "scripts": { "prerelease": "npm t", "postrelease": "npm publish && git push --follow-tags", - "pretest": "standard", - "release": "standard-version -s", - "test": "tap" + "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" }, "tap": { "check-coverage": true @@ -24,19 +30,21 @@ "registry", "npm api" ], - "author": "Kat Marchán ", + "author": "GitHub Inc.", "license": "ISC", "dependencies": { "aproba": "^2.0.0", "npm-registry-fetch": "^11.0.0" }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "nock": "^9.6.1", - "standard": "^11.0.1", - "standard-version": "^4.4.0", - "tap": "^14.10.6" + "tap": "^15.1.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmorg/README.md b/deps/npm/node_modules/libnpmorg/README.md new file mode 100644 index 00000000000000..b2e1ed589b8e98 --- /dev/null +++ b/deps/npm/node_modules/libnpmorg/README.md @@ -0,0 +1,149 @@ +# libnpmorg + +[![npm version](https://img.shields.io/npm/v/libnpmorg.svg)](https://npm.im/libnpmorg) +[![license](https://img.shields.io/npm/l/libnpmorg.svg)](https://npm.im/libnpmorg) +[![GitHub Actions](https://github.com/npm/libnpmorg/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmorg/workflows/Node%20CI/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmorg/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmorg?branch=latest) + +[`libnpmorg`](https://github.com/npm/libnpmorg) is a Node.js library for +programmatically accessing the [npm Org membership +API](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail). + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) + * [hook opts](#opts) + * [`set()`](#set) + * [`rm()`](#rm) + * [`ls()`](#ls) + * [`ls.stream()`](#ls-stream) + +## Example + +```js +const org = require('libnpmorg') + +console.log(await org.ls('myorg', {token: 'deadbeef'})) +=> +Roster { + zkat: 'developer', + iarna: 'admin', + isaacs: 'owner' +} +``` + +## Install + +`$ npm install libnpmorg` + +### API + +#### `opts` for `libnpmorg` commands + +`libnpmorg` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmorg` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> org.set(org, user, [role], [opts]) -> Promise` + +The returned Promise resolves to a [Membership +Detail](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail) +object. + +The `role` is optional and should be one of `admin`, `owner`, or `developer`. +`developer` is the default if no `role` is provided. + +`org` and `user` must be scope names for the org name and user name +respectively. They can optionally be prefixed with `@`. + +See also: [`PUT +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-replace) + +##### Example + +```javascript +await org.set('@myorg', '@myuser', 'admin', {token: 'deadbeef'}) +=> +MembershipDetail { + org: { + name: 'myorg', + size: 15 + }, + user: 'myuser', + role: 'admin' +} +``` + +#### `> org.rm(org, user, [opts]) -> Promise` + +The Promise resolves to `null` on success. + +`org` and `user` must be scope names for the org name and user name +respectively. They can optionally be prefixed with `@`. + +See also: [`DELETE +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-delete) + +##### Example + +```javascript +await org.rm('myorg', 'myuser', {token: 'deadbeef'}) +``` + +#### `> org.ls(org, [opts]) -> Promise` + +The Promise resolves to a +[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster) +object. + +`org` must be a scope name for an org, and can be optionally prefixed with `@`. + +See also: [`GET +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster) + +##### Example + +```javascript +await org.ls('myorg', {token: 'deadbeef'}) +=> +Roster { + zkat: 'developer', + iarna: 'admin', + isaacs: 'owner' +} +``` + +#### `> org.ls.stream(org, [opts]) -> Stream` + +Returns a stream of entries for a +[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster), +with each emitted entry in `[key, value]` format. + +`org` must be a scope name for an org, and can be optionally prefixed with `@`. + +The returned stream is a valid `Symbol.asyncIterator`. + +See also: [`GET +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster) + +##### Example + +```javascript +for await (let [user, role] of org.ls.stream('myorg', {token: 'deadbeef'})) { + console.log(`user: ${user} (${role})`) +} +=> +user: zkat (developer) +user: iarna (admin) +user: isaacs (owner) +``` diff --git a/deps/npm/node_modules/libnpmorg/index.js b/deps/npm/node_modules/libnpmorg/lib/index.js similarity index 96% rename from deps/npm/node_modules/libnpmorg/index.js rename to deps/npm/node_modules/libnpmorg/lib/index.js index 208542b31e8c81..4684b516d2b4ad 100644 --- a/deps/npm/node_modules/libnpmorg/index.js +++ b/deps/npm/node_modules/libnpmorg/lib/index.js @@ -22,7 +22,7 @@ cmd.set = (org, user, role, opts = {}) => { return fetch.json(`/-/org/${eu(org)}/user`, { ...opts, method: 'PUT', - body: { user, role } + body: { user, role }, }).then(ret => Object.assign(new MembershipDetail(), ret)) } @@ -34,7 +34,7 @@ cmd.rm = (org, user, opts = {}) => { ...opts, method: 'DELETE', body: { user }, - ignoreBody: true + ignoreBody: true, }).then(() => null) } @@ -59,6 +59,6 @@ cmd.ls.stream = (org, opts = {}) => { ...opts, mapJSON: (value, [key]) => { return [key, value] - } + }, }) } diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index 0e82a207b70172..93297c36338d27 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,8 +1,9 @@ { "name": "libnpmorg", - "version": "2.0.3", + "version": "3.0.0", "description": "Programmatic api for `npm org` commands", - "author": "Kat Marchán ", + "author": "GitHub Inc.", + "main": "lib/index.js", "keywords": [ "libnpm", "npm", @@ -16,21 +17,25 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "lint": "standard", + "lint": "eslint '**/*.js'", "test": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "files": [ - "index.js" + "bin", + "lib" ], "tap": { "check-coverage": true }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "minipass": "^3.1.1", "nock": "^12.0.1", - "standard": "^14.3.1", - "tap": "^14.10.6" + "tap": "^15.0.0" }, "repository": { "type": "git", @@ -43,6 +48,9 @@ "npm-registry-fetch": "^11.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmpack/README.md b/deps/npm/node_modules/libnpmpack/README.md new file mode 100644 index 00000000000000..15c911a1eaaa88 --- /dev/null +++ b/deps/npm/node_modules/libnpmpack/README.md @@ -0,0 +1,56 @@ +# libnpmpack + +[![npm version](https://img.shields.io/npm/v/libnpmpack.svg)](https://npm.im/libnpmpack) +[![license](https://img.shields.io/npm/l/libnpmpack.svg)](https://npm.im/libnpmpack) +[![GitHub Actions](https://github.com/npm/libnpmpack/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmpack/actions?query=workflow%3A%22Node+CI%22) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmpack/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmpack?branch=latest) + +[`libnpmpack`](https://github.com/npm/libnpmpack) is a Node.js library for +programmatically packing tarballs from a local directory or from a registry or github spec. If packing from a local source, `libnpmpack` will also run the `prepack` and `postpack` lifecycles. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [API](#api) + * [`pack()`](#pack) + +## Example + +```js +const pack = require('libnpmpack') +``` + +## Install + +`$ npm install libnpmpack` + +### API + +#### `> pack(spec, [opts]) -> Promise` + +Packs a tarball from a local directory or from a registry or github spec and returns a Promise that resolves to the tarball data Buffer, with from, resolved, and integrity fields attached. + +If no options are passed, the tarball file will be saved on the same directory from which `pack` was called in. + +`libnpmpack` uses [`pacote`](https://npm.im/pacote). +Most options are passed through directly to that library, so please refer to +[its own `opts` +documentation](https://www.npmjs.com/package/pacote#options) +for options that can be passed in. + +##### Examples + +```javascript +// packs from cwd +const tarball = await pack() + +// packs from a local directory +const localTar = await pack('/Users/claudiahdz/projects/my-cool-pkg') + +// packs from a registry spec +const registryTar = await pack('abbrev@1.0.3') + +// packs from a github spec +const githubTar = await pack('isaacs/rimraf#PR-192') +``` diff --git a/deps/npm/node_modules/libnpmpack/index.js b/deps/npm/node_modules/libnpmpack/lib/index.js similarity index 90% rename from deps/npm/node_modules/libnpmpack/index.js rename to deps/npm/node_modules/libnpmpack/lib/index.js index 779c4d96d93fd8..23bb9df4b2247c 100644 --- a/deps/npm/node_modules/libnpmpack/index.js +++ b/deps/npm/node_modules/libnpmpack/lib/index.js @@ -23,14 +23,14 @@ async function pack (spec = 'file:.', opts = {}) { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, - banner + banner, }) } // packs tarball const tarball = await pacote.tarball(manifest._resolved, { ...opts, - integrity: manifest._integrity + integrity: manifest._integrity, }) if (spec.type === 'directory') { @@ -45,8 +45,8 @@ async function pack (spec = 'file:.', opts = {}) { env: { npm_package_from: tarball.from, npm_package_resolved: tarball.resolved, - npm_package_integrity: tarball.integrity - } + npm_package_integrity: tarball.integrity, + }, }) } diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json index e0538b1716095c..dad28c398585f1 100644 --- a/deps/npm/node_modules/libnpmpack/package.json +++ b/deps/npm/node_modules/libnpmpack/package.json @@ -1,31 +1,35 @@ { "name": "libnpmpack", - "version": "3.0.0", + "version": "3.0.1", "description": "Programmatic API for the bits behind npm pack", - "author": "npm Inc. ", + "author": "GitHub Inc.", + "main": "lib/index.js", "contributors": [ "Claudia Hernández " ], - "main": "index.js", "files": [ - "*.js" + "bin", + "lib" ], "license": "ISC", "scripts": { "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "lint": "standard", + "lint": "eslint '**/*.js'", "test": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "tap": { "check-coverage": true }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "nock": "^13.0.7", - "standard": "^16.0.3", - "tap": "^14.11.0" + "tap": "^15.0.0" }, "repository": { "type": "git", @@ -40,5 +44,8 @@ }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmpublish/README.md b/deps/npm/node_modules/libnpmpublish/README.md new file mode 100644 index 00000000000000..0da46e89d3b051 --- /dev/null +++ b/deps/npm/node_modules/libnpmpublish/README.md @@ -0,0 +1,105 @@ +# libnpmpublish + +[`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js +library for programmatically publishing and unpublishing npm packages. Give +it a manifest as an object and a tarball as a Buffer, and it'll put them on +the registry for you. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [API](#api) + * [publish/unpublish opts](#opts) + * [`publish()`](#publish) + * [`unpublish()`](#unpublish) + +## Example + +```js +const { publish, unpublish } = require('libnpmpublish') +``` + +## Install + +`$ npm install libnpmpublish` + +### API + +#### `opts` for `libnpmpublish` commands + +`libnpmpublish` uses +[`npm-registry-fetch`](https://npm.im/npm-registry-fetch). Most options +are passed through directly to that library, so please refer to [its own +`opts` documentation](http://npm.im/npm-registry-fetch#fetch-options) for +options that can be passed in. + +A couple of options of note: + +* `opts.defaultTag` - registers the published package with the given tag, + defaults to `latest`. + +* `opts.access` - tells the registry whether this package should be + published as public or restricted. Only applies to scoped packages, which + default to restricted. + +* `opts.token` - can be passed in and will be used as the authentication + token for the registry. For other ways to pass in auth details, see the + n-r-f docs. + +#### `> libpub.publish(manifest, tarData, [opts]) -> Promise` + +Sends the package represented by the `manifest` and `tarData` to the +configured registry. + +`manifest` should be the parsed `package.json` for the package being +published (which can also be the manifest pulled from a packument, a git +repo, tarball, etc.) + +`tarData` is a `Buffer` of the tarball being published. + +If `opts.npmVersion` is passed in, it will be used as the `_npmVersion` +field in the outgoing packument. You may put your own user-agent string in +there to identify your publishes. + +If `opts.algorithms` is passed in, it should be an array of hashing +algorithms to generate `integrity` hashes for. The default is `['sha512']`, +which means you end up with `dist.integrity = 'sha512-deadbeefbadc0ffee'`. +Any algorithm supported by your current node version is allowed -- npm +clients that do not support those algorithms will simply ignore the +unsupported hashes. + +##### Example + +```js +// note that pacote.manifest() and pacote.tarball() can also take +// any spec that npm can install. a folder shown here, since that's +// far and away the most common use case. +const path = '/a/path/to/your/source/code' +const pacote = require('pacote') // see: http://npm.im/pacote +const manifest = await pacote.manifest(path) +const tarData = await pacote.tarball(path) +await libpub.publish(manifest, tarData, { + npmVersion: 'my-pub-script@1.0.2', + token: 'my-auth-token-here' +}, opts) +// Package has been published to the npm registry. +``` + +#### `> libpub.unpublish(spec, [opts]) -> Promise` + +Unpublishes `spec` from the appropriate registry. The registry in question may +have its own limitations on unpublishing. + +`spec` should be either a string, or a valid +[`npm-package-arg`](https://npm.im/npm-package-arg) parsed spec object. For +legacy compatibility reasons, only `tag` and `version` specs will work as +expected. `range` specs will fail silently in most cases. + +##### Example + +```js +await libpub.unpublish('lodash', { token: 'i-am-the-worst'}) +// +// `lodash` has now been unpublished, along with all its versions +``` diff --git a/deps/npm/node_modules/libnpmpublish/index.js b/deps/npm/node_modules/libnpmpublish/lib/index.js similarity index 100% rename from deps/npm/node_modules/libnpmpublish/index.js rename to deps/npm/node_modules/libnpmpublish/lib/index.js diff --git a/deps/npm/node_modules/libnpmpublish/publish.js b/deps/npm/node_modules/libnpmpublish/lib/publish.js similarity index 98% rename from deps/npm/node_modules/libnpmpublish/publish.js rename to deps/npm/node_modules/libnpmpublish/lib/publish.js index bed0f27246faa6..f6d88f7325bd07 100644 --- a/deps/npm/node_modules/libnpmpublish/publish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/publish.js @@ -47,8 +47,9 @@ Remove the 'private' field from the package.json to publish it.`), ignoreBody: true, }) } catch (err) { - if (err.code !== 'E409') + if (err.code !== 'E409') { throw err + } // if E409, we attempt exactly ONE retry, to protect us // against malicious activity like trying to publish // a bunch of new versions of a package at the same time @@ -73,8 +74,9 @@ const patchManifest = (_manifest, opts) => { const manifest = { ..._manifest } manifest._nodeVersion = process.versions.node - if (npmVersion) + if (npmVersion) { manifest._npmVersion = npmVersion + } fixer.fixNameField(manifest, { strict: true, allowLegacyCase: true }) const version = semver.clean(manifest.version) diff --git a/deps/npm/node_modules/libnpmpublish/unpublish.js b/deps/npm/node_modules/libnpmpublish/lib/unpublish.js similarity index 94% rename from deps/npm/node_modules/libnpmpublish/unpublish.js rename to deps/npm/node_modules/libnpmpublish/lib/unpublish.js index 937e4b849636d9..7fbeea503a3374 100644 --- a/deps/npm/node_modules/libnpmpublish/unpublish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/unpublish.js @@ -31,8 +31,9 @@ const unpublish = async (spec, opts) => { // if missing specific version, // assumed unpublished - if (!versionData && !rawSpecs && !noVersions) + if (!versionData && !rawSpecs && !noVersions) { return true + } // unpublish all versions of a package: // - no specs supplied "npm unpublish foo" @@ -54,8 +55,9 @@ const unpublish = async (spec, opts) => { // deleting dist tags associated to version Object.keys(pkg['dist-tags']).forEach(tag => { - if (pkg['dist-tags'][tag] === version) + if (pkg['dist-tags'][tag] === version) { delete pkg['dist-tags'][tag] + } }) if (latestVer === version) { @@ -89,8 +91,9 @@ const unpublish = async (spec, opts) => { return true } } catch (err) { - if (err.code !== 'E404') + if (err.code !== 'E404') { throw err + } return true } diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index ac0d632f7d66dc..156503af7d3dd8 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,41 +1,39 @@ { "name": "libnpmpublish", - "version": "4.0.2", + "version": "5.0.0", "description": "Programmatic API for the bits behind npm publish and unpublish", - "author": "npm Inc. ", + "author": "GitHub Inc.", + "main": "lib/index.js", "contributors": [ "Kat Marchán ", "Claudia Hernández " ], - "main": "index.js", "files": [ - "*.js" + "bin", + "lib" ], "license": "ISC", "scripts": { "eslint": "eslint", - "lint": "npm run eslint -- \"*.js\"", + "lint": "eslint '**/*.js'", "lintfix": "npm run lint -- --fix", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "test": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "postlint": "npm-template-check", + "snap": "tap" }, "tap": { "check-coverage": true }, "devDependencies": { - "eslint": "^7.11.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^4.0.2", - "libnpmpack": "^2.0.0", + "@npmcli/template-oss": "^2.4.2", + "libnpmpack": "^3.0.0", "lodash.clonedeep": "^4.5.0", "nock": "^12.0.2", - "standard": "^14.3.1", - "tap": "^14.10.6" + "tap": "^15" }, "repository": { "type": "git", @@ -51,6 +49,9 @@ "ssri": "^8.0.1" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmsearch/README.md b/deps/npm/node_modules/libnpmsearch/README.md new file mode 100644 index 00000000000000..31f44fe247923d --- /dev/null +++ b/deps/npm/node_modules/libnpmsearch/README.md @@ -0,0 +1,173 @@ +# libnpmsearch + +[![npm version](https://img.shields.io/npm/v/libnpmsearch.svg)](https://npm.im/libnpmsearch) +[![license](https://img.shields.io/npm/l/libnpmsearch.svg)](https://npm.im/libnpmsearch) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmsearch/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmsearch?branch=latest) + +[`libnpmsearch`](https://github.com/npm/libnpmsearch) is a Node.js library for +programmatically accessing the npm search endpoint. It does **not** support +legacy search through `/-/all`. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) + * [search opts](#opts) + * [`search()`](#search) + * [`search.stream()`](#search-stream) + +## Example + +```js +const search = require('libnpmsearch') + +console.log(await search('libnpm')) +=> +[ + { + name: 'libnpm', + description: 'programmatic npm API', + ...etc + }, + { + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc + }, + ...more +] +``` + +## Install + +`$ npm install libnpmsearch` + +### API + +#### `opts` for `libnpmsearch` commands + +The following opts are used directly by `libnpmsearch` itself: + +* `opts.limit` - Number of results to limit the query to. Default: 20 +* `opts.from` - Offset number for results. Used with `opts.limit` for pagination. Default: 0 +* `opts.detailed` - If true, returns an object with `package`, `score`, and `searchScore` fields, with `package` being what would usually be returned, and the other two containing details about how that package scored. Useful for UIs. Default: false +* `opts.sortBy` - Used as a shorthand to set `opts.quality`, `opts.maintenance`, and `opts.popularity` with values that prioritize each one. Should be one of `'optimal'`, `'quality'`, `'maintenance'`, or `'popularity'`. Default: `'optimal'` +* `opts.maintenance` - Decimal number between `0` and `1` that defines the weight of `maintenance` metrics when scoring and sorting packages. Default: `0.65` (same as `opts.sortBy: 'optimal'`) +* `opts.popularity` - Decimal number between `0` and `1` that defines the weight of `popularity` metrics when scoring and sorting packages. Default: `0.98` (same as `opts.sortBy: 'optimal'`) +* `opts.quality` - Decimal number between `0` and `1` that defines the weight of `quality` metrics when scoring and sorting packages. Default: `0.5` (same as `opts.sortBy: 'optimal'`) + +`libnpmsearch` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +Most options are passed through directly to that library, so please refer to +[its own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. + +#### `> search(query, [opts]) -> Promise` + +`query` must be either a String or an Array of search terms. + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +The returned Promise resolved to an Array of search results with the following +format: + +```js +{ + name: String, + version: SemverString, + description: String || null, + maintainers: [ + { + username: String, + email: String + }, + ...etc + ] || null, + keywords: [String] || null, + date: Date || null +} +``` + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +For streamed results, see [`search.stream`](#search-stream). + +##### Example + +```javascript +await search('libnpm') +=> +[ + { + name: 'libnpm', + description: 'programmatic npm API', + ...etc + }, + { + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc + }, + ...more +] +``` + +#### `> search.stream(query, [opts]) -> Stream` + +`query` must be either a String or an Array of search terms. + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +The returned Stream emits one entry per search result, with each entry having +the following format: + +```js +{ + name: String, + version: SemverString, + description: String || null, + maintainers: [ + { + username: String, + email: String + }, + ...etc + ] || null, + keywords: [String] || null, + date: Date || null +} +``` + +For getting results in one chunk, see [`search`](#search-stream). + +##### Example + +```javascript +search.stream('libnpm').on('data', console.log) +=> +// entry 1 +{ + name: 'libnpm', + description: 'programmatic npm API', + ...etc +} +// entry 2 +{ + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc +} +// etc +``` diff --git a/deps/npm/node_modules/libnpmsearch/index.js b/deps/npm/node_modules/libnpmsearch/lib/index.js similarity index 96% rename from deps/npm/node_modules/libnpmsearch/index.js rename to deps/npm/node_modules/libnpmsearch/lib/index.js index cb6b50783d35e8..959059176f5c7c 100644 --- a/deps/npm/node_modules/libnpmsearch/index.js +++ b/deps/npm/node_modules/libnpmsearch/lib/index.js @@ -16,7 +16,7 @@ function searchStream (query, opts = {}) { popularity: 0.98, maintenance: 0.5, ...opts.opts, // this is to support the cli's --searchopts parameter - ...opts + ...opts, } switch (opts.sortBy) { @@ -54,7 +54,7 @@ function searchStream (query, opts = {}) { from: opts.from, quality: opts.quality, popularity: opts.popularity, - maintenance: opts.maintenance + maintenance: opts.maintenance, }, mapJSON: (obj) => { if (obj.package.date) { @@ -65,7 +65,7 @@ function searchStream (query, opts = {}) { } else { return obj.package } - } + }, } ) } diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index 88179b8d6fde89..5479e41ae3c3d1 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,10 +1,11 @@ { "name": "libnpmsearch", - "version": "3.1.2", + "version": "4.0.0", "description": "Programmatic API for searching in npm and compatible registries.", - "author": "Kat Marchán ", + "author": "GitHub Inc.", + "main": "lib/index.js", "files": [ - "*.js", + "bin", "lib" ], "keywords": [ @@ -18,16 +19,20 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "posttest": "standard", - "test": "tap" + "posttest": "npm run lint", + "test": "tap", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "tap": { "check-coverage": true }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "nock": "^9.6.1", - "standard": "^12.0.0", - "tap": "^14.11.0" + "tap": "^15" }, "repository": { "type": "git", @@ -39,6 +44,9 @@ "npm-registry-fetch": "^11.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmteam/README.md b/deps/npm/node_modules/libnpmteam/README.md new file mode 100644 index 00000000000000..603cf6622cd495 --- /dev/null +++ b/deps/npm/node_modules/libnpmteam/README.md @@ -0,0 +1,189 @@ +# libnpmteam + +[![npm version](https://img.shields.io/npm/v/libnpmteam.svg)](https://npm.im/libnpmteam) +[![license](https://img.shields.io/npm/l/libnpmteam.svg)](https://npm.im/libnpmteam) +[![GitHub Actions](https://github.com/npm/libnpmteam/workflows/Node%20CI/badge.svg)](https://github.com/npm/libnpmteam/workflows/Node%20CI/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmteam/badge.svg?branch=latest)](https://coveralls.io/github/npm/libnpmteam?branch=latest) + +[`libnpmteam`](https://github.com/npm/libnpmteam) is a Node.js +library that provides programmatic access to the guts of the npm CLI's `npm +team` command and its various subcommands. + +## Example + +```javascript +const team = require('libnpmteam') + +// List all teams for the @npm org. +console.log(await team.lsTeams('npm')) +``` + +## Publishing +1. Manually create CHANGELOG.md file +1. Commit changes to CHANGELOG.md + ```bash + $ git commit -m "chore: updated CHANGELOG.md" + ``` +1. Run `npm version {newVersion}` + ```bash + # Example + $ npm version patch + # 1. Runs `coverage` and `lint` scripts + # 2. Bumps package version; and **create commit/tag** + # 3. Runs `npm publish`; publishing directory with **unpushed commit** + # 4. Runs `git push origin --follow-tags` + ``` + +## Table of Contents + +* [Installing](#install) +* [Example](#example) +* [API](#api) + * [team opts](#opts) + * [`create()`](#create) + * [`destroy()`](#destroy) + * [`add()`](#add) + * [`rm()`](#rm) + * [`lsTeams()`](#ls-teams) + * [`lsTeams.stream()`](#ls-teams-stream) + * [`lsUsers()`](#ls-users) + * [`lsUsers.stream()`](#ls-users-stream) + +### Install + +`$ npm install libnpmteam` + +### API + +#### `opts` for `libnpmteam` commands + +`libnpmteam` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmteam` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> team.create(team, [opts]) -> Promise` + +Creates a team named `team`. Team names use the format `@:`, with +the `@` being optional. + +Additionally, `opts.description` may be passed in to include a description. + +##### Example + +```javascript +await team.create('@npm:cli', {token: 'myregistrytoken'}) +// The @npm:cli team now exists. +``` + +#### `> team.destroy(team, [opts]) -> Promise` + +Destroys a team named `team`. Team names use the format `@:`, with +the `@` being optional. + +##### Example + +```javascript +await team.destroy('@npm:cli', {token: 'myregistrytoken'}) +// The @npm:cli team has been destroyed. +``` + +#### `> team.add(user, team, [opts]) -> Promise` + +Adds `user` to `team`. + +##### Example + +```javascript +await team.add('zkat', '@npm:cli', {token: 'myregistrytoken'}) +// @zkat now belongs to the @npm:cli team. +``` + +#### `> team.rm(user, team, [opts]) -> Promise` + +Removes `user` from `team`. + +##### Example + +```javascript +await team.rm('zkat', '@npm:cli', {token: 'myregistrytoken'}) +// @zkat is no longer part of the @npm:cli team. +``` + +#### `> team.lsTeams(scope, [opts]) -> Promise` + +Resolves to an array of team names belonging to `scope`. + +##### Example + +```javascript +await team.lsTeams('@npm', {token: 'myregistrytoken'}) +=> +[ + 'npm:cli', + 'npm:web', + 'npm:registry', + 'npm:developers' +] +``` + +#### `> team.lsTeams.stream(scope, [opts]) -> Stream` + +Returns a stream of teams belonging to `scope`. + +For a Promise-based version of these results, see [`team.lsTeams()`](#ls-teams). + +##### Example + +```javascript +for await (let team of team.lsTeams.stream('@npm', {token: 'myregistrytoken'})) { + console.log(team) +} + +// outputs +// npm:cli +// npm:web +// npm:registry +// npm:developers +``` + +#### `> team.lsUsers(team, [opts]) -> Promise` + +Resolves to an array of usernames belonging to `team`. + +For a streamed version of these results, see [`team.lsUsers.stream()`](#ls-users-stream). + +##### Example + +```javascript +await team.lsUsers('@npm:cli', {token: 'myregistrytoken'}) +=> +[ + 'iarna', + 'zkat' +] +``` + +#### `> team.lsUsers.stream(team, [opts]) -> Stream` + +Returns a stream of usernames belonging to `team`. + +For a Promise-based version of these results, see [`team.lsUsers()`](#ls-users). + +##### Example + +```javascript +for await (let user of team.lsUsers.stream('@npm:cli', {token: 'myregistrytoken'})) { + console.log(user) +} + +// outputs +// iarna +// zkat +``` diff --git a/deps/npm/node_modules/libnpmteam/index.js b/deps/npm/node_modules/libnpmteam/lib/index.js similarity index 92% rename from deps/npm/node_modules/libnpmteam/index.js rename to deps/npm/node_modules/libnpmteam/lib/index.js index 8b6040113d5b1f..4b257ea850d6e7 100644 --- a/deps/npm/node_modules/libnpmteam/index.js +++ b/deps/npm/node_modules/libnpmteam/lib/index.js @@ -15,7 +15,7 @@ cmd.create = (entity, opts = {}) => { ...opts, method: 'PUT', scope, - body: { name: team, description: opts.description } + body: { name: team, description: opts.description }, }) }) } @@ -27,7 +27,7 @@ cmd.destroy = (entity, opts = {}) => { return npmFetch.json(uri, { ...opts, method: 'DELETE', - scope + scope, }) } @@ -39,7 +39,7 @@ cmd.add = (user, entity, opts = {}) => { ...opts, method: 'PUT', scope, - body: { user } + body: { user }, }) } @@ -51,7 +51,7 @@ cmd.rm = (user, entity, opts = {}) => { ...opts, method: 'DELETE', scope, - body: { user } + body: { user }, }) } @@ -62,7 +62,7 @@ cmd.lsTeams.stream = (scope, opts = {}) => { const uri = `/-/org/${eu(scope)}/team` return npmFetch.json.stream(uri, '.*', { ...opts, - query: { format: 'cli' } + query: { format: 'cli' }, }) } @@ -74,7 +74,7 @@ cmd.lsUsers.stream = (entity, opts = {}) => { const uri = `/-/team/${eu(scope)}/${eu(team)}/user` return npmFetch.json.stream(uri, '.*', { ...opts, - query: { format: 'cli' } + query: { format: 'cli' }, }) } diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index 09837ad2dd14a4..1264402321ee75 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -1,28 +1,33 @@ { "name": "libnpmteam", "description": "npm Team management APIs", - "version": "2.0.4", - "author": "Kat Marchán ", + "version": "3.0.0", + "author": "GitHub Inc.", "license": "ISC", + "main": "lib/index.js", "scripts": { "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "lint": "standard", + "lint": "eslint '**/*.js'", "test": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "nock": "^12.0.1", - "standard": "^14.3.1", - "tap": "^14.10.6" + "tap": "^15" }, "repository": { "type": "git", "url": "https://github.com/npm/libnpmteam.git" }, "files": [ - "index.js" + "bin", + "lib" ], "homepage": "https://npmjs.com/package/libnpmteam", "dependencies": { @@ -30,9 +35,12 @@ "npm-registry-fetch": "^11.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" }, "tap": { "check-coverage": true + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/node_modules/libnpmversion/README.md b/deps/npm/node_modules/libnpmversion/README.md new file mode 100644 index 00000000000000..e82e7cd6f8730f --- /dev/null +++ b/deps/npm/node_modules/libnpmversion/README.md @@ -0,0 +1,159 @@ +# libnpmversion + +Library to do the things that 'npm version' does. + +## USAGE + +```js +const npmVersion = require('libnpmversion') + +// argument can be one of: +// - any semver version string (set to that exact version) +// - 'major', 'minor', 'patch', 'pre{major,minor,patch}' (increment at +// that value) +// - 'from-git' (set to the latest semver-lookin git tag - this skips +// gitTagVersion, but will still sign if asked) +npmVersion(arg, { + path: '/path/to/my/pkg', // defaults to cwd + + allowSameVersion: false, // allow tagging/etc to the current version + preid: '', // when arg=='pre', define the prerelease string, like 'beta' etc. + tagVersionPrefix: 'v', // tag as 'v1.2.3' when versioning to 1.2.3 + commitHooks: true, // default true, run git commit hooks, default true + gitTagVersion: true, // default true, tag the version + signGitCommit: false, // default false, gpg sign the git commit + signGitTag: false, // default false, gpg sign the git tag + force: false, // push forward recklessly if any problems happen + ignoreScripts: false, // do not run pre/post/version lifecycle scripts + scriptShell: '/bin/bash', // shell to run lifecycle scripts in + message: 'v%s', // message for tag and commit, replace %s with the version +}).then(newVersion => { + console.error('version updated!', newVersion) +}) +``` + +## Description + +Run this in a package directory to bump the version and write the new data +back to `package.json`, `package-lock.json`, and, if present, +`npm-shrinkwrap.json`. + +The `newversion` argument should be a valid semver string, a valid second +argument to [semver.inc](https://github.com/npm/node-semver#functions) (one +of `patch`, `minor`, `major`, `prepatch`, `preminor`, `premajor`, +`prerelease`), or `from-git`. In the second case, the existing version will +be incremented by 1 in the specified field. `from-git` will try to read +the latest git tag, and use that as the new npm version. + +If run in a git repo, it will also create a version commit and tag. This +behavior is controlled by `gitTagVersion` (see below), and can be +disabled by setting `gitTagVersion: false` in the options. +It will fail if the working directory is not clean, unless `force: true` is +set. + +If supplied with a `message` string option, it will +use it as a commit message when creating a version commit. If the +`message` option contains `%s` then that will be replaced with the +resulting version number. + +If the `signGitTag` option is set, then the tag will be signed using +the `-s` flag to git. Note that you must have a default GPG key set up in +your git config for this to work properly. + +If `preversion`, `version`, or `postversion` are in the `scripts` property +of the package.json, they will be executed in the appropriate sequence. + +The exact order of execution is as follows: + +1. Check to make sure the git working directory is clean before we get + started. Your scripts may add files to the commit in future steps. + This step is skipped if the `force` flag is set. +2. Run the `preversion` script. These scripts have access to the old + `version` in package.json. A typical use would be running your full + test suite before deploying. Any files you want added to the commit + should be explicitly added using `git add`. +3. Bump `version` in `package.json` as requested (`patch`, `minor`, + `major`, explicit version number, etc). +4. Run the `version` script. These scripts have access to the new `version` + in package.json (so they can incorporate it into file headers in + generated files for example). Again, scripts should explicitly add + generated files to the commit using `git add`. +5. Commit and tag. +6. Run the `postversion` script. Use it to clean up the file system or + automatically push the commit and/or tag. + +Take the following example: + +```json +{ + "scripts": { + "preversion": "npm test", + "version": "npm run build && git add -A dist", + "postversion": "git push && git push --tags && rm -rf build/temp" + } +} +``` + +This runs all your tests, and proceeds only if they pass. Then runs your +`build` script, and adds everything in the `dist` directory to the commit. +After the commit, it pushes the new commit and tag up to the server, and +deletes the `build/temp` directory. + +## API + +### `npmVersion(newversion, options = {}) -> Promise` + +Do the things. Returns a promise that resolves to the new version if +all is well, or rejects if any errors are encountered. + +### Options + +#### `path` String + +The path to the package being versionified. Defaults to process.cwd(). + +#### `allowSameVersion` Boolean + +Allow setting the version to the current version in package.json. Default +`false`. + +#### `preid` String +When the `newversion` is pre, premajor, preminor, or prepatch, this +defines the prerelease string, like 'beta' etc. + +#### `tagVersionPrefix` String + +The prefix to add to the raw semver string for the tag name. Defaults to +`'v'`. (So, by default it tags as 'v1.2.3' when versioning to 1.2.3.) + +#### `commitHooks` Boolean + +Run git commit hooks. Default true. + +#### `gitTagVersion` Boolean + +Tag the version, default true. + +#### `signGitCommit` Boolean + +GPG sign the git commit. Default `false`. + +#### `signGitTag` Boolean + +GPG sign the git tag. Default `false`. + +#### `force` Boolean + +Push forward recklessly if any problems happen. Default `false`. + +#### `ignoreScripts` Boolean + +Do not run pre/post/version lifecycle scripts. Default `false`. + +#### `scriptShell` String + +Path to the shell, which should execute the lifecycle scripts. Defaults to `/bin/sh` on unix, or `cmd.exe` on windows. + +#### `message` String + +The message for the git commit and annotated git tag that are created. diff --git a/deps/npm/node_modules/libnpmversion/lib/index.js b/deps/npm/node_modules/libnpmversion/lib/index.js index b10b3e6ba4123a..683941cdea4f35 100644 --- a/deps/npm/node_modules/libnpmversion/lib/index.js +++ b/deps/npm/node_modules/libnpmversion/lib/index.js @@ -16,7 +16,7 @@ module.exports = async (newversion, opts = {}) => { scriptShell = undefined, preid = null, log = proclog, - message = 'v%s' + message = 'v%s', } = opts const pkg = opts.pkg || await readJson(path + '/package.json') @@ -36,6 +36,6 @@ module.exports = async (newversion, opts = {}) => { preid, pkg, log, - message + message, }) } diff --git a/deps/npm/node_modules/libnpmversion/lib/proc-log.js b/deps/npm/node_modules/libnpmversion/lib/proc-log.js index b2bdd9dc90205c..a7c683ba2fd115 100644 --- a/deps/npm/node_modules/libnpmversion/lib/proc-log.js +++ b/deps/npm/node_modules/libnpmversion/lib/proc-log.js @@ -9,7 +9,7 @@ const LEVELS = [ 'http', 'silly', 'pause', - 'resume' + 'resume', ] const log = level => (...args) => process.emit('log', level, ...args) diff --git a/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js b/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js index 6adb6df317a8d2..c5fb64e331198e 100644 --- a/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js +++ b/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js @@ -2,7 +2,9 @@ const { spawn } = require('@npmcli/git') const semver = require('semver') module.exports = async opts => { - const tag = (await spawn(['describe', '--tags', '--abbrev=0', '--match=*.*.*'], opts)).stdout.trim() + const tag = (await spawn( + ['describe', '--tags', '--abbrev=0', '--match=*.*.*'], + opts)).stdout.trim() const ver = semver.coerce(tag, { loose: true }) if (ver) { return ver.version diff --git a/deps/npm/node_modules/libnpmversion/lib/tag.js b/deps/npm/node_modules/libnpmversion/lib/tag.js index 73134dd25e6fe3..095456b20301ad 100644 --- a/deps/npm/node_modules/libnpmversion/lib/tag.js +++ b/deps/npm/node_modules/libnpmversion/lib/tag.js @@ -5,7 +5,7 @@ module.exports = async (version, opts) => { signGitTag, allowSameVersion, tagVersionPrefix, - message + message, } = opts const tag = `${tagVersionPrefix}${version}` @@ -25,6 +25,6 @@ module.exports = async (version, opts) => { 'tag', flags.join(''), message.replace(/%s/g, version), - tag + tag, ], opts) } diff --git a/deps/npm/node_modules/libnpmversion/lib/version.js b/deps/npm/node_modules/libnpmversion/lib/version.js index 2ef79173fca765..116a375553e9ea 100644 --- a/deps/npm/node_modules/libnpmversion/lib/version.js +++ b/deps/npm/node_modules/libnpmversion/lib/version.js @@ -19,7 +19,7 @@ module.exports = async (newversion, opts) => { ignoreScripts, preid, pkg, - log + log, } = opts const { valid, clean, inc } = semver @@ -38,7 +38,7 @@ module.exports = async (newversion, opts) => { if (!newV) { throw Object.assign(new Error('Invalid version: ' + newversion), { current, - requested: newversion + requested: newversion, }) } @@ -46,7 +46,7 @@ module.exports = async (newversion, opts) => { throw Object.assign(new Error('Version not changed'), { current, requested: newversion, - newVersion: newV + newVersion: newV, }) } @@ -67,8 +67,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV - } + npm_new_version: newV, + }, }) } @@ -101,8 +101,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV - } + npm_new_version: newV, + }, }) } @@ -115,7 +115,9 @@ module.exports = async (newversion, opts) => { } await commit(newV, opts) await tag(newV, opts) - } else { log.verbose('version', 'Not tagging: not in a git repo or no git cmd') } + } else { + log.verbose('version', 'Not tagging: not in a git repo or no git cmd') + } if (!ignoreScripts) { await runScript({ @@ -126,8 +128,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV - } + npm_new_version: newV, + }, }) } diff --git a/deps/npm/node_modules/libnpmversion/lib/write-json.js b/deps/npm/node_modules/libnpmversion/lib/write-json.js index 813bb7ffc279b6..f066d72c67e124 100644 --- a/deps/npm/node_modules/libnpmversion/lib/write-json.js +++ b/deps/npm/node_modules/libnpmversion/lib/write-json.js @@ -7,7 +7,7 @@ const kNewline = Symbol.for('newline') module.exports = async (path, pkg) => { const { [kIndent]: indent = 2, - [kNewline]: newline = '\n' + [kNewline]: newline = '\n', } = pkg delete pkg._id const raw = JSON.stringify(pkg, null, indent) + '\n' diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 523f25f1d55c39..6d7823f5d0a5bf 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,40 +1,37 @@ { "name": "libnpmversion", - "version": "2.0.1", + "version": "2.0.2", "main": "lib/index.js", "files": [ - "lib/*.js" + "bin", + "lib" ], "description": "library to do the things that 'npm version' does", "repository": { "type": "git", "url": "git+https://github.com/npm/libnpmversion" }, - "author": "Isaac Z. Schlueter (https://izs.me)", + "author": "GitHub Inc.", "license": "ISC", "scripts": { - "lint": "standard", - "lint:fix": "standard --fix", + "lint": "eslint '**/*.js'", "test": "tap", "posttest": "npm run lint", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "standard": { - "ignore": [ - "tap-snapshots" - ] + "prepublishOnly": "git push origin --follow-tags", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix" }, "tap": { "coverage-map": "map.js", "check-coverage": true }, "devDependencies": { + "@npmcli/template-oss": "^2.4.2", "require-inject": "^1.4.4", - "standard": "^16.0.3", - "tap": "^14.11.0" + "tap": "^15" }, "dependencies": { "@npmcli/git": "^2.0.7", @@ -45,5 +42,8 @@ }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "version": "2.4.3" } } diff --git a/deps/npm/package.json b/deps/npm/package.json index 636ef21e5fb643..a4a5fcc6e8d4db 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "8.3.0", + "version": "8.3.1", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -55,9 +55,9 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^4.1.1", + "@npmcli/arborist": "^4.2.0", "@npmcli/ci-detect": "^1.4.0", - "@npmcli/config": "^2.3.2", + "@npmcli/config": "^2.4.0", "@npmcli/map-workspaces": "^2.0.0", "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^2.0.0", @@ -74,22 +74,22 @@ "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", "graceful-fs": "^4.2.8", - "hosted-git-info": "^4.0.2", + "hosted-git-info": "^4.1.0", "ini": "^2.0.0", "init-package-json": "^2.0.5", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", - "libnpmaccess": "^4.0.2", - "libnpmdiff": "^2.0.4", - "libnpmexec": "^3.0.1", - "libnpmfund": "^2.0.1", - "libnpmhook": "^6.0.2", - "libnpmorg": "^2.0.2", - "libnpmpack": "^3.0.0", - "libnpmpublish": "^4.0.1", - "libnpmsearch": "^3.1.1", - "libnpmteam": "^2.0.3", - "libnpmversion": "^2.0.1", + "libnpmaccess": "^5.0.0", + "libnpmdiff": "^3.0.0", + "libnpmexec": "^3.0.2", + "libnpmfund": "^2.0.2", + "libnpmhook": "^7.0.0", + "libnpmorg": "^3.0.0", + "libnpmpack": "^3.0.1", + "libnpmpublish": "^5.0.0", + "libnpmsearch": "^4.0.0", + "libnpmteam": "^3.0.0", + "libnpmversion": "^2.0.2", "make-fetch-happen": "^9.1.0", "minipass": "^3.1.6", "minipass-pipeline": "^1.2.4", @@ -201,16 +201,18 @@ ], "devDependencies": { "@npmcli/eslint-config": "^2.0.0", + "@npmcli/template-oss": "^2.4.3", "eslint": "^8.3.0", "licensee": "^8.2.0", "spawk": "^1.7.1", - "tap": "^15.1.5" + "tap": "^15.1.6" }, "scripts": { "dumpconf": "env | grep npm | sort | uniq", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", "licenses": "licensee --production --errors-only", "test": "tap", + "test-all": "npm run test --if-present --workspaces --include-workspace-root", "check-coverage": "tap", "snap": "tap", "postsnap": "make -s mandocs", @@ -235,6 +237,26 @@ "check-coverage": true, "timeout": 600 }, + "templateOSS": { + "applyRootRepoFiles": false, + "applyWorkspaceRepoFiles": true, + "applyRootModuleFiles": false, + "workspaces": [ + "@npmcli/arborist", + "libnpmaccess", + "libnpmdiff", + "libnpmfund", + "libnpmexec", + "libnpmorg", + "libnpmhook", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion" + ], + "version": "2.4.3" + }, "license": "Artistic-2.0", "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/test/lib/commands/pack.js b/deps/npm/test/lib/commands/pack.js index 21057e207953e2..51453dae9b017d 100644 --- a/deps/npm/test/lib/commands/pack.js +++ b/deps/npm/test/lib/commands/pack.js @@ -136,6 +136,9 @@ t.test('workspaces', async t => { }, config: { workspaces: true, + // TODO: this is a workaround for npm run test-all + // somehow leaking include-workspace-root + 'include-workspace-root': false, }, }) diff --git a/deps/npm/test/lib/commands/unpublish.js b/deps/npm/test/lib/commands/unpublish.js index 1424adf5c98515..b1b148a7c27ec2 100644 --- a/deps/npm/test/lib/commands/unpublish.js +++ b/deps/npm/test/lib/commands/unpublish.js @@ -3,6 +3,23 @@ const { fake: mockNpm } = require('../../fixtures/mock-npm') let result = '' const noop = () => null +const versions = async () => { + return { + versions: { + '1.0.0': {}, + '1.0.1': {}, + }, + } +} + +const singleVersion = async () => { + return { + versions: { + '1.0.0': {}, + }, + } +} + const config = { force: false, loglevel: 'silly', @@ -26,7 +43,7 @@ const npm = mockNpm({ const mocks = { libnpmaccess: { lsPackages: noop }, libnpmpublish: { unpublish: noop }, - 'npm-registry-fetch': { json: noop }, + 'npm-registry-fetch': { json: versions }, '../../../lib/utils/otplease.js': async (opts, fn) => fn(opts), '../../../lib/utils/get-identity.js': async () => 'foo', 'proc-log': { silly () {}, verbose () {} }, @@ -530,3 +547,32 @@ t.test('completion', async t => { }) }) }) + +t.test('show error on unpublish @version with package.json and the last version', async t => { + const Unpublish = t.mock('../../../lib/commands/unpublish.js', { + ...mocks, + 'npm-registry-fetch': { json: singleVersion }, + path: { resolve: () => testDir, join: () => testDir + '/package.json' }, + }) + const unpublish = new Unpublish(npm) + await t.rejects( + unpublish.exec(['pkg@1.0.0']), + 'Refusing to delete the last version of the package. ' + + 'It will block from republishing a new version for 24 hours.\n' + + 'Run with --force to do this.' + ) +}) + +t.test('show error on unpublish @version when the last version', async t => { + const Unpublish = t.mock('../../../lib/commands/unpublish.js', { + ...mocks, + 'npm-registry-fetch': { json: singleVersion }, + }) + const unpublish = new Unpublish(npm) + await t.rejects( + unpublish.exec(['pkg@1.0.0']), + 'Refusing to delete the last version of the package. ' + + 'It will block from republishing a new version for 24 hours.\n' + + 'Run with --force to do this.' + ) +})