diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-01 11:38:43 -0500 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-02 09:31:29 +0100 |
commit | 993963e2ee1c24dee0f39dbdbb3283272c30679c (patch) | |
tree | 7ad138c8a4b240f948e322eb2bc5c6d7acca32e6 /deps/npm | |
parent | b3f35e2c70c7d1e3ee7b4c3fd74672adceb16c52 (diff) | |
download | node-new-993963e2ee1c24dee0f39dbdbb3283272c30679c.tar.gz |
deps: upgrade npm to 7.6.0
PR-URL: https://github.com/nodejs/node/pull/37559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm')
187 files changed, 819 insertions, 1812 deletions
diff --git a/deps/npm/.npmignore b/deps/npm/.npmignore index b900574578..d1b1fde3d4 100644 --- a/deps/npm/.npmignore +++ b/deps/npm/.npmignore @@ -16,6 +16,7 @@ node_modules/npm-registry-mock # don't need these in the npm package. html/*.png +docs/nav.yml # don't ignore .npmignore files # these are used in some tests. diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 3032e1e545..e58d1dffae 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -753,3 +753,5 @@ Alexander Riccio <test35965@gmail.com> RA80533 <32469082+RA80533@users.noreply.github.com> Ikko Ashimine <eltociear@gmail.com> MrBrain295 <66077254+MrBrain295@users.noreply.github.com> +kumavis <aaron@kumavis.me> +Christof Lemke <christoflemke@github.com> diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 9e76a07473..22e6018f0a 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,4 +1,37 @@ -## v7.5.6 (2021-02-22 +## v7.6.0 (2021-02-25) + +### FEATURES + +* [`983d218f7`](https://github.com/npm/cli/commit/983d218f7e68e3c7866f2efa23ea2aff7ff3881e) + [#2750](https://github.com/npm/cli/issues/2750) + feat(explain): mark when dependency is bundled + ([@kumavis](https://github.com/kumavis)) + +### DEPENDENCIES + +* [`b9fa7e32a`](https://github.com/npm/cli/commit/b9fa7e32a63a3dc3a4865865c4ca737c862b9cf2) + chore(package-lock): resetdeps and `eslint@7.20.0` + ([@wraithgar](https://github.com/wraithgar)) +* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e) + `arborist@2.2.5` + * fix: hidden lockfiles were not respected on Node v10.0-10.12 + +### DOCUMENTATION + +* [`ba1adef42`](https://github.com/npm/cli/commit/ba1adef4292123e87e26b59e0c6fd6f5ff1fe775) + [#2760](https://github.com/npm/cli/issues/2760) + chore(docs): capitalize all Instaces of "package" + ([@MrBrain295](https://github.com/MrBrain295)) +* [`8bfa05fa1`](https://github.com/npm/cli/commit/8bfa05fa1dfd4a64381c7ec750df6d174724e8c1) + [#2775](https://github.com/npm/cli/issues/2775) + chore(docs): add navigation configuration + ([@ethomson](https://github.com/ethomson)) +* [`238e474a4`](https://github.com/npm/cli/commit/238e474a48ddecc33c76eb3d2c4d0642cfe8829a) + [#2778](https://github.com/npm/cli/issues/2778) + chore(docs):update unpublish cooldown + ([@christoflemke](https://github.com/christoflemke)) + +## v7.5.6 (2021-02-22) ### BUG FIXES diff --git a/deps/npm/docs/content/commands/npm-unpublish.md b/deps/npm/docs/content/commands/npm-unpublish.md index e9d6e9045c..14813e9434 100644 --- a/deps/npm/docs/content/commands/npm-unpublish.md +++ b/deps/npm/docs/content/commands/npm-unpublish.md @@ -42,7 +42,7 @@ versions then the registry will remove the root package entry entirely. Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, -you may not publish any new versions of that package until 24 hours have +you may not publish any new versions of that package until 28 days have passed. ### See Also diff --git a/deps/npm/docs/content/using-npm/developers.md b/deps/npm/docs/content/using-npm/developers.md index 627ce7c707..a76808ca67 100644 --- a/deps/npm/docs/content/using-npm/developers.md +++ b/deps/npm/docs/content/using-npm/developers.md @@ -93,7 +93,7 @@ You can use `npm init` in the root of your package in order to get you started with a pretty basic package.json file. See [`npm init`](/commands/npm-init) for more info. -### Keeping files *out* of your package +### Keeping files *out* of your Package Use a `.npmignore` file to keep stuff out of your package. If there's no `.npmignore` file, but there *is* a `.gitignore` file, then npm will ignore @@ -210,7 +210,7 @@ and then follow the prompts. This is documented better in [npm adduser](/commands/npm-adduser). -### Publish your package +### Publish your Package This part's easy. In the root of your folder, do this: diff --git a/deps/npm/docs/dockhand.js b/deps/npm/docs/dockhand.js index ae68e3fbb8..7f2c90dae9 100644 --- a/deps/npm/docs/dockhand.js +++ b/deps/npm/docs/dockhand.js @@ -19,7 +19,12 @@ const template = fs.readFileSync('template.html').toString(); const run = async function() { try { - await walk(inputRoot); + const navPaths = await getNavigationPaths(); + const fsPaths = await renderFilesystemPaths(); + + if (!ensureNavigationComplete(navPaths, fsPaths)) { + process.exit(1); + } } catch (error) { console.error(error); @@ -28,7 +33,85 @@ const run = async function() { run(); -async function walk(root, dirRelative) { +function ensureNavigationComplete(navPaths, fsPaths) { + const unmatchedNav = { }, unmatchedFs = { }; + + for (const navPath of navPaths) { + unmatchedNav[navPath] = true; + } + + for (let fsPath of fsPaths) { + fsPath = '/' + fsPath.replace(/\.md$/, ""); + + if (unmatchedNav[fsPath]) { + delete unmatchedNav[fsPath]; + } + else { + unmatchedFs[fsPath] = true; + } + } + + const missingNav = Object.keys(unmatchedNav).sort(); + const missingFs = Object.keys(unmatchedFs).sort() + + if (missingNav.length > 0 || missingFs.length > 0) { + let message = "Error: documentation navigation (nav.yml) does not match filesystem.\n"; + + if (missingNav.length > 0) { + message += "\nThe following path(s) exist on disk but are not present in nav.yml:\n\n"; + + for (const nav of missingNav) { + message += ` ${nav}\n`; + } + } + + if (missingNav.length > 0 && missingFs.length > 0) { + message += "\nThe following path(s) exist in nav.yml but are not present on disk:\n\n"; + + for (const fs of missingFs) { + message += ` ${fs}\n`; + } + } + + message += "\nUpdate nav.yml to ensure that all files are listed in the appropriate place."; + + console.error(message); + + return false; + } + + return true; +} + +function getNavigationPaths() { + const navFilename = path.join(docsRoot, 'nav.yml'); + const nav = yaml.parse(fs.readFileSync(navFilename).toString(), 'utf8'); + + return walkNavigation(nav); +} + +function walkNavigation(entries) { + const paths = [ ] + + for (const entry of entries) { + if (entry.children) { + paths.push(... walkNavigation(entry.children)); + } + else { + paths.push(entry.url); + } + } + + return paths; +} + +async function renderFilesystemPaths() { + return await walkFilesystem(inputRoot); +} + +async function walkFilesystem(root, dirRelative) { + const paths = [ ] + const dirPath = dirRelative ? path.join(root, dirRelative) : root; const children = fs.readdirSync(dirPath); @@ -37,15 +120,18 @@ async function walk(root, dirRelative) { const childPath = path.join(root, childRelative); if (fs.lstatSync(childPath).isDirectory()) { - await walk(root, childRelative); + paths.push(... await walkFilesystem(root, childRelative)); } else { - await translate(childRelative); + await renderFile(childRelative); + paths.push(childRelative); } } + + return paths; } -async function translate(childPath) { +async function renderFile(childPath) { const inputPath = path.join(inputRoot, childPath); if (!inputPath.match(/\.md$/)) { @@ -119,7 +205,6 @@ async function translate(childPath) { console.log(`warning: unknown token '${token}' in ${inputPath}`); return ''; } - console.log(key); return key; }); diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index f4cfc919c0..aaa6f3ea28 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code> the results to only the paths to the packages named. Note that nested packages will <em>also</em> show the paths to the specified packages. For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p> -<pre lang="bash"><code>npm@7.5.6 /path/to/npm +<pre lang="bash"><code>npm@7.6.0 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 </code></pre> diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index 75751d3408..3ec254a109 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -166,7 +166,7 @@ versions then the registry will remove the root package entry entirely.</p> <p>Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, -you may not publish any new versions of that package until 24 hours have +you may not publish any new versions of that package until 28 days have passed.</p> <h3 id="see-also">See Also</h3> <ul> diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 9cc6b055db..610396038c 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@ npm command-line interface <pre lang="bash"><code>npm <command> [args] </code></pre> <h3 id="version">Version</h3> -<p>7.5.6</p> +<p>7.6.0</p> <h3 id="description">Description</h3> <p>npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/using-npm/developers.html b/deps/npm/docs/output/using-npm/developers.html index 25d6ae8fa1..7553ac5a67 100644 --- a/deps/npm/docs/output/using-npm/developers.html +++ b/deps/npm/docs/output/using-npm/developers.html @@ -141,7 +141,7 @@ npm command-line interface <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#about-these-documents">About These Documents</a></li><li><a href="#what-is-a-package">What is a Package</a></li><li><a href="#the-packagejson-file">The package.json File</a></li><li><a href="#keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</a></li><ul><li><a href="#testing-whether-your-npmignore-or-files-config-works">Testing whether your <code>.npmignore</code> or <code>files</code> config works</a></li></ul><li><a href="#link-packages">Link Packages</a></li><li><a href="#before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</a></li><li><a href="#create-a-user-account">Create a User Account</a></li><li><a href="#publish-your-package">Publish your package</a></li><li><a href="#brag-about-it">Brag about it</a></li><li><a href="#see-also">See also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#about-these-documents">About These Documents</a></li><li><a href="#what-is-a-package">What is a Package</a></li><li><a href="#the-packagejson-file">The package.json File</a></li><li><a href="#keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</a></li><ul><li><a href="#testing-whether-your-npmignore-or-files-config-works">Testing whether your <code>.npmignore</code> or <code>files</code> config works</a></li></ul><li><a href="#link-packages">Link Packages</a></li><li><a href="#before-publishing-make-sure-your-package-installs-and-works">Before Publishing: Make Sure Your Package Installs and Works</a></li><li><a href="#create-a-user-account">Create a User Account</a></li><li><a href="#publish-your-package">Publish your Package</a></li><li><a href="#brag-about-it">Brag about it</a></li><li><a href="#see-also">See also</a></li></ul></div> </section> <div id="_content"><h3 id="description">Description</h3> @@ -223,7 +223,7 @@ full of man pages, they’ll get installed just like these ones.</p> </ul> <p>You can use <code>npm init</code> in the root of your package in order to get you started with a pretty basic package.json file. See <a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p> -<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</h3> +<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your Package</h3> <p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there’s no <code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will ignore the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to include @@ -310,7 +310,7 @@ bring in your module’s main module.</p> </code></pre> <p>and then follow the prompts.</p> <p>This is documented better in <a href="../commands/npm-adduser.html">npm adduser</a>.</p> -<h3 id="publish-your-package">Publish your package</h3> +<h3 id="publish-your-package">Publish your Package</h3> <p>This part’s easy. In the root of your folder, do this:</p> <pre lang="bash"><code>npm publish </code></pre> diff --git a/deps/npm/lib/access.js b/deps/npm/lib/access.js index 8a372d90cb..10b1e21e0c 100644 --- a/deps/npm/lib/access.js +++ b/deps/npm/lib/access.js @@ -59,17 +59,17 @@ const access = async ([cmd, ...args], cb) => { return fn(args, { ...npm.flatOptions }) } -const completion = function (opts, cb) { - var argv = opts.conf.argv.remain +const completion = async (opts) => { + const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, subcommands) + return subcommands switch (argv[2]) { case 'grant': if (argv.length === 3) - return cb(null, ['read-only', 'read-write']) + return ['read-only', 'read-write'] else - return cb(null, []) + return [] case 'public': case 'restricted': @@ -79,9 +79,9 @@ const completion = function (opts, cb) { case '2fa-required': case '2fa-not-required': case 'revoke': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index b6c3321745..c68c2b80f8 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -15,8 +15,6 @@ const usage = usageUtil( 'npm adduser [--registry=url] [--scope=@orgname] [--always-auth]' ) -const completion = require('./utils/completion/none.js') - const cmd = (args, cb) => adduser(args).then(() => cb()).catch(cb) const getRegistry = ({ scope, registry }) => { @@ -74,4 +72,4 @@ const adduser = async (args) => { output(message) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/audit.js b/deps/npm/lib/audit.js index cb8ab5b3a4..1b31401b1a 100644 --- a/deps/npm/lib/audit.js +++ b/deps/npm/lib/audit.js @@ -38,17 +38,17 @@ const usage = usageUtil( '[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]' ) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['fix']) + return ['fix'] switch (argv[2]) { case 'fix': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/bin.js b/deps/npm/lib/bin.js index 1d776365c2..e627ce22f1 100644 --- a/deps/npm/lib/bin.js +++ b/deps/npm/lib/bin.js @@ -1,7 +1,6 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const PATH = require('./utils/path.js') const cmd = (args, cb) => bin(args).then(() => cb()).catch(cb) const usage = usageUtil('bin', 'npm bin [-g]') @@ -11,4 +10,4 @@ const bin = async (args, cb) => { if (npm.flatOptions.global && !PATH.includes(b)) console.error('(not in PATH env variable)') } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index 012f39efbd..09856313ce 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -7,7 +7,6 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('bugs', 'npm bugs [<pkgname>]') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => bugs(args).then(() => cb()).catch(cb) @@ -44,4 +43,4 @@ const getBugs = async pkg => { await openUrl(url, `${mani.name} bug list available at the following URL`) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index 30d6aef863..7b84353b4a 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -19,17 +19,17 @@ const usage = usageUtil('cache', '\nnpm cache verify' ) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['add', 'clean', 'verify']) + return ['add', 'clean', 'verify'] // TODO - eventually... switch (argv[2]) { case 'verify': case 'clean': case 'add': - return cb(null, []) + return [] } } diff --git a/deps/npm/lib/ci.js b/deps/npm/lib/ci.js index 80b9dbb223..51c165acce 100644 --- a/deps/npm/lib/ci.js +++ b/deps/npm/lib/ci.js @@ -11,7 +11,6 @@ const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('ci', 'npm ci') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ci().then(() => cb()).catch(cb) @@ -76,4 +75,4 @@ const ci = async () => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, {usage}) diff --git a/deps/npm/lib/completion.js b/deps/npm/lib/completion.js index bdea338ff2..b31867d988 100644 --- a/deps/npm/lib/completion.js +++ b/deps/npm/lib/completion.js @@ -28,8 +28,6 @@ // one per line for the shell completion method to consume in IFS=$'\n' mode // as an array. // -// TODO: make all the implementation completion methods promise-returning -// instead of callback-taking. const npm = require('./npm.js') const { types, shorthands } = require('./utils/config.js') @@ -52,9 +50,9 @@ const { promisify } = require('util') const cmd = (args, cb) => compl(args).then(() => cb()).catch(cb) // completion for the completion command -const completion = async (opts, cb) => { +const completion = async (opts) => { if (opts.w > 2) - return cb() + return const { resolve } = require('path') const [bashExists, zshExists] = await Promise.all([ @@ -68,7 +66,7 @@ const completion = async (opts, cb) => { if (bashExists) out.push(['>>', '~/.bashrc']) - cb(null, out) + return out } const compl = async args => { @@ -121,18 +119,16 @@ const compl = async args => { raw: args, } - const wrap = getWrap(opts) - if (partialWords.slice(0, -1).indexOf('--') === -1) { if (word.charAt(0) === '-') - return wrap(configCompl(opts)) + return wrap(opts, configCompl(opts)) if (words[w - 1] && words[w - 1].charAt(0) === '-' && !isFlag(words[w - 1])) { // awaiting a value for a non-bool config. // don't even try to do this for now - return wrap(configValueCompl(opts)) + return wrap(opts, configValueCompl(opts)) } } @@ -146,7 +142,7 @@ const compl = async args => { // check if there's a command already. const cmd = parsed.argv.remain[1] if (!cmd) - return wrap(cmdCompl(opts)) + return wrap(opts, cmdCompl(opts)) Object.keys(parsed).forEach(k => npm.config.set(k, parsed[k])) @@ -155,10 +151,8 @@ const compl = async args => { // otherwise, do nothing const impl = npm.commands[cmd] if (impl && impl.completion) { - // XXX promisify all the cmd.completion functions - return await new Promise((res, rej) => { - impl.completion(opts, (er, comps) => er ? rej(er) : res(wrap(comps))) - }) + const comps = await impl.completion(opts) + return wrap(opts, comps) } } @@ -215,7 +209,7 @@ const escape = w => !/\s+/.test(w) ? w // If any of the items are arrays, then join them with a space. // Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand // to: 'a', 'b c', or 'd' 'e' -const getWrap = opts => compls => { +const wrap = (opts, compls) => { if (!Array.isArray(compls)) compls = compls ? [compls] : [] diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index b32cf3359d..e4da296de8 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -26,7 +26,7 @@ const usage = usageUtil( const cmd = (args, cb) => config(args).then(() => cb()).catch(cb) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv[1] !== 'config') argv.unshift('config') @@ -36,7 +36,7 @@ const completion = (opts, cb) => { if (opts.partialWord !== 'l') cmds.push('list') - return cb(null, cmds) + return cmds } const action = argv[2] @@ -44,19 +44,19 @@ const completion = (opts, cb) => { case 'set': // todo: complete with valid values, if possible. if (argv.length > 3) - return cb(null, []) + return [] // fallthrough /* eslint no-fallthrough:0 */ case 'get': case 'delete': case 'rm': - return cb(null, Object.keys(types)) + return Object.keys(types) case 'edit': case 'list': case 'ls': default: - return cb(null, []) + return [] } } diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index 5e455192bc..2211fcac8b 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -5,7 +5,6 @@ const usageUtil = require('./utils/usage.js') const reifyFinish = require('./utils/reify-finish.js') const usage = usageUtil('dedupe', 'npm dedupe') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe(args).then(() => cb()).catch(cb) @@ -27,4 +26,4 @@ const dedupe = async (args) => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index e049986452..42d099b544 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -17,19 +17,17 @@ const usage = usageUtil( 'npm deprecate <pkg>[@<version>] <message>' ) -const completion = (opts, cb) => { +const completion = async (opts) => { if (opts.conf.argv.remain.length > 1) - return cb(null, []) + return [] - return getIdentity(npm.flatOptions).then((username) => { - return libaccess.lsPackages(username, npm.flatOptions).then((packages) => { - return Object.keys(packages) - .filter((name) => packages[name] === 'write' && - (opts.conf.argv.remain.length === 0 || - name.startsWith(opts.conf.argv.remain[0])) - ) - }) - }).then((list) => cb(null, list), (err) => cb(err)) + const username = await getIdentity(npm.flatOptions) + const packages = await libaccess.lsPackages(username, npm.flatOptions) + return Object.keys(packages) + .filter((name) => + packages[name] === 'write' && + (opts.conf.argv.remain.length === 0 || + name.startsWith(opts.conf.argv.remain[0]))) } const cmd = (args, cb) => diff --git a/deps/npm/lib/diff.js b/deps/npm/lib/diff.js index af6760106e..9ef5a78a20 100644 --- a/deps/npm/lib/diff.js +++ b/deps/npm/lib/diff.js @@ -11,7 +11,6 @@ const pickManifest = require('npm-pick-manifest') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const readLocalPkg = require('./utils/read-local-package.js') const usage = usageUtil( @@ -263,4 +262,4 @@ const findVersionsByPackageName = async (specs) => { }) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/dist-tag.js b/deps/npm/lib/dist-tag.js index ae4b33ce86..e958bb7544 100644 --- a/deps/npm/lib/dist-tag.js +++ b/deps/npm/lib/dist-tag.js @@ -16,14 +16,14 @@ const usage = usageUtil( '\nnpm dist-tag ls [<pkg>]' ) -const completion = function (opts, cb) { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['add', 'rm', 'ls']) + return ['add', 'rm', 'ls'] switch (argv[2]) { default: - return cb() + return [] } } diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js index b6a3df7f70..fa0adb3d37 100644 --- a/deps/npm/lib/docs.js +++ b/deps/npm/lib/docs.js @@ -7,7 +7,6 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('docs', 'npm docs [<pkgname> [<pkgname> ...]]') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => docs(args).then(() => cb()).catch(cb) @@ -37,4 +36,4 @@ const getDocs = async pkg => { await openUrl(url, `${mani.name} docs available at the following URL`) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/doctor.js b/deps/npm/lib/doctor.js index f42b19fa68..e149aec128 100644 --- a/deps/npm/lib/doctor.js +++ b/deps/npm/lib/doctor.js @@ -4,7 +4,6 @@ const chalk = require('chalk') const ansiTrim = require('./utils/ansi-trim.js') const table = require('text-table') const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('doctor', 'npm doctor') const { resolve } = require('path') @@ -285,4 +284,4 @@ const doctor = async args => { throw 'Some problems found. See above for recommendations.' } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/exec.js b/deps/npm/lib/exec.js index e90ec0866e..dab65c23a3 100644 --- a/deps/npm/lib/exec.js +++ b/deps/npm/lib/exec.js @@ -21,8 +21,6 @@ const usage = usageUtil('exec', '-c <cmd> --call=<cmd> (may not be mixed with positional arguments)' ) -const completion = require('./utils/completion/installed-shallow.js') - const { promisify } = require('util') const read = promisify(require('read')) @@ -284,4 +282,4 @@ const getHash = packages => .digest('hex') .slice(0, 16) -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/explain.js b/deps/npm/lib/explain.js index 9176f2e6c2..a0a4427bcc 100644 --- a/deps/npm/lib/explain.js +++ b/deps/npm/lib/explain.js @@ -30,7 +30,7 @@ const explain = async (args) => { const expls = [] for (const node of nodes) { - const { extraneous, dev, optional, devOptional, peer } = node + const { extraneous, dev, optional, devOptional, peer, inBundle } = node const expl = node.explain() if (extraneous) expl.extraneous = true @@ -39,6 +39,7 @@ const explain = async (args) => { expl.optional = optional expl.devOptional = devOptional expl.peer = peer + expl.bundled = inBundle } expls.push(expl) } diff --git a/deps/npm/lib/find-dupes.js b/deps/npm/lib/find-dupes.js index 9579163782..19e7ea6a7c 100644 --- a/deps/npm/lib/find-dupes.js +++ b/deps/npm/lib/find-dupes.js @@ -3,7 +3,6 @@ const dedupe = require('./dedupe.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('find-dupes', 'npm find-dupes') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe({ dryRun: true }, cb) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/get.js b/deps/npm/lib/get.js index ab2141e357..8a416027d7 100644 --- a/deps/npm/lib/get.js +++ b/deps/npm/lib/get.js @@ -1,4 +1,5 @@ const npm = require('./npm.js') +const config = require('./config.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil( @@ -6,7 +7,7 @@ const usage = usageUtil( 'npm get [<key> ...] (See `npm config`)' ) -const completion = npm.commands.config.completion +const completion = config.completion const cmd = (args, cb) => npm.commands.config(['get'].concat(args), cb) diff --git a/deps/npm/lib/help-search.js b/deps/npm/lib/help-search.js index d2a1818060..b184735048 100644 --- a/deps/npm/lib/help-search.js +++ b/deps/npm/lib/help-search.js @@ -11,7 +11,6 @@ const didYouMean = require('./utils/did-you-mean.js') const { cmdList } = require('./utils/cmd-list.js') const usage = usageUtil('help-search', 'npm help-search <text>') -const completion = require('./utils/completion/none.js') const npmUsage = require('./utils/npm-usage.js') @@ -201,4 +200,4 @@ const formatResults = (args, results) => { return finalOut.trim() } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js index f699616654..6f215c76c1 100644 --- a/deps/npm/lib/help.js +++ b/deps/npm/lib/help.js @@ -1,10 +1,24 @@ module.exports = help -help.completion = function (opts, cb) { +help.completion = async (opts) => { if (opts.conf.argv.remain.length > 2) - return cb(null, []) - getSections(cb) + return [] + const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]') + const files = await new Promise((resolve, reject) => { + glob(g, function (er, files) { + if (er) + return reject(er) + resolve(files) + }) + }) + + return Object.keys(files.reduce(function (acc, file) { + file = path.basename(file).replace(/\.[0-9]+$/, '') + file = file.replace(/^npm-/, '') + acc[file] = true + return acc + }, { help: true })) } const npmUsage = require('./utils/npm-usage.js') @@ -175,18 +189,3 @@ function htmlMan (man) { } return 'file://' + path.resolve(__dirname, '..', 'docs', 'output', sect, f + '.html') } - -function getSections (cb) { - const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]') - glob(g, function (er, files) { - if (er) - return cb(er) - - cb(null, Object.keys(files.reduce(function (acc, file) { - file = path.basename(file).replace(/\.[0-9]+$/, '') - file = file.replace(/^npm-/, '') - acc[file] = true - return acc - }, { help: true }))) - }) -} diff --git a/deps/npm/lib/hook.js b/deps/npm/lib/hook.js index e0e15243e0..7d69ccbf2a 100644 --- a/deps/npm/lib/hook.js +++ b/deps/npm/lib/hook.js @@ -13,8 +13,6 @@ const usage = usageUtil('hook', [ 'npm hook update <id> <url> <secret>', ].join('\n')) -const completion = require('./utils/completion/none.js') - const cmd = (args, cb) => hook(args).then(() => cb()).catch(cb) const hook = async (args) => otplease(npm.flatOptions, opts => { @@ -127,4 +125,4 @@ const hookName = (hook) => { return target } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 60ea52e167..a029779f89 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -3,7 +3,6 @@ const npa = require('npm-package-arg') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const output = require('./utils/output.js') const usage = usageUtil( @@ -86,4 +85,4 @@ const init = async args => { }) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index d4ee7047f7..5f0137db1c 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -81,14 +81,14 @@ const usage = usageUtil( '[--save-prod|--save-dev|--save-optional|--save-peer] [--save-exact] [--no-save]' ) -const completion = async (opts, cb) => { +const completion = async (opts) => { const { partialWord } = opts // install can complete to a folder with a package.json, or any package. // if it has a slash, then it's gotta be a folder // if it starts with https?://, then just give up, because it's a url if (/^https?:\/\//.test(partialWord)) { // do not complete to URLs - return cb(null, []) + return [] } if (/\//.test(partialWord)) { @@ -126,19 +126,18 @@ const completion = async (opts, cb) => { const match = matches.filter(el => !el || el.isPackage).pop() if (match) { // Success - only one match and it is a package dir - return cb(null, [match.fullPath]) + return [match.fullPath] } else { // no matches - return cb(null, []) + return [] } } catch (er) { - return cb(null, []) // invalid dir: no matching + return [] // invalid dir: no matching } } // Note: there used to be registry completion here, // but it stopped making sense somewhere around // 50,000 packages on the registry - cb() } module.exports = Object.assign(cmd, { usage, completion }) diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index 84f36ada66..0bb3d87b5e 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -1,4 +1,6 @@ -const { readdir } = require('fs') +const fs = require('fs') +const util = require('util') +const readdir = util.promisify(fs.readdir) const { resolve } = require('path') const Arborist = require('@npmcli/arborist') @@ -10,9 +12,10 @@ const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const reifyFinish = require('./utils/reify-finish.js') -const completion = (opts, cb) => { +const completion = async (opts) => { const dir = npm.globalDir - readdir(dir, (er, files) => cb(er, files.filter(f => !/^[._-]/.test(f)))) + const files = await readdir(dir) + return files.filter(f => !/^[._-]/.test(f)) } const usage = usageUtil( diff --git a/deps/npm/lib/ll.js b/deps/npm/lib/ll.js index ada260e329..1d5a6217da 100644 --- a/deps/npm/lib/ll.js +++ b/deps/npm/lib/ll.js @@ -1,6 +1,9 @@ const { usage, completion } = require('./ls.js') const npm = require('./npm.js') -module.exports = Object.assign((args, cb) => { + +const cmd = (args, cb) => { npm.config.set('long', true) return npm.commands.ls(args, cb) -}, { usage, completion }) +} + +module.exports = Object.assign(cmd, { usage, completion }) diff --git a/deps/npm/lib/logout.js b/deps/npm/lib/logout.js index ba2eb92fee..d2762c1ba3 100644 --- a/deps/npm/lib/logout.js +++ b/deps/npm/lib/logout.js @@ -4,7 +4,6 @@ const getAuth = require('npm-registry-fetch/auth.js') const npmFetch = require('npm-registry-fetch') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const usage = usageUtil( 'logout', @@ -42,4 +41,4 @@ const logout = async (args) => { await npm.config.save('user') } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/org.js b/deps/npm/lib/org.js index b7af3f3a30..aa9c97d497 100644 --- a/deps/npm/lib/org.js +++ b/deps/npm/lib/org.js @@ -13,19 +13,19 @@ org.usage = 'npm org rm orgname username\n' + 'npm org ls orgname [<username>]' -org.completion = function (opts, cb) { +org.completion = async (opts) => { var argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, org.subcommands) + return org.subcommands switch (argv[2]) { case 'ls': case 'add': case 'rm': case 'set': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index f9a3fed8c1..c10f63a12e 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -17,7 +17,6 @@ const ansiTrim = require('./utils/ansi-trim.js') const usage = usageUtil('outdated', 'npm outdated [[<@scope>/]<pkg> ...]' ) -const completion = require('./utils/completion/none.js') function cmd (args, cb) { outdated(args) @@ -287,4 +286,4 @@ function makeJSON (list, opts) { return JSON.stringify(out, null, 2) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/owner.js b/deps/npm/lib/owner.js index 0bfb0a6a54..6dce3ec70f 100644 --- a/deps/npm/lib/owner.js +++ b/deps/npm/lib/owner.js @@ -16,18 +16,16 @@ const usage = usageUtil( '\nnpm owner ls [<@scope>/]<pkg>' ) -const completion = function (opts, cb) { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length > 3) - return cb(null, []) + return [] if (argv[1] !== 'owner') argv.unshift('owner') - if (argv.length === 2) { - var subs = ['add', 'rm', 'ls'] - return cb(null, subs) - } + if (argv.length === 2) + return ['add', 'rm', 'ls'] // reaches registry in order to autocomplete rm if (argv[2] === 'rm') { @@ -35,25 +33,16 @@ const completion = function (opts, cb) { ...npm.flatOptions, fullMetadata: true, } - readLocalPkg() - .then(pkgName => { - if (!pkgName) - return null - - const spec = npa(pkgName) - return pacote.packument(spec, opts) - }) - .then(data => { - if (data && data.maintainers && data.maintainers.length) - return data.maintainers.map(m => m.name) - - return [] - }) - .then(owners => { - return cb(null, owners) - }) - } else - cb(null, []) + const pkgName = await readLocalPkg() + if (!pkgName) + return [] + + const spec = npa(pkgName) + const data = await pacote.packument(spec, opts) + if (data && data.maintainers && data.maintainers.length) + return data.maintainers.map(m => m.name) + } + return [] } const UsageError = () => diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index 7a5c2edabc..ff906cc2bd 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -10,7 +10,6 @@ const { getContents, logTar } = require('./utils/tar.js') const writeFile = util.promisify(require('fs').writeFile) const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('pack', 'npm pack [[<@scope>/]<pkg>...] [--dry-run]') @@ -47,4 +46,4 @@ const pack_ = async (arg, opts) => { return pkgContents } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/ping.js b/deps/npm/lib/ping.js index 7762be6d29..efa2263103 100644 --- a/deps/npm/lib/ping.js +++ b/deps/npm/lib/ping.js @@ -4,7 +4,6 @@ const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('ping', 'npm ping\nping registry') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ping(args).then(() => cb()).catch(cb) const pingUtil = require('./utils/ping.js') @@ -25,4 +24,4 @@ const ping = async args => { log.notice('PONG', `${JSON.stringify(details, null, 2)}`) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/prefix.js b/deps/npm/lib/prefix.js index 0a99144734..d108b9d423 100644 --- a/deps/npm/lib/prefix.js +++ b/deps/npm/lib/prefix.js @@ -1,8 +1,7 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => prefix(args).then(() => cb()).catch(cb) const usage = usageUtil('prefix', 'npm prefix [-g]') const prefix = async (args, cb) => output(npm.prefix) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/profile.js b/deps/npm/lib/profile.js index 24f026ce85..3727ac0c8b 100644 --- a/deps/npm/lib/profile.js +++ b/deps/npm/lib/profile.js @@ -20,25 +20,25 @@ const usage = usageUtil( 'npm profile set <key> <value>' ) -const completion = (opts, cb) => { +const completion = async (opts) => { var argv = opts.conf.argv.remain const subcommands = ['enable-2fa', 'disable-2fa', 'get', 'set'] if (!argv[2]) - return cb(null, subcommands) + return subcommands switch (argv[2]) { case 'enable-2fa': case 'enable-tfa': - return cb(null, ['auth-and-writes', 'auth-only']) + return ['auth-and-writes', 'auth-only'] case 'disable-2fa': case 'disable-tfa': case 'get': case 'set': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/prune.js b/deps/npm/lib/prune.js index ea6ed4108a..228fd3eebb 100644 --- a/deps/npm/lib/prune.js +++ b/deps/npm/lib/prune.js @@ -8,7 +8,6 @@ const reifyFinish = require('./utils/reify-finish.js') const usage = usageUtil('prune', 'npm prune [[<@scope>/]<pkg>...] [--production]' ) -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => prune().then(() => cb()).catch(cb) @@ -22,4 +21,4 @@ const prune = async () => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 3e8df0076e..5ec66d42fa 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -18,7 +18,6 @@ const { getContents, logTar } = require('./utils/tar.js') // defaults and metadata, like git sha's and default scripts and all that. const readJson = util.promisify(require('read-package-json')) -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('publish', 'npm publish [<folder>] [--tag <tag>] [--access <public|restricted>] [--dry-run]' + @@ -137,4 +136,4 @@ const publish_ = async (arg, opts) => { return pkgContents } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/repo.js b/deps/npm/lib/repo.js index 2dc3bcb1b8..e9074dca68 100644 --- a/deps/npm/lib/repo.js +++ b/deps/npm/lib/repo.js @@ -8,7 +8,6 @@ const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const { URL } = require('url') const usage = usageUtil('repo', 'npm repo [<pkgname> [<pkgname> ...]]') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => repo(args).then(() => cb()).catch(cb) @@ -69,4 +68,4 @@ const unknownHostedUrl = url => { } } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/root.js b/deps/npm/lib/root.js index 27e357655c..631aef8386 100644 --- a/deps/npm/lib/root.js +++ b/deps/npm/lib/root.js @@ -1,8 +1,7 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => root(args).then(() => cb()).catch(cb) const usage = usageUtil('root', 'npm root [-g]') const root = async (args, cb) => output(npm.dir) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/run-script.js b/deps/npm/lib/run-script.js index 8e24a8a44e..4dfb854cad 100644 --- a/deps/npm/lib/run-script.js +++ b/deps/npm/lib/run-script.js @@ -14,16 +14,14 @@ const usage = usageUtil( 'npm run-script <command> [-- <args>]' ) -const completion = async (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) { // find the script name const json = resolve(npm.localPrefix, 'package.json') const { scripts = {} } = await readJson(json).catch(er => ({})) - return cb(null, Object.keys(scripts)) + return Object.keys(scripts) } - // otherwise nothing to do, just let the system handle it - return cb() } const cmd = (args, cb) => { diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index a3d806d2f1..3f8fd99fb8 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -8,7 +8,6 @@ const packageFilter = require('./search/package-filter.js') const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const usage = usageUtil( 'search', @@ -86,4 +85,4 @@ function prepareExcludes (searchexclude) { .filter(s => s) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/set-script.js b/deps/npm/lib/set-script.js index f655c22107..7bac6eca50 100644 --- a/deps/npm/lib/set-script.js +++ b/deps/npm/lib/set-script.js @@ -3,7 +3,6 @@ const usageUtil = require('./utils/usage.js') const { localPrefix } = require('./npm.js') const fs = require('fs') const usage = usageUtil('set-script', 'npm set-script [<script>] [<command>]') -const completion = require('./utils/completion/none.js') const parseJSON = require('json-parse-even-better-errors') const rpj = require('read-package-json-fast') @@ -50,4 +49,4 @@ const set = async function (args) { log.warn('set-script', `Script "${args[0]}" was overwritten`) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/set.js b/deps/npm/lib/set.js index fd60762932..3d61c1e93e 100644 --- a/deps/npm/lib/set.js +++ b/deps/npm/lib/set.js @@ -1,14 +1,14 @@ +const npm = require('./npm.js') +const config = require('./config.js') -module.exports = set +const usage = 'npm set <key>=<value> [<key>=<value> ...] (See `npm config`)' -set.usage = 'npm set <key>=<value> [<key>=<value> ...] (See `npm config`)' +const completion = config.completion -var npm = require('./npm.js') - -set.completion = npm.commands.config.completion - -function set (args, cb) { +const cmd = (args, cb) => { if (!args.length) - return cb(set.usage) + return cb(usage) npm.commands.config(['set'].concat(args), cb) } + +module.exports = Object.assign(cmd, { usage, completion }) diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js index f1146206db..8768f35b5f 100644 --- a/deps/npm/lib/shrinkwrap.js +++ b/deps/npm/lib/shrinkwrap.js @@ -6,7 +6,6 @@ const Arborist = require('@npmcli/arborist') const log = require('npmlog') const npm = require('./npm.js') -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('shrinkwrap', 'npm shrinkwrap') @@ -50,4 +49,4 @@ const shrinkwrap = async () => { log.notice('', 'npm-shrinkwrap.json up to date') } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/star.js b/deps/npm/lib/star.js index b3e72d7da3..c02fdeed89 100644 --- a/deps/npm/lib/star.js +++ b/deps/npm/lib/star.js @@ -6,7 +6,6 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') const getIdentity = require('./utils/get-identity') -const completion = require('./utils/completion/none.js') const usage = usageUtil( 'star', @@ -72,4 +71,4 @@ const star = async args => { } } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/stars.js b/deps/npm/lib/stars.js index c09ca6003e..d1c2b73fb1 100644 --- a/deps/npm/lib/stars.js +++ b/deps/npm/lib/stars.js @@ -5,7 +5,6 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const getIdentity = require('./utils/get-identity.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const usage = usageUtil('stars', 'npm stars [<user>]') @@ -33,4 +32,4 @@ const stars_ = async ([user = getIdentity(npm.flatOptions)]) => { output(row.value) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/team.js b/deps/npm/lib/team.js index 5e88011cfe..24e8360b64 100644 --- a/deps/npm/lib/team.js +++ b/deps/npm/lib/team.js @@ -17,10 +17,10 @@ const usage = usageUtil( 'npm team ls <scope>|<scope:team>\n' ) -const completion = (opts, cb) => { +const completion = async (opts) => { const { conf: { argv: { remain: argv } } } = opts if (argv.length === 2) - return cb(null, subcommands) + return subcommands switch (argv[2]) { case 'ls': @@ -28,9 +28,9 @@ const completion = (opts, cb) => { case 'destroy': case 'add': case 'rm': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/token.js b/deps/npm/lib/token.js index b737b5ffbc..1e78584c77 100644 --- a/deps/npm/lib/token.js +++ b/deps/npm/lib/token.js @@ -30,18 +30,18 @@ const InvalidCIDRError = (msg) => token.subcommands = ['list', 'revoke', 'create'] -token.completion = function (opts, cb) { +token.completion = async (opts) => { var argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, token.subcommands) + return token.subcommands switch (argv[2]) { case 'list': case 'revoke': case 'create': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/unpublish.js b/deps/npm/lib/unpublish.js index 528208c396..bb931682b4 100644 --- a/deps/npm/lib/unpublish.js +++ b/deps/npm/lib/unpublish.js @@ -17,11 +17,7 @@ const usage = usageUtil('unpublish', 'npm unpublish [<@scope>/]<pkg>[@<version>] const cmd = (args, cb) => unpublish(args).then(() => cb()).catch(cb) -const completion = (args, cb) => completionFn(args) - .then((res) => cb(null, res)) - .catch(cb) - -const completionFn = async (args) => { +const completion = async (args) => { const { partialWord, conf } = args if (conf.argv.remain.length >= 3) diff --git a/deps/npm/lib/unstar.js b/deps/npm/lib/unstar.js index 5dea5bcab0..554bd60bc9 100644 --- a/deps/npm/lib/unstar.js +++ b/deps/npm/lib/unstar.js @@ -1,4 +1,4 @@ -const { usage, completion } = require('./star.js') +const { usage } = require('./star.js') const npm = require('./npm.js') const unstar = (args, cb) => { @@ -6,4 +6,4 @@ const unstar = (args, cb) => { return npm.commands.star(args, cb) } -module.exports = Object.assign(unstar, { usage, completion }) +module.exports = Object.assign(unstar, { usage }) diff --git a/deps/npm/lib/utils/completion/installed-deep.js b/deps/npm/lib/utils/completion/installed-deep.js index 793f3b3e9a..f464bb9a9d 100644 --- a/deps/npm/lib/utils/completion/installed-deep.js +++ b/deps/npm/lib/utils/completion/installed-deep.js @@ -2,7 +2,7 @@ const { resolve } = require('path') const Arborist = require('@npmcli/arborist') const npm = require('../../npm.js') -const readNames = async () => { +const installedDeep = async () => { const { depth, global, @@ -36,8 +36,4 @@ const readNames = async () => { return [...res] } -function installedDeep (opts, cb) { - return readNames().then(res => cb(null, res)).catch(cb) -} - module.exports = installedDeep diff --git a/deps/npm/lib/utils/completion/installed-shallow.js b/deps/npm/lib/utils/completion/installed-shallow.js index e2ff5a3025..c9c680e7dd 100644 --- a/deps/npm/lib/utils/completion/installed-shallow.js +++ b/deps/npm/lib/utils/completion/installed-shallow.js @@ -4,7 +4,7 @@ const readdir = promisify(require('readdir-scoped-modules')) const names = global => readdir(global ? npm.globalDir : npm.localDir) -const installedShallow = async opts => { +const installedShallow = async (opts) => { const { conf: { argv: { remain } } } = opts if (remain.length > 3) return null @@ -15,5 +15,4 @@ const installedShallow = async opts => { return [...locals, ...globals] } -module.exports = (opts, cb) => - installedShallow(opts).then(list => cb(null, list)).catch(cb) +module.exports = installedShallow diff --git a/deps/npm/lib/utils/completion/none.js b/deps/npm/lib/utils/completion/none.js deleted file mode 100644 index 752400da46..0000000000 --- a/deps/npm/lib/utils/completion/none.js +++ /dev/null @@ -1,2 +0,0 @@ -// used for commands where no completion is relevant/possible -module.exports = (opts, cb) => cb(null, []) diff --git a/deps/npm/lib/utils/explain-dep.js b/deps/npm/lib/utils/explain-dep.js index ed69a02c14..213493c654 100644 --- a/deps/npm/lib/utils/explain-dep.js +++ b/deps/npm/lib/utils/explain-dep.js @@ -6,6 +6,7 @@ const nocolor = { yellow: s => s, cyan: s => s, magenta: s => s, + blue: s => s, } const explainNode = (node, depth, color) => @@ -13,11 +14,12 @@ const explainNode = (node, depth, color) => explainDependents(node, depth, color) const colorType = (type, color) => { - const { red, yellow, cyan, magenta } = color ? chalk : nocolor + const { red, yellow, cyan, magenta, blue } = color ? chalk : nocolor const style = type === 'extraneous' ? red : type === 'dev' ? yellow : type === 'optional' ? cyan : type === 'peer' ? magenta + : type === 'bundled' ? blue : /* istanbul ignore next */ s => s return style(type) } @@ -31,6 +33,7 @@ const printNode = (node, color) => { dev, optional, peer, + bundled, } = node const { bold, dim } = color ? chalk : nocolor const extra = [] @@ -46,6 +49,9 @@ const printNode = (node, color) => { if (peer) extra.push(' ' + bold(colorType('peer', color))) + if (bundled) + extra.push(' ' + bold(colorType('bundled', color))) + return `${bold(name)}@${bold(version)}${extra.join('')}` + (location ? dim(`\n${location}`) : '') } diff --git a/deps/npm/lib/utils/lifecycle-cmd.js b/deps/npm/lib/utils/lifecycle-cmd.js index 83a712cf40..94b109942a 100644 --- a/deps/npm/lib/utils/lifecycle-cmd.js +++ b/deps/npm/lib/utils/lifecycle-cmd.js @@ -2,10 +2,9 @@ // test, start, stop, restart const usageUtil = require('./usage.js') -const completion = require('./completion/none.js') module.exports = (npm, stage) => { const cmd = (args, cb) => npm.commands['run-script']([stage, ...args], cb) const usage = usageUtil(stage, `npm ${stage} [-- <args>]`) - return Object.assign(cmd, { usage, completion }) + return Object.assign(cmd, { usage }) } diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index 3a46efae19..9d87b2f2c9 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -3,13 +3,12 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = (opts, cb) => { - const none = require('./utils/completion/none.js') +const completion = async (opts) => { const { conf: { argv: { remain } } } = opts if (remain.length > 2) - return none(opts, cb) + return [] - return cb(null, [ + return [ 'major', 'minor', 'patch', @@ -18,7 +17,7 @@ const completion = (opts, cb) => { 'prepatch', 'prerelease', 'from-git', - ]) + ] } const usage = usageUtil('version', diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index bc9a13d85d..d6d79d35c5 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -26,11 +26,11 @@ const usage = usageUtil( const cmd = (args, cb) => view(args).then(() => cb()).catch(cb) -const completion = async (opts, cb) => { +const completion = async (opts) => { if (opts.conf.argv.remain.length <= 2) { // There used to be registry completion here, but it stopped // making sense somewhere around 50,000 packages on the registry - return cb() + return } // have the package, get the fields const config = { ...npm.flatOptions, fullMetadata: true, preferOnline: true } @@ -39,8 +39,8 @@ const completion = async (opts, cb) => { const pckmnt = await packument(spec, config) const dv = pckmnt.versions[pckmnt['dist-tags'][defaultTag]] pckmnt.versions = Object.keys(pckmnt.versions).sort(semver.compareLoose) - const fields = getFields(pckmnt).concat(getFields(dv)) - return cb(null, fields) + + return getFields(pckmnt).concat(getFields(dv)) function getFields (d, f, pref) { f = f || [] diff --git a/deps/npm/lib/whoami.js b/deps/npm/lib/whoami.js index 8e1c1d0523..bbbc39ccec 100644 --- a/deps/npm/lib/whoami.js +++ b/deps/npm/lib/whoami.js @@ -2,7 +2,6 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const getIdentity = require('./utils/get-identity.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => whoami(args).then(() => cb()).catch(cb) @@ -14,4 +13,4 @@ const whoami = async ([spec]) => { output(opts.json ? JSON.stringify(username) : username) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 4a876707d6..08a028b049 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" "February 2021" "" "" +.TH "NPM\-ACCESS" "1" "March 2021" "" "" .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 a8fd9fdcb8..f690c1f53d 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" "February 2021" "" "" +.TH "NPM\-ADDUSER" "1" "March 2021" "" "" .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 d18e94ebb3..f3c974a08b 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" "February 2021" "" "" +.TH "NPM\-AUDIT" "1" "March 2021" "" "" .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 bf6283b35a..cf1692e894 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" "February 2021" "" "" +.TH "NPM\-BIN" "1" "March 2021" "" "" .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 325fd855cd..af46a438cc 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" "February 2021" "" "" +.TH "NPM\-BUGS" "1" "March 2021" "" "" .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 4e70325055..4f0b0f19fc 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" "February 2021" "" "" +.TH "NPM\-CACHE" "1" "March 2021" "" "" .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 ac46f95ac7..6c2604bb82 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" "February 2021" "" "" +.TH "NPM\-CI" "1" "March 2021" "" "" .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 997188c52b..bc206f5242 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" "February 2021" "" "" +.TH "NPM\-COMPLETION" "1" "March 2021" "" "" .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 cba7846b8e..3e29c71f50 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" "February 2021" "" "" +.TH "NPM\-CONFIG" "1" "March 2021" "" "" .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 be1b3e9b77..70267ff45e 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" "February 2021" "" "" +.TH "NPM\-DEDUPE" "1" "March 2021" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SS Synopsis diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 00060ceea1..fa95af0a85 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" "February 2021" "" "" +.TH "NPM\-DEPRECATE" "1" "March 2021" "" "" .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 3249611b13..4d51928f23 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" "February 2021" "" "" +.TH "NPM\-DIFF" "1" "March 2021" "" "" .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 779fd6b48e..6542bd7893 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" "February 2021" "" "" +.TH "NPM\-DIST\-TAG" "1" "March 2021" "" "" .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 3bb3258b99..6fc922d83c 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" "February 2021" "" "" +.TH "NPM\-DOCS" "1" "March 2021" "" "" .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 9f6006eb3d..c45944c2b3 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" "February 2021" "" "" +.TH "NPM\-DOCTOR" "1" "March 2021" "" "" .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 248150e2ff..3c8d1ecd10 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" "February 2021" "" "" +.TH "NPM\-EDIT" "1" "March 2021" "" "" .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 22d04207b9..9b21bfe438 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" "February 2021" "" "" +.TH "NPM\-EXEC" "1" "March 2021" "" "" .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 13b252d8a6..cdcf751e80 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" "February 2021" "" "" +.TH "NPM\-EXPLAIN" "1" "March 2021" "" "" .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 adcc074e53..6b04f3be33 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" "February 2021" "" "" +.TH "NPM\-EXPLORE" "1" "March 2021" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SS Synopsis diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1 index 278e39d4f9..6e7e1cf22d 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" "February 2021" "" "" +.TH "NPM\-FUND" "1" "March 2021" "" "" .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 60a3ac4d59..e0dc5419d3 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" "February 2021" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "March 2021" "" "" .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 0ace5ec6bb..6e0ad91a66 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" "February 2021" "" "" +.TH "NPM\-HELP" "1" "March 2021" "" "" .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 950b7f8514..f92de18130 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" "February 2021" "" "" +.TH "NPM\-HOOK" "1" "March 2021" "" "" .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 d759efc524..05aa13f013 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" "February 2021" "" "" +.TH "NPM\-INIT" "1" "March 2021" "" "" .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 a4f69dd04e..e519b78814 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" "February 2021" "" "" +.TH "NPM\-INSTALL\-CI\-TEST" "1" "March 2021" "" "" .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 def347d19d..a91f3513a5 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" "February 2021" "" "" +.TH "NPM\-INSTALL\-TEST" "1" "March 2021" "" "" .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 0522d8b658..c7eeff3343 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" "February 2021" "" "" +.TH "NPM\-INSTALL" "1" "March 2021" "" "" .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 7f978f281f..7566ce16e4 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" "February 2021" "" "" +.TH "NPM\-LINK" "1" "March 2021" "" "" .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 032a0bbd76..777467cbe2 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" "February 2021" "" "" +.TH "NPM\-LOGOUT" "1" "March 2021" "" "" .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 1db5ccb0ef..f5d5e81130 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" "February 2021" "" "" +.TH "NPM\-LS" "1" "March 2021" "" "" .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@7\.5\.6 /path/to/npm +npm@7\.6\.0 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1 index 8749ca79d7..27f3fab580 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" "February 2021" "" "" +.TH "NPM\-ORG" "1" "March 2021" "" "" .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 6fe63984c1..27f6aee107 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" "February 2021" "" "" +.TH "NPM\-OUTDATED" "1" "March 2021" "" "" .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 ca853fd0d2..bd0758d701 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" "February 2021" "" "" +.TH "NPM\-OWNER" "1" "March 2021" "" "" .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 60434874a8..d9445271a4 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" "February 2021" "" "" +.TH "NPM\-PACK" "1" "March 2021" "" "" .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 0633da299d..9357497758 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" "February 2021" "" "" +.TH "NPM\-PING" "1" "March 2021" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SS Synopsis diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index 93c5035e7f..85178a2c06 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" "February 2021" "" "" +.TH "NPM\-PREFIX" "1" "March 2021" "" "" .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 ee153aedf4..470b8eaf71 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" "February 2021" "" "" +.TH "NPM\-PROFILE" "1" "March 2021" "" "" .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 20e3346c40..337546353f 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" "February 2021" "" "" +.TH "NPM\-PRUNE" "1" "March 2021" "" "" .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 fdcdbd0c04..5464ea9669 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" "February 2021" "" "" +.TH "NPM\-PUBLISH" "1" "March 2021" "" "" .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 ae451948b5..0977b10664 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" "February 2021" "" "" +.TH "NPM\-REBUILD" "1" "March 2021" "" "" .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 9d56e9c39e..3372840246 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" "February 2021" "" "" +.TH "NPM\-REPO" "1" "March 2021" "" "" .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 5c421e6b8c..dfa0a2f71e 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" "February 2021" "" "" +.TH "NPM\-RESTART" "1" "March 2021" "" "" .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 be6042217c..ccb2cac063 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" "February 2021" "" "" +.TH "NPM\-ROOT" "1" "March 2021" "" "" .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 0d7f8ae994..e19a4c08ab 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" "February 2021" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "March 2021" "" "" .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 c34eb58a8d..3dd493edb3 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" "February 2021" "" "" +.TH "NPM\-SEARCH" "1" "March 2021" "" "" .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 e5cbdc067d..72c5ea3370 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" "February 2021" "" "" +.TH "NPM\-SET\-SCRIPT" "1" "March 2021" "" "" .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 31ad8d96ac..75b4d3e2f7 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" "February 2021" "" "" +.TH "NPM\-SHRINKWRAP" "1" "March 2021" "" "" .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 476e0298d7..8fdb41e9d5 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" "February 2021" "" "" +.TH "NPM\-STAR" "1" "March 2021" "" "" .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 09a1cecc3b..4d0d3d5fcc 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" "February 2021" "" "" +.TH "NPM\-STARS" "1" "March 2021" "" "" .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 2f9507cae4..41e565a036 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" "February 2021" "" "" +.TH "NPM\-START" "1" "March 2021" "" "" .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 ebbde966f4..c25fbb4140 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" "February 2021" "" "" +.TH "NPM\-STOP" "1" "March 2021" "" "" .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 79a9dc3b0c..3331bb1b41 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" "February 2021" "" "" +.TH "NPM\-TEAM" "1" "March 2021" "" "" .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 33b1570a33..899b9459fd 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" "February 2021" "" "" +.TH "NPM\-TEST" "1" "March 2021" "" "" .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 4437653cd3..1da8ce9f71 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" "February 2021" "" "" +.TH "NPM\-TOKEN" "1" "March 2021" "" "" .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 4e996411db..ba404bf01e 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" "February 2021" "" "" +.TH "NPM\-UNINSTALL" "1" "March 2021" "" "" .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 b938c99d57..44d0bd45d1 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" "February 2021" "" "" +.TH "NPM\-UNPUBLISH" "1" "March 2021" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SS Synopsis @@ -39,7 +39,7 @@ versions then the registry will remove the root package entry entirely\. Even if you unpublish a package version, that specific name and version combination can never be reused\. In order to publish the package again, you must use a new version number\. If you unpublish the entire package, -you may not publish any new versions of that package until 24 hours have +you may not publish any new versions of that package until 28 days have passed\. .SS See Also .RS 0 diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1 index f45999e939..a08ab4c5af 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" "February 2021" "" "" +.TH "NPM\-UNSTAR" "1" "March 2021" "" "" .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 59f0177187..55db8abb0e 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" "February 2021" "" "" +.TH "NPM\-UPDATE" "1" "March 2021" "" "" .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 aa47748610..bb38997ad3 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" "February 2021" "" "" +.TH "NPM\-VERSION" "1" "March 2021" "" "" .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 b503ea1536..37de1dd9f0 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" "February 2021" "" "" +.TH "NPM\-VIEW" "1" "March 2021" "" "" .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 0d623e7f1f..6ade4045c0 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" "February 2021" "" "" +.TH "NPM\-WHOAMI" "1" "March 2021" "" "" .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 2a94ac6608..2848e6332e 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "February 2021" "" "" +.TH "NPM" "1" "March 2021" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SS Synopsis @@ -10,7 +10,7 @@ npm <command> [args] .RE .SS Version .P -7\.5\.6 +7\.6\.0 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1 index 4de1c3ddf6..f4c9a317b9 100644 --- a/deps/npm/man/man1/npx.1 +++ b/deps/npm/man/man1/npx.1 @@ -1,4 +1,4 @@ -.TH "NPX" "1" "February 2021" "" "" +.TH "NPX" "1" "March 2021" "" "" .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 89df00b19d..698c975880 100644 --- a/deps/npm/man/man5/folders.5 +++ b/deps/npm/man/man5/folders.5 @@ -1,4 +1,4 @@ -.TH "FOLDERS" "5" "February 2021" "" "" +.TH "FOLDERS" "5" "March 2021" "" "" .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 106ca58a2f..45e686155c 100644 --- a/deps/npm/man/man5/install.5 +++ b/deps/npm/man/man5/install.5 @@ -1,4 +1,4 @@ -.TH "INSTALL" "5" "February 2021" "" "" +.TH "INSTALL" "5" "March 2021" "" "" .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 12c366e6ee..cfcae39330 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" "February 2021" "" "" +.TH "NPM\-SHRINKWRAP\.JSON" "5" "March 2021" "" "" .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 410f4e4ea8..226ff9a42a 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "February 2021" "" "" +.TH "NPMRC" "5" "March 2021" "" "" .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 cfe8eb3c6d..a244fa7e4d 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" "February 2021" "" "" +.TH "PACKAGE\.JSON" "5" "March 2021" "" "" .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 f1e82de0a8..3424e66ee1 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" "February 2021" "" "" +.TH "PACKAGE\-LOCK\.JSON" "5" "March 2021" "" "" .SH "NAME" \fBpackage-lock.json\fR \- A manifestation of the manifest .SS Description diff --git a/deps/npm/man/man5/package-locks.5 b/deps/npm/man/man5/package-locks.5 deleted file mode 100644 index 0fc35cfb5a..0000000000 --- a/deps/npm/man/man5/package-locks.5 +++ /dev/null @@ -1,200 +0,0 @@ -.TH "PACKAGE\-LOCKS" "5" "December 2020" "" "" -.SH "NAME" -\fBpackage-locks\fR \- An explanation of npm lockfiles -.SS Description -.P -Conceptually, the "input" to npm help \fBinstall\fP is a npm help package\.json, while its -"output" is a fully\-formed \fBnode_modules\fP tree: a representation of the -dependencies you declared\. In an ideal world, npm would work like a pure -function: the same \fBpackage\.json\fP should produce the exact same \fBnode_modules\fP -tree, any time\. In some cases, this is indeed true\. But in many others, npm is -unable to do this\. There are multiple reasons for this: -.RS 0 -.IP \(bu 2 -different versions of npm (or other package managers) may have been used to install a package, each using slightly different installation algorithms\. -.IP \(bu 2 -a new version of a direct semver\-range package may have been published since the last time your packages were installed, and thus a newer version will be used\. -.IP \(bu 2 -A dependency of one of your dependencies may have published a new version, which will update even if you used pinned dependency specifiers (\fB1\.2\.3\fP instead of \fB^1\.2\.3\fP) -.IP \(bu 2 -The registry you installed from is no longer available, or allows mutation of versions (unlike the primary npm registry), and a different version of a package exists under the same version number now\. - -.RE -.P -As an example, consider package A: -.P -.RS 2 -.nf -{ - "name": "A", - "version": "0\.1\.0", - "dependencies": { - "B": "<0\.1\.0" - } -} -.fi -.RE -.P -package B: -.P -.RS 2 -.nf -{ - "name": "B", - "version": "0\.0\.1", - "dependencies": { - "C": "<0\.1\.0" - } -} -.fi -.RE -.P -and package C: -.P -.RS 2 -.nf -{ - "name": "C", - "version": "0\.0\.1" -} -.fi -.RE -.P -If these are the only versions of A, B, and C available in the -registry, then a normal \fBnpm install A\fP will install: -.P -.RS 2 -.nf -A@0\.1\.0 -`\-\- B@0\.0\.1 - `\-\- C@0\.0\.1 -.fi -.RE -.P -However, if B@0\.0\.2 is published, then a fresh \fBnpm install A\fP will -install: -.P -.RS 2 -.nf -A@0\.1\.0 -`\-\- B@0\.0\.2 - `\-\- C@0\.0\.1 -.fi -.RE -.P -assuming the new version did not modify B's dependencies\. Of course, -the new version of B could include a new version of C and any number -of new dependencies\. If such changes are undesirable, the author of A -could specify a dependency on B@0\.0\.1\|\. However, if A's author and B's -author are not the same person, there's no way for A's author to say -that he or she does not want to pull in newly published versions of C -when B hasn't changed at all\. -.P -To prevent this potential issue, npm uses npm help package\-lock\.json or, if present, npm help npm\-shrinkwrap\.json\. These files are called package locks, or lockfiles\. -.P -Whenever you run \fBnpm install\fP, npm generates or updates your package lock, -which will look something like this: -.P -.RS 2 -.nf -{ - "name": "A", - "version": "0\.1\.0", - \.\.\.metadata fields\.\.\. - "dependencies": { - "B": { - "version": "0\.0\.1", - "resolved": "https://registry\.npmjs\.org/B/\-/B\-0\.0\.1\.tgz", - "integrity": "sha512\-DeAdb33F+" - "dependencies": { - "C": { - "version": "git://github\.com/org/C\.git#5c380ae319fc4efe9e7f2d9c78b0faa588fd99b4" - } - } - } - } -} -.fi -.RE -.P -This file describes an \fIexact\fR, and more importantly \fIreproducible\fR -\fBnode_modules\fP tree\. Once it's present, any future installation will base its -work off this file, instead of recalculating dependency versions off -npm help package\.json\. -.P -The presence of a package lock changes the installation behavior such that: -.RS 0 -.IP 1. 3 -The module tree described by the package lock is reproduced\. This means -reproducing the structure described in the file, using the specific files -referenced in "resolved" if available, falling back to normal package resolution -using "version" if one isn't\. -.IP 2. 3 -The tree is walked and any missing dependencies are installed in the usual -fashion\. - -.RE -.P -If \fBpreshrinkwrap\fP, \fBshrinkwrap\fP or \fBpostshrinkwrap\fP are in the \fBscripts\fP -property of the \fBpackage\.json\fP, they will be executed in order\. \fBpreshrinkwrap\fP -and \fBshrinkwrap\fP are executed before the shrinkwrap, \fBpostshrinkwrap\fP is -executed afterwards\. These scripts run for both \fBpackage\-lock\.json\fP and -\fBnpm\-shrinkwrap\.json\fP\|\. For example to run some postprocessing on the generated -file: -.P -.RS 2 -.nf - "scripts": { - "postshrinkwrap": "json \-I \-e \\"this\.myMetadata = $MY_APP_METADATA\\"" - } -.fi -.RE -.SS Using locked packages -.P -Using a locked package is no different than using any package without a package -lock: any commands that update \fBnode_modules\fP and/or \fBpackage\.json\fP\|'s -dependencies will automatically sync the existing lockfile\. This includes \fBnpm -install\fP, \fBnpm rm\fP, \fBnpm update\fP, etc\. To prevent this update from happening, -you can use the \fB\-\-no\-save\fP option to prevent saving altogether, or -\fB\-\-no\-shrinkwrap\fP to allow \fBpackage\.json\fP to be updated while leaving -\fBpackage\-lock\.json\fP or \fBnpm\-shrinkwrap\.json\fP intact\. -.P -It is highly recommended you commit the generated package lock to source -control: this will allow anyone else on your team, your deployments, your -CI/continuous integration, and anyone else who runs \fBnpm install\fP in your -package source to get the exact same dependency tree that you were developing -on\. Additionally, the diffs from these changes are human\-readable and will -inform you of any changes npm has made to your \fBnode_modules\fP, so you can notice -if any transitive dependencies were updated, hoisted, etc\. -.SS Resolving lockfile conflicts -.P -Occasionally, two separate npm install will create package locks that cause -merge conflicts in source control systems\. As of \fBnpm@5\.7\.0\fP, these conflicts -can be resolved by manually fixing any \fBpackage\.json\fP conflicts, and then -running \fBnpm install [\-\-package\-lock\-only]\fP again\. npm will automatically -resolve any conflicts for you and write a merged package lock that includes all -the dependencies from both branches in a reasonable tree\. If -\fB\-\-package\-lock\-only\fP is provided, it will do this without also modifying your -local \fBnode_modules/\fP\|\. -.P -To make this process seamless on git, consider installing -\fBnpm\-merge\-driver\fP \fIhttps://npm\.im/npm\-merge\-driver\fR, which will teach git how -to do this itself without any user interaction\. In short: \fB$ npx -npm\-merge\-driver install \-g\fP will let you do this, and even works with -pre\-\fBnpm@5\.7\.0\fP versions of npm 5, albeit a bit more noisily\. Note that if -\fBpackage\.json\fP itself conflicts, you will have to resolve that by hand and run -\fBnpm install\fP manually, even with the merge driver\. -.SS See Also -.RS 0 -.IP \(bu 2 -https://medium\.com/@sdboyer/so\-you\-want\-to\-write\-a\-package\-manager\-4ae9c17d9527 -.IP \(bu 2 -npm help package\.json -.IP \(bu 2 -npm help package\-lock\.json -.IP \(bu 2 -npm help shrinkwrap\.json -.IP \(bu 2 -npm help shrinkwrap - -.RE diff --git a/deps/npm/man/man5/shrinkwrap-json.5 b/deps/npm/man/man5/shrinkwrap-json.5 deleted file mode 100644 index 7457df20e4..0000000000 --- a/deps/npm/man/man5/shrinkwrap-json.5 +++ /dev/null @@ -1,32 +0,0 @@ -.TH "SHRINKWRAP\.JSON" "5" "December 2020" "" "" -.SH "NAME" -\fBshrinkwrap.json\fR \- A publishable lockfile -.SS Description -.P -\fBnpm\-shrinkwrap\.json\fP is a file created by npm help \fBshrinkwrap\fP\|\. It is identical to -\fBpackage\-lock\.json\fP, with one major caveat: Unlike \fBpackage\-lock\.json\fP, -\fBnpm\-shrinkwrap\.json\fP may be included when publishing a package\. -.P -The recommended use\-case for \fBnpm\-shrinkwrap\.json\fP is applications deployed -through the publishing process on the registry: for example, daemons and -command\-line tools intended as global installs or \fBdevDependencies\fP\|\. It's -strongly discouraged for library authors to publish this file, since that would -prevent end users from having control over transitive dependency updates\. -.P -Additionally, if both \fBpackage\-lock\.json\fP and \fBnpm\-shrinkwrap\.json\fP are present -in a package root, \fBpackage\-lock\.json\fP will be ignored in favor of this file\. -.P -For full details and description of the \fBnpm\-shrinkwrap\.json\fP file format, refer -to the manual page for npm help package\-lock\.json\. -.SS See also -.RS 0 -.IP \(bu 2 -npm help shrinkwrap -.IP \(bu 2 -npm help package\-lock\.json -.IP \(bu 2 -npm help package\.json -.IP \(bu 2 -npm help install - -.RE diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index c2cb63e089..6e826d0787 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1,4 +1,4 @@ -.TH "CONFIG" "7" "February 2021" "" "" +.TH "CONFIG" "7" "March 2021" "" "" .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 ba421431ae..20a069f219 100644 --- a/deps/npm/man/man7/developers.7 +++ b/deps/npm/man/man7/developers.7 @@ -1,4 +1,4 @@ -.TH "DEVELOPERS" "7" "February 2021" "" "" +.TH "DEVELOPERS" "7" "March 2021" "" "" .SH "NAME" \fBdevelopers\fR \- Developer Guide .SS Description @@ -98,7 +98,7 @@ full of man pages, they'll get installed just like these ones\. You can use \fBnpm init\fP in the root of your package in order to get you started with a pretty basic package\.json file\. See npm help \fBnpm init\fP for more info\. -.SS Keeping files \fIout\fR of your package +.SS Keeping files \fIout\fR of your Package .P Use a \fB\|\.npmignore\fP file to keep stuff out of your package\. If there's no \fB\|\.npmignore\fP file, but there \fIis\fR a \fB\|\.gitignore\fP file, then npm will ignore @@ -244,7 +244,7 @@ npm adduser and then follow the prompts\. .P This is documented better in npm help adduser\. -.SS Publish your package +.SS Publish your Package .P This part's easy\. In the root of your folder, do this: .P diff --git a/deps/npm/man/man7/disputes.7 b/deps/npm/man/man7/disputes.7 deleted file mode 100644 index 8e95505991..0000000000 --- a/deps/npm/man/man7/disputes.7 +++ /dev/null @@ -1,149 +0,0 @@ -.TH "DISPUTES" "7" "December 2020" "" "" -.SH "NAME" -\fBdisputes\fR \- Handling Module Name Disputes -.P -This document describes the steps that you should take to resolve module name -disputes with other npm publishers\. It also describes special steps you should -take about names you think infringe your trademarks\. -.P -This document is a clarification of the acceptable behavior outlined in the -npm Code of Conduct \fIhttps://www\.npmjs\.com/policies/conduct\fR, and nothing in -this document should be interpreted to contradict any aspect of the npm Code of -Conduct\. -.SS TL;DR -.RS 0 -.IP 1. 3 -Get the author email with \fBnpm owner ls <pkgname>\fP -.IP 2. 3 -Email the author, CC support@npmjs\.com -.IP 3. 3 -After a few weeks, if there's no resolution, we'll sort it out\. - -.RE -.P -Don't squat on package names\. Publish code or move out of the way\. -.SS Description -.P -There sometimes arise cases where a user publishes a module, and then later, -some other user wants to use that name\. Here are some common ways that happens -(each of these is based on actual events\.) -.RS 0 -.IP 1. 3 -Alice writes a JavaScript module \fBfoo\fP, which is not node\-specific\. Alice -doesn't use node at all\. Yusuf wants to use \fBfoo\fP in node, so he wraps it in -an npm module\. Some time later, Alice starts using node, and wants to take -over management of her program\. -.IP 2. 3 -Yusuf writes an npm module \fBfoo\fP, and publishes it\. Perhaps much later, Alice -finds a bug in \fBfoo\fP, and fixes it\. She sends a pull request to Yusuf, but -Yusuf doesn't have the time to deal with it, because he has a new job and a -new baby and is focused on his new Erlang project, and kind of not involved -with node any more\. Alice would like to publish a new \fBfoo\fP, but can't, -because the name is taken\. -.IP 3. 3 -Yusuf writes a 10\-line flow\-control library, and calls it \fBfoo\fP, and -publishes it to the npm registry\. Being a simple little thing, it never -really has to be updated\. Alice works for Foo Inc, the makers of the -critically acclaimed and widely\-marketed \fBfoo\fP JavaScript toolkit framework\. -They publish it to npm as \fBfoojs\fP, but people are routinely confused when -\fBnpm install foo\fP is some different thing\. -.IP 4. 3 -Yusuf writes a parser for the widely\-known \fBfoo\fP file format, because he -needs it for work\. Then, he gets a new job, and never updates the prototype\. -Later on, Alice writes a much more complete \fBfoo\fP parser, but can't publish, -because Yusuf's \fBfoo\fP is in the way\. -.IP 5. 3 -\fBnpm owner ls foo\fP\|\. This will tell Alice the email address of the owner -(Yusuf)\. -.IP 6. 3 -Alice emails Yusuf, explaining the situation \fBas respectfully as possible\fR, -and what she would like to do with the module name\. She adds the npm support -staff support@npmjs\.com to the CC list of the email\. Mention in the email -that Yusuf can run npm owner \fBadd alice foo\fP to add Alice as an owner of the -foo package\. -.IP 7. 3 -After a reasonable amount of time, if Yusuf has not responded, or if Yusuf -and Alice can't come to any sort of resolution, email support -support@npmjs\.com and we'll sort it out\. ("Reasonable" is usually at least -4 weeks\.) - -.RE -.SS Reasoning -.P -In almost every case so far, the parties involved have been able to reach an -amicable resolution without any major intervention\. Most people really do want -to be reasonable, and are probably not even aware that they're in your way\. -.P -Module ecosystems are most vibrant and powerful when they are as self\-directed -as possible\. If an admin one day deletes something you had worked on, then that -is going to make most people quite upset, regardless of the justification\. When -humans solve their problems by talking to other humans with respect, everyone -has the chance to end up feeling good about the interaction\. -.SS Exceptions -.P -Some things are not allowed, and will be removed without discussion if they are -brought to the attention of the npm registry admins, including but not limited -to: -.RS 0 -.IP 1. 3 -Malware (that is, a package designed to exploit or harm the machine on which -it is installed)\. -.IP 2. 3 -Violations of copyright or licenses (for example, cloning an MIT\-licensed -program, and then removing or changing the copyright and license statement)\. -.IP 3. 3 -Illegal content\. -.IP 4. 3 -"Squatting" on a package name that you plan to use, but aren't actually -using\. Sorry, I don't care how great the name is, or how perfect a fit it is -for the thing that someday might happen\. If someone wants to use it today, -and you're just taking up space with an empty tarball, you're going to be -evicted\. -.IP 5. 3 -Putting empty packages in the registry\. Packages must have SOME -functionality\. It can be silly, but it can't be nothing\. (See also: -squatting\.) -.IP 6. 3 -Doing weird things with the registry, like using it as your own personal -application database or otherwise putting non\-packagey things into it\. -.IP 7. 3 -Other things forbidden by the npm -Code of Conduct \fIhttps://www\.npmjs\.com/policies/conduct\fR such as hateful -language, pornographic content, or harassment\. - -.RE -.P -If you see bad behavior like this, please report it to abuse@npmjs\.com right -away\. \fBYou are never expected to resolve abusive behavior on your own\. We are -here to help\.\fR -.SS Trademarks -.P -If you think another npm publisher is infringing your trademark, such as by -using a confusingly similar package name, email abuse@npmjs\.com with a link to -the package or user account on https://www\.npmjs\.com/ \fIhttps://www\.npmjs\.com/\fR\|\. -Attach a copy of your trademark registration certificate\. -.P -If we see that the package's publisher is intentionally misleading others by -misusing your registered mark without permission, we will transfer the package -name to you\. Otherwise, we will contact the package publisher and ask them to -clear up any confusion with changes to their package's \fBREADME\fP file or -metadata\. -.SS Changes -.P -This is a living document and may be updated from time to time\. Please refer to -the git history for this document \fIhttps://github\.com/npm/cli/commits/latest/doc/misc/npm\-disputes\.md\fR -to view the changes\. -.SS License -.P -Copyright (C) npm, Inc\., All rights reserved -.P -This document may be reused under a Creative Commons Attribution\-ShareAlike -License\. -.SS See also -.RS 0 -.IP \(bu 2 -npm help registry -.IP \(bu 2 -npm help owner - -.RE diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7 index f8bcbf808a..9765fa675d 100644 --- a/deps/npm/man/man7/orgs.7 +++ b/deps/npm/man/man7/orgs.7 @@ -1,4 +1,4 @@ -.TH "ORGS" "7" "February 2021" "" "" +.TH "ORGS" "7" "March 2021" "" "" .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 68c6f7b0e4..b4c6c0cc2d 100644 --- a/deps/npm/man/man7/registry.7 +++ b/deps/npm/man/man7/registry.7 @@ -1,4 +1,4 @@ -.TH "REGISTRY" "7" "February 2021" "" "" +.TH "REGISTRY" "7" "March 2021" "" "" .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 e0c1cd68fa..cf3a0e6507 100644 --- a/deps/npm/man/man7/removal.7 +++ b/deps/npm/man/man7/removal.7 @@ -1,4 +1,4 @@ -.TH "REMOVAL" "7" "February 2021" "" "" +.TH "REMOVAL" "7" "March 2021" "" "" .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 c7e3b9d93a..40f5d289f9 100644 --- a/deps/npm/man/man7/scope.7 +++ b/deps/npm/man/man7/scope.7 @@ -1,4 +1,4 @@ -.TH "SCOPE" "7" "February 2021" "" "" +.TH "SCOPE" "7" "March 2021" "" "" .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 1e02753987..c160a0ea5b 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -1,4 +1,4 @@ -.TH "SCRIPTS" "7" "February 2021" "" "" +.TH "SCRIPTS" "7" "March 2021" "" "" .SH "NAME" \fBscripts\fR \- How npm handles the "scripts" field .SS Description diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 deleted file mode 100644 index 0a08bf9abb..0000000000 --- a/deps/npm/man/man7/semver.7 +++ /dev/null @@ -1,510 +0,0 @@ -.TH "SEMVER" "7" "December 2020" "" "" -.SH "NAME" -\fBsemver\fR \- The semantic versioner for npm -.SH Install -.P -.RS 2 -.nf -npm install \-\-save semver -.fi -.RE -.SH Usage -.P -As a node module: -.P -.RS 2 -.nf -const semver = require('semver') - -semver\.valid('1\.2\.3') // '1\.2\.3' -semver\.valid('a\.b\.c') // null -semver\.clean(' =v1\.2\.3 ') // '1\.2\.3' -semver\.satisfies('1\.2\.3', '1\.x || >=2\.5\.0 || 5\.0\.0 \- 7\.2\.3') // true -semver\.gt('1\.2\.3', '9\.8\.7') // false -semver\.lt('1\.2\.3', '9\.8\.7') // true -semver\.minVersion('>=1\.0\.0') // '1\.0\.0' -semver\.valid(semver\.coerce('v2')) // '2\.0\.0' -semver\.valid(semver\.coerce('42\.6\.7\.9\.3\-alpha')) // '42\.6\.7' -.fi -.RE -.P -As a command\-line utility: -.P -.RS 2 -.nf -$ semver \-h - -A JavaScript implementation of the https://semver\.org/ specification -Copyright Isaac Z\. Schlueter - -Usage: semver [options] <version> [<version> [\.\.\.]] -Prints valid versions sorted by SemVer precedence - -Options: -\-r \-\-range <range> - Print versions that match the specified range\. - -\-i \-\-increment [<level>] - Increment a version by the specified level\. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease\. Default level is 'patch'\. - Only one version may be specified\. - -\-\-preid <identifier> - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments\. - -\-l \-\-loose - Interpret versions and ranges loosely - -\-p \-\-include\-prerelease - Always include prerelease versions in range matching - -\-c \-\-coerce - Coerce a string into SemVer if possible - (does not imply \-\-loose) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions\. - -If no satisfying versions are found, then exits failure\. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them\. -.fi -.RE -.SH Versions -.P -A "version" is described by the \fBv2\.0\.0\fP specification found at -https://semver\.org/\|\. -.P -A leading \fB"="\fP or \fB"v"\fP character is stripped off and ignored\. -.SH Ranges -.P -A \fBversion range\fP is a set of \fBcomparators\fP which specify versions -that satisfy the range\. -.P -A \fBcomparator\fP is composed of an \fBoperator\fP and a \fBversion\fP\|\. The set -of primitive \fBoperators\fP is: -.RS 0 -.IP \(bu 2 -\fB<\fP Less than -.IP \(bu 2 -\fB<=\fP Less than or equal to -.IP \(bu 2 -\fB>\fP Greater than -.IP \(bu 2 -\fB>=\fP Greater than or equal to -.IP \(bu 2 -\fB=\fP Equal\. If no operator is specified, then equality is assumed, -so this operator is optional, but MAY be included\. - -.RE -.P -For example, the comparator \fB>=1\.2\.7\fP would match the versions -\fB1\.2\.7\fP, \fB1\.2\.8\fP, \fB2\.5\.3\fP, and \fB1\.3\.9\fP, but not the versions \fB1\.2\.6\fP -or \fB1\.1\.0\fP\|\. -.P -Comparators can be joined by whitespace to form a \fBcomparator set\fP, -which is satisfied by the \fBintersection\fR of all of the comparators -it includes\. -.P -A range is composed of one or more comparator sets, joined by \fB||\fP\|\. A -version matches a range if and only if every comparator in at least -one of the \fB||\fP\-separated comparator sets is satisfied by the version\. -.P -For example, the range \fB>=1\.2\.7 <1\.3\.0\fP would match the versions -\fB1\.2\.7\fP, \fB1\.2\.8\fP, and \fB1\.2\.99\fP, but not the versions \fB1\.2\.6\fP, \fB1\.3\.0\fP, -or \fB1\.1\.0\fP\|\. -.P -The range \fB1\.2\.7 || >=1\.2\.9 <2\.0\.0\fP would match the versions \fB1\.2\.7\fP, -\fB1\.2\.9\fP, and \fB1\.4\.6\fP, but not the versions \fB1\.2\.8\fP or \fB2\.0\.0\fP\|\. -.SS Prerelease Tags -.P -If a version has a prerelease tag (for example, \fB1\.2\.3\-alpha\.3\fP) then -it will only be allowed to satisfy comparator sets if at least one -comparator with the same \fB[major, minor, patch]\fP tuple also has a -prerelease tag\. -.P -For example, the range \fB>1\.2\.3\-alpha\.3\fP would be allowed to match the -version \fB1\.2\.3\-alpha\.7\fP, but it would \fInot\fR be satisfied by -\fB3\.4\.5\-alpha\.9\fP, even though \fB3\.4\.5\-alpha\.9\fP is technically "greater -than" \fB1\.2\.3\-alpha\.3\fP according to the SemVer sort rules\. The version -range only accepts prerelease tags on the \fB1\.2\.3\fP version\. The -version \fB3\.4\.5\fP \fIwould\fR satisfy the range, because it does not have a -prerelease flag, and \fB3\.4\.5\fP is greater than \fB1\.2\.3\-alpha\.7\fP\|\. -.P -The purpose for this behavior is twofold\. First, prerelease versions -frequently are updated very quickly, and contain many breaking changes -that are (by the author's design) not yet fit for public consumption\. -Therefore, by default, they are excluded from range matching -semantics\. -.P -Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use \fIthat specific\fR set of -alpha/beta/rc versions\. By including a prerelease tag in the range, -the user is indicating that they are aware of the risk\. However, it -is still not appropriate to assume that they have opted into taking a -similar risk on the \fInext\fR set of prerelease versions\. -.P -Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the \fBincludePrerelease\fP flag on the options -object to any -functions \fIhttps://github\.com/npm/node\-semver#functions\fR that do -range matching\. -.SS Prerelease Identifiers -.P -The method \fB\|\.inc\fP takes an additional \fBidentifier\fP string argument that -will append the value of the string as a prerelease identifier: -.P -.RS 2 -.nf -semver\.inc('1\.2\.3', 'prerelease', 'beta') -// '1\.2\.4\-beta\.0' -.fi -.RE -.P -command\-line example: -.P -.RS 2 -.nf -$ semver 1\.2\.3 \-i prerelease \-\-preid beta -1\.2\.4\-beta\.0 -.fi -.RE -.P -Which then can be used to increment further: -.P -.RS 2 -.nf -$ semver 1\.2\.4\-beta\.0 \-i prerelease -1\.2\.4\-beta\.1 -.fi -.RE -.SS Advanced Range Syntax -.P -Advanced range syntax desugars to primitive comparators in -deterministic ways\. -.P -Advanced ranges may be combined in the same way as primitive -comparators using white space or \fB||\fP\|\. -.SS Hyphen Ranges \fBX\.Y\.Z \- A\.B\.C\fP -.P -Specifies an inclusive set\. -.RS 0 -.IP \(bu 2 -\fB1\.2\.3 \- 2\.3\.4\fP := \fB>=1\.2\.3 <=2\.3\.4\fP - -.RE -.P -If a partial version is provided as the first version in the inclusive -range, then the missing pieces are replaced with zeroes\. -.RS 0 -.IP \(bu 2 -\fB1\.2 \- 2\.3\.4\fP := \fB>=1\.2\.0 <=2\.3\.4\fP - -.RE -.P -If a partial version is provided as the second version in the -inclusive range, then all versions that start with the supplied parts -of the tuple are accepted, but nothing that would be greater than the -provided tuple parts\. -.RS 0 -.IP \(bu 2 -\fB1\.2\.3 \- 2\.3\fP := \fB>=1\.2\.3 <2\.4\.0\fP -.IP \(bu 2 -\fB1\.2\.3 \- 2\fP := \fB>=1\.2\.3 <3\.0\.0\fP - -.RE -.SS X\-Ranges \fB1\.2\.x\fP \fB1\.X\fP \fB1\.2\.*\fP \fB*\fP -.P -Any of \fBX\fP, \fBx\fP, or \fB*\fP may be used to "stand in" for one of the -numeric values in the \fB[major, minor, patch]\fP tuple\. -.RS 0 -.IP \(bu 2 -\fB*\fP := \fB>=0\.0\.0\fP (Any version satisfies) -.IP \(bu 2 -\fB1\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP (Matching major version) -.IP \(bu 2 -\fB1\.2\.x\fP := \fB>=1\.2\.0 <1\.3\.0\fP (Matching major and minor versions) - -.RE -.P -A partial version range is treated as an X\-Range, so the special -character is in fact optional\. -.RS 0 -.IP \(bu 2 -\fB""\fP (empty string) := \fB*\fP := \fB>=0\.0\.0\fP -.IP \(bu 2 -\fB1\fP := \fB1\.x\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP -.IP \(bu 2 -\fB1\.2\fP := \fB1\.2\.x\fP := \fB>=1\.2\.0 <1\.3\.0\fP - -.RE -.SS Tilde Ranges \fB~1\.2\.3\fP \fB~1\.2\fP \fB~1\fP -.P -Allows patch\-level changes if a minor version is specified on the -comparator\. Allows minor\-level changes if not\. -.RS 0 -.IP \(bu 2 -\fB~1\.2\.3\fP := \fB>=1\.2\.3 <1\.(2+1)\.0\fP := \fB>=1\.2\.3 <1\.3\.0\fP -.IP \(bu 2 -\fB~1\.2\fP := \fB>=1\.2\.0 <1\.(2+1)\.0\fP := \fB>=1\.2\.0 <1\.3\.0\fP (Same as \fB1\.2\.x\fP) -.IP \(bu 2 -\fB~1\fP := \fB>=1\.0\.0 <(1+1)\.0\.0\fP := \fB>=1\.0\.0 <2\.0\.0\fP (Same as \fB1\.x\fP) -.IP \(bu 2 -\fB~0\.2\.3\fP := \fB>=0\.2\.3 <0\.(2+1)\.0\fP := \fB>=0\.2\.3 <0\.3\.0\fP -.IP \(bu 2 -\fB~0\.2\fP := \fB>=0\.2\.0 <0\.(2+1)\.0\fP := \fB>=0\.2\.0 <0\.3\.0\fP (Same as \fB0\.2\.x\fP) -.IP \(bu 2 -\fB~0\fP := \fB>=0\.0\.0 <(0+1)\.0\.0\fP := \fB>=0\.0\.0 <1\.0\.0\fP (Same as \fB0\.x\fP) -.IP \(bu 2 -\fB~1\.2\.3\-beta\.2\fP := \fB>=1\.2\.3\-beta\.2 <1\.3\.0\fP Note that prereleases in -the \fB1\.2\.3\fP version will be allowed, if they are greater than or -equal to \fBbeta\.2\fP\|\. So, \fB1\.2\.3\-beta\.4\fP would be allowed, but -\fB1\.2\.4\-beta\.2\fP would not, because it is a prerelease of a -different \fB[major, minor, patch]\fP tuple\. - -.RE -.SS Caret Ranges \fB^1\.2\.3\fP \fB^0\.2\.5\fP \fB^0\.0\.4\fP -.P -Allows changes that do not modify the left\-most non\-zero digit in the -\fB[major, minor, patch]\fP tuple\. In other words, this allows patch and -minor updates for versions \fB1\.0\.0\fP and above, patch updates for -versions \fB0\.X >=0\.1\.0\fP, and \fIno\fR updates for versions \fB0\.0\.X\fP\|\. -.P -Many authors treat a \fB0\.x\fP version as if the \fBx\fP were the major -"breaking\-change" indicator\. -.P -Caret ranges are ideal when an author may make breaking changes -between \fB0\.2\.4\fP and \fB0\.3\.0\fP releases, which is a common practice\. -However, it presumes that there will \fInot\fR be breaking changes between -\fB0\.2\.4\fP and \fB0\.2\.5\fP\|\. It allows for changes that are presumed to be -additive (but non\-breaking), according to commonly observed practices\. -.RS 0 -.IP \(bu 2 -\fB^1\.2\.3\fP := \fB>=1\.2\.3 <2\.0\.0\fP -.IP \(bu 2 -\fB^0\.2\.3\fP := \fB>=0\.2\.3 <0\.3\.0\fP -.IP \(bu 2 -\fB^0\.0\.3\fP := \fB>=0\.0\.3 <0\.0\.4\fP -.IP \(bu 2 -\fB^1\.2\.3\-beta\.2\fP := \fB>=1\.2\.3\-beta\.2 <2\.0\.0\fP Note that prereleases in -the \fB1\.2\.3\fP version will be allowed, if they are greater than or -equal to \fBbeta\.2\fP\|\. So, \fB1\.2\.3\-beta\.4\fP would be allowed, but -\fB1\.2\.4\-beta\.2\fP would not, because it is a prerelease of a -different \fB[major, minor, patch]\fP tuple\. -.IP \(bu 2 -\fB^0\.0\.3\-beta\fP := \fB>=0\.0\.3\-beta <0\.0\.4\fP Note that prereleases in the -\fB0\.0\.3\fP version \fIonly\fR will be allowed, if they are greater than or -equal to \fBbeta\fP\|\. So, \fB0\.0\.3\-pr\.2\fP would be allowed\. - -.RE -.P -When parsing caret ranges, a missing \fBpatch\fP value desugars to the -number \fB0\fP, but will allow flexibility within that value, even if the -major and minor versions are both \fB0\fP\|\. -.RS 0 -.IP \(bu 2 -\fB^1\.2\.x\fP := \fB>=1\.2\.0 <2\.0\.0\fP -.IP \(bu 2 -\fB^0\.0\.x\fP := \fB>=0\.0\.0 <0\.1\.0\fP -.IP \(bu 2 -\fB^0\.0\fP := \fB>=0\.0\.0 <0\.1\.0\fP - -.RE -.P -A missing \fBminor\fP and \fBpatch\fP values will desugar to zero, but also -allow flexibility within those values, even if the major version is -zero\. -.RS 0 -.IP \(bu 2 -\fB^1\.x\fP := \fB>=1\.0\.0 <2\.0\.0\fP -.IP \(bu 2 -\fB^0\.x\fP := \fB>=0\.0\.0 <1\.0\.0\fP - -.RE -.SS Range Grammar -.P -Putting all this together, here is a Backus\-Naur grammar for ranges, -for the benefit of parser authors: -.P -.RS 2 -.nf -range\-set ::= range ( logical\-or range ) * -logical\-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' \- ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '\.' xr ( '\.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | ['1'\-'9'] ( ['0'\-'9'] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '\-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '\.' part ) * -part ::= nr | [\-0\-9A\-Za\-z]+ -.fi -.RE -.SH Functions -.P -All methods and classes take a final \fBoptions\fP object argument\. All -options in this object are \fBfalse\fP by default\. The options supported -are: -.RS 0 -.IP \(bu 2 -\fBloose\fP Be more forgiving about not\-quite\-valid semver strings\. -(Any resulting output will always be 100% strict compliant, of -course\.) For backwards compatibility reasons, if the \fBoptions\fP -argument is a boolean value instead of an object, it is interpreted -to be the \fBloose\fP param\. -.IP \(bu 2 -\fBincludePrerelease\fP Set to suppress the default -behavior \fIhttps://github\.com/npm/node\-semver#prerelease\-tags\fR of -excluding prerelease tagged versions from ranges unless they are -explicitly opted into\. - -.RE -.P -Strict\-mode Comparators and Ranges will be strict about the SemVer -strings that they parse\. -.RS 0 -.IP \(bu 2 -\fBvalid(v)\fP: Return the parsed version, or null if it's not valid\. -.IP \(bu 2 -\fBinc(v, release)\fP: Return the version incremented by the release -type (\fBmajor\fP, \fBpremajor\fP, \fBminor\fP, \fBpreminor\fP, \fBpatch\fP, -\fBprepatch\fP, or \fBprerelease\fP), or null if it's not valid -.RS -.IP \(bu 2 -\fBpremajor\fP in one call will bump the version up to the next major -version and down to a prerelease of that major version\. -\fBpreminor\fP, and \fBprepatch\fP work the same way\. -.IP \(bu 2 -If called from a non\-prerelease version, the \fBprerelease\fP will work the -same as \fBprepatch\fP\|\. It increments the patch version, then makes a -prerelease\. If the input version is already a prerelease it simply -increments it\. - -.RE -.IP \(bu 2 -\fBprerelease(v)\fP: Returns an array of prerelease components, or null -if none exist\. Example: \fBprerelease('1\.2\.3\-alpha\.1') \-> ['alpha', 1]\fP -.IP \(bu 2 -\fBmajor(v)\fP: Return the major version number\. -.IP \(bu 2 -\fBminor(v)\fP: Return the minor version number\. -.IP \(bu 2 -\fBpatch(v)\fP: Return the patch version number\. -.IP \(bu 2 -\fBintersects(r1, r2, loose)\fP: Return true if the two supplied ranges -or comparators intersect\. -.IP \(bu 2 -\fBparse(v)\fP: Attempt to parse a string as a semantic version, returning either -a \fBSemVer\fP object or \fBnull\fP\|\. - -.RE -.SS Comparison -.RS 0 -.IP \(bu 2 -\fBgt(v1, v2)\fP: \fBv1 > v2\fP -.IP \(bu 2 -\fBgte(v1, v2)\fP: \fBv1 >= v2\fP -.IP \(bu 2 -\fBlt(v1, v2)\fP: \fBv1 < v2\fP -.IP \(bu 2 -\fBlte(v1, v2)\fP: \fBv1 <= v2\fP -.IP \(bu 2 -\fBeq(v1, v2)\fP: \fBv1 == v2\fP This is true if they're logically equivalent, -even if they're not the exact same string\. You already know how to -compare strings\. -.IP \(bu 2 -\fBneq(v1, v2)\fP: \fBv1 != v2\fP The opposite of \fBeq\fP\|\. -.IP \(bu 2 -\fBcmp(v1, comparator, v2)\fP: Pass in a comparison string, and it'll call -the corresponding function above\. \fB"==="\fP and \fB"!=="\fP do simple -string comparison, but are included for completeness\. Throws if an -invalid comparison string is provided\. -.IP \(bu 2 -\fBcompare(v1, v2)\fP: Return \fB0\fP if \fBv1 == v2\fP, or \fB1\fP if \fBv1\fP is greater, or \fB\-1\fP if -\fBv2\fP is greater\. Sorts in ascending order if passed to \fBArray\.sort()\fP\|\. -.IP \(bu 2 -\fBrcompare(v1, v2)\fP: The reverse of compare\. Sorts an array of versions -in descending order when passed to \fBArray\.sort()\fP\|\. -.IP \(bu 2 -\fBdiff(v1, v2)\fP: Returns difference between two versions by the release type -(\fBmajor\fP, \fBpremajor\fP, \fBminor\fP, \fBpreminor\fP, \fBpatch\fP, \fBprepatch\fP, or \fBprerelease\fP), -or null if the versions are the same\. - -.RE -.SS Comparators -.RS 0 -.IP \(bu 2 -\fBintersects(comparator)\fP: Return true if the comparators intersect - -.RE -.SS Ranges -.RS 0 -.IP \(bu 2 -\fBvalidRange(range)\fP: Return the valid range or null if it's not valid -.IP \(bu 2 -\fBsatisfies(version, range)\fP: Return true if the version satisfies the -range\. -.IP \(bu 2 -\fBmaxSatisfying(versions, range)\fP: Return the highest version in the list -that satisfies the range, or \fBnull\fP if none of them do\. -.IP \(bu 2 -\fBminSatisfying(versions, range)\fP: Return the lowest version in the list -that satisfies the range, or \fBnull\fP if none of them do\. -.IP \(bu 2 -\fBminVersion(range)\fP: Return the lowest version that can possibly match -the given range\. -.IP \(bu 2 -\fBgtr(version, range)\fP: Return \fBtrue\fP if version is greater than all the -versions possible in the range\. -.IP \(bu 2 -\fBltr(version, range)\fP: Return \fBtrue\fP if version is less than all the -versions possible in the range\. -.IP \(bu 2 -\fBoutside(version, range, hilo)\fP: Return true if the version is outside -the bounds of the range in either the high or low direction\. The -\fBhilo\fP argument must be either the string \fB\|'>'\fP or \fB\|'<'\fP\|\. (This is -the function called by \fBgtr\fP and \fBltr\fP\|\.) -.IP \(bu 2 -\fBintersects(range)\fP: Return true if any of the ranges comparators intersect - -.RE -.P -Note that, since ranges may be non\-contiguous, a version might not be -greater than a range, less than a range, \fIor\fR satisfy a range! For -example, the range \fB1\.2 <1\.2\.9 || >2\.0\.0\fP would have a hole from \fB1\.2\.9\fP -until \fB2\.0\.0\fP, so the version \fB1\.2\.10\fP would not be greater than the -range (because \fB2\.0\.1\fP satisfies, which is higher), nor less than the -range (since \fB1\.2\.8\fP satisfies, which is lower), and it also does not -satisfy the range\. -.P -If you want to know if a version satisfies or does not satisfy a -range, use the \fBsatisfies(version, range)\fP function\. -.SS Coercion -.RS 0 -.IP \(bu 2 -\fBcoerce(version)\fP: Coerces a string to semver if possible - -.RE -.P -This aims to provide a very forgiving translation of a non\-semver string to -semver\. It looks for the first digit in a string, and consumes all -remaining characters which satisfy at least a partial semver (e\.g\., \fB1\fP, -\fB1\.2\fP, \fB1\.2\.3\fP) up to the max permitted length (256 characters)\. Longer -versions are simply truncated (\fB4\.6\.3\.9\.2\-alpha2\fP becomes \fB4\.6\.3\fP)\. All -surrounding text is simply ignored (\fBv3\.4 replaces v3\.3\.1\fP becomes -\fB3\.4\.0\fP)\. Only text which lacks digits will fail coercion (\fBversion one\fP -is not valid)\. The maximum length for any semver component considered for -coercion is 16 characters; longer components will be ignored -(\fB10000000000000000\.4\.7\.4\fP becomes \fB4\.7\.4\fP)\. The maximum value for any -semver component is \fBNumber\.MAX_SAFE_INTEGER || (2**53 \- 1)\fP; higher value -components are invalid (\fB9999999999999999\.4\.7\.4\fP is likely invalid)\. diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index 350a806378..61da2ce657 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -1,4 +1,4 @@ -.TH "WORKSPACES" "7" "February 2021" "" "" +.TH "WORKSPACES" "7" "March 2021" "" "" .SH "NAME" \fBworkspaces\fR \- Working with workspaces .SS Description diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js index 6c46656eb9..09a6f70054 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -28,6 +28,7 @@ const {resolve} = require('path') const {homedir} = require('os') +const procLog = require('../proc-log.js') const mixins = [ require('../tracker.js'), @@ -54,6 +55,7 @@ class Arborist extends Base { path: options.path || '.', cache: options.cache || `${homedir()}/.npm/_cacache`, packumentCache: new Map(), + log: options.log || procLog, } this.cache = resolve(this.options.cache) this.path = resolve(this.options.path) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index f9f4297dba..828b9f3282 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -32,6 +32,7 @@ const mismatch = (a, b) => a && b && a !== b // After calling this.commit(), any nodes not present in the tree will have // been removed from the shrinkwrap data as well. +const procLog = require('./proc-log.js') const YarnLock = require('./yarn-lock.js') const {promisify} = require('util') const rimraf = promisify(require('rimraf')) @@ -39,7 +40,23 @@ const fs = require('fs') const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) const stat = promisify(fs.stat) -const readdir = promisify(fs.readdir) +const readdir_ = promisify(fs.readdir) + +// XXX remove when drop support for node v10 +const lstat = promisify(fs.lstat) +/* istanbul ignore next - version specific polyfill */ +const readdir = async (path, opt) => { + if (!opt || !opt.withFileTypes) + return readdir_(path, opt) + const ents = await readdir_(path, opt) + if (typeof ents[0] === 'string') { + return Promise.all(ents.map(async ent => { + return Object.assign(await lstat(path + '/' + ent), { name: ent }) + })) + } + return ents +} + const { resolve, basename } = require('path') const specFromLock = require('./spec-from-lock.js') const versionFromTgz = require('./version-from-tgz.js') @@ -265,7 +282,10 @@ class Shrinkwrap { newline = '\n', shrinkwrapOnly = false, hiddenLockfile = false, + log = procLog, } = options + + this.log = log this[_awaitingUpdate] = new Map() this.tree = null this.path = resolve(path || '.') @@ -398,6 +418,8 @@ class Shrinkwrap { // all good! hidden lockfile is the newest thing in here. return data }).catch(er => { + const rel = relpath(this.path, this.filename) + this.log.verbose('shrinkwrap', `failed to load ${rel}`, er) this.loadingError = er this.loadedFromDisk = false this.ancientLockfile = false diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js index c90404f00a..47267872ce 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js @@ -1,13 +1,12 @@ -const procLog = require('./proc-log.js') - const _progress = Symbol('_progress') const _onError = Symbol('_onError') +const procLog = require('./proc-log.js') module.exports = cls => class Tracker extends cls { constructor (options = {}) { super(options) - this[_progress] = new Map() this.log = options.log || procLog + this[_progress] = new Map() } addTracker (section, subsection = null, key = null) { diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index 77c11e7221..cf4224234c 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,9 +1,9 @@ { "name": "@npmcli/arborist", - "version": "2.2.4", + "version": "2.2.5", "description": "Manage node_modules trees", "dependencies": { - "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/map-workspaces": "^1.0.2", "@npmcli/metavuln-calculator": "^1.1.0", "@npmcli/move-file": "^1.1.0", @@ -46,7 +46,8 @@ "tcompare": "^3.0.4" }, "scripts": { - "test": "tap", + "test": "npm run test-only --", + "test-only": "tap", "posttest": "npm run lint", "snap": "tap", "postsnap": "npm run lint", @@ -76,12 +77,16 @@ }, "tap": { "100": true, - "node-arg": [ - "--unhandled-rejections=strict" - ], "after": "test/fixtures/cleanup.js", "coverage-map": "map.js", "esm": false, + "test-env": [ + "NODE_OPTIONS=--no-warnings" + ], + "node-arg": [ + "--no-warnings", + "--no-deprecation" + ], "timeout": "120" } } diff --git a/deps/npm/package.json b/deps/npm/package.json index 4af2d03946..8ed3c32b88 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "7.5.6", + "version": "7.6.0", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -42,7 +42,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^2.2.4", + "@npmcli/arborist": "^2.2.5", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", "@npmcli/run-script": "^1.8.3", diff --git a/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js index 54a77bc122..6d169bca69 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js @@ -21,6 +21,28 @@ manydep@1.0.0 6 more (optdep, extra-neos, deep-dev, peer, the root project, a package with a pretty long name) ` +exports[`test/lib/utils/explain-dep.js TAP bundled > explain color deep 1`] = ` +[1mbundle-of-joy[22m@[1m1.0.0[22m [1m[34mbundled[39m[22m[2m[22m +[2mnode_modules/bundle-of-joy[22m + [1mprod-dep[22m@"[1m1.x[22m" from the root project +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > explain nocolor shallow 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy + prod-dep@"1.x" from the root project +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > print color 1`] = ` +[1mbundle-of-joy[22m@[1m1.0.0[22m [1m[34mbundled[39m[22m[2m[22m +[2mnode_modules/bundle-of-joy[22m +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > print nocolor 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy +` + exports[`test/lib/utils/explain-dep.js TAP deepDev > explain color deep 1`] = ` [1mdeep-dev[22m@[1m2.3.4[22m [1m[33mdev[39m[22m[2m[22m [2mnode_modules/deep-dev[22m diff --git a/deps/npm/test/lib/access.js b/deps/npm/test/lib/access.js index 3063b6c532..fb799f2df2 100644 --- a/deps/npm/test/lib/access.js +++ b/deps/npm/test/lib/access.js @@ -1,35 +1,24 @@ const { test } = require('tap') const requireInject = require('require-inject') -const emptyMock = requireInject('../../lib/access.js', { +const access = requireInject('../../lib/access.js', { '../../lib/npm.js': { flatOptions: {}, }, }) test('completion', t => { - const { completion } = emptyMock + const { completion } = access const testComp = (argv, expect) => { - completion({conf: {argv: {remain: argv}}}, (er, res) => { - if (er) - throw er - t.strictSame(res, expect, argv.join(' ')) - }) + const res = completion({conf: {argv: {remain: argv}}}) + t.resolves(res, expect, argv.join(' ')) } testComp(['npm', 'access'], [ - 'public', - 'restricted', - 'grant', - 'revoke', - 'ls-packages', - 'ls-collaborators', - 'edit', - '2fa-required', - '2fa-not-required', + 'public', 'restricted', 'grant', 'revoke', 'ls-packages', + 'ls-collaborators', 'edit', '2fa-required', '2fa-not-required', ]) - testComp(['npm', 'access', 'grant'], ['read-only', 'read-write']) testComp(['npm', 'access', 'grant', 'read-only'], []) testComp(['npm', 'access', 'public'], []) @@ -42,15 +31,15 @@ test('completion', t => { testComp(['npm', 'access', '2fa-not-required'], []) testComp(['npm', 'access', 'revoke'], []) - completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}, (er) => { - t.match(er, { message: 'foobar not recognized' }) - }) + t.rejects( + completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}), + { message: 'foobar not recognized' } + ) t.end() }) test('subcommand required', t => { - const access = emptyMock access([], (err) => { t.equal(err, '\nUsage: Subcommand is required.\n\n' + access.usage) t.end() @@ -58,8 +47,6 @@ test('subcommand required', t => { }) test('unrecognized subcommand', (t) => { - const access = emptyMock - access(['blerg'], (err) => { t.match( err, @@ -71,8 +58,6 @@ test('unrecognized subcommand', (t) => { }) test('edit', (t) => { - const access = emptyMock - access([ 'edit', '@scoped/another', @@ -349,8 +334,6 @@ test('access grant current cwd', (t) => { }) test('access grant others', (t) => { - const access = emptyMock - access([ 'grant', 'rerere', @@ -367,8 +350,6 @@ test('access grant others', (t) => { }) test('access grant missing team args', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -385,8 +366,6 @@ test('access grant missing team args', (t) => { }) test('access grant malformed team arg', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -452,8 +431,6 @@ test('access revoke', (t) => { }) test('access revoke missing team args', (t) => { - const access = emptyMock - access([ 'revoke', undefined, @@ -469,8 +446,6 @@ test('access revoke missing team args', (t) => { }) test('access revoke malformed team arg', (t) => { - const access = emptyMock - access([ 'revoke', 'foo', diff --git a/deps/npm/test/lib/audit.js b/deps/npm/test/lib/audit.js index cc7379394b..3d6296bac6 100644 --- a/deps/npm/test/lib/audit.js +++ b/deps/npm/test/lib/audit.js @@ -168,35 +168,22 @@ t.test('report endpoint error', t => { }) t.test('completion', t => { - t.test('fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit'] } }, - }, (err, res) => { - if (err) - throw err - const subcmd = res.pop() - t.equals('fix', subcmd, 'completes to fix') - t.end() - }) + t.test('fix', async t => { + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit'] } } }), ['fix'], 'completes to fix') + t.end() }) t.test('subcommand fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'fix'] } }, - }, (err) => { - if (err) - throw err - t.end() - }) + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'fix'] } } }), [], 'resolves to ?') + t.end() }) t.test('subcommand not recognized', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'repare'] } }, - }, (err) => { - t.ok(err, 'not recognized') - t.end() - }) + t.rejects( + audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'repare'] } } }), + { message: 'repare not recognized' } + ) + t.end() }) t.end() diff --git a/deps/npm/test/lib/bugs.js b/deps/npm/test/lib/bugs.js index df64349878..992bd9f614 100644 --- a/deps/npm/test/lib/bugs.js +++ b/deps/npm/test/lib/bugs.js @@ -54,14 +54,6 @@ const bugs = requireInject('../../lib/bugs.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - bugs.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open bugs urls', t => { const expect = { nobugs: 'https://www.npmjs.com/package/nobugs', diff --git a/deps/npm/test/lib/cache.js b/deps/npm/test/lib/cache.js index 2e9ad346bb..05d269dd4d 100644 --- a/deps/npm/test/lib/cache.js +++ b/deps/npm/test/lib/cache.js @@ -208,18 +208,10 @@ t.test('cache completion', t => { const { completion } = cache const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - t.ifError(err) - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } - testComp(['npm', 'cache'], [ - 'add', - 'clean', - 'verify', - ]) - + testComp(['npm', 'cache'], ['add', 'clean', 'verify']) testComp(['npm', 'cache', 'add'], []) testComp(['npm', 'cache', 'clean'], []) testComp(['npm', 'cache', 'verify'], []) diff --git a/deps/npm/test/lib/completion.js b/deps/npm/test/lib/completion.js index 367a1c03ab..19f70df20e 100644 --- a/deps/npm/test/lib/completion.js +++ b/deps/npm/test/lib/completion.js @@ -21,28 +21,28 @@ const npm = { }, commands: { completion: { - completion: (opts, cb) => { - return cb(null, [['>>', '~/.bashrc']]) - }, + completion: () => [['>>', '~/.bashrc']], }, adduser: {}, access: { - completion: (opts, cb) => { + completion: () => { if (accessCompletionError) - return cb(new Error('access completion failed')) + throw new Error('access completion failed') - return cb(null, ['public', 'restricted']) + return ['public', 'restricted'] }, }, + promise: { + completion: () => Promise.resolve(['resolved_completion_promise']), + }, donothing: { - completion: (opts, cb) => { - return cb(null, null) + completion: () => { + return null }, }, driveaboat: { - completion: (opts, cb) => { - // the leading space here is to exercise the escape method - return cb(null, ' fast') + completion: () => { + return ' fast' }, }, }, @@ -86,7 +86,7 @@ const completion = requireInject('../../lib/completion.js', { }, }) -test('completion completion', t => { +test('completion completion', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -97,19 +97,15 @@ test('completion completion', t => { '.zshrc': '', }) - completion.completion({ w: 2 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, [ - ['>>', '~/.zshrc'], - ['>>', '~/.bashrc'], - ], 'identifies both shells') - t.end() - }) + const res = await completion.completion({ w: 2 }) + t.strictSame(res, [ + ['>>', '~/.zshrc'], + ['>>', '~/.bashrc'], + ], 'identifies both shells') + t.end() }) -test('completion completion no known shells', t => { +test('completion completion no known shells', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -117,23 +113,15 @@ test('completion completion no known shells', t => { process.env.HOME = t.testdir() - completion.completion({ w: 2 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, [], 'no responses') - t.end() - }) + const res = await completion.completion({ w: 2 }) + t.strictSame(res, [], 'no responses') + t.end() }) -test('completion completion wrong word count', t => { - completion.completion({ w: 3 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, undefined, 'no responses') - t.end() - }) +test('completion completion wrong word count', async t => { + const res = await completion.completion({ w: 3 }) + t.strictSame(res, undefined, 'no responses') + t.end() }) test('completion errors in windows without bash', t => { @@ -313,6 +301,35 @@ test('completion of invalid command name does nothing', t => { }) }) +test('handles async completion function', t => { + process.env.COMP_CWORD = 2 + process.env.COMP_LINE = 'npm promise' + process.env.COMP_POINT = process.env.COMP_LINE.length + + t.teardown(() => { + delete process.env.COMP_CWORD + delete process.env.COMP_LINE + delete process.env.COMP_POINT + npm.config.clear() + output.length = 0 + }) + + completion(['npm', 'promise', ''], (err, res) => { + if (err) + throw err + + t.strictSame(npmConfig, { + argv: { + remain: ['npm', 'promise'], + cooked: ['npm', 'promise'], + original: ['npm', 'promise'], + }, + }, 'applies command config appropriately') + t.strictSame(output, ['resolved_completion_promise'], 'resolves async completion results') + t.end() + }) +}) + test('completion triggers command completions', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm access ' diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js index 5d2f54249c..edaa6486cd 100644 --- a/deps/npm/test/lib/config.js +++ b/deps/npm/test/lib/config.js @@ -610,23 +610,13 @@ t.test('completion', t => { const { completion } = config const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (er, res) => { - t.ifError(er) - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } testComp(['npm', 'foo'], []) - testComp(['npm', 'config'], [ - 'get', - 'set', - 'delete', - 'ls', - 'rm', - 'edit', - 'list', - ]) + testComp(['npm', 'config'], ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'list']) testComp(['npm', 'config', 'set', 'foo'], []) + const possibleConfigKeys = [...Object.keys(types)] testComp(['npm', 'config', 'get'], possibleConfigKeys) testComp(['npm', 'config', 'set'], possibleConfigKeys) @@ -636,24 +626,8 @@ t.test('completion', t => { testComp(['npm', 'config', 'list'], []) testComp(['npm', 'config', 'ls'], []) - completion({ - conf: { - argv: { - remain: ['npm', 'config'], - }, - }, - partialWord: 'l', - }, (er, res) => { - t.ifError(er) - t.strictSame(res, [ - 'get', - 'set', - 'delete', - 'ls', - 'rm', - 'edit', - ], 'npm config') - }) + const partial = completion({conf: { argv: { remain: ['npm', 'config'] } }, partialWord: 'l'}) + t.resolveMatch(partial, ['get', 'set', 'delete', 'ls', 'rm', 'edit'], 'npm config') t.end() }) diff --git a/deps/npm/test/lib/deprecate.js b/deps/npm/test/lib/deprecate.js index 229cb9137a..fd563de120 100644 --- a/deps/npm/test/lib/deprecate.js +++ b/deps/npm/test/lib/deprecate.js @@ -38,29 +38,24 @@ test('completion', async t => { const { completion } = deprecate - const testComp = (argv, expect) => { - return new Promise((resolve, reject) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - return reject(err) - - t.strictSame(res, expect, `completion: ${argv}`) - resolve() - }) - }) + const testComp = async (argv, expect) => { + const res = await completion({ conf: { argv: { remain: argv } } }) + t.strictSame(res, expect, `completion: ${argv}`) } - await testComp([], ['foo', 'bar', 'baz']) - await testComp(['b'], ['bar', 'baz']) - await testComp(['fo'], ['foo']) - await testComp(['g'], []) - await testComp(['foo', 'something'], []) + await Promise.all([ + testComp([], ['foo', 'bar', 'baz']), + testComp(['b'], ['bar', 'baz']), + testComp(['fo'], ['foo']), + testComp(['g'], []), + testComp(['foo', 'something'], []), + ]) getIdentityImpl = () => { - throw new Error('unknown failure') + throw new Error('deprecate test failure') } - t.rejects(testComp([], []), /unknown failure/) + t.rejects(testComp([], []), { message: 'deprecate test failure' }) }) test('no args', t => { diff --git a/deps/npm/test/lib/dist-tag.js b/deps/npm/test/lib/dist-tag.js index 8b1106fa39..c189352302 100644 --- a/deps/npm/test/lib/dist-tag.js +++ b/deps/npm/test/lib/dist-tag.js @@ -294,35 +294,13 @@ test('remove missing pkg name', (t) => { test('completion', t => { const { completion } = distTag - t.plan(3) + t.plan(2) - completion({ - conf: { - argv: { - remain: ['npm', 'dist-tag'], - }, - }, - }, (err, res) => { - t.ifError(err, 'npm dist-tags completion') - - t.strictSame( - res, - [ - 'add', - 'rm', - 'ls', - ], - 'should list npm dist-tag commands for completion' - ) - }) + const match = completion({ conf: { argv: { remain: ['npm', 'dist-tag'] } } }) + t.resolveMatch(match, ['add', 'rm', 'ls'], + 'should list npm dist-tag commands for completion') - completion({ - conf: { - argv: { - remain: ['npm', 'dist-tag', 'foobar'], - }, - }, - }, (err) => { - t.notOk(err, 'should ignore any unknown name') - }) + const noMatch = completion({ conf: { argv: { remain: ['npm', 'dist-tag', 'foobar'] } } }) + t.resolveMatch(noMatch, []) + t.end() }) diff --git a/deps/npm/test/lib/docs.js b/deps/npm/test/lib/docs.js index b4ede87316..8a59ed7cc0 100644 --- a/deps/npm/test/lib/docs.js +++ b/deps/npm/test/lib/docs.js @@ -44,14 +44,6 @@ const docs = requireInject('../../lib/docs.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - docs.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open docs urls', t => { const expect = { nodocs: 'https://www.npmjs.com/package/nodocs', diff --git a/deps/npm/test/lib/help.js b/deps/npm/test/lib/help.js index 40a0354210..fc4a32e07b 100644 --- a/deps/npm/test/lib/help.js +++ b/deps/npm/test/lib/help.js @@ -101,20 +101,13 @@ test('npm help completion', async t => { t.teardown(() => { globErr = null }) - const completion = (opts) => new Promise((resolve, reject) => { - help.completion(opts, (err, res) => { - if (err) - return reject(err) - return resolve(res) - }) - }) - const noArgs = await completion({ conf: { argv: { remain: [] } } }) + const noArgs = await help.completion({ conf: { argv: { remain: [] } } }) t.strictSame(noArgs, ['help', 'whoami', 'npmrc', 'disputes'], 'outputs available help pages') - const threeArgs = await completion({ conf: { argv: { remain: ['one', 'two', 'three'] } } }) + const threeArgs = await help.completion({ conf: { argv: { remain: ['one', 'two', 'three'] } } }) t.strictSame(threeArgs, [], 'outputs no results when more than 2 args are provided') globErr = new Error('glob failed') - t.rejects(completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate') + t.rejects(help.completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate') }) test('npm help -h', t => { diff --git a/deps/npm/test/lib/install.js b/deps/npm/test/lib/install.js index 177952b9e9..859a4bdaaa 100644 --- a/deps/npm/test/lib/install.js +++ b/deps/npm/test/lib/install.js @@ -130,7 +130,7 @@ test('should install globally using Arborist', (t) => { }) }) -test('completion to folder', (t) => { +test('completion to folder', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -145,17 +145,13 @@ test('completion to folder', (t) => { }, }, }) - install.completion({ - partialWord: '/ar', - }, (er, res) => { - t.equal(er, null) - const expect = process.platform === 'win32' ? '\\arborist' : '/arborist' - t.strictSame(res, [expect], 'package dir match') - t.end() - }) + const res = await install.completion({ partialWord: '/ar' }) + const expect = process.platform === 'win32' ? '\\arborist' : '/arborist' + t.strictSame(res, [expect], 'package dir match') + t.end() }) -test('completion to folder - invalid dir', (t) => { +test('completion to folder - invalid dir', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -167,16 +163,12 @@ test('completion to folder - invalid dir', (t) => { }, }, }) - install.completion({ - partialWord: 'path/to/folder', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'invalid dir: no matching') - t.end() - }) + const res = await install.completion({ partialWord: 'path/to/folder' }) + t.strictSame(res, [], 'invalid dir: no matching') + t.end() }) -test('completion to folder - no matches', (t) => { +test('completion to folder - no matches', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -188,16 +180,12 @@ test('completion to folder - no matches', (t) => { }, }, }) - install.completion({ - partialWord: '/pa', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'no name match') - t.end() - }) + const res = await install.completion({ partialWord: '/pa' }) + t.strictSame(res, [], 'no name match') + t.end() }) -test('completion to folder - match is not a package', (t) => { +test('completion to folder - match is not a package', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -212,31 +200,19 @@ test('completion to folder - match is not a package', (t) => { }, }, }) - install.completion({ - partialWord: '/ar', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'no name match') - t.end() - }) + const res = await install.completion({ partialWord: '/ar' }) + t.strictSame(res, [], 'no name match') + t.end() }) -test('completion to url', (t) => { - install.completion({ - partialWord: 'http://path/to/url', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, []) - t.end() - }) +test('completion to url', async t => { + const res = await install.completion({ partialWord: 'http://path/to/url' }) + t.strictSame(res, []) + t.end() }) -test('completion', (t) => { - install.completion({ - partialWord: 'toto', - }, (er, res) => { - t.notOk(er) - t.notOk(res) - t.end() - }) +test('completion', async t => { + const res = await install.completion({ partialWord: 'toto' }) + t.notOk(res) + t.end() }) diff --git a/deps/npm/test/lib/link.js b/deps/npm/test/lib/link.js index c39026a491..b1048427d7 100644 --- a/deps/npm/test/lib/link.js +++ b/deps/npm/test/lib/link.js @@ -317,7 +317,7 @@ t.test('link pkg already in global space when prefix is a symlink', (t) => { }) }) -t.test('completion', (t) => { +t.test('completion', async t => { const testdir = t.testdir({ 'global-prefix': { lib: { @@ -332,31 +332,30 @@ t.test('completion', (t) => { }) npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules') - link.completion({}, (err, words) => { - t.ifError(err, 'should not error out') - t.deepEqual( - words, - ['bar', 'foo', 'ipsum', 'lorem'], - 'should list all package names available in globalDir' - ) - t.end() - }) + const words = await link.completion({}) + t.deepEqual( + words, + ['bar', 'foo', 'ipsum', 'lorem'], + 'should list all package names available in globalDir' + ) + t.end() }) -t.test('--global option', (t) => { +t.test('--global option', async t => { const _config = npm.config npm.config = { get () { return true } } - link([], (err) => { + try { + await link([]) + t.fail('should not get here') + } catch (err) { npm.config = _config - t.match( err.message, /link should never be --global/, 'should throw an useful error' ) - - t.end() - }) + } + t.end() }) diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js index fa73b8a78d..02cb0be650 100644 --- a/deps/npm/test/lib/load-all-commands.js +++ b/deps/npm/test/lib/load-all-commands.js @@ -12,11 +12,14 @@ t.test('load each command', t => { t.plan(cmdList.length) for (const cmd of cmdList.sort((a, b) => a.localeCompare(b))) { t.test(cmd, t => { - t.plan(3) const impl = npm.commands[cmd] + if (impl.completion) { + t.plan(3) + t.isa(impl.completion, 'function', 'completion, if present, is a function') + } else + t.plan(2) t.isa(impl, 'function', 'implementation is a function') t.isa(impl.usage, 'string', 'usage is a string') - t.isa(impl.completion, 'function', 'completion is a function') }) } }) diff --git a/deps/npm/test/lib/ls.js b/deps/npm/test/lib/ls.js index a89137b9ef..b1df9067c3 100644 --- a/deps/npm/test/lib/ls.js +++ b/deps/npm/test/lib/ls.js @@ -3,6 +3,12 @@ const { resolve } = require('path') const t = require('tap') const requireInject = require('require-inject') +const { utimesSync } = require('fs') +const touchHiddenPackageLock = prefix => { + const later = new Date(Date.now() + 10000) + utimesSync(`${prefix}/node_modules/.package-lock.json`, later, later) +} + t.cleanSnapshot = str => str.split(/\r\n/).join('\n') const simpleNmFixture = { @@ -1186,6 +1192,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing aliases') t.end() @@ -1231,6 +1238,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], (err) => { t.ifError(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing git refs') @@ -1329,6 +1337,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should not be printed in tree output') t.end() @@ -2228,6 +2237,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing aliases') t.end() @@ -2272,6 +2282,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing git refs') t.end() @@ -2325,6 +2336,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should not be printed in tree output') t.end() @@ -3688,6 +3700,7 @@ t.test('ls --json', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), @@ -3747,6 +3760,7 @@ t.test('ls --json', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), @@ -3830,6 +3844,7 @@ t.test('ls --json', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), diff --git a/deps/npm/test/lib/org.js b/deps/npm/test/lib/org.js index 68e3c9f0d6..1e8aabc1d7 100644 --- a/deps/npm/test/lib/org.js +++ b/deps/npm/test/lib/org.js @@ -49,13 +49,8 @@ const org = requireInject('../../lib/org.js', { }) test('completion', async t => { - const completion = (argv) => new Promise((resolve, reject) => { - org.completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - return reject(err) - return resolve(res) - }) - }) + const completion = (argv) => + org.completion({ conf: { argv: { remain: argv } } }) const assertions = [ [['npm', 'org'], ['set', 'rm', 'ls']], @@ -66,7 +61,7 @@ test('completion', async t => { ] for (const [argv, expected] of assertions) - t.strictSame(await completion(argv), expected, `completion for: ${argv.join(', ')}`) + t.resolveMatch(completion(argv), expected, `completion for: ${argv.join(', ')}`) t.rejects(completion(['npm', 'org', 'flurb']), /flurb not recognized/, 'errors for unknown subcommand') }) diff --git a/deps/npm/test/lib/owner.js b/deps/npm/test/lib/owner.js index c5f9d646c2..aa5e3ee637 100644 --- a/deps/npm/test/lib/owner.js +++ b/deps/npm/test/lib/owner.js @@ -699,29 +699,25 @@ t.test('owner rm <user> no cwd package', t => { }) }) -t.test('completion', t => { +t.test('completion', async t => { const { completion } = owner - const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - t.ifError(err) - t.strictSame(res, expect, argv.join(' ')) - }) + const testComp = async (argv, expect) => { + const res = await completion({ conf: { argv: { remain: argv } } }) + t.strictSame(res, expect, argv.join(' ')) } - testComp(['npm', 'foo'], []) - testComp(['npm', 'owner'], [ - 'add', - 'rm', - 'ls', + await Promise.all([ + testComp(['npm', 'foo'], []), + testComp(['npm', 'owner'], ['add', 'rm', 'ls']), + testComp(['npm', 'owner', 'add'], []), + testComp(['npm', 'owner', 'ls'], []), + testComp(['npm', 'owner', 'rm', 'foo'], []), ]) - testComp(['npm', 'owner', 'add'], []) - testComp(['npm', 'owner', 'ls'], []) - testComp(['npm', 'owner', 'rm', 'foo'], []) // npm owner rm completion is async - t.test('completion npm owner rm', t => { - t.plan(3) + t.test('completion npm owner rm', async t => { + t.plan(2) readLocalPkgResponse = '@npmcli/map-workspaces' pacote.packument = async spec => { t.equal(spec.name, readLocalPkgResponse, 'should use package spec') @@ -734,31 +730,21 @@ t.test('completion', t => { pacote.packument = noop }) - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame( - res, - [ - 'nlf', - 'ruyadorno', - 'darcyclarke', - 'isaacs', - ], - 'should return list of current owners' - ) - }) + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, + ['nlf', 'ruyadorno', 'darcyclarke', 'isaacs'], + 'should return list of current owners' + ) }) - t.test('completion npm owner rm no cwd package', t => { - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame(res, [], 'should have no owners to autocomplete if not cwd package') - t.end() - }) + t.test('completion npm owner rm no cwd package', async t => { + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, [], 'should have no owners to autocomplete if not cwd package') + t.end() }) - t.test('completion npm owner rm no owners found', t => { - t.plan(3) + t.test('completion npm owner rm no owners found', async t => { + t.plan(2) readLocalPkgResponse = '@npmcli/map-workspaces' pacote.packument = async spec => { t.equal(spec.name, readLocalPkgResponse, 'should use package spec') @@ -771,10 +757,8 @@ t.test('completion', t => { pacote.packument = noop }) - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame(res, [], 'should return no owners if not found') - }) + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, [], 'should return no owners if not found') }) t.end() diff --git a/deps/npm/test/lib/profile.js b/deps/npm/test/lib/profile.js index 48a558cace..3b2e140036 100644 --- a/deps/npm/test/lib/profile.js +++ b/deps/npm/test/lib/profile.js @@ -1398,17 +1398,16 @@ t.test('unknown subcommand', t => { t.test('completion', t => { const { completion } = profile - const testComp = ({ t, argv, expect, title }) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - throw err - - t.strictSame(res, expect, title) - }) + const testComp = async ({ t, argv, expect, title }) => { + t.resolveMatch( + completion({ conf: { argv: { remain: argv } } }), + expect, + title + ) } - t.test('npm profile autocomplete', t => { - testComp({ + t.test('npm profile autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile'], expect: ['enable-2fa', 'disable-2fa', 'get', 'set'], @@ -1418,8 +1417,8 @@ t.test('completion', t => { t.end() }) - t.test('npm profile enable autocomplete', t => { - testComp({ + t.test('npm profile enable autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile', 'enable-2fa'], expect: ['auth-and-writes', 'auth-only'], @@ -1429,10 +1428,10 @@ t.test('completion', t => { t.end() }) - t.test('npm profile <subcmd> no autocomplete', t => { + t.test('npm profile <subcmd> no autocomplete', async t => { const noAutocompleteCmds = ['disable-2fa', 'disable-tfa', 'get', 'set'] for (const subcmd of noAutocompleteCmds) { - testComp({ + await testComp({ t, argv: ['npm', 'profile', subcmd], expect: [], @@ -1443,22 +1442,12 @@ t.test('completion', t => { t.end() }) - t.test('npm profile unknown subcommand autocomplete', t => { - completion({ - conf: { - argv: { - remain: ['npm', 'profile', 'asdf'], - }, - }, - }, (err, res) => { - t.match( - err, - /asdf not recognized/, - 'should throw unknown cmd error' - ) - - t.end() - }) + t.test('npm profile unknown subcommand autocomplete', async t => { + t.rejects( + completion({ conf: { argv: { remain: ['npm', 'profile', 'asdf'] } } }), + { message: 'asdf not recognized' }, 'should throw unknown cmd error' + ) + t.end() }) t.end() diff --git a/deps/npm/test/lib/repo.js b/deps/npm/test/lib/repo.js index c4b1b46e73..3367f7c885 100644 --- a/deps/npm/test/lib/repo.js +++ b/deps/npm/test/lib/repo.js @@ -119,14 +119,6 @@ const repo = requireInject('../../lib/repo.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - repo.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open repo urls', t => { const expect = { hostedgit: 'https://github.com/foo/hostedgit', diff --git a/deps/npm/test/lib/restart.js b/deps/npm/test/lib/restart.js index fde7988888..a19bfd0d41 100644 --- a/deps/npm/test/lib/restart.js +++ b/deps/npm/test/lib/restart.js @@ -1,5 +1,4 @@ const t = require('tap') const restart = require('../../lib/restart.js') t.isa(restart, Function) -t.equal(restart.completion, require('../../lib/utils/completion/none.js'), 'empty completion') t.equal(restart.usage, 'npm restart [-- <args>]') diff --git a/deps/npm/test/lib/run-script.js b/deps/npm/test/lib/run-script.js index 070f766b44..974202aa8c 100644 --- a/deps/npm/test/lib/run-script.js +++ b/deps/npm/test/lib/run-script.js @@ -42,45 +42,29 @@ const { writeFileSync } = require('fs') t.test('completion', t => { const dir = t.testdir() npm.localPrefix = dir - t.test('already have a script name', t => { - runScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}}, (er, results) => { - if (er) - throw er - - t.equal(results, undefined) - t.end() - }) + t.test('already have a script name', async t => { + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}}) + t.equal(res, undefined) + t.end() }) - t.test('no package.json', t => { - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, []) - t.end() - }) + t.test('no package.json', async t => { + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, []) + t.end() }) - t.test('has package.json, no scripts', t => { + t.test('has package.json, no scripts', async t => { writeFileSync(`${dir}/package.json`, JSON.stringify({})) - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, []) - t.end() - }) + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, []) + t.end() }) - t.test('has package.json, with scripts', t => { + t.test('has package.json, with scripts', async t => { writeFileSync(`${dir}/package.json`, JSON.stringify({ scripts: { hello: 'echo hello', world: 'echo world' }, })) - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, ['hello', 'world']) - t.end() - }) + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, ['hello', 'world']) + t.end() }) t.end() }) diff --git a/deps/npm/test/lib/set-script.js b/deps/npm/test/lib/set-script.js index ab25ba968a..196fd3d3e6 100644 --- a/deps/npm/test/lib/set-script.js +++ b/deps/npm/test/lib/set-script.js @@ -4,7 +4,6 @@ const setScriptDefault = require('../../lib/set-script.js') const parseJSON = require('json-parse-even-better-errors') test.type(setScriptDefault, 'function', 'command is function') -test.equal(setScriptDefault.completion, require('../../lib/utils/completion/none.js'), 'empty completion') test.equal(setScriptDefault.usage, 'npm set-script [<script>] [<command>]', 'usage matches') test.test('fails on invalid arguments', (t) => { const setScript = requireInject('../../lib/set-script.js', { diff --git a/deps/npm/test/lib/start.js b/deps/npm/test/lib/start.js index 1277412758..4f599223d7 100644 --- a/deps/npm/test/lib/start.js +++ b/deps/npm/test/lib/start.js @@ -1,5 +1,4 @@ const t = require('tap') const start = require('../../lib/start.js') t.isa(start, Function) -t.equal(start.completion, require('../../lib/utils/completion/none.js'), 'empty completion') t.equal(start.usage, 'npm start [-- <args>]') diff --git a/deps/npm/test/lib/stop.js b/deps/npm/test/lib/stop.js index d015161d2f..4e26703c93 100644 --- a/deps/npm/test/lib/stop.js +++ b/deps/npm/test/lib/stop.js @@ -1,5 +1,4 @@ const t = require('tap') const stop = require('../../lib/stop.js') t.isa(stop, Function) -t.equal(stop.completion, require('../../lib/utils/completion/none.js'), 'empty completion') t.equal(stop.usage, 'npm stop [-- <args>]') diff --git a/deps/npm/test/lib/team.js b/deps/npm/test/lib/team.js index c534cc8327..9edaf58ee7 100644 --- a/deps/npm/test/lib/team.js +++ b/deps/npm/test/lib/team.js @@ -506,66 +506,45 @@ t.test('team rm <scope:team> <user>', t => { t.test('completion', t => { const { completion } = team - t.test('npm team autocomplete', t => { - completion({ + t.test('npm team autocomplete', async t => { + const res = await completion({ conf: { argv: { remain: ['npm', 'team'], }, }, - }, (err, res) => { - if (err) - throw err - - t.strictSame( - res, - ['create', 'destroy', 'add', 'rm', 'ls'], - 'should auto complete with subcommands' - ) - - t.end() }) + t.strictSame( + res, + ['create', 'destroy', 'add', 'rm', 'ls'], + 'should auto complete with subcommands' + ) + t.end() }) t.test('npm team <subcommand> autocomplete', async t => { - const check = (subcmd) => new Promise((res, rej) => - completion({ + for (const subcmd of ['create', 'destroy', 'add', 'rm', 'ls']) { + const res = await completion({ conf: { argv: { remain: ['npm', 'team', subcmd], }, }, - }, (err, response) => { - if (err) - rej(err) - - t.strictSame( - response, - [], - `should not autocomplete ${subcmd} subcommand` - ) - res() - })) - - await ['create', 'destroy', 'add', 'rm', 'ls'].map(check) + }) + t.strictSame( + res, + [], + `should not autocomplete ${subcmd} subcommand` + ) + } }) - t.test('npm team unknown subcommand autocomplete', t => { - completion({ - conf: { - argv: { - remain: ['npm', 'team', 'missing-subcommand'], - }, - }, - }, (err, res) => { - t.match( - err, - /missing-subcommand not recognized/, - 'should throw a a not recognized error' - ) + t.test('npm team unknown subcommand autocomplete', async t => { + t.rejects(completion({conf: {argv: {remain: ['npm', 'team', 'missing-subcommand'] } } }), + {message: 'missing-subcommand not recognized'}, 'should throw a a not recognized error' + ) - t.end() - }) + t.end() }) t.end() diff --git a/deps/npm/test/lib/token.js b/deps/npm/test/lib/token.js index f988810722..6ab841f499 100644 --- a/deps/npm/test/lib/token.js +++ b/deps/npm/test/lib/token.js @@ -48,27 +48,18 @@ test('completion', (t) => { t.plan(5) const testComp = (argv, expect) => { - tokenMock.completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - throw err - - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(tokenMock.completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } - testComp(['npm', 'token'], [ - 'list', - 'revoke', - 'create', - ]) - + testComp(['npm', 'token'], ['list', 'revoke', 'create']) testComp(['npm', 'token', 'list'], []) testComp(['npm', 'token', 'revoke'], []) testComp(['npm', 'token', 'create'], []) - tokenMock.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }, (err) => { - t.match(err, { message: 'foobar not recognized' }) - }) + t.rejects( + tokenMock.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }), + { message: 'foobar not recognize' } + ) }) test('token foobar', (t) => { diff --git a/deps/npm/test/lib/unpublish.js b/deps/npm/test/lib/unpublish.js index 11e24714d8..c1fbed57eb 100644 --- a/deps/npm/test/lib/unpublish.js +++ b/deps/npm/test/lib/unpublish.js @@ -310,16 +310,12 @@ t.test('silent', t => { }) }) -t.test('completion', t => { - const testComp = (t, { completion, argv, partialWord, expect, title }) => - new Promise((resolve, rej) => { - completion({conf: {argv: {remain: argv}}, partialWord}, (er, res) => { - if (er) - rej(er) - t.strictSame(res, expect, title || argv.join(' ')) - resolve() - }) - }) +t.test('completion', async t => { + const testComp = + async (t, { completion, argv, partialWord, expect, title }) => { + const res = await completion({conf: {argv: {remain: argv}}, partialWord}) + t.strictSame(res, expect, title || argv.join(' ')) + } t.test('completing with multiple versions from the registry', async t => { const { completion } = requireInject('../../lib/unpublish.js', { diff --git a/deps/npm/test/lib/utils/completion/installed-deep.js b/deps/npm/test/lib/utils/completion/installed-deep.js index a2a3756104..bd61ab4280 100644 --- a/deps/npm/test/lib/utils/completion/installed-deep.js +++ b/deps/npm/test/lib/utils/completion/installed-deep.js @@ -11,7 +11,8 @@ const _flatOptions = { return prefix }, } -const installedDeep = requireInject('../../../../lib/utils/completion/installed-deep.js', { +const p = '../../../../lib/utils/completion/installed-deep.js' +const installedDeep = requireInject(p, { '../../../../lib/npm.js': { flatOptions: _flatOptions, get prefix () { @@ -144,7 +145,7 @@ const globalFixture = { }, } -test('get list of package names', (t) => { +test('get list of package names', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -153,25 +154,23 @@ test('get list of package names', (t) => { prefix = resolve(fix, 'local') globalDir = resolve(fix, 'global/node_modules') - installedDeep(null, (err, res) => { - t.ifError(err, 'should not error out') - t.deepEqual( - res, - [ - ['bar', '-g'], - ['foo', '-g'], - ['a-bar', '-g'], - 'a', 'b', 'c', - 'd', 'e', 'f', - 'g', 'bb', - ], - 'should return list of package names and global flag' - ) - t.end() - }) + const res = await installedDeep(null) + t.deepEqual( + res, + [ + ['bar', '-g'], + ['foo', '-g'], + ['a-bar', '-g'], + 'a', 'b', 'c', + 'd', 'e', 'f', + 'g', 'bb', + ], + 'should return list of package names and global flag' + ) + t.end() }) -test('get list of package names as global', (t) => { +test('get list of package names as global', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -182,23 +181,21 @@ test('get list of package names as global', (t) => { _flatOptions.global = true - installedDeep(null, (err, res) => { - t.ifError(err, 'should not error out') - t.deepEqual( - res, - [ - 'bar', - 'foo', - 'a-bar', - ], - 'should return list of global packages with no extra flags' - ) - _flatOptions.global = false - t.end() - }) + const res = await installedDeep(null) + t.deepEqual( + res, + [ + 'bar', + 'foo', + 'a-bar', + ], + 'should return list of global packages with no extra flags' + ) + _flatOptions.global = false + t.end() }) -test('limit depth', (t) => { +test('limit depth', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -209,26 +206,24 @@ test('limit depth', (t) => { _flatOptions.depth = 0 - installedDeep(null, (err, res) => { - t.ifError(err, 'should not error out') - t.deepEqual( - res, - [ - ['bar', '-g'], - ['foo', '-g'], - 'a', 'b', - 'c', 'd', - 'e', 'f', - 'g', - ], - 'should print only packages up to the specified depth' - ) - _flatOptions.depth = 0 - t.end() - }) + const res = await installedDeep(null) + t.deepEqual( + res, + [ + ['bar', '-g'], + ['foo', '-g'], + 'a', 'b', + 'c', 'd', + 'e', 'f', + 'g', + ], + 'should print only packages up to the specified depth' + ) + _flatOptions.depth = 0 + t.end() }) -test('limit depth as global', (t) => { +test('limit depth as global', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -240,18 +235,16 @@ test('limit depth as global', (t) => { _flatOptions.global = true _flatOptions.depth = 0 - installedDeep(null, (err, res) => { - t.ifError(err, 'should not error out') - t.deepEqual( - res, - [ - 'bar', - 'foo', - ], - 'should reorder so that packages above that level depth goes last' - ) - _flatOptions.global = false - _flatOptions.depth = 0 - t.end() - }) + const res = await installedDeep(null) + t.deepEqual( + res, + [ + 'bar', + 'foo', + ], + 'should reorder so that packages above that level depth goes last' + ) + _flatOptions.global = false + _flatOptions.depth = 0 + t.end() }) diff --git a/deps/npm/test/lib/utils/completion/installed-shallow.js b/deps/npm/test/lib/utils/completion/installed-shallow.js index 1d6369bc78..1da68810b5 100644 --- a/deps/npm/test/lib/utils/completion/installed-shallow.js +++ b/deps/npm/test/lib/utils/completion/installed-shallow.js @@ -9,7 +9,7 @@ const installed = requireInject(p, { '../../../../lib/npm.js': npm, }) -t.test('global not set, include globals with -g', t => { +t.test('global not set, include globals with -g', async t => { const dir = t.testdir({ global: { node_modules: { @@ -32,21 +32,17 @@ t.test('global not set, include globals with -g', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [] } } } - installed(opt, (er, res) => { - if (er) - throw er - - t.strictSame(res.sort(), [ - '@scope/y -g', - 'x -g', - 'a', - '@scope/b', - ].sort()) - t.end() - }) + const res = await installed(opt) + t.strictSame(res.sort(), [ + '@scope/y -g', + 'x -g', + 'a', + '@scope/b', + ].sort()) + t.end() }) -t.test('global set, include globals and not locals', t => { +t.test('global set, include globals and not locals', async t => { const dir = t.testdir({ global: { node_modules: { @@ -69,16 +65,15 @@ t.test('global set, include globals and not locals', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = true const opt = { conf: { argv: { remain: [] } } } - installed(opt, (er, res) => { - t.strictSame(res.sort(), [ - '@scope/y', - 'x', - ].sort()) - t.end() - }) + const res = await installed(opt) + t.strictSame(res.sort(), [ + '@scope/y', + 'x', + ].sort()) + t.end() }) -t.test('more than 3 items in argv, skip it', t => { +t.test('more than 3 items in argv, skip it', async t => { const dir = t.testdir({ global: { node_modules: { @@ -101,11 +96,7 @@ t.test('more than 3 items in argv, skip it', t => { npm.localDir = resolve(dir, 'local/node_modules') flatOptions.global = false const opt = { conf: { argv: { remain: [1, 2, 3, 4, 5, 6] } } } - installed(opt, (er, res) => { - if (er) - throw er - - t.strictSame(res, null) - t.end() - }) + const res = await installed(opt) + t.strictSame(res, null) + t.end() }) diff --git a/deps/npm/test/lib/utils/completion/none.js b/deps/npm/test/lib/utils/completion/none.js deleted file mode 100644 index 70488be07e..0000000000 --- a/deps/npm/test/lib/utils/completion/none.js +++ /dev/null @@ -1,6 +0,0 @@ -const t = require('tap') -const none = require('../../../../lib/utils/completion/none.js') -none({any: 'thing'}, (er, res) => { - t.equal(er, null) - t.strictSame(res, []) -}) diff --git a/deps/npm/test/lib/utils/explain-dep.js b/deps/npm/test/lib/utils/explain-dep.js index 28f14477ab..1b8c4ae380 100644 --- a/deps/npm/test/lib/utils/explain-dep.js +++ b/deps/npm/test/lib/utils/explain-dep.js @@ -97,6 +97,23 @@ const cases = { ], }, + bundled: { + name: 'bundle-of-joy', + version: '1.0.0', + location: 'node_modules/bundle-of-joy', + bundled: true, + dependents: [ + { + type: 'prod', + name: 'prod-dep', + spec: '1.x', + from: { + location: '/path/to/project', + }, + }, + ], + }, + extraneous: { name: 'extra-neos', version: '1337.420.69-lol', diff --git a/deps/npm/test/lib/utils/lifecycle-cmd.js b/deps/npm/test/lib/utils/lifecycle-cmd.js index 9e45b15e40..3928c1b26e 100644 --- a/deps/npm/test/lib/utils/lifecycle-cmd.js +++ b/deps/npm/test/lib/utils/lifecycle-cmd.js @@ -7,7 +7,6 @@ const npm = { } t.test('create a lifecycle command', t => { const cmd = lifecycleCmd(npm, 'asdf') - t.equal(cmd.completion, require('../../../lib/utils/completion/none.js'), 'empty completion') cmd(['some', 'args'], (er, result) => { t.strictSame(result, 'called npm.commands.run') t.end() diff --git a/deps/npm/test/lib/version.js b/deps/npm/test/lib/version.js index 943e143702..a69953bb8a 100644 --- a/deps/npm/test/lib/version.js +++ b/deps/npm/test/lib/version.js @@ -73,17 +73,15 @@ t.test('too many args', t => { }) }) -t.test('completion', t => { +t.test('completion', async t => { const { completion } = version - const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - t.ifError(err) - t.strictSame(res, expect, argv.join(' ')) - }) + const testComp = async (argv, expect) => { + const res = await completion({ conf: { argv: { remain: argv } } }) + t.strictSame(res, expect, argv.join(' ')) } - testComp(['npm', 'version'], [ + await testComp(['npm', 'version'], [ 'major', 'minor', 'patch', @@ -93,7 +91,7 @@ t.test('completion', t => { 'prerelease', 'from-git', ]) - testComp(['npm', 'version', 'major'], []) + await testComp(['npm', 'version', 'major'], []) t.end() }) diff --git a/deps/npm/test/lib/view.js b/deps/npm/test/lib/view.js index f3e5d97f33..9419ab7ec8 100644 --- a/deps/npm/test/lib/view.js +++ b/deps/npm/test/lib/view.js @@ -553,7 +553,7 @@ t.test('throws when unpublished', (t) => { }) }) -t.test('completion', (t) => { +t.test('completion', async t => { const view = requireInject('../../lib/view.js', { '../../lib/npm.js': { flatOptions: { @@ -565,17 +565,14 @@ t.test('completion', (t) => { packument, }, }) - view.completion({ + const res = await view.completion({ conf: { argv: { remain: ['npm', 'view', 'green@1.0.0'] } }, - }, (err, res) => { - if (err) - throw err - t.ok(res, 'returns back fields') - t.end() }) + t.ok(res, 'returns back fields') + t.end() }) -t.test('no registry completion', (t) => { +t.test('no registry completion', async t => { const view = requireInject('../../lib/view.js', { '../../lib/npm.js': { flatOptions: { @@ -583,10 +580,7 @@ t.test('no registry completion', (t) => { }, }, }) - view.completion({ - conf: { argv: { remain: ['npm', 'view'] } }, - }, (err) => { - t.notOk(err, 'there is no package completion') - t.end() - }) + const res = await view.completion({conf: { argv: { remain: ['npm', 'view'] } } }) + t.notOk(res, 'there is no package completion') + t.end() }) |