@npmcli/config 10.3.0 → 10.4.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.
@@ -230,12 +230,13 @@ const definitions = {
230
230
  }),
231
231
  before: new Definition('before', {
232
232
  default: null,
233
+ hint: '<date>',
233
234
  type: [null, Date],
234
235
  description: `
235
236
  If passed to \`npm install\`, will rebuild the npm tree such that only
236
- versions that were available **on or before** the \`--before\` time get
237
- installed. If there's no versions available for the current set of
238
- direct dependencies, the command will error.
237
+ versions that were available **on or before** the given date are
238
+ installed. If there are no versions available for the current set of
239
+ dependencies, the command will error.
239
240
 
240
241
  If the requested version is a \`dist-tag\` and the given tag does not
241
242
  pass the \`--before\` filter, the most recent version less than or equal
@@ -260,7 +261,7 @@ const definitions = {
260
261
  browser: new Definition('browser', {
261
262
  default: null,
262
263
  defaultDescription: `
263
- OS X: \`"open"\`, Windows: \`"start"\`, Others: \`"xdg-open"\`
264
+ macOS: \`"open"\`, Windows: \`"start"\`, Others: \`"xdg-open"\`
264
265
  `,
265
266
  type: [null, Boolean, String],
266
267
  description: `
@@ -1571,9 +1572,9 @@ const definitions = {
1571
1572
  },
1572
1573
  }),
1573
1574
  progress: new Definition('progress', {
1574
- default: !ciInfo.isCI,
1575
+ default: !(ciInfo.isCI || !process.stderr.isTTY || !process.stdout.isTTY || process.env.TERM === 'dumb'),
1575
1576
  defaultDescription: `
1576
- \`true\` unless running in a known CI system
1577
+ \`true\` when not in CI and both stderr and stdout are TTYs and not in a dumb terminal
1577
1578
  `,
1578
1579
  type: Boolean,
1579
1580
  description: `
@@ -1583,11 +1584,8 @@ const definitions = {
1583
1584
  Set to \`false\` to suppress the progress bar.
1584
1585
  `,
1585
1586
  flatten (key, obj, flatOptions) {
1586
- flatOptions.progress = !obj.progress ? false
1587
- // progress is only written to stderr but we disable it unless stdout is a tty
1588
- // also. This prevents the progress from appearing when piping output to another
1589
- // command which doesn't break anything, but does look very odd to users.
1590
- : !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb'
1587
+ // Only show progress if explicitly enabled AND we have proper TTY environment
1588
+ flatOptions.progress = !!obj.progress && !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb'
1591
1589
  },
1592
1590
  }),
1593
1591
  provenance: new Definition('provenance', {
@@ -1,9 +1,11 @@
1
1
  // replace any ${ENV} values with the appropriate environ.
2
+ // optional "?" modifier can be used like this: ${ENV?} so in case of the variable being not defined, it evaluates into empty string.
2
3
 
3
- const envExpr = /(?<!\\)(\\*)\$\{([^${}]+)\}/g
4
+ const envExpr = /(?<!\\)(\\*)\$\{([^${}?]+)(\?)?\}/g
4
5
 
5
- module.exports = (f, env) => f.replace(envExpr, (orig, esc, name) => {
6
- const val = env[name] !== undefined ? env[name] : `$\{${name}}`
6
+ module.exports = (f, env) => f.replace(envExpr, (orig, esc, name, modifier) => {
7
+ const fallback = modifier === '?' ? '' : `$\{${name}}`
8
+ const val = env[name] !== undefined ? env[name] : fallback
7
9
 
8
10
  // consume the escape chars that are relevant.
9
11
  if (esc.length % 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/config",
3
- "version": "10.3.0",
3
+ "version": "10.4.0",
4
4
  "files": [
5
5
  "bin/",
6
6
  "lib/"
@@ -33,7 +33,7 @@
33
33
  "devDependencies": {
34
34
  "@npmcli/eslint-config": "^5.0.1",
35
35
  "@npmcli/mock-globals": "^1.0.0",
36
- "@npmcli/template-oss": "4.23.6",
36
+ "@npmcli/template-oss": "4.24.4",
37
37
  "tap": "^16.3.8"
38
38
  },
39
39
  "dependencies": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "templateOSS": {
53
53
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
54
- "version": "4.23.6",
54
+ "version": "4.24.4",
55
55
  "content": "../../scripts/template-oss/index.js"
56
56
  }
57
57
  }