@npmcli/config 4.0.0 → 4.1.0
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/lib/env-replace.js +2 -2
- package/lib/index.js +9 -9
- package/lib/parse-field.js +1 -1
- package/package.json +15 -13
package/lib/env-replace.js
CHANGED
|
@@ -7,8 +7,8 @@ module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => {
|
|
|
7
7
|
|
|
8
8
|
// consume the escape chars that are relevant.
|
|
9
9
|
if (esc.length % 2) {
|
|
10
|
-
return orig.
|
|
10
|
+
return orig.slice((esc.length + 1) / 2)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
return (esc.
|
|
13
|
+
return (esc.slice(esc.length / 2)) + val
|
|
14
14
|
})
|
package/lib/index.js
CHANGED
|
@@ -366,7 +366,7 @@ class Config {
|
|
|
366
366
|
if (!/^npm_config_/i.test(envKey) || envVal === '') {
|
|
367
367
|
continue
|
|
368
368
|
}
|
|
369
|
-
const key = envKey.
|
|
369
|
+
const key = envKey.slice('npm_config_'.length)
|
|
370
370
|
.replace(/(?!^)_/g, '-') // don't replace _ at the start of the key
|
|
371
371
|
.toLowerCase()
|
|
372
372
|
conf[key] = envVal
|
|
@@ -396,13 +396,13 @@ class Config {
|
|
|
396
396
|
validate (where) {
|
|
397
397
|
if (!where) {
|
|
398
398
|
let valid = true
|
|
399
|
-
for (const [
|
|
399
|
+
for (const [entryWhere] of this.data.entries()) {
|
|
400
400
|
// no need to validate our defaults, we know they're fine
|
|
401
401
|
// cli was already validated when parsed the first time
|
|
402
|
-
if (
|
|
402
|
+
if (entryWhere === 'default' || entryWhere === 'builtin' || entryWhere === 'cli') {
|
|
403
403
|
continue
|
|
404
404
|
}
|
|
405
|
-
const ret = this.validate(
|
|
405
|
+
const ret = this.validate(entryWhere)
|
|
406
406
|
valid = valid && ret
|
|
407
407
|
}
|
|
408
408
|
return valid
|
|
@@ -506,10 +506,9 @@ class Config {
|
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
[_checkDeprecated] (key, where, obj, kv) {
|
|
509
|
-
// XXX
|
|
510
|
-
// An even more future npm version will make this an error.
|
|
509
|
+
// XXX(npm9+) make this throw an error
|
|
511
510
|
if (this.deprecated[key]) {
|
|
512
|
-
log.
|
|
511
|
+
log.warn('config', key, this.deprecated[key])
|
|
513
512
|
}
|
|
514
513
|
}
|
|
515
514
|
|
|
@@ -566,6 +565,7 @@ class Config {
|
|
|
566
565
|
}
|
|
567
566
|
|
|
568
567
|
const cliWorkspaces = this[_get]('workspaces', 'cli')
|
|
568
|
+
const isGlobal = this[_get]('global') || this[_get]('location') === 'global'
|
|
569
569
|
|
|
570
570
|
for (const p of walkUp(this.cwd)) {
|
|
571
571
|
const hasNodeModules = await stat(resolve(p, 'node_modules'))
|
|
@@ -579,8 +579,8 @@ class Config {
|
|
|
579
579
|
if (!this.localPrefix && (hasNodeModules || hasPackageJson)) {
|
|
580
580
|
this.localPrefix = p
|
|
581
581
|
|
|
582
|
-
// if workspaces are disabled, return now
|
|
583
|
-
if (cliWorkspaces === false) {
|
|
582
|
+
// if workspaces are disabled, or we're in global mode, return now
|
|
583
|
+
if (cliWorkspaces === false || isGlobal) {
|
|
584
584
|
return
|
|
585
585
|
}
|
|
586
586
|
|
package/lib/parse-field.js
CHANGED
|
@@ -56,7 +56,7 @@ const parseField = (f, key, opts, listElement = false) => {
|
|
|
56
56
|
if (isPath) {
|
|
57
57
|
const homePattern = platform === 'win32' ? /^~(\/|\\)/ : /^~\//
|
|
58
58
|
if (homePattern.test(f) && home) {
|
|
59
|
-
f = resolve(home, f.
|
|
59
|
+
f = resolve(home, f.slice(2))
|
|
60
60
|
} else {
|
|
61
61
|
f = resolve(f)
|
|
62
62
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"files": [
|
|
5
|
-
"bin",
|
|
6
|
-
"lib"
|
|
5
|
+
"bin/",
|
|
6
|
+
"lib/"
|
|
7
7
|
],
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"description": "Configuration management for the npm cli",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "
|
|
12
|
+
"url": "https://github.com/npm/config.git"
|
|
13
13
|
},
|
|
14
14
|
"author": "GitHub Inc.",
|
|
15
15
|
"license": "ISC",
|
|
@@ -19,23 +19,24 @@
|
|
|
19
19
|
"preversion": "npm test",
|
|
20
20
|
"postversion": "npm publish",
|
|
21
21
|
"prepublishOnly": "git push origin --follow-tags",
|
|
22
|
-
"lint": "eslint
|
|
23
|
-
"postlint": "
|
|
22
|
+
"lint": "eslint \"**/*.js\"",
|
|
23
|
+
"postlint": "template-oss-check",
|
|
24
24
|
"lintfix": "npm run lint -- --fix",
|
|
25
25
|
"posttest": "npm run lint",
|
|
26
|
-
"template-
|
|
26
|
+
"template-oss-apply": "template-oss-apply --force"
|
|
27
27
|
},
|
|
28
28
|
"tap": {
|
|
29
29
|
"check-coverage": true,
|
|
30
30
|
"coverage-map": "map.js"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@npmcli/
|
|
34
|
-
"
|
|
33
|
+
"@npmcli/eslint-config": "^3.0.1",
|
|
34
|
+
"@npmcli/template-oss": "3.3.2",
|
|
35
|
+
"tap": "^16.0.1"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@npmcli/map-workspaces": "^2.0.
|
|
38
|
-
"ini": "^
|
|
38
|
+
"@npmcli/map-workspaces": "^2.0.2",
|
|
39
|
+
"ini": "^3.0.0",
|
|
39
40
|
"mkdirp-infer-owner": "^2.0.0",
|
|
40
41
|
"nopt": "^5.0.0",
|
|
41
42
|
"proc-log": "^2.0.0",
|
|
@@ -44,9 +45,10 @@
|
|
|
44
45
|
"walk-up-path": "^1.0.0"
|
|
45
46
|
},
|
|
46
47
|
"engines": {
|
|
47
|
-
"node": "^12.13.0 || ^14.15.0 || >=16"
|
|
48
|
+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
|
48
49
|
},
|
|
49
50
|
"templateOSS": {
|
|
50
|
-
"
|
|
51
|
+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
52
|
+
"version": "3.3.2"
|
|
51
53
|
}
|
|
52
54
|
}
|