@npmcli/config 7.0.1 → 7.2.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/definitions/definitions.js +22 -0
- package/lib/definitions/index.js +0 -7
- package/lib/index.js +3 -0
- package/lib/set-envs.js +1 -4
- package/package.json +1 -1
|
@@ -472,6 +472,28 @@ define('commit-hooks', {
|
|
|
472
472
|
flatten,
|
|
473
473
|
})
|
|
474
474
|
|
|
475
|
+
define('cpu', {
|
|
476
|
+
default: null,
|
|
477
|
+
type: [null, String],
|
|
478
|
+
description: `
|
|
479
|
+
Override CPU architecture of native modules to install.
|
|
480
|
+
Acceptable values are same as \`cpu\` field of package.json,
|
|
481
|
+
which comes from \`process.arch\`.
|
|
482
|
+
`,
|
|
483
|
+
flatten,
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
define('os', {
|
|
487
|
+
default: null,
|
|
488
|
+
type: [null, String],
|
|
489
|
+
description: `
|
|
490
|
+
Override OS of native modules to install.
|
|
491
|
+
Acceptable values are same as \`os\` field of package.json,
|
|
492
|
+
which comes from \`process.platform\`.
|
|
493
|
+
`,
|
|
494
|
+
flatten,
|
|
495
|
+
})
|
|
496
|
+
|
|
475
497
|
define('depth', {
|
|
476
498
|
default: null,
|
|
477
499
|
defaultDescription: `
|
package/lib/definitions/index.js
CHANGED
|
@@ -18,13 +18,6 @@ const flatten = (obj, flat = {}) => {
|
|
|
18
18
|
flat[key] = val
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
// XXX make this the bin/npm-cli.js file explicitly instead
|
|
23
|
-
// otherwise using npm programmatically is a bit of a pain.
|
|
24
|
-
flat.npmBin = require.main ? require.main.filename
|
|
25
|
-
: /* istanbul ignore next - not configurable property */ undefined
|
|
26
|
-
flat.nodeBin = process.env.NODE || process.execPath
|
|
27
|
-
|
|
28
21
|
return flat
|
|
29
22
|
}
|
|
30
23
|
|
package/lib/index.js
CHANGED
|
@@ -115,6 +115,7 @@ class Config {
|
|
|
115
115
|
this.defaults = defaults
|
|
116
116
|
|
|
117
117
|
this.npmPath = npmPath
|
|
118
|
+
this.npmBin = join(this.npmPath, 'bin/npm-cli.js')
|
|
118
119
|
this.argv = argv
|
|
119
120
|
this.env = env
|
|
120
121
|
this.execPath = execPath
|
|
@@ -231,6 +232,8 @@ class Config {
|
|
|
231
232
|
for (const { data } of this.data.values()) {
|
|
232
233
|
this.#flatten(data, this.#flatOptions)
|
|
233
234
|
}
|
|
235
|
+
this.#flatOptions.nodeBin = this.execPath
|
|
236
|
+
this.#flatOptions.npmBin = this.npmBin
|
|
234
237
|
process.emit('timeEnd', 'config:load:flatten')
|
|
235
238
|
|
|
236
239
|
return this.#flatOptions
|
package/lib/set-envs.js
CHANGED
|
@@ -101,10 +101,7 @@ const setEnvs = (config) => {
|
|
|
101
101
|
if (cliConf['node-options']) {
|
|
102
102
|
env.NODE_OPTIONS = cliConf['node-options']
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
if (require.main && require.main.filename) {
|
|
106
|
-
env.npm_execpath = require.main.filename
|
|
107
|
-
}
|
|
104
|
+
env.npm_execpath = config.npmBin
|
|
108
105
|
env.NODE = env.npm_node_execpath = config.execPath
|
|
109
106
|
}
|
|
110
107
|
|