diff --git a/AUTHORS b/AUTHORS index 0cddb173c2bf5..769d18f83d5d9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -766,3 +766,4 @@ Augusto Moura Eric Chow kbayrhammer James Chen-Smith +Yash Singh diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da388f0b92d0..a0e098833ac53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,39 @@ +## v7.7.2 (2021-03-24) + +### BUG FIXES + +* [`c76f04ac2`](https://github.com/npm/cli/commit/c76f04ac28ddf2ae4df4b3ce0aec684a118de1b5) + [#2925](https://github.com/npm/cli/issues/2925) + fix(set-script): add completion + ([@Yash-Singh1](https://github.com/Yash-Singh1)) +* [`0379eab69`](https://github.com/npm/cli/commit/0379eab698b78ae4aa89bbe2043607f420e52f11) + [#2929](https://github.com/npm/cli/issues/2929) + fix(install): ignore auditLevel + `npm install` should not be affected by the `auditLevel` config, as the + results of audit do not change its exit status. + ([@wraithgar](https://github.com/wraithgar)) +* [`98efadeb4`](https://github.com/npm/cli/commit/98efadeb4b2ae9289f14ed6f42a169230faf7239) + [#2923](https://github.com/npm/cli/issues/2923) + fix(audit-level): add `info` audit level + This is a valid level but wasn't configured to be allowed. + Also added this param to the usage output for `npm audit` + ([@wraithgar](https://github.com/wraithgar)) +* [`e8d2adcf4`](https://github.com/npm/cli/commit/e8d2adcf40ad63030f844c9aa44c6d16e2146797) + [#2945](https://github.com/npm/cli/issues/2945) + config should not error when workspaces are configured + ([@nlf](https://github.com/nlf)) +* [`aba2bc623`](https://github.com/npm/cli/commit/aba2bc623ea99e563b1b15b81dbb4ba94f86fe4c) + [#2944](https://github.com/npm/cli/issues/2944) + fix(progress): re-add progress bar to reify + The logger was no longer in flatOptions, we pass it in explicitly now + ([@wraithgar](https://github.com/wraithgar)) +* [`877b4ed29`](https://github.com/npm/cli/commit/877b4ed2925c97b5249a4d33575420dda64f7339) + [#2946](https://github.com/npm/cli/issues/2946) + fix(flatOptions): re-add `_auth` + This was not being added to flatOptions, and things like + `npm-registry-fetch` are looking for it. + ([@wraithgar](https://github.com/wraithgar)) + ## v7.7.1 (2021-03-24) ### BUG FIXES diff --git a/lib/audit.js b/lib/audit.js index f990e1fa5efaa..9df2698589278 100644 --- a/lib/audit.js +++ b/lib/audit.js @@ -18,6 +18,7 @@ class Audit extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get params () { return [ + 'audit-level', 'dry-run', 'force', 'json', diff --git a/lib/ci.js b/lib/ci.js index b73b3a8591114..9ae31950ef102 100644 --- a/lib/ci.js +++ b/lib/ci.js @@ -42,8 +42,14 @@ class CI extends BaseCommand { } const where = this.npm.prefix - const arb = new Arborist({ ...this.npm.flatOptions, path: where }) + const opts = { + ...this.npm.flatOptions, + path: where, + log: this.npm.log, + save: false, // npm ci should never modify the lockfile or package.json + } + const arb = new Arborist(opts) await Promise.all([ arb.loadVirtual().catch(er => { log.verbose('loadVirtual', er.stack) @@ -55,8 +61,7 @@ class CI extends BaseCommand { }), removeNodeModules(where), ]) - // npm ci should never modify the lockfile or package.json - await arb.reify({ ...this.npm.flatOptions, save: false }) + await arb.reify(opts) const ignoreScripts = this.npm.config.get('ignore-scripts') // run the same set of scripts that `npm install` runs. diff --git a/lib/config.js b/lib/config.js index d5ef6ec50a5e6..6bfde9845ce33 100644 --- a/lib/config.js +++ b/lib/config.js @@ -88,6 +88,10 @@ class Config extends BaseCommand { this.config(args).then(() => cb()).catch(cb) } + execWorkspaces (args, filters, cb) { + this.exec(args, cb) + } + async config ([action, ...args]) { this.npm.log.disableProgress() try { diff --git a/lib/dedupe.js b/lib/dedupe.js index b80a777fcc2f7..9649025739c60 100644 --- a/lib/dedupe.js +++ b/lib/dedupe.js @@ -30,6 +30,7 @@ class Dedupe extends BaseCommand { const where = this.npm.prefix const opts = { ...this.npm.flatOptions, + log: this.npm.log, path: where, dryRun, } diff --git a/lib/exec.js b/lib/exec.js index 0a61de7c1200c..5967ee4234592 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -175,7 +175,11 @@ class Exec extends BaseCommand { if (needInstall) { const installDir = this.cacheInstallDir(packages) await mkdirp(installDir) - const arb = new Arborist({ ...this.npm.flatOptions, path: installDir }) + const arb = new Arborist({ + ...this.npm.flatOptions, + log: this.npm.log, + path: installDir, + }) const tree = await arb.loadActual() // at this point, we have to ensure that we get the exact same @@ -212,7 +216,11 @@ class Exec extends BaseCommand { throw new Error('canceled') } } - await arb.reify({ ...this.npm.flatOptions, add }) + await arb.reify({ + ...this.npm.flatOptions, + log: this.npm.log, + add, + }) } pathArr.unshift(resolve(installDir, 'node_modules/.bin')) } diff --git a/lib/install.js b/lib/install.js index 54ea6d8251051..a023015ed823a 100644 --- a/lib/install.js +++ b/lib/install.js @@ -126,15 +126,16 @@ class Install extends BaseCommand { if (this.npm.config.get('dev')) log.warn('install', 'Usage of the `--dev` option is deprecated. Use `--include=dev` instead.') - const arb = new Arborist({ + const opts = { ...this.npm.flatOptions, + log: this.npm.log, + auditLevel: null, path: where, - }) - - await arb.reify({ - ...this.npm.flatOptions, add: args, - }) + } + const arb = new Arborist(opts) + await arb.reify(opts) + if (!args.length && !isGlobalInstall && !ignoreScripts) { const scriptShell = this.npm.config.get('script-shell') || undefined const scripts = [ diff --git a/lib/link.js b/lib/link.js index fe9cfd3a6b254..3e9ec1807fca1 100644 --- a/lib/link.js +++ b/lib/link.js @@ -66,6 +66,7 @@ class Link extends BaseCommand { const globalOpts = { ...this.npm.flatOptions, path: globalTop, + log: this.npm.log, global: true, prune: false, } @@ -113,12 +114,14 @@ class Link extends BaseCommand { // reify all the pending names as symlinks there const localArb = new Arborist({ ...this.npm.flatOptions, + log: this.npm.log, path: this.npm.prefix, save, }) await localArb.reify({ ...this.npm.flatOptions, path: this.npm.prefix, + log: this.npm.log, add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`), save, }) @@ -131,9 +134,13 @@ class Link extends BaseCommand { const arb = new Arborist({ ...this.npm.flatOptions, path: globalTop, + log: this.npm.log, global: true, }) - await arb.reify({ add: [`file:${this.npm.prefix}`] }) + await arb.reify({ + add: [`file:${this.npm.prefix}`], + log: this.npm.log, + }) await reifyFinish(this.npm, arb) } diff --git a/lib/prune.js b/lib/prune.js index 1da86a3e82187..5c4a549d4d7ad 100644 --- a/lib/prune.js +++ b/lib/prune.js @@ -30,11 +30,13 @@ class Prune extends BaseCommand { async prune () { const where = this.npm.prefix - const arb = new Arborist({ + const opts = { ...this.npm.flatOptions, path: where, - }) - await arb.prune(this.npm.flatOptions) + log: this.npm.log, + } + const arb = new Arborist(opts) + await arb.prune(opts) await reifyFinish(this.npm, arb) } } diff --git a/lib/set-script.js b/lib/set-script.js index df101a0acb709..9d4aadad558fb 100644 --- a/lib/set-script.js +++ b/lib/set-script.js @@ -2,6 +2,7 @@ const log = require('npmlog') const fs = require('fs') const parseJSON = require('json-parse-even-better-errors') const rpj = require('read-package-json-fast') +const { resolve } = require('path') const BaseCommand = require('./base-command.js') class SetScript extends BaseCommand { @@ -20,6 +21,16 @@ class SetScript extends BaseCommand { return ['[