@npmcli/config 10.10.0 → 10.11.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.
@@ -178,9 +178,10 @@ const definitions = {
178
178
  type: Boolean,
179
179
  short: 'a',
180
180
  description: `
181
- When running \`npm outdated\` and \`npm ls\`, setting \`--all\` will show
182
- all outdated or installed packages, rather than only those directly
183
- depended upon by the current project.
181
+ Show or act on all packages, not just the ones your project directly
182
+ depends on. For \`npm outdated\` and \`npm ls\` this lists every outdated
183
+ or installed package. For \`npm approve-scripts\` and \`npm deny-scripts\`
184
+ it selects every package with pending install scripts.
184
185
  `,
185
186
  flatten,
186
187
  }),
@@ -339,6 +340,9 @@ const definitions = {
339
340
  Across sources, the standard precedence applies (cli > env > project >
340
341
  user > global), so a higher-priority source can always relax or
341
342
  override a lower-priority one.
343
+
344
+ Packages whose names match \`min-release-age-exclude\` are exempt from
345
+ this filter.
342
346
  `,
343
347
  flatten,
344
348
  }),
@@ -1470,6 +1474,9 @@ const definitions = {
1470
1474
  spawns a sub-process with \`--before\` while preparing a \`git:\` or
1471
1475
  \`github:\` dependency); when both apply, \`before\` wins within a
1472
1476
  single source and across sources the standard precedence rules apply.
1477
+
1478
+ Packages whose names match \`min-release-age-exclude\` are exempt from
1479
+ this filter.
1473
1480
  `,
1474
1481
  flatten: (key, obj, flatOptions) => {
1475
1482
  const age = obj['min-release-age']
@@ -1480,6 +1487,45 @@ const definitions = {
1480
1487
  }
1481
1488
  },
1482
1489
  }),
1490
+ 'min-release-age-exclude': new Definition('min-release-age-exclude', {
1491
+ default: [],
1492
+ hint: '<pkg|glob>',
1493
+ type: [Array, String],
1494
+ envExport: false,
1495
+ description: `
1496
+ A list of package names or \`minimatch\` glob patterns that are exempt
1497
+ from the \`min-release-age\` (and \`before\`) filter. A matching package
1498
+ can always resolve to its newest version, even when a release-age window
1499
+ is set.
1500
+
1501
+ For example, to apply a release-age window to third-party dependencies
1502
+ while letting internally maintained packages update immediately:
1503
+
1504
+ \`\`\`
1505
+ min-release-age=7
1506
+ min-release-age-exclude[]=@myorg/*
1507
+ min-release-age-exclude[]=my-internal-pkg
1508
+ \`\`\`
1509
+
1510
+ Only the named package is exempt; its own dependencies still follow the
1511
+ release-age policy unless they also match a pattern. Patterns match
1512
+ against the package name, so \`@myorg/*\` matches \`@myorg/shared-utils\`.
1513
+
1514
+ Excluding a package does not change which registry it is fetched from. You
1515
+ should own your private scope on the public registry so that nobody else
1516
+ can publish a package with the same name.
1517
+ `,
1518
+ flatten: (key, obj, flatOptions) => {
1519
+ // The config layer always resolves this to an array (nopt and .npmrc both
1520
+ // coerce `[Array, String]` to a list, default `[]`), so treat it as one.
1521
+ // A single value may still pack multiple names as a comma string.
1522
+ const list = obj[key]
1523
+ .flatMap(v => String(v).split(','))
1524
+ .map(v => v.trim())
1525
+ .filter(Boolean)
1526
+ flatOptions.minReleaseAgeExclude = [...new Set(list)]
1527
+ },
1528
+ }),
1483
1529
  'node-gyp': new Definition('node-gyp', {
1484
1530
  default: (() => {
1485
1531
  try {
@@ -2338,13 +2384,13 @@ const definitions = {
2338
2384
  If you ask npm to install a package and don't tell it a specific version,
2339
2385
  then it will install the specified tag.
2340
2386
 
2341
- It is the tag added to the package@version specified in the
2387
+ It is the tag added to the package@version specified in the
2342
2388
  \`npm dist-tag add\` command, if no explicit tag is given.
2343
2389
 
2344
2390
  When used by the \`npm diff\` command, this is the tag used to fetch the
2345
2391
  tarball that will be compared with the local files by default.
2346
-
2347
- If used in the \`npm publish\` command, this is the tag that will be
2392
+
2393
+ If used in the \`npm publish\` command, this is the tag that will be
2348
2394
  added to the package submitted to the registry.
2349
2395
  `,
2350
2396
  flatten (key, obj, flatOptions) {
@@ -2453,6 +2499,36 @@ const definitions = {
2453
2499
  flatten (key, obj, flatOptions) {
2454
2500
  const value = obj[key]
2455
2501
  const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null
2502
+ // A more specific sub-category for the detected CI, appended to the
2503
+ // ci token as `ci/{ci-name}/{sub-ci-name}` when present.
2504
+ let subCiName = null
2505
+ if (ciInfo.GITHUB_ACTIONS) {
2506
+ // Env vars can be absent, empty, or whitespace; normalize before use.
2507
+ const serverUrl = (process.env.GITHUB_SERVER_URL || '').trim()
2508
+ const runnerEnv = (process.env.RUNNER_ENVIRONMENT || '').trim()
2509
+ let serverHost = ''
2510
+ try {
2511
+ serverHost = new URL(serverUrl).hostname.toLowerCase()
2512
+ } catch {
2513
+ serverHost = ''
2514
+ }
2515
+ if (serverHost === 'github.com') {
2516
+ if (runnerEnv === 'github-hosted') {
2517
+ subCiName = 'dotcom-hosted'
2518
+ } else if (runnerEnv === 'self-hosted') {
2519
+ subCiName = 'dotcom-selfhosted'
2520
+ } else {
2521
+ subCiName = 'dotcom'
2522
+ }
2523
+ } else if (serverHost === 'ghe.com' || serverHost.endsWith('.ghe.com')) {
2524
+ subCiName = 'ghecom'
2525
+ } else if (serverHost) {
2526
+ subCiName = 'ghes'
2527
+ }
2528
+ }
2529
+ const ci = ciName
2530
+ ? `ci/${ciName}${subCiName ? `/${subCiName}` : ''}`
2531
+ : ''
2456
2532
  let inWorkspaces = false
2457
2533
  if (obj.workspaces || obj.workspace && obj.workspace.length) {
2458
2534
  inWorkspaces = true
@@ -2463,7 +2539,7 @@ const definitions = {
2463
2539
  .replace(/\{platform\}/gi, process.platform)
2464
2540
  .replace(/\{arch\}/gi, process.arch)
2465
2541
  .replace(/\{workspaces\}/gi, inWorkspaces)
2466
- .replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
2542
+ .replace(/\{ci\}/gi, ci)
2467
2543
  .trim()
2468
2544
 
2469
2545
  // We can't clobber the original or else subsequent flattening will fail
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/config",
3
- "version": "10.10.0",
3
+ "version": "10.11.0",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"