Skip to content

Commit

Permalink
deps: upgrade npm to 7.24.0
Browse files Browse the repository at this point in the history
PR-URL: #40167
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
npm-robot authored and BethGriggs committed Sep 21, 2021
1 parent 0254b4b commit 85206b7
Show file tree
Hide file tree
Showing 28 changed files with 429 additions and 181 deletions.
2 changes: 1 addition & 1 deletion deps/npm/docs/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ package.json file, then your package scripts would have the
in your code with `process.env.npm_package_name` and
`process.env.npm_package_version`, and so on for other fields.

See [`package-json.md`](/using-npm/package-json) for more on package configs.
See [`package-json.md`](/configuring-npm/package-json) for more on package configs.

#### current lifecycle event

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
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.23.0 /path/to/npm
<pre lang="bash"><code>npm@7.24.0 /path/to/npm
└─┬ [email protected]
└── [email protected]
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.23.0</p>
<p>7.24.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
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/using-npm/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ <h4 id="packagejson-vars">package.json vars</h4>
<code>npm_package_version</code> set to “1.2.5”. You can access these variables
in your code with <code>process.env.npm_package_name</code> and
<code>process.env.npm_package_version</code>, and so on for other fields.</p>
<p>See <a href="../using-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
<p>See <a href="../configuring-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
<h4 id="current-lifecycle-event">current lifecycle event</h4>
<p>Lastly, the <code>npm_lifecycle_event</code> environment variable is set to
whichever stage of the cycle is being executed. So, you could have a
Expand Down
3 changes: 2 additions & 1 deletion deps/npm/lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class Install extends ArboristWorkspaceCmd {
// be very strict about engines when trying to update npm itself
const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm')
if (isGlobalInstall && npmInstall) {
const npmManifest = await pacote.manifest(npmInstall)
const npmOptions = this.npm.flatOptions
const npmManifest = await pacote.manifest(npmInstall, npmOptions)
try {
checks.checkEngine(npmManifest, npmManifest.version, process.version)
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/lib/search/format-package-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class JSONOutputStream extends Minipass {
}

end () {
super.write(this._didFirst ? ']\n' : '\n]\n')
super.write(this._didFirst ? ']\n' : '\n[]\n')
super.end()
}
}
Expand Down
12 changes: 11 additions & 1 deletion deps/npm/lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2053,10 +2053,14 @@ define('user-agent', {
.replace(/\{workspaces\}/gi, inWorkspaces)
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
.trim()

// We can't clobber the original or else subsequent flattening will fail
// (i.e. when we change the underlying config values)
// obj[key] = flatOptions.userAgent

// user-agent is a unique kind of config item that gets set from a template
// and ends up translated. Because of this, the normal "should we set this
// to process.env also doesn't work
obj[key] = flatOptions.userAgent
process.env.npm_config_user_agent = flatOptions.userAgent
},
})
Expand Down Expand Up @@ -2140,6 +2144,9 @@ define('workspace', {
a workspace which does not yet exist, to create the folder and set it
up as a brand new workspace within the project.
`,
flatten: (key, obj, flatOptions) => {
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
},
})

define('workspaces', {
Expand All @@ -2151,6 +2158,9 @@ define('workspaces', {
Enable running a command in the context of **all** the configured
workspaces.
`,
flatten: (key, obj, flatOptions) => {
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
},
})

define('yes', {
Expand Down
29 changes: 15 additions & 14 deletions deps/npm/lib/utils/did-you-mean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ const readJson = require('read-package-json-fast')
const { cmdList } = require('./cmd-list.js')

const didYouMean = async (npm, path, scmd) => {
const bestCmd = cmdList
let best = cmdList
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 && scmd !== cmd)
.map(str => ` npm ${str} # ${npm.commands[str].description}`)

const pkg = await readJson(`${path}/package.json`)
const { scripts } = pkg
// We would already be suggesting this in `npm x` so omit them here
const runScripts = ['stop', 'start', 'test', 'restart']
const bestRun = Object.keys(scripts || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
!runScripts.includes(cmd))
.map(str => ` npm run ${str} # run the "${str}" package script`)

const { bin } = pkg
const bestBin = Object.keys(bin || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)

const best = [...bestCmd, ...bestRun, ...bestBin]
try {
const { bin, scripts } = await readJson(`${path}/package.json`)
best = best.concat(
Object.keys(scripts || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
!runScripts.includes(cmd))
.map(str => ` npm run ${str} # run the "${str}" package script`),
Object.keys(bin || {})
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)
)
} catch (_) {
// gracefully ignore not being in a folder w/ a package.json
}

if (best.length === 0)
return ''
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ module.exports = (er, npm) => {
detail.push(['signal', er.signal])

if (er.cmd && Array.isArray(er.args))
detail.push(['command', ...[er.cmd, ...er.args]])
detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]])

if (er.stdout)
detail.push(['', er.stdout.trim()])
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/lib/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class View extends BaseCommand {
email: color.cyan(manifest._npmUser.email),
}),
modified: !packument.time ? undefined
: color.yellow(relativeDate(packument.time[packument.version])),
: color.yellow(relativeDate(packument.time[manifest.version])),
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
name: color.yellow(u.name),
email: color.cyan(u.email),
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-ls.1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
npm@7\.23\.0 /path/to/npm
npm@7\.24\.0 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm.1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ npm <command> [args]
.RE
.SS Version
.P
7\.23\.0
7\.24\.0
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
Expand Down
15 changes: 0 additions & 15 deletions deps/npm/node_modules/init-package-json/LICENSE

This file was deleted.

18 changes: 18 additions & 0 deletions deps/npm/node_modules/init-package-json/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 85206b7

Please sign in to comment.