@npmcli/config 5.0.0 → 6.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/lib/index.js +9 -23
- package/package.json +7 -8
package/lib/index.js
CHANGED
|
@@ -2,26 +2,20 @@
|
|
|
2
2
|
const walkUp = require('walk-up-path')
|
|
3
3
|
const ini = require('ini')
|
|
4
4
|
const nopt = require('nopt')
|
|
5
|
-
const mkdirp = require('mkdirp-infer-owner')
|
|
6
5
|
const mapWorkspaces = require('@npmcli/map-workspaces')
|
|
7
6
|
const rpj = require('read-package-json-fast')
|
|
8
7
|
const log = require('proc-log')
|
|
9
8
|
|
|
10
|
-
/* istanbul ignore next */
|
|
11
|
-
const myUid = process.getuid && process.getuid()
|
|
12
|
-
/* istanbul ignore next */
|
|
13
|
-
const myGid = process.getgid && process.getgid()
|
|
14
|
-
|
|
15
9
|
const { resolve, dirname, join } = require('path')
|
|
16
10
|
const { homedir } = require('os')
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
const {
|
|
12
|
+
readFile,
|
|
13
|
+
writeFile,
|
|
14
|
+
chmod,
|
|
15
|
+
unlink,
|
|
16
|
+
stat,
|
|
17
|
+
mkdir,
|
|
18
|
+
} = require('fs/promises')
|
|
25
19
|
|
|
26
20
|
const hasOwnProperty = (obj, key) =>
|
|
27
21
|
Object.prototype.hasOwnProperty.call(obj, key)
|
|
@@ -731,16 +725,8 @@ class Config {
|
|
|
731
725
|
return
|
|
732
726
|
}
|
|
733
727
|
const dir = dirname(conf.source)
|
|
734
|
-
await
|
|
728
|
+
await mkdir(dir, { recursive: true })
|
|
735
729
|
await writeFile(conf.source, iniData, 'utf8')
|
|
736
|
-
// don't leave a root-owned config file lying around
|
|
737
|
-
/* istanbul ignore if - this is best-effort and a pita to test */
|
|
738
|
-
if (myUid === 0) {
|
|
739
|
-
const st = await stat(dir).catch(() => null)
|
|
740
|
-
if (st && (st.uid !== myUid || st.gid !== myGid)) {
|
|
741
|
-
await chown(conf.source, st.uid, st.gid).catch(() => {})
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
730
|
const mode = where === 'user' ? 0o600 : 0o666
|
|
745
731
|
await chmod(conf.source, mode)
|
|
746
732
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -31,17 +31,16 @@
|
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@npmcli/eslint-config": "^
|
|
35
|
-
"@npmcli/template-oss": "4.5.
|
|
34
|
+
"@npmcli/eslint-config": "^4.0.0",
|
|
35
|
+
"@npmcli/template-oss": "4.5.1",
|
|
36
36
|
"tap": "^16.0.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@npmcli/map-workspaces": "^
|
|
39
|
+
"@npmcli/map-workspaces": "^3.0.0",
|
|
40
40
|
"ini": "^3.0.0",
|
|
41
|
-
"mkdirp-infer-owner": "^2.0.0",
|
|
42
41
|
"nopt": "^6.0.0",
|
|
43
|
-
"proc-log": "^
|
|
44
|
-
"read-package-json-fast": "^
|
|
42
|
+
"proc-log": "^3.0.0",
|
|
43
|
+
"read-package-json-fast": "^3.0.0",
|
|
45
44
|
"semver": "^7.3.5",
|
|
46
45
|
"walk-up-path": "^1.0.0"
|
|
47
46
|
},
|
|
@@ -50,6 +49,6 @@
|
|
|
50
49
|
},
|
|
51
50
|
"templateOSS": {
|
|
52
51
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
53
|
-
"version": "4.5.
|
|
52
|
+
"version": "4.5.1"
|
|
54
53
|
}
|
|
55
54
|
}
|