Skip to content

Commit 6cd7057

Browse files
npm-cli-botMylesBorins
authored andcommitted
deps: upgrade npm to 9.3.1
PR-URL: #46242 Reviewed-By: Ruy Adorno <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 679aae2 commit 6cd7057

File tree

11 files changed

+61
-19
lines changed

11 files changed

+61
-19
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
2727
example, running `npm ls promzard` in npm's source tree will show:
2828

2929
```bash
30-
[email protected].0 /path/to/npm
30+
[email protected].1 /path/to/npm
3131
3232
3333
```

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
1414

1515
### Version
1616

17-
9.3.0
17+
9.3.1
1818

1919
### Description
2020

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><code class="language-bash">[email protected].0 /path/to/npm
163+
<pre><code class="language-bash">[email protected].1 /path/to/npm
164164
165165
166166
</code></pre>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ <h2 id="table-of-contents">Table of contents</h2>
150150
</code></pre>
151151
<p>Note: This command is unaware of workspaces.</p>
152152
<h3 id="version">Version</h3>
153-
<p>9.3.0</p>
153+
<p>9.3.1</p>
154154
<h3 id="description">Description</h3>
155155
<p>npm is the package manager for the Node JavaScript platform. It puts
156156
modules in place so that node can find them, and manages dependency

deps/npm/lib/commands/ci.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CI extends ArboristWorkspaceCmd {
6767
const path = `${where}/node_modules`
6868
// get the list of entries so we can skip the glob for performance
6969
const entries = await fs.readdir(path, null).catch(er => [])
70-
return Promise.all(entries.map(f => fs.rm(`${path}/${f}`, { force: true })))
70+
return Promise.all(entries.map(f => fs.rm(`${path}/${f}`, { force: true, recursive: true })))
7171
})
7272

7373
await arb.reify(opts)

deps/npm/lib/commands/deprecate.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,21 @@ class Deprecate extends BaseCommand {
5252
query: { write: true },
5353
})
5454

55-
Object.keys(packument.versions)
55+
const versions = Object.keys(packument.versions)
5656
.filter(v => semver.satisfies(v, spec, { includePrerelease: true }))
57-
.forEach(v => {
58-
packument.versions[v].deprecated = msg
59-
})
6057

61-
return otplease(this.npm, this.npm.flatOptions, opts => fetch(uri, {
62-
...opts,
63-
spec: p,
64-
method: 'PUT',
65-
body: packument,
66-
ignoreBody: true,
67-
}))
58+
if (versions.length) {
59+
for (const v of versions) {
60+
packument.versions[v].deprecated = msg
61+
}
62+
return otplease(this.npm, this.npm.flatOptions, opts => fetch(uri, {
63+
...opts,
64+
spec: p,
65+
method: 'PUT',
66+
body: packument,
67+
ignoreBody: true,
68+
}))
69+
}
6870
}
6971
}
7072

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
2020
.P
2121
.RS 2
2222
.nf
23-
[email protected].0 /path/to/npm
23+
[email protected].1 /path/to/npm
2424
2525
2626
.fi

deps/npm/man/man1/npm.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ npm
1212
Note: This command is unaware of workspaces.
1313
.SS "Version"
1414
.P
15-
9.3.0
15+
9.3.1
1616
.SS "Description"
1717
.P
1818
npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

deps/npm/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "9.3.0",
2+
"version": "9.3.1",
33
"name": "npm",
44
"description": "a package manager for JavaScript",
55
"workspaces": [

deps/npm/test/lib/commands/ci.js

+24
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,30 @@ t.test('reifies, audits, removes node_modules', async t => {
7979
t.equal(fs.existsSync(nmAbbrev), true, 'installs abbrev')
8080
})
8181

82+
t.test('reifies, audits, removes node_modules on repeat run', async t => {
83+
const { npm, joinedOutput, registry } = await loadMockNpm(t, {
84+
prefixDir: {
85+
abbrev: abbrev,
86+
'package.json': JSON.stringify(packageJson),
87+
'package-lock.json': JSON.stringify(packageLock),
88+
node_modules: { test: 'test file that will be removed' },
89+
},
90+
})
91+
const manifest = registry.manifest({ name: 'abbrev' })
92+
await registry.tarball({
93+
manifest: manifest.versions['1.0.0'],
94+
tarball: path.join(npm.prefix, 'abbrev'),
95+
})
96+
registry.nock.post('/-/npm/v1/security/advisories/bulk').reply(200, {})
97+
await npm.exec('ci', [])
98+
await npm.exec('ci', [])
99+
t.match(joinedOutput(), 'added 1 package, and audited 2 packages in')
100+
const nmTest = path.join(npm.prefix, 'node_modules', 'test')
101+
t.equal(fs.existsSync(nmTest), false, 'existing node_modules is removed')
102+
const nmAbbrev = path.join(npm.prefix, 'node_modules', 'abbrev')
103+
t.equal(fs.existsSync(nmAbbrev), true, 'installs abbrev')
104+
})
105+
82106
t.test('--no-audit and --ignore-scripts', async t => {
83107
const { npm, joinedOutput, registry } = await loadMockNpm(t, {
84108
config: {

deps/npm/test/lib/commands/deprecate.js

+16
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,19 @@ t.test('deprecates all versions when no range is specified', async t => {
153153
await npm.exec('deprecate', ['foo', message])
154154
t.match(joinedOutput(), '')
155155
})
156+
157+
t.test('does nothing if version does not actually exist', async t => {
158+
const { npm, joinedOutput } = await loadMockNpm(t, { config: { ...auth } })
159+
const registry = new MockRegistry({
160+
tap: t,
161+
registry: npm.config.get('registry'),
162+
authorization: token,
163+
})
164+
const manifest = registry.manifest({
165+
name: 'foo',
166+
versions,
167+
})
168+
await registry.package({ manifest, query: { write: true } })
169+
await npm.exec('deprecate', ['[email protected]', 'this should be ignored'])
170+
t.match(joinedOutput(), '')
171+
})

0 commit comments

Comments
 (0)