Skip to content

Commit

Permalink
deps: upgrade npm to 7.0.0-rc.4
Browse files Browse the repository at this point in the history
PR-URL: #35576
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
MylesBorins authored and gengjiawen committed Oct 10, 2020
1 parent d70c0ed commit dabc6dd
Show file tree
Hide file tree
Showing 107 changed files with 790 additions and 598 deletions.
22 changes: 22 additions & 0 deletions deps/npm/CHANGELOG.md
@@ -1,3 +1,25 @@
## v7.0.0-rc.4 (2020-10-09)

* [`09b456f2d`](https://github.com/npm/cli/commit/09b456f2d776e2757956d2b9869febd1e01a1076)
`@npmcli/config@1.2.1`
* [#1919](https://github.com/npm/cli/pull/1919)
exposes `npm_config_user_agent` env variable
([@nlf](https://github.com/nlf))
* [`e859fba9e`](https://github.com/npm/cli/commit/e859fba9e7c267b0587b7d22da72e33f3e8f906b)
[#1936](https://github.com/npm/cli/pull/1936)
fix npx for non-interactive shells
([@nlf](https://github.com/nlf))
* [`9320b8e4f`](https://github.com/npm/cli/commit/9320b8e4f0e0338ea95e970ec9bbf0704def64b8)
[#1906](https://github.com/npm/cli/pull/1906)
restore old npx behavior of running existing bins first
([@nlf](https://github.com/nlf))
* [`7bd47ca2c`](https://github.com/npm/cli/commit/7bd47ca2c718df0a7d809f1992b7a87eece3f6dc)
`@npmcli/arborist@0.0.33`
* fixed handling of invalid package.json file
* [`02737453b`](https://github.com/npm/cli/commit/02737453bc2363daeef8c4e4b7d239e2299029b2)
`make-fetch-happen@8.0.10`
* do not calculate integrity values of http errors

## v7.0.0-rc.3 (2020-10-06)

* [`d816c2efa`](https://github.com/npm/cli/commit/d816c2efae41930cbdf4fff8657e0adc450d1dd4)
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-access/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-adduser/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-audit/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-bin/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-bugs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-bundle/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-cache/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-ci/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-completion/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-config/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-dedupe/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-deprecate/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-dist-tag/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-doctor/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-edit/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-exec/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-explain/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-explore/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-fund/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-help-search/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-help/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-hook/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-init/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-install-test/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-install/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-link/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-logout/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions deps/npm/docs/public/cli-commands/npm-ls/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-org/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-outdated/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-owner/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-pack/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-ping/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-prefix/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-profile/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-prune/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-publish/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-rebuild/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-repo/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-restart/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-root/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-run-script/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-search/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-shrinkwrap/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-star/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-stars/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-start/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-stop/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-team/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-test/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-token/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-uninstall/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-unpublish/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-update/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-version/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-view/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npm-whoami/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions deps/npm/docs/public/cli-commands/npm/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/cli-commands/npx/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/configuring-npm/folders/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/configuring-npm/install/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/configuring-npm/npmrc/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/configuring-npm/package-json/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/configuring-npm/package-locks/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/npm/docs/public/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/config/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/developers/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/disputes/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/orgs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/registry/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/removal/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/scope/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/scripts/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions deps/npm/docs/public/using-npm/semver/index.html

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions deps/npm/lib/completion.js
Expand Up @@ -43,6 +43,7 @@ const shorthandNames = Object.keys(shorthands)
const allConfs = configNames.concat(shorthandNames)
const isWindowsShell = require('./utils/is-windows-shell.js')
const output = require('./utils/output.js')
const fileExists = require('./utils/file-exists.js')

const usageUtil = require('./utils/usage.js')
const usage = usageUtil('completion', 'source <(npm completion)')
Expand All @@ -56,13 +57,10 @@ const completion = async (opts, cb) => {
return cb()
}

const fs = require('fs')
const stat = promisify(fs.stat)
const exists = f => stat(f).then(() => true).catch(() => false)
const { resolve } = require('path')
const [bashExists, zshExists] = await Promise.all([
exists(resolve(process.env.HOME, '.bashrc')),
exists(resolve(process.env.HOME, '.zshrc'))
fileExists(resolve(process.env.HOME, '.bashrc')),
fileExists(resolve(process.env.HOME, '.zshrc'))
])
const out = []
if (zshExists) {
Expand Down
55 changes: 46 additions & 9 deletions deps/npm/lib/exec.js
Expand Up @@ -59,6 +59,8 @@ const crypto = require('crypto')
const pacote = require('pacote')
const npa = require('npm-package-arg')
const escapeArg = require('./utils/escape-arg.js')
const fileExists = require('./utils/file-exists.js')
const PATH = require('./utils/path.js')

const cmd = (args, cb) => exec(args).then(() => cb()).catch(cb)

Expand All @@ -69,8 +71,38 @@ const exec = async args => {
throw usage
}

const pathArr = [...PATH]

const needPackageCommandSwap = args.length && !packages.length
// if there's an argument and no package has been explicitly asked for
// check the local and global bin paths for a binary named the same as
// the argument and run it if it exists, otherwise fall through to
// the behavior of treating the single argument as a package name
if (needPackageCommandSwap) {
let binExists = false
if (await fileExists(`${npm.localBin}/${args[0]}`)) {
pathArr.unshift(npm.localBin)
binExists = true
} else if (await fileExists(`${npm.globalBin}/${args[0]}`)) {
pathArr.unshift(npm.globalBin)
binExists = true
}

if (binExists) {
return await runScript({
cmd: [args[0], ...args.slice(1).map(escapeArg)].join(' ').trim(),
banner: false,
// we always run in cwd, not --prefix
path: process.cwd(),
stdioString: true,
event: 'npx',
env: {
PATH: pathArr.join(delimiter)
},
stdio: 'inherit'
})
}

packages.push(args[0])
}

Expand Down Expand Up @@ -111,7 +143,6 @@ const exec = async args => {
// do we have all the packages in manifest list?
const needInstall = manis.some(mani => manifestMissing(tree, mani))

const pathArr = [process.env.PATH]
if (needInstall) {
const installDir = cacheInstallDir(packages)
await mkdirp(installDir)
Expand All @@ -126,19 +157,25 @@ const exec = async args => {

// no need to install if already present
if (add.length) {
const isTTY = process.stdin.isTTY && process.stdout.isTTY
if (!npm.flatOptions.yes) {
// set -n to always say no
if (npm.flatOptions.yes === false) {
throw 'canceled'
}
const addList = add.map(a => ` ${a.replace(/@$/, '')}`)
.join('\n') + '\n'
const prompt = `Need to install the following packages:\n${
addList
}Ok to proceed? `
const confirm = await read({ prompt, default: 'y' })
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
throw 'canceled'

if (!isTTY) {
npm.log.warn('exec', `The following package${add.length === 1 ? ' was' : 's were'} not found and will be installed: ${add.map((pkg) => pkg.replace(/@$/, '')).join(', ')}`)
} else {
const addList = add.map(a => ` ${a.replace(/@$/, '')}`)
.join('\n') + '\n'
const prompt = `Need to install the following packages:\n${
addList
}Ok to proceed? `
const confirm = await read({ prompt, default: 'y' })
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
throw 'canceled'
}
}
}
await arb.reify({ ...npm.flatOptions, add })
Expand Down
3 changes: 0 additions & 3 deletions deps/npm/lib/npm.js
Expand Up @@ -164,8 +164,6 @@ const npm = module.exports = new class extends EventEmitter {
await this.config.load()
this.argv = this.config.parsedArgv.remain

setUserAgent(this.config)

this.color = setupLog(this.config, this)
process.env.COLOR = this.color ? '1' : '0'

Expand Down Expand Up @@ -279,7 +277,6 @@ const startMetrics = require('./utils/metrics.js').start

const which = promisify(require('which'))

const setUserAgent = require('./utils/set-user-agent.js')
const deref = require('./utils/deref-command.js')
const setupLog = require('./utils/setup-log.js')
const cleanUpLogFiles = require('./utils/cleanup-log-files.js')
Expand Down

0 comments on commit dabc6dd

Please sign in to comment.