Skip to content

Commit 4b8ef07

Browse files
committed
fix: move code
1 parent 9080b92 commit 4b8ef07

File tree

13 files changed

+997
-425
lines changed

13 files changed

+997
-425
lines changed

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

Lines changed: 4 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,6 @@ const productGroups: GroupingRule[] = [
204204
patterns: ['**/packages/rewards-hub/**'],
205205
icon: '🏆',
206206
},
207-
{
208-
title: 'Reporting Package',
209-
patterns: ['**/packages/reporting/**'],
210-
icon: '📊',
211-
},
212207
{
213208
title: 'Migration Kit Package',
214209
patterns: ['**/packages/migration-kit/**'],
@@ -219,26 +214,11 @@ const productGroups: GroupingRule[] = [
219214
patterns: ['**/packages/loaders-lib/**'],
220215
icon: '📦',
221216
},
222-
{
223-
title: 'GitLab Data Access Package',
224-
patterns: ['**/packages/gitlab-data-access/**'],
225-
icon: '🔗',
226-
},
227217
{
228218
title: 'Geo Coordinator Lib Package',
229219
patterns: ['**/packages/geo-coordinator-lib/**'],
230220
icon: '🌍',
231221
},
232-
{
233-
title: 'ESBuild Plugins Package',
234-
patterns: ['**/packages/esbuild-plugins/**'],
235-
icon: '🔌',
236-
},
237-
{
238-
title: 'ESLint Utils Package',
239-
patterns: ['**/packages/eslint-utils/**'],
240-
icon: '🔧',
241-
},
242222
{
243223
title: 'Extractor App Package',
244224
patterns: ['**/packages/extractor-app/**'],
@@ -249,26 +229,6 @@ const productGroups: GroupingRule[] = [
249229
patterns: ['**/packages/gantry-app/**'],
250230
icon: '🏗️',
251231
},
252-
{
253-
title: 'Moxxi Test Utils Package',
254-
patterns: ['**/packages/moxxi-test-utils/**'],
255-
icon: '🧪',
256-
},
257-
{
258-
title: 'NX Plugin Package',
259-
patterns: ['**/packages/nx-plugin/**'],
260-
icon: '⚙️',
261-
},
262-
{
263-
title: 'RTMS Test App Package',
264-
patterns: ['**/packages/rtms-test-app/**'],
265-
icon: '🧪',
266-
},
267-
{
268-
title: 'SFAPI Smoke Test Package',
269-
patterns: ['**/packages/sfapi-smoke-test/**'],
270-
icon: '💨',
271-
},
272232
{
273233
title: 'Device Atlas Smoke Test Package',
274234
patterns: ['**/packages/device-atlas-smoke-test/**'],
@@ -286,57 +246,6 @@ const productGroups: GroupingRule[] = [
286246
},
287247
];
288248

289-
const badGroups: GroupingRule[] = [
290-
{
291-
title: 'Test Web App Package',
292-
patterns: ['**/packages/testweb-app/**'],
293-
},
294-
// 🚨 CRITICAL: Files that shouldn't be in production - these are important findings!
295-
{
296-
title: '🚨 Test Files in Production',
297-
patterns: [
298-
'**/node_modules/**/*.test.js',
299-
'**/node_modules/**/*.spec.js',
300-
'**/node_modules/**/test/**',
301-
'**/node_modules/**/tests/**',
302-
'**/node_modules/**/__tests__/**',
303-
],
304-
},
305-
{
306-
title: '🚨 📚 Documentation in Production',
307-
patterns: [
308-
'**/node_modules/**/demo/**',
309-
'**/node_modules/**/examples/**',
310-
'**/node_modules/**/docs/**',
311-
'**/node_modules/**/*.md',
312-
'**/node_modules/**/README*',
313-
'**/node_modules/**/CHANGELOG*',
314-
'**/node_modules/**/LICENSE*',
315-
],
316-
icon: '📄',
317-
},
318-
{
319-
title: '🛠️ Dev Tools in Production',
320-
patterns: [
321-
'**/node_modules/**/webpack.config.js',
322-
'**/node_modules/**/rollup.config.js',
323-
'**/node_modules/**/jest.config.js',
324-
'**/node_modules/**/.eslintrc*',
325-
'**/node_modules/**/.babelrc*',
326-
'**/node_modules/**/tsconfig*.json',
327-
],
328-
icon: '🔧',
329-
},
330-
{
331-
title: 'E2E Test Framework Package',
332-
patterns: ['**/packages/e2e-test-framework/**'],
333-
icon: '🧪',
334-
},
335-
].map(group => ({
336-
...group,
337-
icon: '⚠️',
338-
}));
339-
340249
const config = {
341250
plugins: [
342251
await bundleStatsPlugin({
@@ -354,12 +263,11 @@ const config = {
354263
blacklist,
355264
},
356265
},
357-
insights: [
266+
insightsTable: [
358267
...productGroups, // Process product groups first for better specificity
359-
...badGroups, // Process bad/warning groups second
360268
...nodeModulesGroup, // Process general node_modules groups last
361269
],
362-
artefactTree: {
270+
dependencyTree: {
363271
groups: [
364272
...productGroups, // Process product groups first for better specificity
365273
...nodeModulesGroup, // Process general node_modules groups last
@@ -376,7 +284,7 @@ const config = {
376284
description: 'All files in the bundle',
377285
selection: {
378286
// Use specific includeOutputs instead of global include for better control
379-
include: ['**/*.js'],
287+
includeOutputs: ['**/*'],
380288
// Exclude patterns to filter out unwanted files
381289
excludeOutputs: [
382290
'**/*.map', // Source maps
@@ -391,9 +299,8 @@ const config = {
391299
// Initial bundle size audit
392300
{
393301
title: 'Initial Bundle Size',
394-
slug: 'initial-bundle-size',
395302
description:
396-
'Initial bundle size audit for main and polyfills bundles',
303+
'Initial bundle size audit for main and polyfills bundles as well as styles assets',
397304
selection: {
398305
includeOutputs: [
399306
'**/main-*.js',

packages/plugin-bundle-stats/src/lib/normalize.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ export function cleanTitleForSlug(title: string): string {
182182
* Enhances descriptions with educational content, selection options, and scoring configuration.
183183
*/
184184
export function prepareDescription(config: BundleStatsConfig): string {
185-
const { description, scoring, selection, artefactTree, insights } = config;
185+
const {
186+
description,
187+
scoring,
188+
selection,
189+
dependencyTree: artefactTree,
190+
insightsTable: insights,
191+
} = config;
186192
const { totalSize, penalty } = scoring;
187193

188194
let enhancedDescription = description || '';
@@ -253,8 +259,8 @@ export function normalizeBundleStatsOptions(
253259
description: description || '', // Include original description
254260
selection: normalizedSelection,
255261
scoring: normalizedScoring,
256-
artefactTree: restOptions.artefactTree,
257-
insights: restOptions.insights,
262+
dependencyTree: restOptions.dependencyTree,
263+
insightsTable: restOptions.insightsTable,
258264
...restOptions,
259265
};
260266

packages/plugin-bundle-stats/src/lib/runner/audits/audit-outputs.unit.test.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ describe('createAuditOutput', () => {
4242
title: 'Bundle Size',
4343
slug: 'bundle-size',
4444
description: 'Bundle size analysis',
45-
selection: { includeOutputs: ['**/*.js'] },
45+
selection: {
46+
includeOutputs: ['**/*.js'],
47+
excludeOutputs: [],
48+
includeInputs: [],
49+
excludeInputs: [],
50+
includeImports: [],
51+
excludeImports: [],
52+
includeEntryPoints: [],
53+
excludeEntryPoints: [],
54+
},
4655
scoring: { totalSize: [1000, 10000] },
4756
},
4857
),
@@ -70,7 +79,16 @@ describe('createAuditOutput', () => {
7079
title: 'Bundle Size',
7180
slug: 'bundle-size',
7281
description: 'Bundle size analysis',
73-
selection: { includeOutputs: ['**/*.js'] },
82+
selection: {
83+
includeOutputs: ['**/*.js'],
84+
excludeOutputs: [],
85+
includeInputs: [],
86+
excludeInputs: [],
87+
includeImports: [],
88+
excludeImports: [],
89+
includeEntryPoints: [],
90+
excludeEntryPoints: [],
91+
},
7492
scoring: { totalSize: [1000, 10000] },
7593
},
7694
),
@@ -98,7 +116,16 @@ describe('createAuditOutput', () => {
98116
title: 'Bundle Size',
99117
slug: 'bundle-size',
100118
description: 'Bundle size analysis',
101-
selection: { includeOutputs: ['**/*.js'] },
119+
selection: {
120+
includeOutputs: ['**/*.js'],
121+
excludeOutputs: [],
122+
includeInputs: [],
123+
excludeInputs: [],
124+
includeImports: [],
125+
excludeImports: [],
126+
includeEntryPoints: [],
127+
excludeEntryPoints: [],
128+
},
102129
scoring: {
103130
totalSize: [1000, 10000],
104131
penalty: {
@@ -112,7 +139,7 @@ describe('createAuditOutput', () => {
112139
},
113140
},
114141
).score,
115-
).toBe(0.5);
142+
).toBe(0.8);
116143
});
117144
});
118145

@@ -144,6 +171,8 @@ describe('generateAuditOutputs', () => {
144171
excludeOutputs: [],
145172
includeInputs: [],
146173
excludeInputs: [],
174+
includeImports: [],
175+
excludeImports: [],
147176
includeEntryPoints: [],
148177
excludeEntryPoints: [],
149178
},
@@ -178,6 +207,8 @@ describe('generateAuditOutputs', () => {
178207
excludeOutputs: [],
179208
includeInputs: [],
180209
excludeInputs: [],
210+
includeImports: [],
211+
excludeImports: [],
181212
includeEntryPoints: [],
182213
excludeEntryPoints: [],
183214
},
@@ -211,6 +242,8 @@ describe('generateAuditOutputs', () => {
211242
excludeOutputs: [],
212243
includeInputs: [],
213244
excludeInputs: [],
245+
includeImports: [],
246+
excludeImports: [],
214247
includeEntryPoints: [],
215248
excludeEntryPoints: [],
216249
},
@@ -225,6 +258,8 @@ describe('generateAuditOutputs', () => {
225258
excludeOutputs: [],
226259
includeInputs: [],
227260
excludeInputs: [],
261+
includeImports: [],
262+
excludeImports: [],
228263
includeEntryPoints: [],
229264
excludeEntryPoints: [],
230265
},
@@ -239,6 +274,8 @@ describe('generateAuditOutputs', () => {
239274
excludeOutputs: [],
240275
includeInputs: [],
241276
excludeInputs: [],
277+
includeImports: [],
278+
excludeImports: [],
242279
includeEntryPoints: [],
243280
excludeEntryPoints: [],
244281
},

packages/plugin-bundle-stats/src/lib/runner/audits/details/audit-details.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ export function createAuditOutputDetails(
1717
issues,
1818
};
1919

20-
if (config.insights && config.insights.length > 0) {
20+
if (config.insightsTable && config.insightsTable.length > 0) {
2121
console.time('📊 CREATE_INSIGHTS_TABLE');
22-
details.table = createInsightsTable(statsSlice, config.insights);
22+
details.table = createInsightsTable(statsSlice, config.insightsTable);
2323
console.timeEnd('📊 CREATE_INSIGHTS_TABLE');
2424
}
2525

26-
if (config.artefactTree) {
26+
// Check if dependency tree is enabled (default: enabled if config exists)
27+
const isTreeEnabled =
28+
config.dependencyTree &&
29+
typeof config.dependencyTree === 'object' &&
30+
(!('enabled' in config.dependencyTree) ||
31+
config.dependencyTree.enabled !== false);
32+
33+
if (isTreeEnabled && typeof config.dependencyTree === 'object') {
2734
console.time('🌳 CREATE_TREE');
2835
details.trees = [
2936
createTree(statsSlice, {
3037
title: config.slug,
31-
pruning: config.artefactTree.pruning ?? {},
32-
groups: config.artefactTree.groups ?? [],
38+
pruning: config.dependencyTree.pruning ?? {},
39+
groups: config.dependencyTree.groups ?? [],
3340
}),
3441
];
3542
console.timeEnd('🌳 CREATE_TREE');

0 commit comments

Comments
 (0)