@@ -24,80 +24,119 @@ import bundleStatsPlugin, { DEFAULT_GROUPING } from './src';
2424 * nx code-pushup:minimal-angular plugin-bundle-stats
2525 */
2626
27+ const GROUPING_PACKAGES = [
28+ {
29+ title : 'Payment' ,
30+ patterns : [ '**/payments/**/*' ] ,
31+ icon : '🚀' ,
32+ } ,
33+ {
34+ title : 'Loaders Library' ,
35+ patterns : [ '**/loaders-lib/**/*' ] ,
36+ icon : '🔄' ,
37+ } ,
38+ {
39+ title : 'Sports Platform' ,
40+ patterns : [ '**/sports/**/*' ] ,
41+ icon : '⚽' ,
42+ } ,
43+ {
44+ title : 'Host App' ,
45+ patterns : [ '**/host-app/**/*' ] ,
46+ icon : '🏠' ,
47+ } ,
48+ {
49+ title : 'Casino' ,
50+ patterns : [ '**/casino/**/*' ] ,
51+ icon : '🎰' ,
52+ } ,
53+ {
54+ title : 'Oxygen Framework' ,
55+ patterns : [ '**/oxygen/**/*' ] ,
56+ icon : '🔧' ,
57+ } ,
58+ ] ;
59+
60+ const GROUPING_ANGULAR_BLOCKS = [
61+ {
62+ title : 'Components' ,
63+ patterns : [ '**/*.component.ts' ] ,
64+ icon : '🅰️' ,
65+ } ,
66+ {
67+ title : 'Directives' ,
68+ patterns : [ '**/*.directive.ts' ] ,
69+ icon : '🅰️' ,
70+ } ,
71+ {
72+ title : 'Pipes' ,
73+ patterns : [ '**/*.pipe.ts' ] ,
74+ icon : '🅰️' ,
75+ } ,
76+ {
77+ title : 'Modules' ,
78+ patterns : [ '**/*.module.ts' ] ,
79+ icon : '🅰️' ,
80+ } ,
81+ {
82+ title : 'Guards' ,
83+ patterns : [ '**/*.guard.ts' ] ,
84+ icon : '🅰️' ,
85+ } ,
86+ {
87+ title : 'Resolvers' ,
88+ patterns : [ '**/*.resolver.ts' ] ,
89+ icon : '🅰️' ,
90+ } ,
91+ {
92+ title : 'Interceptors' ,
93+ patterns : [ '**/*.interceptor.ts' ] ,
94+ icon : '🅰️' ,
95+ } ,
96+ {
97+ title : 'Providers' ,
98+ patterns : [ '**/*.provider.ts' ] ,
99+ icon : '🅰️' ,
100+ } ,
101+ {
102+ title : 'Services' ,
103+ patterns : [ '**/*.service.ts' ] ,
104+ icon : '🅰️' ,
105+ } ,
106+ ] ;
107+
27108const config = {
28109 plugins : [
29110 await bundleStatsPlugin ( {
30111 artefactsPath :
31112 './packages/plugin-bundle-stats/mocks/fixtures/stats/angular-large.stats.json' ,
32- bundler : 'esbuild' ,
33- grouping : [ ...DEFAULT_GROUPING ] ,
34- configs : [
35- {
36- title : 'Entry Bundle' ,
37- selection : {
38- includeEntryPoints : [ '**/payments.routes.ts' ] ,
39- } ,
40- thresholds : {
41- totalSize : [ 300 * 1024 , 1 * 1024 * 1024 ] ,
42- artefactSize : [ 100 * 1024 , 500 * 1024 ] ,
43- } ,
44- } ,
45- {
46- title : 'All Chunks' ,
47- selection : {
48- includeOutputs : [ 'chunk-*.js' ] ,
49- } ,
50- thresholds : {
51- totalSize : [ 300 * 1024 , 1 * 1024 * 1024 ] ,
52- artefactSize : [ 100 * 1024 , 500 * 1024 ] ,
53- } ,
54- } ,
55- {
56- title : 'Main Components' ,
57- selection : {
58- includeInputs : [ '**/main/**' , '**/main.*' ] ,
59- } ,
60- thresholds : {
61- totalSize : [ 300 * 1024 , 1 * 1024 * 1024 ] ,
62- artefactSize : [ 100 * 1024 , 500 * 1024 ] ,
63- } ,
64- } ,
65- /* keep commented out
113+ audits : [
66114 {
67115 title : 'Initial Bundles' ,
68- include: ['main-*.js', 'polyfills-*.js'],
69- thresholds: {
70- totalSize: [300 * 1024, 1 * 1024 * 1024],
71- artefactSize: [100 * 1024, 500 * 1024],
116+ selection : {
117+ includeOutputs : [
118+ '**/main*.js' ,
119+ '**/polyfills*.js' ,
120+ '**/runtime*.js' ,
121+ ] ,
72122 } ,
73- },
74- {
75- title: 'Shared Chunks',
76- include: ['**\/chunk-*.js'],
77- thresholds: {
78- totalSize: [10, 100 * 1024],
123+ scoring : {
124+ totalSize : 100_000 ,
79125 } ,
80- pruning: {
81- maxChildren: 10,
82- maxDepth: 3,
126+ artefactTree : {
127+ groups : GROUPING_PACKAGES ,
83128 } ,
129+ insights : [
130+ ...GROUPING_PACKAGES ,
131+ ...GROUPING_ANGULAR_BLOCKS ,
132+ {
133+ title : 'Node Modules' ,
134+ patterns : [ '**/node_modules/**/*' ] ,
135+ icon : '📚' ,
136+ } ,
137+ ] ,
84138 } ,
85- {
86- title: 'CSS Assets',
87- include: ['**\/*.css'],
88- thresholds: {
89- totalSize: [1 * 1024, 50 * 1024],
90- },
91- },*/
92139 ] ,
93- penalty : {
94- errorWeight : 1 ,
95- warningWeight : 0.5 ,
96- } ,
97- pruning : {
98- maxChildren : 30 ,
99- maxDepth : 4 ,
100- } ,
101140 } ) ,
102141 ] ,
103142} ;
0 commit comments