diff --git a/AUTHORS b/AUTHORS index d457a5b98a8b5..d731ad8ca64f0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -748,3 +748,5 @@ Jeff Griffiths Michael Garvin Gar dr-js +Pavan Bellamkonda <31280326+pavanbellamkonda@users.noreply.github.com> +Alexander Riccio diff --git a/CHANGELOG.md b/CHANGELOG.md index f332ed5f0a604..c3b826517edba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ +## v7.5.1 (2021-02-01 + +### BUG FIXES + +* [`0ea134e41`](https://github.com/npm/cli/commit/0ea134e4190f322138299c51672eab5387ec41bb) + [#2587](https://github.com/npm/cli/issues/2587) + pass all settings through to pacote.packument, fixes #2060 + ([@nlf](https://github.com/nlf)) +* [`8c5ca2f51`](https://github.com/npm/cli/commit/8c5ca2f516f5ac87f3bbd7f1fd95c0b283a21f14) + Add test for npm-usage.js, and fix 'npm --long' output + ([@isaacs](https://github.com/isaacs)) + +### DEPENDENCIES + +* [`7e4e88e93`](https://github.com/npm/cli/commit/7e4e88e938323e34a2a41176472d8e43e84bd4dd) + `@npmcli/arborist@2.1.1`, `pacote@11.2.4` + * Properly raise ERESOLVE errors on root dev dependencies + * Ignore ERESOLVE errors when performing git dep 'prepare' scripts + * Always reinstall packages that are explicitly requested + * fix global update all so it actually updates things + * Install bins properly when global root is a link + ([@isaacs](https://github.com/isaacs)) + +### DOCUMENTATION + +* [`23dac2fef`](https://github.com/npm/cli/commit/23dac2feff1d02193791c7e39d9e93bc9bf8e624) + [#2557](https://github.com/npm/cli/issues/2557) + npm team revamp + ([@ruyadorno](https://github.com/ruyadorno)) +* [`dd05ba0c0`](https://github.com/npm/cli/commit/dd05ba0c0b2f4c70eb8558c0ecc54889efbe98f5) + [#2572](https://github.com/npm/cli/issues/2572) + add note about `--force` overriding peer dependencies + ([@isaacs](https://github.com/isaacs)) +* [`e27639780`](https://github.com/npm/cli/commit/e276397809aceb01cc468e02a83bc6f2265376d9) + [#2584](https://github.com/npm/cli/issues/2584) + Fixed the spelling of contributor as it was written as conributor + ([@pavanbellamkonda](https://github.com/pavanbellamkonda)) +* [`13a5e3178`](https://github.com/npm/cli/commit/13a5e31781cdaa37d3f007e1c8583c7cb591c62a) + [#2502](https://github.com/npm/cli/issues/2502) + elaborate that npm help uses browser + ([@ariccio](https://github.com/ariccio)) + ## v7.5.0 (2021-01-28) ### FEATURES diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e2890140bb09..5198918f010df 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ $ cd ./npm && npm install $ npm run test ``` -**5. Open a [Pull Request](https://github.com/npm/cli/pulls) for your work & become the newest conributor to `npm`! 🎉** +**5. Open a [Pull Request](https://github.com/npm/cli/pulls) for your work & become the newest contributor to `npm`! 🎉** ## Test Coverage diff --git a/docs/content/commands/npm-team.md b/docs/content/commands/npm-team.md index 4901ae1680a54..96aacd8ae95f2 100644 --- a/docs/content/commands/npm-team.md +++ b/docs/content/commands/npm-team.md @@ -14,8 +14,6 @@ npm team add npm team rm npm team ls | - -npm team edit ``` ### Description @@ -24,31 +22,76 @@ Used to manage teams in organizations, and change team memberships. Does not handle permissions for packages. Teams must always be fully qualified with the organization/scope they belong to -when operating on them, separated by a colon (`:`). That is, if you have a `wombats` team in a `wisdom` organization, you must always refer to that team as `wisdom:wombats` in these commands. +when operating on them, separated by a colon (`:`). That is, if you have a +`newteam` team in an `org` organization, you must always refer to that team +as `@org:newteam` in these commands. -If you have two-factor authentication enabled in `auth-and-writes` mode, then you can provide a code from your authenticator with `[--otp ]`. If you don't include this then you will be prompted. +If you have two-factor authentication enabled in `auth-and-writes` mode, then +you can provide a code from your authenticator with `[--otp ]`. +If you don't include this then you will be prompted. * create / destroy: - Create a new team, or destroy an existing one. Note: You cannot remove the `developers` team, learn more. -* add / rm: - Add a user to an existing team, or remove a user from a team they belong to. + Create a new team, or destroy an existing one. Note: You cannot remove the + `developers` team, learn more. + + Here's how to create a new team `newteam` under the `org` org: + + ```bash + npm team create @org:newteam + ``` + + You should see a confirming message such as: `+@org:newteam` once the new + team has been created. + +* add: + Add a user to an existing team. + + Adding a new user `username` to a team named `newteam` under the `org` org: + + ```bash + npm team add @org:newteam username + ``` + + On success, you should see a message: `username added to @org:newteam` + +* rm: + Using `npm team rm` you can also remove users from a team they belong to. + + Here's an example removing user `username` from `newteam` team + in `org` organization: + + ```bash + npm team rm @org:newteam username + ``` + + Once the user is removed a confirmation message is displayed: + `username removed from @org:newteam` * ls: If performed on an organization name, will return a list of existing teams under that organization. If performed on a team, it will instead return a list of all users belonging to that particular team. -* edit: - Edit a current team. + Here's an example of how to list all teams from an org named `org`: + + ```bash + npm team ls @org + ``` + + Example listing all members of a team named `newteam`: + + ```bash + npm team ls @org:newteam + ``` ### Details `npm team` always operates directly on the current registry, configurable from the command line using `--registry=`. -In order to create teams and manage team membership, you must be a *team admin* -under the given organization. Listing teams and team memberships may be done by -any member of the organizations. +You must be a *team admin* to create teams and manage team membership, under +the given organization. Listing teams and team memberships may be done by +any member of the organization. Organization creation and management of team admins and *organization* members is done through the website, not the npm CLI. @@ -59,4 +102,5 @@ use the `npm access` command to grant or revoke the appropriate permissions. ### See Also * [npm access](/commands/npm-access) +* [npm config](/commands/npm-config) * [npm registry](/using-npm/registry) diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index 1e0b20359219c..1032adafbeb22 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -472,6 +472,7 @@ mistakes, unnecessary performance degradation, and malicious input. range (including SemVer-major changes). * Allow a module to be installed as a direct dependency of itself. * Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! diff --git a/lib/access.js b/lib/access.js index 68c6e628d0187..8a372d90cb55c 100644 --- a/lib/access.js +++ b/lib/access.js @@ -8,7 +8,6 @@ const output = require('./utils/output.js') const otplease = require('./utils/otplease.js') const usageUtil = require('./utils/usage.js') const getIdentity = require('./utils/get-identity.js') -const { prefix } = npm const usage = usageUtil( 'npm access', @@ -165,7 +164,7 @@ const getPackage = async (name, requireScope) => { return name.trim() else { try { - const pkg = await readPackageJson(path.resolve(prefix, 'package.json')) + const pkg = await readPackageJson(path.resolve(npm.prefix, 'package.json')) name = pkg.name } catch (err) { if (err.code === 'ENOENT') { diff --git a/lib/ci.js b/lib/ci.js index 89c6b8f420742..36410616fb9bf 100644 --- a/lib/ci.js +++ b/lib/ci.js @@ -3,6 +3,8 @@ const Arborist = require('@npmcli/arborist') const rimraf = util.promisify(require('rimraf')) const reifyFinish = require('./utils/reify-finish.js') const runScript = require('@npmcli/run-script') +const fs = require('fs') +const readdir = util.promisify(fs.readdir) const log = require('npmlog') const npm = require('./npm.js') @@ -13,6 +15,16 @@ const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ci().then(() => cb()).catch(cb) +const removeNodeModules = async where => { + const rimrafOpts = { glob: false } + process.emit('time', 'npm-ci:rm') + const path = `${where}/node_modules` + // get the list of entries so we can skip the glob for performance + const entries = await readdir(path, null).catch(er => []) + await Promise.all(entries.map(f => rimraf(`${path}/${f}`, rimrafOpts))) + process.emit('timeEnd', 'npm-ci:rm') +} + const ci = async () => { if (npm.flatOptions.global) { const err = new Error('`npm ci` does not work for global packages') @@ -33,7 +45,7 @@ const ci = async () => { 'later to generate a package-lock.json file, then try again.' throw new Error(msg) }), - rimraf(`${where}/node_modules/*`, { glob: { dot: true, nosort: true, silent: true } }), + removeNodeModules(where), ]) // npm ci should never modify the lockfile or package.json await arb.reify({ ...npm.flatOptions, save: false }) diff --git a/lib/help-search.js b/lib/help-search.js index d60ef5b4ba89f..d2a1818060b21 100644 --- a/lib/help-search.js +++ b/lib/help-search.js @@ -135,12 +135,11 @@ const searchFiles = async (args, data, files) => { // coverage is ignored here because the contents of results are // nondeterministic due to either glob or readFiles or Object.entries - return results.sort((a, b) => + return results.sort(/* istanbul ignore next */ (a, b) => a.found.length > b.found.length ? -1 : a.found.length < b.found.length ? 1 : a.totalHits > b.totalHits ? -1 : a.totalHits < b.totalHits ? 1 - /* istanbul ignore next */ : a.lines.length > b.lines.length ? -1 : a.lines.length < b.lines.length ? 1 : 0).slice(0, 10) diff --git a/lib/outdated.js b/lib/outdated.js index b5f0f3b5b2928..f9a3fed8c10d4 100644 --- a/lib/outdated.js +++ b/lib/outdated.js @@ -108,6 +108,7 @@ async function outdated_ (tree, deps, opts) { async function getPackument (spec) { const packument = await pacote.packument(spec, { + ...npm.flatOptions, fullMetadata: npm.flatOptions.long, preferOnline: true, }) diff --git a/lib/utils/ansi-trim.js b/lib/utils/ansi-trim.js index 7f9a6c30ec9b1..e35a1baf63335 100644 --- a/lib/utils/ansi-trim.js +++ b/lib/utils/ansi-trim.js @@ -1,7 +1,3 @@ -function ansiTrim (str) { - var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' + - '\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g') - return str.replace(r, '') -} - -module.exports = ansiTrim +const r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' + + '\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g') +module.exports = str => str.replace(r, '') diff --git a/lib/utils/npm-usage.js b/lib/utils/npm-usage.js index 720aab3de088f..d4261f79dcb71 100644 --- a/lib/utils/npm-usage.js +++ b/lib/utils/npm-usage.js @@ -6,6 +6,8 @@ const { cmdList } = require('./cmd-list') module.exports = (valid = true) => { npm.config.set('loglevel', 'silent') + const usesBrowser = npm.config.get('viewer') === 'browser' + ? ' (in a browser)' : '' npm.log.level = 'silent' output(` Usage: npm @@ -16,8 +18,8 @@ npm test run this project's tests npm run run the script named npm -h quick help on npm -l display usage info for all commands -npm help search for help on -npm help npm more involved overview +npm help search for help on ${usesBrowser} +npm help npm more involved overview${usesBrowser} All commands: ${npm.config.get('long') ? usages() : ('\n ' + wrap(cmdList))} @@ -40,44 +42,34 @@ npm@${npm.version} ${dirname(dirname(__dirname))} } const wrap = (arr) => { - var out = [''] - var l = 0 - var line + const out = [''] - line = process.stdout.columns - if (!line) - line = 60 - else - line = Math.min(60, Math.max(line - 16, 24)) + const line = !process.stdout.columns ? 60 + : Math.min(60, Math.max(process.stdout.columns - 16, 24)) - arr.sort(function (a, b) { - return a < b ? -1 : 1 - }) - .forEach(function (c) { - if (out[l].length + c.length + 2 < line) - out[l] += ', ' + c - else { - out[l++] += ',' - out[l] = c - } - }) + let l = 0 + for (const c of arr.sort((a, b) => a < b ? -1 : 1)) { + if (out[l].length + c.length + 2 < line) + out[l] += ', ' + c + else { + out[l++] += ',' + out[l] = c + } + } return out.join('\n ').substr(2) } const usages = () => { // return a string of : - var maxLen = 0 - return cmdList.reduce(function (set, c) { - set.push([c, require(`./${npm.deref(c)}.js`).usage || '']) + let maxLen = 0 + return cmdList.reduce((set, c) => { + set.push([c, require(`../${npm.deref(c)}.js`).usage || + /* istanbul ignore next - all commands should have usage */ '']) maxLen = Math.max(maxLen, c.length) return set - }, []).sort((a, b) => { - return a[0].localeCompare(b[0]) - }).map(function (item) { - var c = item[0] - var usage = item[1] - return '\n ' + - c + (new Array(maxLen - c.length + 2).join(' ')) + - (usage.split('\n').join('\n' + (new Array(maxLen + 6).join(' ')))) - }).join('\n') + }, []) + .sort((a, b) => a[0].localeCompare(b[0])) + .map(([c, usage]) => `\n ${c}${' '.repeat(maxLen - c.length + 1)}${ + (usage.split('\n').join('\n' + ' '.repeat(maxLen + 5)))}`) + .join('\n') } diff --git a/lib/utils/pulse-till-done.js b/lib/utils/pulse-till-done.js index 9d145eee976e1..13147bae16613 100644 --- a/lib/utils/pulse-till-done.js +++ b/lib/utils/pulse-till-done.js @@ -1,4 +1,3 @@ -const validate = require('aproba') const log = require('npmlog') let pulsers = 0 @@ -18,7 +17,6 @@ function pulseStop () { } module.exports = function (prefix, cb) { - validate('SF', [prefix, cb]) if (!prefix) prefix = 'network' pulseStart(prefix) diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index 9328b8043bd4e..ae92b74cefd18 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -416,7 +416,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { await this[_add](options) // triggers a refresh of all edgesOut - if (options.add && options.add.length || options.rm && options.rm.length) + if (options.add && options.add.length || options.rm && options.rm.length || this[_global]) tree.package = tree.package process.emit('timeEnd', 'idealTree:userRequests') } @@ -1148,6 +1148,7 @@ This is a one-time fix-up, please be patient... [_placeDep] (dep, node, edge, peerEntryEdge = null, peerPath = []) { if (edge.to && !edge.error && + !this[_explicitRequests].has(edge.name) && !this[_updateNames].includes(edge.name) && !this[_isVulnerable](edge.to)) return [] diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js index 19c7fa384de51..6cc129a7cc057 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -233,7 +233,7 @@ module.exports = cls => class Reifier extends cls { const actualOpt = this[_global] ? { ignoreMissing: true, global: true, - filter: (node, kid) => !node.isRoot && node !== node.root.target + filter: (node, kid) => this[_explicitRequests].size === 0 || !node.isProjectRoot ? true : (node.edgesOut.has(kid) || this[_explicitRequests].has(kid)), } : { ignoreMissing: true } @@ -605,7 +605,7 @@ module.exports = cls => class Reifier extends cls { tree: this.diff, visit: diff => { const node = diff.ideal - if (node && !node.isRoot && node.package.bundleDependencies && + if (node && !node.isProjectRoot && node.package.bundleDependencies && node.package.bundleDependencies.length) { maxBundleDepth = Math.max(maxBundleDepth, node.depth) if (!bundlesByDepth.has(node.depth)) @@ -811,7 +811,7 @@ module.exports = cls => class Reifier extends cls { dfwalk({ tree: this.diff, leave: diff => { - if (!diff.ideal.isRoot) + if (!diff.ideal.isProjectRoot) nodes.push(diff.ideal) }, // process adds before changes, ignore removals diff --git a/node_modules/@npmcli/arborist/lib/node.js b/node_modules/@npmcli/arborist/lib/node.js index 01147b9d48da8..9a6b86e4021b8 100644 --- a/node_modules/@npmcli/arborist/lib/node.js +++ b/node_modules/@npmcli/arborist/lib/node.js @@ -247,7 +247,7 @@ class Node { // true for packages installed directly in the global node_modules folder get globalTop () { - return this.global && this.parent.isRoot + return this.global && this.parent.isProjectRoot } get workspaces () { @@ -294,8 +294,11 @@ class Node { const { name = '', version = '' } = this.package // root package will prefer package name over folder name, // and never be called an alias. - const myname = this.isRoot ? name || this.name : this.name - const alias = !this.isRoot && name && myname !== name ? `npm:${name}@` : '' + const { isProjectRoot } = this + const myname = isProjectRoot ? name || this.name + : this.name + const alias = !isProjectRoot && name && myname !== name ? `npm:${name}@` + : '' return `${myname}@${alias}${version}` } @@ -339,14 +342,14 @@ class Node { } [_explain] (edge, seen) { - if (this.isRoot && !this.sourceReference) { + if (this.isProjectRoot && !this.sourceReference) { return { location: this.path, } } const why = { - name: this.isRoot ? this.package.name : this.name, + name: this.isProjectRoot ? this.package.name : this.name, version: this.package.version, } if (this.errors.length || !this.package.name || !this.package.version) { @@ -384,7 +387,7 @@ class Node { // and are not keeping it held in this spot anyway. const edges = [] for (const edge of this.edgesIn) { - if (!edge.valid && !edge.from.isRoot) + if (!edge.valid && !edge.from.isProjectRoot) continue edges.push(edge) @@ -453,7 +456,7 @@ class Node { } get isWorkspace () { - if (this.isRoot) + if (this.isProjectRoot) return false const { root } = this const { type, to } = root.edgesOut.get(this.package.name) || {} @@ -733,7 +736,9 @@ class Node { // Linked targets that are disconnected from the tree are tops, // but don't have a 'path' field, only a 'realpath', because we // don't know their canonical location. We don't need their devDeps. - if (this.isTop && this.path && !this.sourceReference) + const { isTop, path, sourceReference } = this + const { isTop: srcTop, path: srcPath } = sourceReference || {} + if (isTop && path && (!sourceReference || srcTop && srcPath)) this[_loadDepType](this.package.devDependencies, 'dev') const pd = this.package.peerDependencies @@ -902,8 +907,8 @@ class Node { if (this.isLink) return node.isLink && this.target.matches(node.target) - // if they're two root nodes, they're different if the paths differ - if (this.isRoot && node.isRoot) + // if they're two project root nodes, they're different if the paths differ + if (this.isProjectRoot && node.isProjectRoot) return this.path === node.path // if the integrity matches, then they're the same. diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index bf0de29939182..2107652c6754d 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "2.1.0", + "version": "2.1.1", "description": "Manage node_modules trees", "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", @@ -20,7 +20,7 @@ "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.3", + "pacote": "^11.2.4", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -55,7 +55,7 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "npm run eslint -- \"lib/**/*.js\"", + "lint": "npm run eslint -- \"lib/**/*.js\" \"test/arborist/*.js\" \"test/*.js\"", "lintfix": "npm run lint -- --fix", "benchmark": "node scripts/benchmark.js", "benchclean": "rm -rf scripts/benchmark/*/" diff --git a/node_modules/pacote/lib/fetcher.js b/node_modules/pacote/lib/fetcher.js index c4e5852daf8a8..ad3cacec89bf4 100644 --- a/node_modules/pacote/lib/fetcher.js +++ b/node_modules/pacote/lib/fetcher.js @@ -103,7 +103,7 @@ class FetcherBase { this.npmBin = opts.npmBin || 'npm' // command to install deps for preparing - this.npmInstallCmd = opts.npmInstallCmd || [ 'install' ] + this.npmInstallCmd = opts.npmInstallCmd || [ 'install', '--force' ] // XXX fill more of this in based on what we know from this.opts // we explicitly DO NOT fill in --tag, though, since we are often diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index b55685a48b241..959cb1ec48831 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "11.2.3", + "version": "11.2.4", "description": "JavaScript package downloader", "author": "Isaac Z. Schlueter (https://izs.me)", "bin": { diff --git a/node_modules/require-from-string/index.js b/node_modules/require-from-string/index.js deleted file mode 100644 index cb5595fde96fb..0000000000000 --- a/node_modules/require-from-string/index.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -var Module = require('module'); -var path = require('path'); - -module.exports = function requireFromString(code, filename, opts) { - if (typeof filename === 'object') { - opts = filename; - filename = undefined; - } - - opts = opts || {}; - filename = filename || ''; - - opts.appendPaths = opts.appendPaths || []; - opts.prependPaths = opts.prependPaths || []; - - if (typeof code !== 'string') { - throw new Error('code must be a string, not ' + typeof code); - } - - var paths = Module._nodeModulePaths(path.dirname(filename)); - - var parent = module.parent; - var m = new Module(filename, parent); - m.filename = filename; - m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); - m._compile(code, filename); - - var exports = m.exports; - parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); - - return exports; -}; diff --git a/node_modules/require-from-string/license b/node_modules/require-from-string/license deleted file mode 100644 index 1aeb74fd25e17..0000000000000 --- a/node_modules/require-from-string/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/require-from-string/package.json b/node_modules/require-from-string/package.json deleted file mode 100644 index 800d46efcb00b..0000000000000 --- a/node_modules/require-from-string/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "require-from-string", - "version": "2.0.2", - "description": "Require module from string", - "license": "MIT", - "repository": "floatdrop/require-from-string", - "author": { - "name": "Vsevolod Strukchinsky", - "email": "floatdrop@gmail.com", - "url": "github.com/floatdrop" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "" - ], - "dependencies": {}, - "devDependencies": { - "mocha": "*" - } -} diff --git a/node_modules/require-from-string/readme.md b/node_modules/require-from-string/readme.md deleted file mode 100644 index 88b3236f895d3..0000000000000 --- a/node_modules/require-from-string/readme.md +++ /dev/null @@ -1,56 +0,0 @@ -# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string) - -Load module from string in Node. - -## Install - -``` -$ npm install --save require-from-string -``` - - -## Usage - -```js -var requireFromString = require('require-from-string'); - -requireFromString('module.exports = 1'); -//=> 1 -``` - - -## API - -### requireFromString(code, [filename], [options]) - -#### code - -*Required* -Type: `string` - -Module code. - -#### filename -Type: `string` -Default: `''` - -Optional filename. - - -#### options -Type: `object` - -##### appendPaths -Type: `Array` - -List of `paths`, that will be appended to module `paths`. Useful, when you want -to be able require modules from these paths. - -##### prependPaths -Type: `Array` - -Same as `appendPaths`, but paths will be prepended. - -## License - -MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/package-lock.json b/package-lock.json index 7536487824b24..2697874fb5e44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "npm", - "version": "7.5.0", + "version": "7.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "npm", - "version": "7.5.0", + "version": "7.5.1", "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", @@ -15,7 +15,6 @@ "abbrev", "ansicolors", "ansistyles", - "aproba", "archy", "byte-size", "cacache", @@ -100,6 +99,7 @@ "ansi-colors", "ansi-regex", "ansi-styles", + "aproba", "are-we-there-yet", "argparse", "array-includes", @@ -358,14 +358,13 @@ ], "license": "Artistic-2.0", "dependencies": { - "@npmcli/arborist": "^2.1.0", + "@npmcli/arborist": "^2.1.1", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.8", "@npmcli/run-script": "^1.8.1", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", - "aproba": "^2.0.0", "archy": "~1.0.0", "byte-size": "^7.0.0", "cacache": "^15.0.5", @@ -687,9 +686,9 @@ } }, "node_modules/@npmcli/arborist": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.1.0.tgz", - "integrity": "sha512-ltBA6olA04/Gt1KJ2YTE5V0Bxi2U4to7psst6JFlRHBfqxE6LiHKbqqiIRXB5qmW0c+26LOR9ocH+NxKjddX8w==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.1.1.tgz", + "integrity": "sha512-zt+dabNvSuhQMlmJL4H0YV4mGujylxgxeXPWSSjMjMoZI3laniHUB+oGOhJi/k68FVoZ/o/Aevi4rWDClfm5ZQ==", "inBundle": true, "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", @@ -709,7 +708,7 @@ "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.3", + "pacote": "^11.2.4", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -5381,9 +5380,9 @@ } }, "node_modules/pacote": { - "version": "11.2.3", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.3.tgz", - "integrity": "sha512-Jphxyk1EjGyLzNwa+MkbcQUQeTIqlKcIoPq0t9ekR9ZxsTGjzhRjz/cOoL9PTVkqAW1FH7qBoVbYL4FqQGNNJg==", + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.4.tgz", + "integrity": "sha512-GfTeVQGJ6WyBQbQD4t3ocHbyOmTQLmWjkCKSZPmKiGFKYKNUaM5U2gbLzUW8WG1XmS9yQFnsTFA0k3o1+q4klQ==", "inBundle": true, "dependencies": { "@npmcli/git": "^2.0.1", @@ -9924,9 +9923,9 @@ } }, "@npmcli/arborist": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.1.0.tgz", - "integrity": "sha512-ltBA6olA04/Gt1KJ2YTE5V0Bxi2U4to7psst6JFlRHBfqxE6LiHKbqqiIRXB5qmW0c+26LOR9ocH+NxKjddX8w==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.1.1.tgz", + "integrity": "sha512-zt+dabNvSuhQMlmJL4H0YV4mGujylxgxeXPWSSjMjMoZI3laniHUB+oGOhJi/k68FVoZ/o/Aevi4rWDClfm5ZQ==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/map-workspaces": "^1.0.1", @@ -9945,7 +9944,7 @@ "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.3", + "pacote": "^11.2.4", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -13372,9 +13371,9 @@ } }, "pacote": { - "version": "11.2.3", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.3.tgz", - "integrity": "sha512-Jphxyk1EjGyLzNwa+MkbcQUQeTIqlKcIoPq0t9ekR9ZxsTGjzhRjz/cOoL9PTVkqAW1FH7qBoVbYL4FqQGNNJg==", + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.4.tgz", + "integrity": "sha512-GfTeVQGJ6WyBQbQD4t3ocHbyOmTQLmWjkCKSZPmKiGFKYKNUaM5U2gbLzUW8WG1XmS9yQFnsTFA0k3o1+q4klQ==", "requires": { "@npmcli/git": "^2.0.1", "@npmcli/installed-package-contents": "^1.0.5", diff --git a/package.json b/package.json index 3c967869a6dcc..57b7f48964b81 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "7.5.0", + "version": "7.5.1", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -42,14 +42,13 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^2.1.0", + "@npmcli/arborist": "^2.1.1", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.8", "@npmcli/run-script": "^1.8.1", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", - "aproba": "^2.0.0", "archy": "~1.0.0", "byte-size": "^7.0.0", "cacache": "^15.0.5", @@ -119,7 +118,6 @@ "abbrev", "ansicolors", "ansistyles", - "aproba", "archy", "byte-size", "cacache", diff --git a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js new file mode 100644 index 0000000000000..ced8d1a055377 --- /dev/null +++ b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js @@ -0,0 +1,495 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/utils/npm-usage.js TAP basic usage > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + /some/config/file/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@{VERSION} {BASEDIR} + +` + +exports[`test/lib/utils/npm-usage.js TAP did you mean? > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + /some/config/file/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@{VERSION} {BASEDIR} + +` + +exports[`test/lib/utils/npm-usage.js TAP did you mean? > must match snapshot 2`] = ` + +Did you mean one of these? + install + uninstall +` + +exports[`test/lib/utils/npm-usage.js TAP set process.stdout.columns columns=0 > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + /some/config/file/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@{VERSION} {BASEDIR} + +` + +exports[`test/lib/utils/npm-usage.js TAP set process.stdout.columns columns=90 > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + /some/config/file/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@{VERSION} {BASEDIR} + +` + +exports[`test/lib/utils/npm-usage.js TAP with browser > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on (in a browser) +npm help npm more involved overview (in a browser) + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + /some/config/file/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@{VERSION} {BASEDIR} + +` + +exports[`test/lib/utils/npm-usage.js TAP with long > must match snapshot 1`] = ` + +Usage: npm + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access npm access public [] + npm access restricted [] + npm access grant [] + npm access revoke [] + npm access 2fa-required [] + npm access 2fa-not-required [] + npm access ls-packages [||] + npm access ls-collaborators [ []] + npm access edit [] + + adduser npm adduser [--registry=url] [--scope=@orgname] [--always-auth] + + aliases: login, add-user + + audit npm audit [--json] [--production] + npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)] + + bin npm bin [-g] + + bugs npm bugs [] + + alias: issues + + cache npm cache add + npm cache add + npm cache add + npm cache add + npm cache add @ + npm cache clean + npm cache verify + + ci npm ci + + aliases: clean-install, ic, install-clean, isntall-clean + + completion source <(npm completion) + + config npm config set = [= ...] + npm config get [ [ ...]] + npm config delete [ ...] + npm config list [--json] + npm config edit + npm set = [= ...] + npm get [ [ ...]] + + alias: c + + dedupe npm dedupe + + alias: ddp + + deprecate npm deprecate [@] + + diff npm diff [...] + npm diff --diff= [...] + npm diff --diff= [--diff=] [...] + npm diff --diff= [--diff=] [...] + npm diff [--diff-ignore-all-space] [--diff-name-only] [...] [...] + + dist-tag npm dist-tag add @ [] + npm dist-tag rm + npm dist-tag ls [] + + alias: dist-tags + + docs npm docs [ [ ...]] + + alias: home + + doctor npm doctor + + edit npm edit [/...] + + exec Run a command from a local or remote npm package. + + npm exec -- [@] [args...] + npm exec --package=[@] -- [args...] + npm exec -c ' [args...]' + npm exec --package=foo -c ' [args...]' + + npx [@] [args...] + npx -p [@] [args...] + npx -c ' [args...]' + npx -p [@] -c ' [args...]' + Run without --call or positional args to open interactive subshell + + + alias: x + common options: + --package= (may be specified multiple times) + -p is a shorthand for --package only when using npx executable + -c --call= (may not be mixed with positional arguments) + + explain npm explain + + alias: why + + explore npm explore [ -- ] + + find-dupes npm find-dupes + + fund npm fund + + common options: npm fund [--json] [--browser] [--unicode] [[<@scope>/] [--which=] + + get npm get [ ...] (See \`npm config\`) + + help npm help [] + + alias: hlep + + hook npm hook add [--type=] + npm hook ls [pkg] + npm hook rm + npm hook update + + init + npm init [--force|-f|--yes|-y|--scope] + npm init <@scope> (same as \`npx <@scope>/create\`) + npm init [<@scope>/] (same as \`npx [<@scope>/]create-\`) + + aliases: create, innit + + install npm install (with no args, in package dir) + npm install [<@scope>/] + npm install [<@scope>/]@ + npm install [<@scope>/]@ + npm install [<@scope>/]@ + npm install @npm: + npm install + npm install + npm install + npm install + npm install / + + aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add + common options: [--save-prod|--save-dev|--save-optional|--save-peer] [--save-exact] [--no-save] + + install-ci-test npm install-ci-test [args] + Same args as \`npm ci\` + + alias: cit + + install-test npm install-test [args] + Same args as \`npm install\` + + alias: it + + link npm link (in package dir) + npm link [<@scope>/][@] + + alias: ln + + ll npm ls [[<@scope>/] ...] + + alias: list + + login npm adduser [--registry=url] [--scope=@orgname] [--always-auth] + + aliases: login, add-user + + logout npm logout [--registry=] [--scope=<@scope>] + + ls npm ls [[<@scope>/] ...] + + alias: list + + org npm org set orgname username [developer | admin | owner] + npm org rm orgname username + npm org ls orgname [] + + outdated npm outdated [[<@scope>/] ...] + + owner npm owner add [<@scope>/] + npm owner rm [<@scope>/] + npm owner ls [<@scope>/] + + alias: author + + pack npm pack [[<@scope>/]...] [--dry-run] + + ping npm ping + ping registry + + prefix npm prefix [-g] + + profile npm profile disable-2fa + + + common options: npm profile get [] + + + prune npm prune [[<@scope>/]...] [--production] + + publish npm publish [] [--tag ] [--access ] [--dry-run] + + Publishes '.' if no argument supplied + Sets tag \`latest\` if no --tag specified + + rebuild npm rebuild [[<@scope>/][@] ...] + + alias: rb + + repo npm repo [ [ ...]] + + restart npm restart [-- ] + + root npm root [-g] + + run-script npm run-script [-- ] + + aliases: run, rum, urn + + search npm search [-l|--long] [--json] [--parseable] [--no-description] [search terms ...] + + aliases: s, se, find + + set npm set = [= ...] (See \`npm config\`) + + set-script npm set-script [