Skip to content

Commit 3aea343

Browse files
committed
feat: report total file size
1 parent 294e2dc commit 3aea343

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/features/report.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ export function ReportPlugin(cwd: string, cjsDts?: boolean): Plugin {
5959
const brotliTextLength = Math.max(
6060
...sizes.map((size) => size.brotliText.length),
6161
)
62+
63+
let totalRaw = 0
6264
for (const size of sizes) {
6365
size.rawText = size.rawText.padStart(rawTextLength)
6466
size.gzipText = size.gzipText.padStart(gzipTextLength)
6567
size.brotliText = size.brotliText.padStart(brotliTextLength)
68+
totalRaw += size.raw
6669
}
6770

6871
// sort
@@ -91,6 +94,9 @@ export function ReportPlugin(cwd: string, cjsDts?: boolean): Plugin {
9194
dim`${size.rawText} │ gzip: ${size.gzipText} │ brotli: ${size.brotliText}`,
9295
)
9396
}
97+
98+
const totalSizeText = formatBytes(totalRaw)
99+
logger.info(formatText, `${sizes.length} files, total: ${totalSizeText}`)
94100
},
95101
}
96102
}

0 commit comments

Comments
 (0)