Skip to content

Commit afa8088

Browse files
committed
fix: adjust grouping and external imports
1 parent a9bc1f5 commit afa8088

12 files changed

Lines changed: 1446496 additions & 100 deletions

packages/plugin-bundle-stats/code-pushup.large-angular.config.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bundleStatsPlugin from './src';
1+
import bundleStatsPlugin, { DEFAULT_GROUPING } from './src';
22

33
/**
44
* This is a large config for the bundle stats plugin.
@@ -28,32 +28,34 @@ const config = {
2828
plugins: [
2929
await bundleStatsPlugin({
3030
artefactsPath:
31-
'./packages/plugin-bundle-stats/mocks/fixtures/stats/large-angular.stats.json',
31+
'./packages/plugin-bundle-stats/mocks/fixtures/stats/entain-bundle-stats.json',
3232
bundler: 'esbuild',
33+
grouping: [...DEFAULT_GROUPING],
3334
configs: [
3435
{
3536
title: 'Initial Bundles',
36-
include: ['main-*.js', 'polyfills-*.js', '*.css'],
37+
include: ['main-*.js', 'polyfills-*.js'],
3738
thresholds: {
3839
totalSize: [300 * 1024, 1 * 1024 * 1024],
3940
artefactSize: [100 * 1024, 500 * 1024],
4041
},
4142
},
42-
43+
// commented out for later
44+
/*
4345
{
4446
title: 'Shared Chunks',
45-
include: ['**/chunk-*.js'],
47+
include: ['**\/chunk-*.js'],
4648
thresholds: {
4749
totalSize: [10, 100 * 1024],
4850
},
4951
},
5052
{
5153
title: 'CSS Assets',
52-
include: ['**/*.css'],
54+
include: ['**\/*.css'],
5355
thresholds: {
5456
totalSize: [1 * 1024, 50 * 1024],
5557
},
56-
},
58+
},*/
5759
],
5860
penalty: {
5961
errorWeight: 1,
@@ -62,7 +64,7 @@ const config = {
6264
},
6365
pruning: {
6466
maxChildren: 10,
65-
maxDepth: 3,
67+
maxDepth: 2,
6668
},
6769
}),
6870
],

packages/plugin-bundle-stats/code-pushup.minimal-angular.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const config = {
3434
plugins: [
3535
await bundleStatsPlugin({
3636
artefactsPath:
37-
'./packages/plugin-bundle-stats/mocks/fixtures/angular-minimal/dist/angular-minimal/stats.json',
37+
// './packages/plugin-bundle-stats/mocks/fixtures/angular-minimal/dist/angular-minimal/stats.json',
38+
'./packages/plugin-bundle-stats/src/lib/__snapshots__/esbuild.stats.json',
3839
bundler: 'esbuild',
3940
configs: [
4041
// JavaScript bundles - should focus on main and polyfills outputs
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import bundleStatsPlugin, { DEFAULT_GROUPING } from './src';
2+
3+
/**
4+
* Execute the code-pushup over Nx:
5+
* nx code-pushup:minimal plugin-bundle-stats
6+
*/
7+
8+
const config = {
9+
plugins: [
10+
await bundleStatsPlugin({
11+
artefactsPath:
12+
// './packages/plugin-bundle-stats/mocks/fixtures/angular-minimal/dist/angular-minimal/stats.json',
13+
'./packages/plugin-bundle-stats/src/lib/__snapshots__/esbuild.stats.json',
14+
bundler: 'esbuild',
15+
configs: [
16+
// JavaScript bundles - should focus on main and polyfills outputs
17+
{
18+
title: 'Initial Bundles',
19+
description: 'Main and polyfills JavaScript bundles (~34KB expected)',
20+
include: ['dist/bundle.js', 'dist/bundle.css'], // Updated to match actual files
21+
thresholds: {
22+
totalSize: [30 * 1024, 50 * 1024], // 30KB warning, 50KB error
23+
artefactSize: [35 * 1024, 40 * 1024], // Individual file limits
24+
},
25+
},
26+
],
27+
28+
// Add the default grouping configuration to enable emoji formatting
29+
// Enhanced penalty configuration
30+
penalty: {
31+
errorWeight: 1.0, // Full penalty for errors
32+
warningWeight: 0.5, // Reduced penalty for warnings
33+
blacklistWeight: 0.8, // Significant penalty for blacklisted items
34+
},
35+
36+
// Pruning options to keep output manageable
37+
pruning: {
38+
maxChildren: 8, // Show up to 8 children per node
39+
maxDepth: 5, // Limit nesting depth
40+
},
41+
}),
42+
],
43+
};
44+
45+
export default config;

0 commit comments

Comments
 (0)