diffpx 0.0.7 → 0.0.8

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 +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffpx",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "bin": {
5
5
  "diffpx": "bin/diffpx.js"
6
6
  },
package/src/runner.js CHANGED
@@ -52,8 +52,7 @@ async function runJob({diffpxKey, payload}) {
52
52
  barCompleteChar: '█',
53
53
  barIncompleteChar: '░',
54
54
  format: '{name} [{bar}] {percentage}% | {value}/{total}',
55
- noTTYOutput: true,
56
- notTTYSchedule: 500
55
+ stream: process.stdout
57
56
  }, cliProgress.Presets.shades_classic);
58
57
 
59
58
  const initialSnapshotsTotal = Array.isArray(payload?.snapshots) ? payload.snapshots.length : 1;
@@ -72,6 +71,8 @@ async function runJob({diffpxKey, payload}) {
72
71
  );
73
72
 
74
73
  let jobId = null;
74
+ let lastSnapshot = {total: Math.max(1, initialSnapshotsTotal), done: 0, label: getInitialSnapshotName(payload)};
75
+ let lastWidth = {total: Math.max(1, initialWidthsTotal), done: 0, label: getInitialWidthName(payload)};
75
76
 
76
77
  try {
77
78
  const diffpxUrl = process.env.DIFFPX_URL || '';
@@ -92,14 +93,20 @@ async function runJob({diffpxKey, payload}) {
92
93
  const snapTotal = p.snapshotsTotal > 0 ? p.snapshotsTotal : Math.max(1, initialSnapshotsTotal);
93
94
  const snapDone = p.snapshotsTotal > 0 ? Math.min(p.snapshotsDone, p.snapshotsTotal) : snapshotsBar.value;
94
95
 
95
- snapshotsBar.setTotal(snapTotal);
96
- snapshotsBar.update(snapDone, {name: snapshotLabel});
96
+ if (snapTotal !== lastSnapshot.total || snapDone !== lastSnapshot.done || snapshotLabel !== lastSnapshot.label) {
97
+ snapshotsBar.setTotal(snapTotal);
98
+ snapshotsBar.update(snapDone, {name: snapshotLabel});
99
+ lastSnapshot = {total: snapTotal, done: snapDone, label: snapshotLabel};
100
+ }
97
101
 
98
102
  const wTotal = p.widthsTotal > 0 ? p.widthsTotal : Math.max(1, initialWidthsTotal);
99
103
  const wDone = p.widthsTotal > 0 ? Math.min(p.widthsDone, p.widthsTotal) : widthsBar.value;
100
104
 
101
- widthsBar.setTotal(wTotal);
102
- widthsBar.update(wDone, {name: widthLabel});
105
+ if (wTotal !== lastWidth.total || wDone !== lastWidth.done || widthLabel !== lastWidth.label) {
106
+ widthsBar.setTotal(wTotal);
107
+ widthsBar.update(wDone, {name: widthLabel});
108
+ lastWidth = {total: wTotal, done: wDone, label: widthLabel};
109
+ }
103
110
  }
104
111
  });
105
112