@npmcli/config 7.2.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -8
- package/lib/definitions/definitions.js +33 -0
- package/lib/index.js +16 -16
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -55,20 +55,17 @@ The resulting hierarchy of configs:
|
|
|
55
55
|
|
|
56
56
|
```js
|
|
57
57
|
const Config = require('@npmcli/config')
|
|
58
|
-
|
|
59
|
-
const types = require('./config/types.js')
|
|
60
|
-
// default values for all the configs we know about
|
|
61
|
-
const defaults = require('./config/defaults.js')
|
|
62
|
-
// if you want -c to be short for --call and so on, define it here
|
|
63
|
-
const shorthands = require('./config/shorthands.js')
|
|
58
|
+
const { shorthands, definitions, flatten } = require('@npmcli/config/lib/definitions')
|
|
64
59
|
|
|
65
60
|
const conf = new Config({
|
|
66
61
|
// path to the npm module being run
|
|
67
62
|
npmPath: resolve(__dirname, '..'),
|
|
68
|
-
|
|
63
|
+
definitions,
|
|
69
64
|
shorthands,
|
|
70
|
-
|
|
65
|
+
flatten,
|
|
71
66
|
// optional, defaults to process.argv
|
|
67
|
+
// argv: [] <- if you are using this package in your own cli
|
|
68
|
+
// and dont want to have colliding argv
|
|
72
69
|
argv: process.argv,
|
|
73
70
|
// optional, defaults to process.env
|
|
74
71
|
env: process.env,
|
|
@@ -963,6 +963,7 @@ define('include-workspace-root', {
|
|
|
963
963
|
|
|
964
964
|
define('init-author-email', {
|
|
965
965
|
default: '',
|
|
966
|
+
hint: '<email>',
|
|
966
967
|
type: String,
|
|
967
968
|
description: `
|
|
968
969
|
The value \`npm init\` should use by default for the package author's
|
|
@@ -972,6 +973,7 @@ define('init-author-email', {
|
|
|
972
973
|
|
|
973
974
|
define('init-author-name', {
|
|
974
975
|
default: '',
|
|
976
|
+
hint: '<name>',
|
|
975
977
|
type: String,
|
|
976
978
|
description: `
|
|
977
979
|
The value \`npm init\` should use by default for the package author's name.
|
|
@@ -981,6 +983,7 @@ define('init-author-name', {
|
|
|
981
983
|
define('init-author-url', {
|
|
982
984
|
default: '',
|
|
983
985
|
type: ['', url],
|
|
986
|
+
hint: '<url>',
|
|
984
987
|
description: `
|
|
985
988
|
The value \`npm init\` should use by default for the package author's homepage.
|
|
986
989
|
`,
|
|
@@ -988,6 +991,7 @@ define('init-author-url', {
|
|
|
988
991
|
|
|
989
992
|
define('init-license', {
|
|
990
993
|
default: 'ISC',
|
|
994
|
+
hint: '<license>',
|
|
991
995
|
type: String,
|
|
992
996
|
description: `
|
|
993
997
|
The value \`npm init\` should use by default for the package license.
|
|
@@ -997,6 +1001,7 @@ define('init-license', {
|
|
|
997
1001
|
define('init-module', {
|
|
998
1002
|
default: '~/.npm-init.js',
|
|
999
1003
|
type: path,
|
|
1004
|
+
hint: '<module>',
|
|
1000
1005
|
description: `
|
|
1001
1006
|
A module that will be loaded by the \`npm init\` command. See the
|
|
1002
1007
|
documentation for the
|
|
@@ -1008,6 +1013,7 @@ define('init-module', {
|
|
|
1008
1013
|
define('init-version', {
|
|
1009
1014
|
default: '1.0.0',
|
|
1010
1015
|
type: semver,
|
|
1016
|
+
hint: '<version>',
|
|
1011
1017
|
description: `
|
|
1012
1018
|
The value that \`npm init\` should use by default for the package
|
|
1013
1019
|
version number, if not already set in package.json.
|
|
@@ -1207,6 +1213,33 @@ define('local-address', {
|
|
|
1207
1213
|
flatten,
|
|
1208
1214
|
})
|
|
1209
1215
|
|
|
1216
|
+
define('sbom-format', {
|
|
1217
|
+
default: null,
|
|
1218
|
+
type: [
|
|
1219
|
+
'cyclonedx',
|
|
1220
|
+
'spdx',
|
|
1221
|
+
],
|
|
1222
|
+
description: `
|
|
1223
|
+
SBOM format to use when generating SBOMs.
|
|
1224
|
+
`,
|
|
1225
|
+
flatten,
|
|
1226
|
+
})
|
|
1227
|
+
|
|
1228
|
+
define('sbom-type', {
|
|
1229
|
+
default: 'library',
|
|
1230
|
+
type: [
|
|
1231
|
+
'library',
|
|
1232
|
+
'application',
|
|
1233
|
+
'framework',
|
|
1234
|
+
],
|
|
1235
|
+
description: `
|
|
1236
|
+
The type of package described by the generated SBOM. For SPDX, this is the
|
|
1237
|
+
value for the \`primaryPackagePurpose\` fieled. For CycloneDX, this is the
|
|
1238
|
+
value for the \`type\` field.
|
|
1239
|
+
`,
|
|
1240
|
+
flatten,
|
|
1241
|
+
})
|
|
1242
|
+
|
|
1210
1243
|
define('location', {
|
|
1211
1244
|
default: 'user',
|
|
1212
1245
|
short: 'L',
|
package/lib/index.js
CHANGED
|
@@ -774,29 +774,29 @@ class Config {
|
|
|
774
774
|
await chmod(conf.source, mode)
|
|
775
775
|
}
|
|
776
776
|
|
|
777
|
-
clearCredentialsByURI (uri) {
|
|
777
|
+
clearCredentialsByURI (uri, level = 'user') {
|
|
778
778
|
const nerfed = nerfDart(uri)
|
|
779
779
|
const def = nerfDart(this.get('registry'))
|
|
780
780
|
if (def === nerfed) {
|
|
781
|
-
this.delete(`-authtoken`,
|
|
782
|
-
this.delete(`_authToken`,
|
|
783
|
-
this.delete(`_authtoken`,
|
|
784
|
-
this.delete(`_auth`,
|
|
785
|
-
this.delete(`_password`,
|
|
786
|
-
this.delete(`username`,
|
|
781
|
+
this.delete(`-authtoken`, level)
|
|
782
|
+
this.delete(`_authToken`, level)
|
|
783
|
+
this.delete(`_authtoken`, level)
|
|
784
|
+
this.delete(`_auth`, level)
|
|
785
|
+
this.delete(`_password`, level)
|
|
786
|
+
this.delete(`username`, level)
|
|
787
787
|
// de-nerf email if it's nerfed to the default registry
|
|
788
|
-
const email = this.get(`${nerfed}:email`,
|
|
788
|
+
const email = this.get(`${nerfed}:email`, level)
|
|
789
789
|
if (email) {
|
|
790
|
-
this.set('email', email,
|
|
790
|
+
this.set('email', email, level)
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
this.delete(`${nerfed}:_authToken`,
|
|
794
|
-
this.delete(`${nerfed}:_auth`,
|
|
795
|
-
this.delete(`${nerfed}:_password`,
|
|
796
|
-
this.delete(`${nerfed}:username`,
|
|
797
|
-
this.delete(`${nerfed}:email`,
|
|
798
|
-
this.delete(`${nerfed}:certfile`,
|
|
799
|
-
this.delete(`${nerfed}:keyfile`,
|
|
793
|
+
this.delete(`${nerfed}:_authToken`, level)
|
|
794
|
+
this.delete(`${nerfed}:_auth`, level)
|
|
795
|
+
this.delete(`${nerfed}:_password`, level)
|
|
796
|
+
this.delete(`${nerfed}:username`, level)
|
|
797
|
+
this.delete(`${nerfed}:email`, level)
|
|
798
|
+
this.delete(`${nerfed}:certfile`, level)
|
|
799
|
+
this.delete(`${nerfed}:keyfile`, level)
|
|
800
800
|
}
|
|
801
801
|
|
|
802
802
|
setCredentialsByURI (uri, { token, username, password, email, certfile, keyfile }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"snap": "tap",
|
|
20
20
|
"lint": "eslint \"**/*.js\"",
|
|
21
21
|
"postlint": "template-oss-check",
|
|
22
|
-
"lintfix": "
|
|
23
|
-
"posttest": "
|
|
22
|
+
"lintfix": "npm run lint -- --fix",
|
|
23
|
+
"posttest": "npm run lint",
|
|
24
24
|
"template-oss-apply": "template-oss-apply --force"
|
|
25
25
|
},
|
|
26
26
|
"tap": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@npmcli/eslint-config": "^4.0.0",
|
|
34
34
|
"@npmcli/mock-globals": "^1.0.0",
|
|
35
|
-
"@npmcli/template-oss": "4.
|
|
35
|
+
"@npmcli/template-oss": "4.19.0",
|
|
36
36
|
"tap": "^16.3.8"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
@@ -46,10 +46,12 @@
|
|
|
46
46
|
"walk-up-path": "^3.0.1"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": "^
|
|
49
|
+
"node": "^16.14.0 || >=18.0.0"
|
|
50
50
|
},
|
|
51
51
|
"templateOSS": {
|
|
52
52
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
53
|
-
"version": "4.
|
|
53
|
+
"version": "4.19.0",
|
|
54
|
+
"content": "../../scripts/template-oss/index.js",
|
|
55
|
+
"npm": "npm"
|
|
54
56
|
}
|
|
55
57
|
}
|