summaryrefslogtreecommitdiff
path: root/deps/npm
diff options
context:
space:
mode:
authornpm CLI robot <npm-cli+bot@github.com>2023-01-18 09:48:47 -0500
committerGitHub <noreply@github.com>2023-01-18 14:48:47 +0000
commitad16a75941437259199beb3fe7c0fcac15b4e6aa (patch)
treeb2c00db7a3d717a72d38dfe56cc69f44f0d15601 /deps/npm
parentdc06df31b6b69a6f5d2d2fceaddf82bda7a66fc2 (diff)
downloadnode-new-ad16a75941437259199beb3fe7c0fcac15b4e6aa.tar.gz
deps: upgrade npm to 9.3.1
PR-URL: https://github.com/nodejs/node/pull/46242 Reviewed-By: Ruy Adorno <ruyadorno@google.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'deps/npm')
-rw-r--r--deps/npm/docs/content/commands/npm-ls.md2
-rw-r--r--deps/npm/docs/content/commands/npm.md2
-rw-r--r--deps/npm/docs/output/commands/npm-ls.html2
-rw-r--r--deps/npm/docs/output/commands/npm.html2
-rw-r--r--deps/npm/lib/commands/ci.js2
-rw-r--r--deps/npm/lib/commands/deprecate.js24
-rw-r--r--deps/npm/man/man1/npm-ls.12
-rw-r--r--deps/npm/man/man1/npm.12
-rw-r--r--deps/npm/package.json2
-rw-r--r--deps/npm/test/lib/commands/ci.js24
-rw-r--r--deps/npm/test/lib/commands/deprecate.js16
11 files changed, 61 insertions, 19 deletions
diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md
index d8b6f4a7de..4690d7752f 100644
--- a/deps/npm/docs/content/commands/npm-ls.md
+++ b/deps/npm/docs/content/commands/npm-ls.md
@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
example, running `npm ls promzard` in npm's source tree will show:
```bash
-npm@9.3.0 /path/to/npm
+npm@9.3.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
diff --git a/deps/npm/docs/content/commands/npm.md b/deps/npm/docs/content/commands/npm.md
index 2396b40cf5..f2fdaee318 100644
--- a/deps/npm/docs/content/commands/npm.md
+++ b/deps/npm/docs/content/commands/npm.md
@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
### Version
-9.3.0
+9.3.1
### Description
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html
index ffe72db7c5..4bb067ab67 100644
--- a/deps/npm/docs/output/commands/npm-ls.html
+++ b/deps/npm/docs/output/commands/npm-ls.html
@@ -160,7 +160,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
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><code class="language-bash">npm@9.3.0 /path/to/npm
+<pre><code class="language-bash">npm@9.3.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index cb6d4ea3c7..76f4fc5cc1 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -150,7 +150,7 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="version">Version</h3>
-<p>9.3.0</p>
+<p>9.3.1</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
diff --git a/deps/npm/lib/commands/ci.js b/deps/npm/lib/commands/ci.js
index a2c61044eb..4dd7898dc6 100644
--- a/deps/npm/lib/commands/ci.js
+++ b/deps/npm/lib/commands/ci.js
@@ -67,7 +67,7 @@ class CI extends ArboristWorkspaceCmd {
const path = `${where}/node_modules`
// get the list of entries so we can skip the glob for performance
const entries = await fs.readdir(path, null).catch(er => [])
- return Promise.all(entries.map(f => fs.rm(`${path}/${f}`, { force: true })))
+ return Promise.all(entries.map(f => fs.rm(`${path}/${f}`, { force: true, recursive: true })))
})
await arb.reify(opts)
diff --git a/deps/npm/lib/commands/deprecate.js b/deps/npm/lib/commands/deprecate.js
index 1e1b8994c5..844d5f60a0 100644
--- a/deps/npm/lib/commands/deprecate.js
+++ b/deps/npm/lib/commands/deprecate.js
@@ -52,19 +52,21 @@ class Deprecate extends BaseCommand {
query: { write: true },
})
- Object.keys(packument.versions)
+ const versions = Object.keys(packument.versions)
.filter(v => semver.satisfies(v, spec, { includePrerelease: true }))
- .forEach(v => {
- packument.versions[v].deprecated = msg
- })
- return otplease(this.npm, this.npm.flatOptions, opts => fetch(uri, {
- ...opts,
- spec: p,
- method: 'PUT',
- body: packument,
- ignoreBody: true,
- }))
+ if (versions.length) {
+ for (const v of versions) {
+ packument.versions[v].deprecated = msg
+ }
+ return otplease(this.npm, this.npm.flatOptions, opts => fetch(uri, {
+ ...opts,
+ spec: p,
+ method: 'PUT',
+ body: packument,
+ ignoreBody: true,
+ }))
+ }
}
}
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index 2458a585b7..76a6790822 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
.P
.RS 2
.nf
-npm@9.3.0 /path/to/npm
+npm@9.3.1 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
.fi
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index e29df213a0..1286027b16 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -12,7 +12,7 @@ npm
Note: This command is unaware of workspaces.
.SS "Version"
.P
-9.3.0
+9.3.1
.SS "Description"
.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 conflicts intelligently.
diff --git a/deps/npm/package.json b/deps/npm/package.json
index 73c41bc2b4..423024ae21 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "9.3.0",
+ "version": "9.3.1",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
diff --git a/deps/npm/test/lib/commands/ci.js b/deps/npm/test/lib/commands/ci.js
index bd3fd9be9a..000ddc0eb8 100644
--- a/deps/npm/test/lib/commands/ci.js
+++ b/deps/npm/test/lib/commands/ci.js
@@ -79,6 +79,30 @@ t.test('reifies, audits, removes node_modules', async t => {
t.equal(fs.existsSync(nmAbbrev), true, 'installs abbrev')
})
+t.test('reifies, audits, removes node_modules on repeat run', async t => {
+ const { npm, joinedOutput, registry } = await loadMockNpm(t, {
+ prefixDir: {
+ abbrev: abbrev,
+ 'package.json': JSON.stringify(packageJson),
+ 'package-lock.json': JSON.stringify(packageLock),
+ node_modules: { test: 'test file that will be removed' },
+ },
+ })
+ const manifest = registry.manifest({ name: 'abbrev' })
+ await registry.tarball({
+ manifest: manifest.versions['1.0.0'],
+ tarball: path.join(npm.prefix, 'abbrev'),
+ })
+ registry.nock.post('/-/npm/v1/security/advisories/bulk').reply(200, {})
+ await npm.exec('ci', [])
+ await npm.exec('ci', [])
+ t.match(joinedOutput(), 'added 1 package, and audited 2 packages in')
+ const nmTest = path.join(npm.prefix, 'node_modules', 'test')
+ t.equal(fs.existsSync(nmTest), false, 'existing node_modules is removed')
+ const nmAbbrev = path.join(npm.prefix, 'node_modules', 'abbrev')
+ t.equal(fs.existsSync(nmAbbrev), true, 'installs abbrev')
+})
+
t.test('--no-audit and --ignore-scripts', async t => {
const { npm, joinedOutput, registry } = await loadMockNpm(t, {
config: {
diff --git a/deps/npm/test/lib/commands/deprecate.js b/deps/npm/test/lib/commands/deprecate.js
index 22ddfe182d..48513c7303 100644
--- a/deps/npm/test/lib/commands/deprecate.js
+++ b/deps/npm/test/lib/commands/deprecate.js
@@ -153,3 +153,19 @@ t.test('deprecates all versions when no range is specified', async t => {
await npm.exec('deprecate', ['foo', message])
t.match(joinedOutput(), '')
})
+
+t.test('does nothing if version does not actually exist', async t => {
+ const { npm, joinedOutput } = await loadMockNpm(t, { config: { ...auth } })
+ const registry = new MockRegistry({
+ tap: t,
+ registry: npm.config.get('registry'),
+ authorization: token,
+ })
+ const manifest = registry.manifest({
+ name: 'foo',
+ versions,
+ })
+ await registry.package({ manifest, query: { write: true } })
+ await npm.exec('deprecate', ['foo@1.0.99', 'this should be ignored'])
+ t.match(joinedOutput(), '')
+})