Skip to content

Commit f1eeb6a

Browse files
committed
chore: switch to true static attributes
now that we're off of node10 we can clean this up
1 parent 8ffeb71 commit f1eeb6a

Some content is hidden

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

67 files changed

+602
-1439
lines changed

lib/commands/access.js

+17-29
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,23 @@ const subcommands = [
2020
]
2121

2222
class Access extends BaseCommand {
23-
static get description () {
24-
return 'Set access level on published packages'
25-
}
26-
27-
static get name () {
28-
return 'access'
29-
}
30-
31-
/* istanbul ignore next - see test/lib/load-all-commands.js */
32-
static get params () {
33-
return [
34-
'registry',
35-
'otp',
36-
]
37-
}
38-
39-
static get usage () {
40-
return [
41-
'public [<package>]',
42-
'restricted [<package>]',
43-
'grant <read-only|read-write> <scope:team> [<package>]',
44-
'revoke <scope:team> [<package>]',
45-
'2fa-required [<package>]',
46-
'2fa-not-required [<package>]',
47-
'ls-packages [<user>|<scope>|<scope:team>]',
48-
'ls-collaborators [<package> [<user>]]',
49-
'edit [<package>]',
50-
]
51-
}
23+
static description = 'Set access level on published packages'
24+
static name = 'access'
25+
static params =[
26+
'registry',
27+
'otp',
28+
]
29+
static usage = [
30+
'public [<package>]',
31+
'restricted [<package>]',
32+
'grant <read-only|read-write> <scope:team> [<package>]',
33+
'revoke <scope:team> [<package>]',
34+
'2fa-required [<package>]',
35+
'2fa-not-required [<package>]',
36+
'ls-packages [<user>|<scope>|<scope:team>]',
37+
'ls-collaborators [<package> [<user>]]',
38+
'edit [<package>]',
39+
]
5240

5341
async completion (opts) {
5442
const argv = opts.conf.argv.remain

lib/commands/adduser.js

+6-14
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@ const authTypes = {
99
}
1010

1111
class AddUser extends BaseCommand {
12-
static get description () {
13-
return 'Add a registry user account'
14-
}
15-
16-
static get name () {
17-
return 'adduser'
18-
}
19-
20-
static get params () {
21-
return [
22-
'registry',
23-
'scope',
24-
]
25-
}
12+
static description = 'Add a registry user account'
13+
static name = 'adduser'
14+
static params = [
15+
'registry',
16+
'scope',
17+
]
2618

2719
async exec (args) {
2820
const { scope } = this.npm.flatOptions

lib/commands/audit.js

+12-27
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,18 @@ const auditError = require('../utils/audit-error.js')
55
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
66

77
class Audit extends ArboristWorkspaceCmd {
8-
/* istanbul ignore next - see test/lib/load-all-commands.js */
9-
static get description () {
10-
return 'Run a security audit'
11-
}
12-
13-
/* istanbul ignore next - see test/lib/load-all-commands.js */
14-
static get name () {
15-
return 'audit'
16-
}
17-
18-
/* istanbul ignore next - see test/lib/load-all-commands.js */
19-
static get params () {
20-
return [
21-
'audit-level',
22-
'dry-run',
23-
'force',
24-
'json',
25-
'package-lock-only',
26-
'omit',
27-
...super.params,
28-
]
29-
}
30-
31-
/* istanbul ignore next - see test/lib/load-all-commands.js */
32-
static get usage () {
33-
return ['[fix]']
34-
}
8+
static description = 'Run a security audit'
9+
static name = 'audit'
10+
static params = [
11+
'audit-level',
12+
'dry-run',
13+
'force',
14+
'json',
15+
'package-lock-only',
16+
'omit',
17+
...super.params,
18+
]
19+
static usage = ['[fix]']
3520

3621
async completion (opts) {
3722
const argv = opts.conf.argv.remain

lib/commands/bin.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ const envPath = require('../utils/path.js')
22
const BaseCommand = require('../base-command.js')
33

44
class Bin extends BaseCommand {
5-
static get description () {
6-
return 'Display npm bin folder'
7-
}
8-
9-
static get name () {
10-
return 'bin'
11-
}
12-
13-
static get params () {
14-
return ['global']
15-
}
5+
static description = 'Display npm bin folder'
6+
static name = 'bin'
7+
static params = ['global']
168

179
async exec (args) {
1810
const b = this.npm.bin

lib/commands/birthday.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const BaseCommand = require('../base-command.js')
22

33
class Birthday extends BaseCommand {
4+
static name = 'birthday'
45
async exec () {
56
this.npm.config.set('package', ['@npmcli/npm-birthday'])
67
this.npm.config.set('yes', true)

lib/commands/bugs.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@ const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
55
const BaseCommand = require('../base-command.js')
66

77
class Bugs extends BaseCommand {
8-
static get description () {
9-
return 'Report bugs for a package in a web browser'
10-
}
11-
12-
static get name () {
13-
return 'bugs'
14-
}
15-
16-
static get usage () {
17-
return ['[<pkgname>]']
18-
}
19-
20-
/* istanbul ignore next - see test/lib/load-all-commands.js */
21-
static get params () {
22-
return ['browser', 'registry']
23-
}
8+
static description = 'Report bugs for a package in a web browser'
9+
static name = 'bugs'
10+
static usage = ['[<pkgname>]']
11+
static params = ['browser', 'registry']
2412

2513
async exec (args) {
2614
if (!args || !args.length)

lib/commands/cache.js

+13-27
Original file line numberDiff line numberDiff line change
@@ -60,33 +60,19 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
6060
}
6161

6262
class Cache extends BaseCommand {
63-
static get description () {
64-
return 'Manipulates packages cache'
65-
}
66-
67-
/* istanbul ignore next - see test/lib/load-all-commands.js */
68-
static get name () {
69-
return 'cache'
70-
}
71-
72-
/* istanbul ignore next - see test/lib/load-all-commands.js */
73-
static get params () {
74-
return ['cache']
75-
}
76-
77-
/* istanbul ignore next - see test/lib/load-all-commands.js */
78-
static get usage () {
79-
return [
80-
'add <tarball file>',
81-
'add <folder>',
82-
'add <tarball url>',
83-
'add <git url>',
84-
'add <name>@<version>',
85-
'clean [<key>]',
86-
'ls [<name>@<version>]',
87-
'verify',
88-
]
89-
}
63+
static description = 'Manipulates packages cache'
64+
static name = 'cache'
65+
static params = ['cache']
66+
static usage = [
67+
'add <tarball file>',
68+
'add <folder>',
69+
'add <tarball url>',
70+
'add <git url>',
71+
'add <name>@<version>',
72+
'clean [<key>]',
73+
'ls [<name>@<version>]',
74+
'verify',
75+
]
9076

9177
async completion (opts) {
9278
const argv = opts.conf.argv.remain

lib/commands/ci.js

+7-18
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,13 @@ const removeNodeModules = async where => {
2020
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
2121

2222
class CI extends ArboristWorkspaceCmd {
23-
/* istanbul ignore next - see test/lib/load-all-commands.js */
24-
static get description () {
25-
return 'Install a project with a clean slate'
26-
}
27-
28-
/* istanbul ignore next - see test/lib/load-all-commands.js */
29-
static get name () {
30-
return 'ci'
31-
}
32-
33-
/* istanbul ignore next - see test/lib/load-all-commands.js */
34-
static get params () {
35-
return [
36-
'audit',
37-
'ignore-scripts',
38-
'script-shell',
39-
]
40-
}
23+
static description = 'Install a project with a clean slate'
24+
static name = 'ci'
25+
static params = [
26+
'audit',
27+
'ignore-scripts',
28+
'script-shell',
29+
]
4130

4231
async exec () {
4332
if (this.npm.config.get('global')) {

lib/commands/completion.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,8 @@ const { promisify } = require('util')
4545
const BaseCommand = require('../base-command.js')
4646

4747
class Completion extends BaseCommand {
48-
/* istanbul ignore next - see test/lib/load-all-commands.js */
49-
static get description () {
50-
return 'Tab Completion for npm'
51-
}
52-
53-
/* istanbul ignore next - see test/lib/load-all-commands.js */
54-
static get name () {
55-
return 'completion'
56-
}
48+
static description = 'Tab Completion for npm'
49+
static name = 'completion'
5750

5851
// completion for the completion command
5952
async completion (opts) {

lib/commands/config.js

+16-30
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,22 @@ const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k)
3131

3232
const BaseCommand = require('../base-command.js')
3333
class Config extends BaseCommand {
34-
static get description () {
35-
return 'Manage the npm configuration files'
36-
}
37-
38-
/* istanbul ignore next - see test/lib/load-all-commands.js */
39-
static get name () {
40-
return 'config'
41-
}
42-
43-
/* istanbul ignore next - see test/lib/load-all-commands.js */
44-
static get usage () {
45-
return [
46-
'set <key>=<value> [<key>=<value> ...]',
47-
'get [<key> [<key> ...]]',
48-
'delete <key> [<key> ...]',
49-
'list [--json]',
50-
'edit',
51-
]
52-
}
53-
54-
/* istanbul ignore next - see test/lib/load-all-commands.js */
55-
static get params () {
56-
return [
57-
'json',
58-
'global',
59-
'editor',
60-
'location',
61-
'long',
62-
]
63-
}
34+
static description = 'Manage the npm configuration files'
35+
static name = 'config'
36+
static usage = [
37+
'set <key>=<value> [<key>=<value> ...]',
38+
'get [<key> [<key> ...]]',
39+
'delete <key> [<key> ...]',
40+
'list [--json]',
41+
'edit',
42+
]
43+
static params = [
44+
'json',
45+
'global',
46+
'editor',
47+
'location',
48+
'long',
49+
]
6450

6551
async completion (opts) {
6652
const argv = opts.conf.argv.remain

lib/commands/dedupe.js

+15-26
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,21 @@ const reifyFinish = require('../utils/reify-finish.js')
55
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
66

77
class Dedupe extends ArboristWorkspaceCmd {
8-
/* istanbul ignore next - see test/lib/load-all-commands.js */
9-
static get description () {
10-
return 'Reduce duplication in the package tree'
11-
}
12-
13-
/* istanbul ignore next - see test/lib/load-all-commands.js */
14-
static get name () {
15-
return 'dedupe'
16-
}
17-
18-
/* istanbul ignore next - see test/lib/load-all-commands.js */
19-
static get params () {
20-
return [
21-
'global-style',
22-
'legacy-bundling',
23-
'strict-peer-deps',
24-
'package-lock',
25-
'omit',
26-
'ignore-scripts',
27-
'audit',
28-
'bin-links',
29-
'fund',
30-
'dry-run',
31-
...super.params,
32-
]
33-
}
8+
static description = 'Reduce duplication in the package tree'
9+
static name = 'dedupe'
10+
static params = [
11+
'global-style',
12+
'legacy-bundling',
13+
'strict-peer-deps',
14+
'package-lock',
15+
'omit',
16+
'ignore-scripts',
17+
'audit',
18+
'bin-links',
19+
'fund',
20+
'dry-run',
21+
...super.params,
22+
]
3423

3524
async exec (args) {
3625
if (this.npm.config.get('global')) {

0 commit comments

Comments
 (0)