npm.io
1.4.1 • Published 2 years agoCLI

buildsize-cli

Licence
MIT
Version
1.4.1
Deps
10
Size
2.2 MB
Vulns
0
Weekly
0
Stars
1

buildsize-cli

define file sizes, error message and the last time it was changed

supported naming

  • .buildsizerc.js
  • buildsize.config.js

flag for path

buildsize-cli --config folder/path

usage

module.exports = {
  lastUpdated: 'Fri May 29 2020 12:00:00 GMT-0500 (Central Daylight Time)', // optional timestamp
  failMessage: 'Please fix, split, or set to warn.', // optional message to display on failed check
  failOnMissingBundles: true, // optional boolean to decalre if job should fail if any files are missing
  files: [
    {
      path: '__mocks__/5kb.mock.js', // build file path to check against
      maxSize: '6kB', // optional max file size validation
      minSize: '1kB', // optional min file size validation
      compression: 'gzip', // optional compression type, gzip | brotli
      warnOnly: true, // optional choice to not fail the check
      lastSize: true, // optionally display percentage difference of current size and last set max size
      externals: {
        // optional sizes are added and removed from maxSize for readabliity
        'package-one': '1kB'
      }
    }
  ]
};
valid example

invalid example

references

this all started on the basis of the amazing bundlesize project but is centered around unique customizations