@npmcli/config 7.1.0 → 8.0.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.
@@ -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: `
@@ -941,6 +963,7 @@ define('include-workspace-root', {
941
963
 
942
964
  define('init-author-email', {
943
965
  default: '',
966
+ hint: '<email>',
944
967
  type: String,
945
968
  description: `
946
969
  The value \`npm init\` should use by default for the package author's
@@ -950,6 +973,7 @@ define('init-author-email', {
950
973
 
951
974
  define('init-author-name', {
952
975
  default: '',
976
+ hint: '<name>',
953
977
  type: String,
954
978
  description: `
955
979
  The value \`npm init\` should use by default for the package author's name.
@@ -959,6 +983,7 @@ define('init-author-name', {
959
983
  define('init-author-url', {
960
984
  default: '',
961
985
  type: ['', url],
986
+ hint: '<url>',
962
987
  description: `
963
988
  The value \`npm init\` should use by default for the package author's homepage.
964
989
  `,
@@ -966,6 +991,7 @@ define('init-author-url', {
966
991
 
967
992
  define('init-license', {
968
993
  default: 'ISC',
994
+ hint: '<license>',
969
995
  type: String,
970
996
  description: `
971
997
  The value \`npm init\` should use by default for the package license.
@@ -975,6 +1001,7 @@ define('init-license', {
975
1001
  define('init-module', {
976
1002
  default: '~/.npm-init.js',
977
1003
  type: path,
1004
+ hint: '<module>',
978
1005
  description: `
979
1006
  A module that will be loaded by the \`npm init\` command. See the
980
1007
  documentation for the
@@ -986,6 +1013,7 @@ define('init-module', {
986
1013
  define('init-version', {
987
1014
  default: '1.0.0',
988
1015
  type: semver,
1016
+ hint: '<version>',
989
1017
  description: `
990
1018
  The value that \`npm init\` should use by default for the package
991
1019
  version number, if not already set in package.json.
@@ -1185,6 +1213,33 @@ define('local-address', {
1185
1213
  flatten,
1186
1214
  })
1187
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
+
1188
1243
  define('location', {
1189
1244
  default: 'user',
1190
1245
  short: 'L',
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/config",
3
- "version": "7.1.0",
3
+ "version": "8.0.0",
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": "node ../.. run lint -- --fix",
23
- "posttest": "node ../.. run lint",
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.18.0",
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": "^14.17.0 || ^16.13.0 || >=18.0.0"
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.18.0"
53
+ "version": "4.19.0",
54
+ "content": "../../scripts/template-oss/index.js",
55
+ "npm": "npm"
54
56
  }
55
57
  }