Skip to content

v3.0.0

Compare
Choose a tag to compare
@benelan benelan released this 27 Feb 22:09
· 55 commits to master since this release

Breaking changes

  • Deprecated and removed getFileSizes function. getFiles now returns a size property
  • Need to use the -f or --filetype flag when specifying a main bundle filetype from the CLI (previously was the second CLI argument)
  • Use base 10 (previously base 2) as the default for converting bytes into a human readable format in the formatBytes function. Base 10 is what operating systems use in file explorers

Enhancements

CLI

  • Added support for CLI flags instead of passing arguments in a specific order (use the -h or --help flag for usage info)
  • Added -d and --decimals CLI flags for specifying decimals places when formatting bytes
  • Added -b and --binary CLI flags for converting bytes to a human readable format in base 2
  • Added -o and --outfile CLI flags for saving the build size data to CSV
  • Log build on-disk size to the console for non-windows machines (uses du)
  • Log compressed main bundle sizes to the console
  • Spiffed up the build-sizes formatting that is logged to the console

New exported functions

  • saveBuildSizes: saves build-sizes data to CSV
  • getFileSizeGzip: calculates a file's gzipped size (with zlib defaults)
  • getFileSizeBrotli: calculates a file's brotli compressed size (with zlib defaults)

New function return properties

  • mainBundleSizeGzip (from getBuildSizes): main bundle's gzipped size
  • mainBundleSizeBrotli from getBuildSizes): main bundle's brotli compressed size
  • buildSizeOnDisk (from getBuildSizes): build's on-disk size (NaN on windows since it uses a unix command)
  • size (from getFiles): file's uncompressed byte size

Fixes

  • Use the correct formula for converting bytes to a human readable format in base 10
  • The on-disk size was actually byte size. I changed it to "size" and added "on-disk size" for non-window machines
  • Some error handling issues are resolved