arcadible 1.0.25 → 1.0.26

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.
@@ -33,7 +33,7 @@ function build(command, { cwdPath, outputPath }) {
33
33
  return command
34
34
  ? execBuild(command, { cwdPath })
35
35
  .then(() => pathExists(outputPath))
36
- .then((exists) => (exists ? { path: outputPath } : { missing: outputPath }))
36
+ .then((exists) => exists ? { path: outputPath } : { missing: outputPath })
37
37
  : Promise.resolve(null);
38
38
  }
39
39
  // [function]
@@ -16,8 +16,20 @@ function formatValue(value, _opts, type) {
16
16
  return formatBytes(value);
17
17
  }
18
18
  // [function]
19
+ // the bar's width: what the terminal leaves beside the text at its widest
20
+ // (100%, and sizes such as 999.9 MB), from 10 to 40, so the numbers always
21
+ // show in a narrow terminal rather than being cut off at its edge.
22
+ export function barSize(format, columns = process.stderr.columns || 80) {
23
+ const text = format
24
+ .replace("{bar}", "")
25
+ .replace("{percentage}", "100")
26
+ .replace("{value}", "999.9 MB")
27
+ .replace("{total}", "999.9 MB");
28
+ return Math.max(10, Math.min(40, columns - text.length - 1));
29
+ }
30
+ // [function]
19
31
  function singleBar(format) {
20
- return new SingleBar({ format, formatValue, stream: process.stderr }, Presets.shades_classic);
32
+ return new SingleBar({ barsize: barSize(format), format, formatValue, stream: process.stderr }, Presets.shades_classic);
21
33
  }
22
34
  // [class]
23
35
  export class ProgressBar {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "license": "Apache-2.0",
45
45
  "name": "arcadible",
46
- "version": "1.0.25"
46
+ "version": "1.0.26"
47
47
  },
48
48
  "node_modules/@asamuzakjp/css-color": {
49
49
  "dependencies": {
@@ -3252,5 +3252,5 @@
3252
3252
  }
3253
3253
  },
3254
3254
  "requires": true,
3255
- "version": "1.0.25"
3255
+ "version": "1.0.26"
3256
3256
  }
package/package.json CHANGED
@@ -67,5 +67,5 @@
67
67
  "test": "tsc && npm run lint && node --test \"test/**/*.test.js\" \"test/**/*.test.mjs\""
68
68
  },
69
69
  "type": "module",
70
- "version": "1.0.25"
70
+ "version": "1.0.26"
71
71
  }