+20
-17
lines changedFilter options
+20
-17
lines changed Original file line number Diff line number Diff line change
@@ -4,23 +4,11 @@ const { spawn } = require('node:child_process')
4
4
const { EOL } = require('node:os')
5
5
const localeCompare = require('@isaacs/string-locale-compare')('en')
6
6
const pkgJson = require('@npmcli/package-json')
7
-
const { defaults, definitions } = require('@npmcli/config/lib/definitions')
7
+
const { defaults, definitions, nerfDarts } = require('@npmcli/config/lib/definitions')
8
8
const { log, output } = require('proc-log')
9
9
const BaseCommand = require('../base-cmd.js')
10
10
const { redact } = require('@npmcli/redact')
11
11
12
-
// These are the configs that we can nerf-dart. Not all of them currently even
13
-
// *have* config definitions so we have to explicitly validate them here.
14
-
// This is used to validate during "npm config set"
15
-
const nerfDarts = [
16
-
'_auth',
17
-
'_authToken',
18
-
'_password',
19
-
'certfile',
20
-
'email',
21
-
'keyfile',
22
-
'username',
23
-
]
24
12
// These are the config values to swap with "protected". It does not catch
25
13
// every single sensitive thing a user may put in the npmrc file but it gets
26
14
// the common ones. This is distinct from nerfDarts because that is used to
@@ -125,7 +113,7 @@ class Config extends BaseCommand {
125
113
const action = argv[2]
126
114
switch (action) {
127
115
case 'set':
128
-
// todo: complete with valid values, if possible.
116
+
// TODO: complete with valid values, if possible.
129
117
if (argv.length > 3) {
130
118
return []
131
119
}
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ const { resolve, dirname, join } = require('node:path')
2
2
const Config = require('@npmcli/config')
3
3
const which = require('which')
4
4
const fs = require('node:fs/promises')
5
-
const { definitions, flatten, shorthands } = require('@npmcli/config/lib/definitions')
5
+
const { definitions, flatten, nerfDarts, shorthands } = require('@npmcli/config/lib/definitions')
6
6
const usage = require('./utils/npm-usage.js')
7
7
const LogFile = require('./utils/log-file.js')
8
8
const Timers = require('./utils/timers.js')
@@ -68,6 +68,7 @@ class Npm {
68
68
npmPath: this.#npmRoot,
69
69
definitions,
70
70
flatten,
71
+
nerfDarts,
71
72
shorthands,
72
73
argv: [...process.argv, ...argv],
73
74
excludeNpmCwd,
Original file line number Diff line number Diff line change
@@ -58,9 +58,22 @@ const shorthands = {
58
58
...definitionProps.shorthands,
59
59
}
60
60
61
+
// These are the configs that we can nerf-dart. Only _auth even has a config definition so we have to explicitly validate them here.
62
+
// This is used to validate during "npm config set" and to not warn on loading unknown configs when we see these.
63
+
const nerfDarts = [
64
+
'_auth', // Has a config
65
+
'_authToken', // Does not have a config
66
+
'_password', // Does not have a config
67
+
'certfile', // Does not have a config
68
+
'email', // Does not have a config
69
+
'keyfile', // Does not have a config
70
+
'username', // Does not have a config
71
+
]
72
+
61
73
module.exports = {
62
74
defaults: definitionProps.defaults,
63
75
definitions,
64
76
flatten,
77
+
nerfDarts,
65
78
shorthands,
66
79
}
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@ class Config {
61
61
definitions,
62
62
shorthands,
63
63
flatten,
64
+
nerfDarts = [],
64
65
npmPath,
65
66
66
67
// options just to override in tests, mostly
@@ -71,8 +72,9 @@ class Config {
71
72
cwd = process.cwd(),
72
73
excludeNpmCwd = false,
73
74
}) {
74
-
// turn the definitions into nopt's weirdo syntax
75
+
this.nerfDarts = nerfDarts
75
76
this.definitions = definitions
77
+
// turn the definitions into nopt's weirdo syntax
76
78
const types = {}
77
79
const defaults = {}
78
80
this.deprecated = {}
@@ -572,7 +574,6 @@ class Config {
572
574
}
573
575
574
576
#checkDeprecated (key) {
575
-
// XXX(npm9+) make this throw an error
576
577
if (this.deprecated[key]) {
577
578
log.warn('config', key, this.deprecated[key])
578
579
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4