@atlaspack/reporter-cli 2.15.1-canary.12 → 2.15.1-canary.121
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/CHANGELOG.md +112 -0
- package/lib/CLIReporter.js +98 -3
- package/lib/CLIReporter.js.map +1 -1
- package/package.json +6 -6
- package/src/CLIReporter.js +39 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/reporter-cli",
|
|
3
|
-
"version": "2.15.1-canary.
|
|
3
|
+
"version": "2.15.1-canary.121+18a57cf8a",
|
|
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.
|
|
30
|
-
"@atlaspack/types": "2.14.5-canary.
|
|
31
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
29
|
+
"@atlaspack/plugin": "2.14.5-canary.121+18a57cf8a",
|
|
30
|
+
"@atlaspack/types": "2.14.5-canary.121+18a57cf8a",
|
|
31
|
+
"@atlaspack/utils": "2.14.5-canary.121+18a57cf8a",
|
|
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.
|
|
36
|
+
"@atlaspack/feature-flags": "2.14.1-canary.189+18a57cf8a",
|
|
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": "
|
|
44
|
+
"gitHead": "18a57cf8a4789b2de5ad8e2676f317a26cc91417"
|
|
45
45
|
}
|
package/src/CLIReporter.js
CHANGED
|
@@ -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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
}
|