Skip to content

Commit c0200e2

Browse files
npm-robotdanielleadams
authored andcommitted
deps: upgrade npm to 8.1.3
PR-URL: #40726 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 25a166d commit c0200e2

File tree

285 files changed

+12513
-15221
lines changed

Some content is hidden

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

285 files changed

+12513
-15221
lines changed

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@8.1.2 /path/to/npm
162+
<pre lang="bash"><code>npm@8.1.3 /path/to/npm
163163
└─┬ init-package-json@0.0.4
164164
└── promzard@0.1.5
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>8.1.2</p>
151+
<p>8.1.3</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/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
if (require.main === module) {
1+
if (require.main === module)
22
require('./lib/cli.js')(process)
3-
} else {
3+
else
44
throw new Error('The programmatic API was removed in npm v8.0.0')
5-
}

deps/npm/lib/workspaces/arborist-cmd.js renamed to deps/npm/lib/arborist-cmd.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// a list of workspace names and passes it on to new Arborist() to
33
// be able to run a filtered Arborist.reify() at some point.
44

5-
const BaseCommand = require('../base-command.js')
5+
const BaseCommand = require('./base-command.js')
66
class ArboristCmd extends BaseCommand {
77
get isArboristCmd () {
88
return true
@@ -17,12 +17,9 @@ class ArboristCmd extends BaseCommand {
1717
]
1818
}
1919

20-
execWorkspaces (args, filters, cb) {
21-
this.setWorkspaces(filters, true)
22-
.then(() => {
23-
this.exec(args, cb)
24-
})
25-
.catch(er => cb(er))
20+
async execWorkspaces (args, filters) {
21+
await this.setWorkspaces(filters)
22+
return this.exec(args)
2623
}
2724
}
2825

deps/npm/lib/base-command.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Base class for npm.commands[cmd]
1+
// Base class for npm commands
22
const usageUtil = require('./utils/usage.js')
33
const ConfigDefinitions = require('./utils/config/definitions.js')
44
const getWorkspaces = require('./workspaces/get-workspaces.js')
@@ -53,19 +53,15 @@ class BaseCommand {
5353
return results
5454
}
5555

56-
usageError (msg) {
57-
if (!msg) {
58-
return Object.assign(new Error(`\nUsage: ${this.usage}`), {
59-
code: 'EUSAGE',
60-
})
61-
}
62-
63-
return Object.assign(new Error(`\nUsage: ${msg}\n\n${this.usage}`), {
56+
usageError (prefix = '') {
57+
if (prefix)
58+
prefix += '\n\n'
59+
return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
6460
code: 'EUSAGE',
6561
})
6662
}
6763

68-
execWorkspaces (args, filters, cb) {
64+
async execWorkspaces (args, filters) {
6965
throw Object.assign(
7066
new Error('This command does not support workspaces.'),
7167
{ code: 'ENOWORKSPACES' }

deps/npm/lib/cli.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = async (process) => {
1818

1919
checkForUnsupportedNode()
2020

21-
const npm = require('../lib/npm.js')
21+
const Npm = require('../lib/npm.js')
22+
const npm = new Npm()
2223
const exitHandler = require('../lib/utils/exit-handler.js')
2324
exitHandler.setNpm(npm)
2425

@@ -38,6 +39,7 @@ module.exports = async (process) => {
3839

3940
const updateNotifier = require('../lib/utils/update-notifier.js')
4041

42+
let cmd
4143
// now actually fire up npm and run the command.
4244
// this is how to use npm programmatically:
4345
try {
@@ -55,24 +57,23 @@ module.exports = async (process) => {
5557

5658
updateNotifier(npm)
5759

58-
const cmd = npm.argv.shift()
60+
cmd = npm.argv.shift()
5961
if (!cmd) {
60-
npm.output(npm.usage)
62+
npm.output(await npm.usage)
6163
process.exitCode = 1
6264
return exitHandler()
6365
}
6466

65-
const impl = npm.commands[cmd]
66-
if (!impl) {
67+
await npm.exec(cmd, npm.argv)
68+
exitHandler()
69+
} catch (err) {
70+
if (err.code === 'EUNKNOWNCOMMAND') {
6771
const didYouMean = require('./utils/did-you-mean.js')
6872
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
6973
npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`)
7074
process.exitCode = 1
7175
return exitHandler()
7276
}
73-
74-
impl(npm.argv, exitHandler)
75-
} catch (err) {
7677
return exitHandler(err)
7778
}
7879
}

deps/npm/lib/access.js renamed to deps/npm/lib/commands/access.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const path = require('path')
33
const libaccess = require('libnpmaccess')
44
const readPackageJson = require('read-package-json-fast')
55

6-
const otplease = require('./utils/otplease.js')
7-
const getIdentity = require('./utils/get-identity.js')
8-
const BaseCommand = require('./base-command.js')
6+
const otplease = require('../utils/otplease.js')
7+
const getIdentity = require('../utils/get-identity.js')
8+
const BaseCommand = require('../base-command.js')
99

1010
const subcommands = [
1111
'public',
@@ -76,11 +76,7 @@ class Access extends BaseCommand {
7676
}
7777
}
7878

79-
exec (args, cb) {
80-
this.access(args).then(() => cb()).catch(cb)
81-
}
82-
83-
async access ([cmd, ...args]) {
79+
async exec ([cmd, ...args]) {
8480
if (!cmd)
8581
throw this.usageError('Subcommand is required.')
8682

deps/npm/lib/adduser.js renamed to deps/npm/lib/commands/adduser.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const log = require('npmlog')
2-
const replaceInfo = require('./utils/replace-info.js')
3-
const BaseCommand = require('./base-command.js')
2+
const replaceInfo = require('../utils/replace-info.js')
3+
const BaseCommand = require('../base-command.js')
44
const authTypes = {
5-
legacy: require('./auth/legacy.js'),
6-
oauth: require('./auth/oauth.js'),
7-
saml: require('./auth/saml.js'),
8-
sso: require('./auth/sso.js'),
5+
legacy: require('../auth/legacy.js'),
6+
oauth: require('../auth/oauth.js'),
7+
saml: require('../auth/saml.js'),
8+
sso: require('../auth/sso.js'),
99
}
1010

1111
class AddUser extends BaseCommand {
@@ -24,11 +24,7 @@ class AddUser extends BaseCommand {
2424
]
2525
}
2626

27-
exec (args, cb) {
28-
this.adduser(args).then(() => cb()).catch(cb)
29-
}
30-
31-
async adduser (args) {
27+
async exec (args) {
3228
const { scope } = this.npm.flatOptions
3329
const registry = this.getRegistry(this.npm.flatOptions)
3430
const auth = this.getAuthType(this.npm.flatOptions)

deps/npm/lib/audit.js renamed to deps/npm/lib/commands/audit.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const Arborist = require('@npmcli/arborist')
22
const auditReport = require('npm-audit-report')
3-
const reifyFinish = require('./utils/reify-finish.js')
4-
const auditError = require('./utils/audit-error.js')
5-
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
3+
const reifyFinish = require('../utils/reify-finish.js')
4+
const auditError = require('../utils/audit-error.js')
5+
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
66

77
class Audit extends ArboristWorkspaceCmd {
88
/* istanbul ignore next - see test/lib/load-all-commands.js */
@@ -47,11 +47,7 @@ class Audit extends ArboristWorkspaceCmd {
4747
}
4848
}
4949

50-
exec (args, cb) {
51-
this.audit(args).then(() => cb()).catch(cb)
52-
}
53-
54-
async audit (args) {
50+
async exec (args) {
5551
const reporter = this.npm.config.get('json') ? 'json' : 'detail'
5652
const opts = {
5753
...this.npm.flatOptions,

deps/npm/lib/bin.js renamed to deps/npm/lib/commands/bin.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const envPath = require('./utils/path.js')
2-
const BaseCommand = require('./base-command.js')
1+
const envPath = require('../utils/path.js')
2+
const BaseCommand = require('../base-command.js')
33

44
class Bin extends BaseCommand {
55
static get description () {
@@ -14,11 +14,7 @@ class Bin extends BaseCommand {
1414
return ['global']
1515
}
1616

17-
exec (args, cb) {
18-
this.bin(args).then(() => cb()).catch(cb)
19-
}
20-
21-
async bin (args) {
17+
async exec (args) {
2218
const b = this.npm.bin
2319
this.npm.output(b)
2420
if (this.npm.config.get('global') && !envPath.includes(b))

0 commit comments

Comments
 (0)