@atlaspack/reporter-cli 2.15.1-canary.12 → 2.15.1-canary.120

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-cli",
3
- "version": "2.15.1-canary.12+143753ba0",
3
+ "version": "2.15.1-canary.120+22e54c6bd",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,14 +26,14 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@atlaspack/plugin": "2.14.5-canary.12+143753ba0",
30
- "@atlaspack/types": "2.14.5-canary.12+143753ba0",
31
- "@atlaspack/utils": "2.14.5-canary.12+143753ba0",
29
+ "@atlaspack/plugin": "2.14.5-canary.120+22e54c6bd",
30
+ "@atlaspack/types": "2.14.5-canary.120+22e54c6bd",
31
+ "@atlaspack/utils": "2.14.5-canary.120+22e54c6bd",
32
32
  "chalk": "^4.1.0",
33
33
  "term-size": "^2.2.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@atlaspack/feature-flags": "2.14.1-canary.80+143753ba0",
36
+ "@atlaspack/feature-flags": "2.14.1-canary.188+22e54c6bd",
37
37
  "filesize": "^6.1.0",
38
38
  "nullthrows": "^1.1.1",
39
39
  "ora": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "wrap-ansi": "^7.0.0"
42
42
  },
43
43
  "type": "commonjs",
44
- "gitHead": "143753ba049078d59fbf1a8880f4c4caf2320311"
44
+ "gitHead": "22e54c6bd98f6c1aa1c74dffb7f54b97e0392740"
45
45
  }
@@ -3,12 +3,15 @@ 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,
14
+ debugTools,
12
15
  } from '@atlaspack/utils';
13
16
  import chalk from 'chalk';
14
17
 
@@ -34,6 +37,27 @@ const seenPhasesGen = new Set();
34
37
 
35
38
  let phaseStartTimes = {};
36
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
+ };
37
61
 
38
62
  let statusThrottle = throttle((message: string) => {
39
63
  updateSpinner(message);
@@ -99,7 +123,10 @@ export async function _report(
99
123
  updateSpinner('Building...');
100
124
  } else if (event.phase == 'bundling' && !seenPhases.has('bundling')) {
101
125
  updateSpinner('Bundling...');
126
+ } else if (event.phase === 'packagingAndOptimizing') {
127
+ updatePackageProgress(event.completeBundles, event.totalBundles);
102
128
  } else if (
129
+ !getFeatureFlag('cliProgressReportingImprovements') &&
103
130
  (event.phase == 'packaging' || event.phase == 'optimizing') &&
104
131
  !seenPhases.has('packaging') &&
105
132
  !seenPhases.has('optimizing')
@@ -134,12 +161,18 @@ export async function _report(
134
161
  );
135
162
 
136
163
  if (options.mode === 'production') {
137
- await bundleReport(
138
- event.bundleGraph,
139
- options.outputFS,
140
- options.projectRoot,
141
- options.detailedReport?.assetsPerBundle,
142
- );
164
+ if (debugTools['simple-cli-reporter']) {
165
+ writeOut(
166
+ `🛠️ Built ${event.bundleGraph.getBundles().length} bundles.`,
167
+ );
168
+ } else {
169
+ await bundleReport(
170
+ event.bundleGraph,
171
+ options.outputFS,
172
+ options.projectRoot,
173
+ options.detailedReport?.assetsPerBundle,
174
+ );
175
+ }
143
176
  } else {
144
177
  pendingIncrementalBuild = true;
145
178
  }