compressed-size-action icon indicating copy to clipboard operation
compressed-size-action copied to clipboard

Report aggregate stats by folder and file type?

Open slorber opened this issue 1 year ago â€ĸ 4 comments

I'm using this project on Docusaurus, a static site generator, to monitor the build output size

Example PR comment: https://github.com/facebook/docusaurus/pull/10470#issuecomment-2324697764

Monitoring by file size is great, but in our case, we emit too many output files to monitor them all without creating noise, so I only added a "representative" list of output files.

What would be a great addition for us would be to have the ability to compare the before/after size of a whole folder. Eventually be able to break it down by file type, so that we could detect if JS, CSS, or HTML total output size increases after a PR.

I'm wondering if this could be part of this project, or if it's out of scope and should be a separate tool.

slorber avatar Sep 04 '24 10:09 slorber

Interesting, would you only want the folder and file types inside of it, replacing individual files altogether then? Something like the following maybe:

Directory Type Size Change
compat/dist/foo CSS 3.53 kB -567 B (-13.83%) 👏
compat/dist/foo JS 3.44 kB -582 B (-14.46%) 👏
compat/dist/foo HTML 3.6 kB -571 B (-13.71%) 👏

Or perhaps:

Directory Type Size Change
compat/dist/foo All 9.53 kB -567 B (-13.83%) 👏
CSS 3.53 kB -567 B (-13.83%) 👏
JS 3.44 kB -582 B (-14.46%) 👏
HTML 3.6 kB -571 B (-13.71%) 👏
compat/dist/bar All 9.53 kB -567 B (-13.83%) 👏

(Ignore the nonsensical sizes that don't add up, I quickly copy/pasted from Preact 😄)

Or in addition to the existing output? Just thinking if it's a toggled either/or situation or just a new output table.


I think it would be a reasonable addition though!

rschristian avatar Sep 04 '24 10:09 rschristian

Thanks!

I think a separate table makes more sense. I guess something like this could be nice, with the ability to count the number of files and the change too.

For flexibility, I'd break it down by extension and not just CSS/JS/HTML.

Folders Count Size Change
website/build1 278 (+1 âš ī¸) 666 kB +34 B (+0.01%)
website/build2 10 (+0) 10 kB +34 B (+0.01%)
TOTAL 288 (+1 âš ī¸) 676 kB +34 B (+0.01%)
â„šī¸ Break down by extension
Extension Count Size Change
.js 100 (+0) 2 B 0 B
.css 100 (+1 âš ī¸) 27.9 kB 0 B
.html 100 (+0) 27.9 kB 0 B
.jpg 100 (+0) 30.2 kB 0 B

slorber avatar Sep 04 '24 12:09 slorber

For flexibility, I'd break it down by extension and not just CSS/JS/HTML.

Yeah that was just for a quick example, albeit using the names instead of the proper extension.

But this seems reasonable and I can see how many might want this. I'll take a look at this later this week if I get some time.

rschristian avatar Sep 04 '24 12:09 rschristian

+1 this sounds like a really nice addition, in a monorepo the stats comment starts to get very noisy and unwieldy

Suggestion: would be nice to retain individual file stats in a collapsed section. Ie if you find a certain folder has increased you can then drill down to more indepth stats.

cloudkite avatar Nov 07 '24 21:11 cloudkite