@atlaspack/reporter-cli 2.16.2-noselfbuild-71fe9e998.0 → 2.16.2-noselfbuild-b8f24f3f8.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.
@@ -5,6 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports._report = _report;
7
7
  exports.default = void 0;
8
+ function _featureFlags() {
9
+ const data = require("@atlaspack/feature-flags");
10
+ _featureFlags = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
8
15
  function _plugin() {
9
16
  const data = require("@atlaspack/plugin");
10
17
  _plugin = function () {
@@ -48,6 +55,25 @@ const seenPhases = new Set();
48
55
  const seenPhasesGen = new Set();
49
56
  let phaseStartTimes = {};
50
57
  let pendingIncrementalBuild = false;
58
+ let packagingProgress = 0;
59
+ let updatePackageProgress = (completeBundles, totalBundles) => {
60
+ let updateThreshold = 0;
61
+ if (totalBundles > 5000) {
62
+ // If more than 5000 bundles, update every 5%
63
+ updateThreshold = 5;
64
+ } else if (totalBundles > 1000) {
65
+ // If more than 1000 bundles, update every 10%
66
+ updateThreshold = 10;
67
+ } else {
68
+ // othewise update every 25%
69
+ updateThreshold = 25;
70
+ }
71
+ let percent = Math.floor(completeBundles / totalBundles * 100);
72
+ if (percent - packagingProgress >= updateThreshold) {
73
+ packagingProgress = percent;
74
+ (0, _render.updateSpinner)((0, _utils().getPackageProgressMessage)(completeBundles, totalBundles));
75
+ }
76
+ };
51
77
  let statusThrottle = (0, _utils().throttle)(message => {
52
78
  (0, _render.updateSpinner)(message);
53
79
  }, THROTTLE_DELAY);
@@ -94,7 +120,9 @@ async function _report(event, options) {
94
120
  (0, _render.updateSpinner)('Building...');
95
121
  } else if (event.phase == 'bundling' && !seenPhases.has('bundling')) {
96
122
  (0, _render.updateSpinner)('Bundling...');
97
- } else if ((event.phase == 'packaging' || event.phase == 'optimizing') && !seenPhases.has('packaging') && !seenPhases.has('optimizing')) {
123
+ } else if (event.phase === 'packagingAndOptimizing') {
124
+ updatePackageProgress(event.completeBundles, event.totalBundles);
125
+ } else if (!(0, _featureFlags().getFeatureFlag)('cliProgressReportingImprovements') && (event.phase == 'packaging' || event.phase == 'optimizing') && !seenPhases.has('packaging') && !seenPhases.has('optimizing')) {
98
126
  (0, _render.updateSpinner)('Packaging & Optimizing...');
99
127
  }
100
128
  seenPhases.add(event.phase);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-cli",
3
- "version": "2.16.2-noselfbuild-71fe9e998.0",
3
+ "version": "2.16.2-noselfbuild-b8f24f3f8.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@atlaspack/plugin": "2.14.18-noselfbuild-71fe9e998.0",
30
- "@atlaspack/types": "2.15.8-noselfbuild-71fe9e998.0",
31
- "@atlaspack/utils": "2.16.2-noselfbuild-71fe9e998.0",
29
+ "@atlaspack/plugin": "2.14.18-noselfbuild-b8f24f3f8.0",
30
+ "@atlaspack/types": "2.15.8-noselfbuild-b8f24f3f8.0",
31
+ "@atlaspack/utils": "2.16.2-noselfbuild-b8f24f3f8.0",
32
32
  "chalk": "^4.1.0",
33
33
  "filesize": "^6.1.0",
34
34
  "nullthrows": "^1.1.1",
@@ -38,8 +38,8 @@
38
38
  "wrap-ansi": "^7.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@atlaspack/feature-flags": "2.18.5-noselfbuild-71fe9e998.0"
41
+ "@atlaspack/feature-flags": "2.18.5-noselfbuild-b8f24f3f8.0"
42
42
  },
43
43
  "type": "commonjs",
44
- "gitHead": "71fe9e998256a417234fd5f388a7428aa0d6fd60"
44
+ "gitHead": "b8f24f3f82b06cb57291e1fa02e9655350bb1ac2"
45
45
  }
@@ -3,9 +3,11 @@ import type {ReporterEvent, PluginOptions} from '@atlaspack/types';
3
3
  import type {Diagnostic} from '@atlaspack/diagnostic';
4
4
  import type {Color} from 'chalk';
5
5
 
6
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
6
7
  import {Reporter} from '@atlaspack/plugin';
7
8
  import {
8
9
  getProgressMessage,
10
+ getPackageProgressMessage,
9
11
  prettifyTime,
10
12
  prettyDiagnostic,
11
13
  throttle,
@@ -35,6 +37,27 @@ const seenPhasesGen = new Set();
35
37
 
36
38
  let phaseStartTimes = {};
37
39
  let pendingIncrementalBuild = false;
40
+ let packagingProgress = 0;
41
+
42
+ let updatePackageProgress = (completeBundles: number, totalBundles: number) => {
43
+ let updateThreshold = 0;
44
+ if (totalBundles > 5000) {
45
+ // If more than 5000 bundles, update every 5%
46
+ updateThreshold = 5;
47
+ } else if (totalBundles > 1000) {
48
+ // If more than 1000 bundles, update every 10%
49
+ updateThreshold = 10;
50
+ } else {
51
+ // othewise update every 25%
52
+ updateThreshold = 25;
53
+ }
54
+
55
+ let percent = Math.floor((completeBundles / totalBundles) * 100);
56
+ if (percent - packagingProgress >= updateThreshold) {
57
+ packagingProgress = percent;
58
+ updateSpinner(getPackageProgressMessage(completeBundles, totalBundles));
59
+ }
60
+ };
38
61
 
39
62
  let statusThrottle = throttle((message: string) => {
40
63
  updateSpinner(message);
@@ -100,7 +123,10 @@ export async function _report(
100
123
  updateSpinner('Building...');
101
124
  } else if (event.phase == 'bundling' && !seenPhases.has('bundling')) {
102
125
  updateSpinner('Bundling...');
126
+ } else if (event.phase === 'packagingAndOptimizing') {
127
+ updatePackageProgress(event.completeBundles, event.totalBundles);
103
128
  } else if (
129
+ !getFeatureFlag('cliProgressReportingImprovements') &&
104
130
  (event.phase == 'packaging' || event.phase == 'optimizing') &&
105
131
  !seenPhases.has('packaging') &&
106
132
  !seenPhases.has('optimizing')