cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
245 stars 44 forks source link

[cubing.js issue] `make test-dist-esm-build-size` size checks are broken. #258

Closed lgarron closed 1 year ago

lgarron commented 1 year ago

Steps to reproduce the issue

make test-dist-esm-build-size

Observed behaviour

┌─────────────────┬──────────┬─────────────┬─────────────┬────────────────────┐
│     (index)     │   size   │ sizeNoTHREE │ gzippedSize │ gzippedSizeNoTHREE │
├─────────────────┼──────────┼─────────────┼─────────────┼────────────────────┤
│       alg       │ '  22kB' │     ''      │  '   6kB'   │         ''         │
│    bluetooth    │ ' 732kB' │  ' 318kB'   │  ' 166kB'   │      '  61kB'      │
│     kpuzzle     │ '  28kB' │     ''      │  '   8kB'   │         ''         │
│    notation     │ '  22kB' │     ''      │  '   6kB'   │         ''         │
│    protocol     │ '  37kB' │     ''      │  '  10kB'   │         ''         │
│ puzzle-geometry │ '  87kB' │     ''      │  '  27kB'   │         ''         │
│     puzzles     │ ' 293kB' │     ''      │  '  53kB'   │         ''         │
│    scramble     │ '1800kB' │     ''      │  ' 559kB'   │         ''         │
│     search      │ '1801kB' │     ''      │  ' 559kB'   │         ''         │
│     stream      │ '  22kB' │     ''      │  '   6kB'   │         ''         │
│     twisty      │ '1037kB' │  ' 432kB'   │  ' 250kB'   │      '  92kB'      │
│     (total)     │ '2576kB' │  '1970kB'   │  ' 768kB'   │      ' 608kB'      │
└─────────────────┴──────────┴─────────────┴─────────────┴────────────────────┘
✅ Gzipped `cubing/twisty` build size is ≤ 300kB
adfaf 2576kB
✅ Total (uncompressed) build size is ≤ 2mB

Note that 2576kB > 2mB, but in JS the string "2576kB" < the number 2_000_000:

https://github.com/cubing/cubing.js/blob/1d56924840efe43be8c3a52cb134d42e462112dc/script/test/dist/esm/build-size/main.js#L108

🖼 Screenshots

No response

Expected behaviour

Proper comparison.

Environment

N/A

Additional info

We should: