Skip to content

Commit 1ed4b37

Browse files
npm-robotBethGriggs
authored andcommitted
deps: upgrade npm to 7.24.0
PR-URL: #40167 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent e557e74 commit 1ed4b37

File tree

28 files changed

+429
-181
lines changed

28 files changed

+429
-181
lines changed

β€Ždeps/npm/docs/content/using-npm/scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ package.json file, then your package scripts would have the
259259
in your code with `process.env.npm_package_name` and
260260
`process.env.npm_package_version`, and so on for other fields.
261261

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

264264
#### current lifecycle event
265265

β€Ždeps/npm/docs/output/commands/npm-ls.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
159159
the results to only the paths to the packages named. Note that nested
160160
packages will <em>also</em> show the paths to the specified packages. For
161161
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
162-
<pre lang="bash"><code>npm@7.23.0 /path/to/npm
162+
<pre lang="bash"><code>npm@7.24.0 /path/to/npm
163163
└─┬ [email protected]
164164
└── [email protected]
165165
</code></pre>

β€Ždeps/npm/docs/output/commands/npm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
148148
<pre lang="bash"><code>npm &lt;command&gt; [args]
149149
</code></pre>
150150
<h3 id="version">Version</h3>
151-
<p>7.23.0</p>
151+
<p>7.24.0</p>
152152
<h3 id="description">Description</h3>
153153
<p>npm is the package manager for the Node JavaScript platform. It puts
154154
modules in place so that node can find them, and manages dependency

β€Ždeps/npm/docs/output/using-npm/scripts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ <h4 id="packagejson-vars">package.json vars</h4>
379379
<code>npm_package_version</code> set to β€œ1.2.5”. You can access these variables
380380
in your code with <code>process.env.npm_package_name</code> and
381381
<code>process.env.npm_package_version</code>, and so on for other fields.</p>
382-
<p>See <a href="../using-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
382+
<p>See <a href="../configuring-npm/package-json.html"><code>package-json.md</code></a> for more on package configs.</p>
383383
<h4 id="current-lifecycle-event">current lifecycle event</h4>
384384
<p>Lastly, the <code>npm_lifecycle_event</code> environment variable is set to
385385
whichever stage of the cycle is being executed. So, you could have a

β€Ždeps/npm/lib/install.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ class Install extends ArboristWorkspaceCmd {
135135
// be very strict about engines when trying to update npm itself
136136
const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm')
137137
if (isGlobalInstall && npmInstall) {
138-
const npmManifest = await pacote.manifest(npmInstall)
138+
const npmOptions = this.npm.flatOptions
139+
const npmManifest = await pacote.manifest(npmInstall, npmOptions)
139140
try {
140141
checks.checkEngine(npmManifest, npmManifest.version, process.version)
141142
} catch (e) {

β€Ždeps/npm/lib/search/format-package-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class JSONOutputStream extends Minipass {
4242
}
4343

4444
end () {
45-
super.write(this._didFirst ? ']\n' : '\n]\n')
45+
super.write(this._didFirst ? ']\n' : '\n[]\n')
4646
super.end()
4747
}
4848
}

β€Ždeps/npm/lib/utils/config/definitions.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2053,10 +2053,14 @@ define('user-agent', {
20532053
.replace(/\{workspaces\}/gi, inWorkspaces)
20542054
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
20552055
.trim()
2056+
2057+
// We can't clobber the original or else subsequent flattening will fail
2058+
// (i.e. when we change the underlying config values)
2059+
// obj[key] = flatOptions.userAgent
2060+
20562061
// user-agent is a unique kind of config item that gets set from a template
20572062
// and ends up translated. Because of this, the normal "should we set this
20582063
// to process.env also doesn't work
2059-
obj[key] = flatOptions.userAgent
20602064
process.env.npm_config_user_agent = flatOptions.userAgent
20612065
},
20622066
})
@@ -2140,6 +2144,9 @@ define('workspace', {
21402144
a workspace which does not yet exist, to create the folder and set it
21412145
up as a brand new workspace within the project.
21422146
`,
2147+
flatten: (key, obj, flatOptions) => {
2148+
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
2149+
},
21432150
})
21442151

21452152
define('workspaces', {
@@ -2151,6 +2158,9 @@ define('workspaces', {
21512158
Enable running a command in the context of **all** the configured
21522159
workspaces.
21532160
`,
2161+
flatten: (key, obj, flatOptions) => {
2162+
definitions['user-agent'].flatten('user-agent', obj, flatOptions)
2163+
},
21542164
})
21552165

21562166
define('yes', {

β€Ždeps/npm/lib/utils/did-you-mean.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@ const readJson = require('read-package-json-fast')
33
const { cmdList } = require('./cmd-list.js')
44

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

10-
const pkg = await readJson(`${path}/package.json`)
11-
const { scripts } = pkg
1210
// We would already be suggesting this in `npm x` so omit them here
1311
const runScripts = ['stop', 'start', 'test', 'restart']
14-
const bestRun = Object.keys(scripts || {})
15-
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
16-
!runScripts.includes(cmd))
17-
.map(str => ` npm run ${str} # run the "${str}" package script`)
18-
19-
const { bin } = pkg
20-
const bestBin = Object.keys(bin || {})
21-
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
22-
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)
23-
24-
const best = [...bestCmd, ...bestRun, ...bestBin]
12+
try {
13+
const { bin, scripts } = await readJson(`${path}/package.json`)
14+
best = best.concat(
15+
Object.keys(scripts || {})
16+
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4 &&
17+
!runScripts.includes(cmd))
18+
.map(str => ` npm run ${str} # run the "${str}" package script`),
19+
Object.keys(bin || {})
20+
.filter(cmd => distance(scmd, cmd) < scmd.length * 0.4)
21+
.map(str => ` npm exec ${str} # run the "${str}" command from either this or a remote npm package`)
22+
)
23+
} catch (_) {
24+
// gracefully ignore not being in a folder w/ a package.json
25+
}
2526

2627
if (best.length === 0)
2728
return ''

β€Ždeps/npm/lib/utils/error-message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ module.exports = (er, npm) => {
367367
detail.push(['signal', er.signal])
368368

369369
if (er.cmd && Array.isArray(er.args))
370-
detail.push(['command', ...[er.cmd, ...er.args]])
370+
detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]])
371371

372372
if (er.stdout)
373373
detail.push(['', er.stdout.trim()])

β€Ždeps/npm/lib/view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class View extends BaseCommand {
336336
email: color.cyan(manifest._npmUser.email),
337337
}),
338338
modified: !packument.time ? undefined
339-
: color.yellow(relativeDate(packument.time[packument.version])),
339+
: color.yellow(relativeDate(packument.time[manifest.version])),
340340
maintainers: (packument.maintainers || []).map((u) => unparsePerson({
341341
name: color.yellow(u.name),
342342
email: color.cyan(u.email),

β€Ždeps/npm/man/man1/npm-ls.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
2626
.P
2727
.RS 2
2828
.nf
29-
npm@7\.23\.0 /path/to/npm
29+
npm@7\.24\.0 /path/to/npm
3030
└─┬ init\-package\-json@0\.0\.4
3131
└── promzard@0\.1\.5
3232
.fi

β€Ždeps/npm/man/man1/npm.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm <command> [args]
1010
.RE
1111
.SS Version
1212
.P
13-
7\.23\.0
13+
7\.24\.0
1414
.SS Description
1515
.P
1616
npm is the package manager for the Node JavaScript platform\. It puts

β€Ždeps/npm/node_modules/init-package-json/LICENSE

Lines changed: 0 additions & 15 deletions
This file was deleted.

β€Ždeps/npm/node_modules/init-package-json/LICENSE.md

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)