Skip to content

Commit 2b7c4b4

Browse files
npm-robotMylesBorins
authored andcommitted
deps: upgrade npm to 8.3.2
PR-URL: #41621 Reviewed-By: Ruy Adorno <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 5386c6a commit 2b7c4b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+450
-288
lines changed

deps/npm/docs/content/commands/npm-dedupe.md

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ result in new modules being installed.
7272

7373
Using `npm find-dupes` will run the command in `--dry-run` mode.
7474

75+
Note that by default `npm dedupe` will not update the semver values of direct
76+
dependencies in your project `package.json`, if you want to also update
77+
values in `package.json` you can run: `npm dedupe --save` (or add the
78+
`save=true` option to a [configuration file](/configuring-npm/npmrc)
79+
to make that the default behavior).
80+
7581
### Configuration
7682

7783
<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->

deps/npm/docs/content/commands/npm-update.md

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ packages.
2727
If no package name is specified, all packages in the specified location (global
2828
or local) will be updated.
2929

30+
Note that by default `npm update` will not update the semver values of direct
31+
dependencies in your project `package.json`, if you want to also update
32+
values in `package.json` you can run: `npm update --save` (or add the
33+
`save=true` option to a [configuration file](/configuring-npm/npmrc)
34+
to make that the default behavior).
35+
3036
### Example
3137

3238
For the examples below, assume that the current package is `app` and it depends

deps/npm/docs/content/using-npm/config.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1326,13 +1326,16 @@ The base URL of the npm registry.
13261326

13271327
#### `save`
13281328

1329-
* Default: true
1329+
* Default: `true` unless when using `npm update` or `npm dedupe` where it
1330+
defaults to `false`
13301331
* Type: Boolean
13311332

1332-
Save installed packages to a package.json file as dependencies.
1333+
Save installed packages to a `package.json` file as dependencies.
13331334

13341335
When used with the `npm rm` command, removes the dependency from
1335-
package.json.
1336+
`package.json`.
1337+
1338+
Will also prevent writing to `package-lock.json` if set to `false`.
13361339

13371340
<!-- automatically generated, do not edit manually -->
13381341
<!-- see lib/utils/config/definitions.js -->

deps/npm/docs/output/commands/npm-dedupe.html

+5
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ <h3 id="description">Description</h3>
192192
<p>Note that this operation transforms the dependency tree, but will never
193193
result in new modules being installed.</p>
194194
<p>Using <code>npm find-dupes</code> will run the command in <code>--dry-run</code> mode.</p>
195+
<p>Note that by default <code>npm dedupe</code> will not update the semver values of direct
196+
dependencies in your project <code>package.json</code>, if you want to also update
197+
values in <code>package.json</code> you can run: <code>npm dedupe --save</code> (or add the
198+
<code>save=true</code> option to a <a href="../configuring-npm/npmrc.html">configuration file</a>
199+
to make that the default behavior).</p>
195200
<h3 id="configuration">Configuration</h3>
196201
<!-- raw HTML omitted -->
197202
<!-- raw HTML omitted -->

deps/npm/docs/output/commands/npm-ls.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ <h3 id="description">Description</h3>
160160
the results to only the paths to the packages named. Note that nested
161161
packages will <em>also</em> show the paths to the specified packages. For
162162
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
163-
<pre lang="bash"><code>[email protected].1 /path/to/npm
163+
<pre lang="bash"><code>[email protected].2 /path/to/npm
164164
165165
166166
</code></pre>

deps/npm/docs/output/commands/npm-update.html

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ <h3 id="description">Description</h3>
160160
packages.</p>
161161
<p>If no package name is specified, all packages in the specified location (global
162162
or local) will be updated.</p>
163+
<p>Note that by default <code>npm update</code> will not update the semver values of direct
164+
dependencies in your project <code>package.json</code>, if you want to also update
165+
values in <code>package.json</code> you can run: <code>npm update --save</code> (or add the
166+
<code>save=true</code> option to a <a href="../configuring-npm/npmrc.html">configuration file</a>
167+
to make that the default behavior).</p>
163168
<h3 id="example">Example</h3>
164169
<p>For the examples below, assume that the current package is <code>app</code> and it depends
165170
on dependencies, <code>dep1</code> (<code>dep2</code>, .. etc.). The published versions of <code>dep1</code>

deps/npm/docs/output/commands/npm.html

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

deps/npm/docs/output/using-npm/config.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -1210,12 +1210,14 @@ <h4 id="registry"><code>registry</code></h4>
12101210
<!-- raw HTML omitted -->
12111211
<h4 id="save"><code>save</code></h4>
12121212
<ul>
1213-
<li>Default: true</li>
1213+
<li>Default: <code>true</code> unless when using <code>npm update</code> or <code>npm dedupe</code> where it
1214+
defaults to <code>false</code></li>
12141215
<li>Type: Boolean</li>
12151216
</ul>
1216-
<p>Save installed packages to a package.json file as dependencies.</p>
1217+
<p>Save installed packages to a <code>package.json</code> file as dependencies.</p>
12171218
<p>When used with the <code>npm rm</code> command, removes the dependency from
1218-
package.json.</p>
1219+
<code>package.json</code>.</p>
1220+
<p>Will also prevent writing to <code>package-lock.json</code> if set to <code>false</code>.</p>
12191221
<!-- raw HTML omitted -->
12201222
<!-- raw HTML omitted -->
12211223
<h4 id="save-bundle"><code>save-bundle</code></h4>

deps/npm/lib/base-command.js

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// Base class for npm commands
2+
3+
const { relative } = require('path')
4+
25
const usageUtil = require('./utils/usage.js')
36
const ConfigDefinitions = require('./utils/config/definitions.js')
47
const getWorkspaces = require('./workspaces/get-workspaces.js')
@@ -78,9 +81,14 @@ class BaseCommand {
7881
this.includeWorkspaceRoot = false
7982
}
8083

84+
const relativeFrom = relative(this.npm.localPrefix, process.cwd()).startsWith('..')
85+
? this.npm.localPrefix
86+
: process.cwd()
87+
8188
const ws = await getWorkspaces(filters, {
8289
path: this.npm.localPrefix,
8390
includeWorkspaceRoot: this.includeWorkspaceRoot,
91+
relativeFrom,
8492
})
8593
this.workspaces = ws
8694
this.workspaceNames = [...ws.keys()]

deps/npm/lib/commands/dedupe.js

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Dedupe extends ArboristWorkspaceCmd {
1313
'legacy-bundling',
1414
'strict-peer-deps',
1515
'package-lock',
16+
'save',
1617
'omit',
1718
'ignore-scripts',
1819
'audit',
@@ -29,13 +30,20 @@ class Dedupe extends ArboristWorkspaceCmd {
2930
throw er
3031
}
3132

33+
// In the context of `npm dedupe` the save
34+
// config value should default to `false`
35+
const save = this.npm.config.isDefault('save')
36+
? false
37+
: this.npm.config.get('save')
38+
3239
const dryRun = this.npm.config.get('dry-run')
3340
const where = this.npm.prefix
3441
const opts = {
3542
...this.npm.flatOptions,
3643
log,
3744
path: where,
3845
dryRun,
46+
save,
3947
workspaces: this.workspaceNames,
4048
}
4149
const arb = new Arborist(opts)

deps/npm/lib/commands/update.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Update extends ArboristWorkspaceCmd {
1616
'legacy-bundling',
1717
'strict-peer-deps',
1818
'package-lock',
19+
'save',
1920
'omit',
2021
'ignore-scripts',
2122
'audit',
@@ -40,19 +41,27 @@ class Update extends ArboristWorkspaceCmd {
4041
? global
4142
: this.npm.prefix
4243

44+
// In the context of `npm update` the save
45+
// config value should default to `false`
46+
const save = this.npm.config.isDefault('save')
47+
? false
48+
: this.npm.config.get('save')
49+
4350
if (this.npm.config.get('depth')) {
4451
log.warn('update', 'The --depth option no longer has any effect. See RFC0019.\n' +
4552
'https://github.com/npm/rfcs/blob/latest/implemented/0019-remove-update-depth-option.md')
4653
}
4754

48-
const arb = new Arborist({
55+
const opts = {
4956
...this.npm.flatOptions,
5057
log,
5158
path: where,
59+
save,
5260
workspaces: this.workspaceNames,
53-
})
61+
}
62+
const arb = new Arborist(opts)
5463

55-
await arb.reify({ update })
64+
await arb.reify({ ...opts, update })
5665
await reifyFinish(this.npm, arb)
5766
}
5867
}

deps/npm/lib/utils/config/definitions.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1583,14 +1583,18 @@ define('registry', {
15831583

15841584
define('save', {
15851585
default: true,
1586+
defaultDescription: `\`true\` unless when using \`npm update\` or
1587+
\`npm dedupe\` where it defaults to \`false\``,
15861588
usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer',
15871589
type: Boolean,
15881590
short: 'S',
15891591
description: `
1590-
Save installed packages to a package.json file as dependencies.
1592+
Save installed packages to a \`package.json\` file as dependencies.
15911593
15921594
When used with the \`npm rm\` command, removes the dependency from
1593-
package.json.
1595+
\`package.json\`.
1596+
1597+
Will also prevent writing to \`package-lock.json\` if set to \`false\`.
15941598
`,
15951599
flatten,
15961600
})

deps/npm/lib/workspaces/get-workspaces.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const rpj = require('read-package-json-fast')
55

66
// Returns an Map of paths to workspaces indexed by workspace name
77
// { foo => '/path/to/foo' }
8-
const getWorkspaces = async (filters, { path, includeWorkspaceRoot }) => {
8+
const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => {
99
// TODO we need a better error to be bubbled up here if this rpj call fails
1010
const pkg = await rpj(resolve(path, 'package.json'))
1111
const workspaces = await mapWorkspaces({ cwd: path, pkg })
@@ -21,8 +21,8 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot }) => {
2121
for (const filterArg of filters) {
2222
for (const [workspaceName, workspacePath] of workspaces.entries()) {
2323
if (filterArg === workspaceName
24-
|| resolve(path, filterArg) === workspacePath
25-
|| minimatch(workspacePath, `${resolve(path, filterArg)}/*`)) {
24+
|| resolve(relativeFrom || path, filterArg) === workspacePath
25+
|| minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) {
2626
res.set(workspaceName, workspacePath)
2727
}
2828
}

deps/npm/man/man1/npm-dedupe.1

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ Note that this operation transforms the dependency tree, but will never
7575
result in new modules being installed\.
7676
.P
7777
Using \fBnpm find\-dupes\fP will run the command in \fB\-\-dry\-run\fP mode\.
78+
.P
79+
Note that by default \fBnpm dedupe\fP will not update the semver values of direct
80+
dependencies in your project \fBpackage\.json\fP, if you want to also update
81+
values in \fBpackage\.json\fP you can run: \fBnpm dedupe \-\-save\fP (or add the
82+
\fBsave=true\fP option to a npm help configuration file
83+
to make that the default behavior)\.
7884
.SS Configuration
7985
<!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
8086
<!\-\- automatically generated, do not edit manually \-\->

deps/npm/man/man1/npm-ls.1

+1-1
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@8\.3\.1 /path/to/npm
29+
npm@8\.3\.2 /path/to/npm
3030
└─┬ init\-package\-json@0\.0\.4
3131
└── promzard@0\.1\.5
3232
.fi

deps/npm/man/man1/npm-update.1

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ packages\.
2424
.P
2525
If no package name is specified, all packages in the specified location (global
2626
or local) will be updated\.
27+
.P
28+
Note that by default \fBnpm update\fP will not update the semver values of direct
29+
dependencies in your project \fBpackage\.json\fP, if you want to also update
30+
values in \fBpackage\.json\fP you can run: \fBnpm update \-\-save\fP (or add the
31+
\fBsave=true\fP option to a npm help configuration file
32+
to make that the default behavior)\.
2733
.SS Example
2834
.P
2935
For the examples below, assume that the current package is \fBapp\fP and it depends

deps/npm/man/man1/npm.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm <command> [args]
1010
.RE
1111
.SS Version
1212
.P
13-
8\.3\.1
13+
8\.3\.2
1414
.SS Description
1515
.P
1616
npm is the package manager for the Node JavaScript platform\. It puts

deps/npm/man/man7/config.7

+6-3
Original file line numberDiff line numberDiff line change
@@ -1673,16 +1673,19 @@ The base URL of the npm registry\.
16731673
.SS \fBsave\fP
16741674
.RS 0
16751675
.IP \(bu 2
1676-
Default: true
1676+
Default: \fBtrue\fP unless when using \fBnpm update\fP or \fBnpm dedupe\fP where it
1677+
defaults to \fBfalse\fP
16771678
.IP \(bu 2
16781679
Type: Boolean
16791680

16801681
.RE
16811682
.P
1682-
Save installed packages to a package\.json file as dependencies\.
1683+
Save installed packages to a \fBpackage\.json\fP file as dependencies\.
16831684
.P
16841685
When used with the \fBnpm rm\fP command, removes the dependency from
1685-
package\.json\.
1686+
\fBpackage\.json\fP\|\.
1687+
.P
1688+
Will also prevent writing to \fBpackage\-lock\.json\fP if set to \fBfalse\fP\|\.
16861689
<!\-\- automatically generated, do not edit manually \-\->
16871690
<!\-\- see lib/utils/config/definitions\.js \-\->
16881691

deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js

+9-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)