diffpx 0.0.5 → 0.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runner.js +10 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffpx",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "bin": {
5
5
  "diffpx": "bin/diffpx.js"
6
6
  },
package/src/runner.js CHANGED
@@ -46,19 +46,19 @@ function getProgress(status) {
46
46
  }
47
47
 
48
48
  async function runJob({diffpxKey, payload}) {
49
- const initialSnapshotsTotal = Array.isArray(payload?.snapshots) ? payload.snapshots.length : 1;
50
- const initialWidthsTotal = Array.isArray(payload?.settings?.width) ? payload.settings.width.length : 1;
51
- const isTTY = !!process.stdout.isTTY;
52
49
  const multiBar = new cliProgress.MultiBar({
53
50
  clearOnComplete: false,
54
51
  hideCursor: true,
55
52
  barCompleteChar: '█',
56
53
  barIncompleteChar: '░',
57
54
  format: '{name} [{bar}] {percentage}% | {value}/{total}',
58
- noTTYOutput: !isTTY,
59
- notTTYSchedule: 1000
55
+ noTTYOutput: true,
56
+ notTTYSchedule: 500
60
57
  }, cliProgress.Presets.shades_classic);
61
58
 
59
+ const initialSnapshotsTotal = Array.isArray(payload?.snapshots) ? payload.snapshots.length : 1;
60
+ const initialWidthsTotal = Array.isArray(payload?.settings?.width) ? payload.settings.width.length : 1;
61
+
62
62
  const snapshotsBar = multiBar.create(
63
63
  Math.max(1, initialSnapshotsTotal),
64
64
  0,
@@ -90,17 +90,14 @@ async function runJob({diffpxKey, payload}) {
90
90
  const widthLabel = normalizePxLabel(p.widthLabel) || getInitialWidthName(payload);
91
91
 
92
92
  const snapTotal = p.snapshotsTotal > 0 ? p.snapshotsTotal : Math.max(1, initialSnapshotsTotal);
93
- const snapDone = p.snapshotsTotal > 0
94
- ? Math.min(p.snapshotsDone, p.snapshotsTotal)
95
- : (snapshotsBar ? snapshotsBar.value : 0);
96
-
97
- const wTotal = p.widthsTotal > 0 ? p.widthsTotal : Math.max(1, initialWidthsTotal);
98
- const wDone = p.widthsTotal > 0
99
- ? Math.min(p.widthsDone, p.widthsTotal)
100
- : widthsBar.value;
93
+ const snapDone = p.snapshotsTotal > 0 ? Math.min(p.snapshotsDone, p.snapshotsTotal) : snapshotsBar.value;
101
94
 
102
95
  snapshotsBar.setTotal(snapTotal);
103
96
  snapshotsBar.update(snapDone, {name: snapshotLabel});
97
+
98
+ const wTotal = p.widthsTotal > 0 ? p.widthsTotal : Math.max(1, initialWidthsTotal);
99
+ const wDone = p.widthsTotal > 0 ? Math.min(p.widthsDone, p.widthsTotal) : widthsBar.value;
100
+
104
101
  widthsBar.setTotal(wTotal);
105
102
  widthsBar.update(wDone, {name: widthLabel});
106
103
  }