egoist / package-size

Get the bundle size of an npm package.
MIT License
424 stars 26 forks source link

Cache package sizes #11

Closed wgoodall01 closed 7 years ago

wgoodall01 commented 7 years ago

(Fixes issue #1)

This PR implements caching for the module sizes. Every time getSizes() is run and calculates the size of a bundle, it will write the size information to a JSON file located wherever package-size is installed. Then, for subsequent runs of getSizes(), the cached values will be read from disk and used instead of rebuilding the package. To disable the cache and force a module to be rebuilt, pass --no-cache to the CLI or {cache:false} in the options obj. To clear the cache, run package-size clear-cache.

wgoodall01 commented 7 years ago

Implemented your changes --

For each set of modules, after they are fetched with yarn, a cache key is generated from the names and exact versions -- this is then used to store the sizes with the conf module.

egoist commented 7 years ago

Thanks for the PR, released in v1.5.0