@npmcli/config 6.2.1 → 7.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.
@@ -64,7 +64,7 @@ const editor = process.env.EDITOR ||
64
64
  const shell = isWindows ? process.env.ComSpec || 'cmd'
65
65
  : process.env.SHELL || 'sh'
66
66
 
67
- const { tmpdir, networkInterfaces } = require('os')
67
+ const { networkInterfaces } = require('os')
68
68
  const getLocalAddresses = () => {
69
69
  try {
70
70
  return Object.values(networkInterfaces()).map(
@@ -429,24 +429,6 @@ define('cert', {
429
429
  flatten,
430
430
  })
431
431
 
432
- define('ci-name', {
433
- default: ciInfo.name ? ciInfo.name.toLowerCase().split(' ').join('-') : null,
434
- defaultDescription: `
435
- The name of the current CI system, or \`null\` when not on a known CI
436
- platform.
437
- `,
438
- type: [null, String],
439
- deprecated: `
440
- This config is deprecated and will not be changeable in future version of npm.
441
- `,
442
- description: `
443
- The name of a continuous integration system. If not set explicitly, npm
444
- will detect the current CI environment using the
445
- [\`ci-info\`](http://npm.im/ci-info) module.
446
- `,
447
- flatten,
448
- })
449
-
450
432
  define('cidr', {
451
433
  default: null,
452
434
  type: [null, String, Array],
@@ -2127,24 +2109,6 @@ define('timing', {
2127
2109
  `,
2128
2110
  })
2129
2111
 
2130
- define('tmp', {
2131
- default: tmpdir(),
2132
- defaultDescription: `
2133
- The value returned by the Node.js \`os.tmpdir()\` method
2134
- <https://nodejs.org/api/os.html#os_os_tmpdir>
2135
- `,
2136
- type: path,
2137
- deprecated: `
2138
- This setting is no longer used. npm stores temporary files in a special
2139
- location in the cache, and they are managed by
2140
- [\`cacache\`](http://npm.im/cacache).
2141
- `,
2142
- description: `
2143
- Historically, the location where temporary files were stored. No longer
2144
- relevant.
2145
- `,
2146
- })
2147
-
2148
2112
  define('umask', {
2149
2113
  default: 0,
2150
2114
  type: Umask,
@@ -2222,7 +2186,7 @@ define('user-agent', {
2222
2186
  `,
2223
2187
  flatten (key, obj, flatOptions) {
2224
2188
  const value = obj[key]
2225
- const ciName = obj['ci-name']
2189
+ const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null
2226
2190
  let inWorkspaces = false
2227
2191
  if (obj.workspaces || obj.workspace && obj.workspace.length) {
2228
2192
  inWorkspaces = true
@@ -25,9 +25,6 @@ const flatten = (obj, flat = {}) => {
25
25
  : /* istanbul ignore next - not configurable property */ undefined
26
26
  flat.nodeBin = process.env.NODE || process.execPath
27
27
 
28
- // XXX should this be sha512? is it even relevant?
29
- flat.hashAlgorithm = 'sha1'
30
-
31
28
  return flat
32
29
  }
33
30
 
package/lib/index.js CHANGED
@@ -322,10 +322,6 @@ class Config {
322
322
 
323
323
  const { data } = this.data.get('default')
324
324
 
325
- // the metrics-registry defaults to the current resolved value of
326
- // the registry, unless overridden somewhere else.
327
- settableGetter(data, 'metrics-registry', () => this.#get('registry'))
328
-
329
325
  // if the prefix is set on cli, env, or userconfig, then we need to
330
326
  // default the globalconfig file to that location, instead of the default
331
327
  // global prefix. It's weird that `npm get globalconfig --prefix=/foo`
@@ -614,7 +610,15 @@ class Config {
614
610
  process.emit('time', 'config:load:file:' + file)
615
611
  // only catch the error from readFile, not from the loadObject call
616
612
  await readFile(file, 'utf8').then(
617
- data => this.#loadObject(ini.parse(data), type, file),
613
+ data => {
614
+ const parsedConfig = ini.parse(data)
615
+ if (type === 'project' && parsedConfig.prefix) {
616
+ // Log error if prefix is mentioned in project .npmrc
617
+ /* eslint-disable-next-line max-len */
618
+ log.error('config', `prefix cannot be changed from project config: ${file}.`)
619
+ }
620
+ return this.#loadObject(parsedConfig, type, file)
621
+ },
618
622
  er => this.#loadObject(null, type, file, er)
619
623
  )
620
624
  process.emit('timeEnd', 'config:load:file:' + file)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/config",
3
- "version": "6.2.1",
3
+ "version": "7.0.1",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"
@@ -32,8 +32,8 @@
32
32
  "devDependencies": {
33
33
  "@npmcli/eslint-config": "^4.0.0",
34
34
  "@npmcli/mock-globals": "^1.0.0",
35
- "@npmcli/template-oss": "4.14.1",
36
- "tap": "^16.3.4"
35
+ "@npmcli/template-oss": "4.18.0",
36
+ "tap": "^16.3.8"
37
37
  },
38
38
  "dependencies": {
39
39
  "@npmcli/map-workspaces": "^3.0.2",
@@ -50,6 +50,6 @@
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.14.1"
53
+ "version": "4.18.0"
54
54
  }
55
55
  }