medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

chore: Add .npmignore #114

Closed andrew--r closed 3 years ago

andrew--r commented 3 years ago

Reduced package size by removing tests, benchmark and other non-relevant files from published package. Unpacked size went from 266.5 kB to 62.8 kB.

Before ``` ➜ memoizee git:(a3bb4be) npm publish --dry-run npm notice npm notice 📦 memoizee@0.4.14 npm notice === Tarball Contents === ... npm notice === Tarball Details === npm notice name: memoizee npm notice version: 0.4.14 npm notice package size: 37.2 kB npm notice unpacked size: 266.5 kB npm notice shasum: c5cfd766e8008c51886784b917c8c60f189d615c npm notice integrity: sha512-ucJijywclHuHa[...]2OsFUVwkahrog== npm notice total files: 59 npm notice + memoizee@0.4.14 ```
After ``` ➜ memoizee git:(master) ✗ npm publish --dry-run npm notice npm notice 📦 memoizee@0.4.14 npm notice === Tarball Contents === ... npm notice === Tarball Details === npm notice name: memoizee npm notice version: 0.4.14 npm notice package size: 19.1 kB npm notice unpacked size: 62.8 kB npm notice shasum: 1ae7608171055e241cada82acf6b79fbc168280a npm notice integrity: sha512-FNZP6oHLrehey[...]6k80NoLHyt67g== npm notice total files: 30 npm notice + memoizee@0.4.14 ```
andrew--r commented 3 years ago

@medikoo I see your point, but isn’t it a really rare case when someone needs to test the package from node_modules? I think most developers expect packages to be tested before publishing. For example, I checked some popular packages contents and didn’t found any tests:

I’ll update .npmignore according to your request if you insist, but I suggest to think about the impact of removing tests from published package. memoizee is downloaded 2,248,756 times a week, and reducing published package size by 18 kB (packed size diff) would reduce weekly traffic by 40 GB, and also save disk size for the end users.

medikoo commented 3 years ago

Ok @andrew--r let's also ignore tests. I'm a bit on fence on that, as I see some value in keeping them published (for verification purposes), but I guess in most of the package distribution systems packages are published without tests (as handling of that it belongs more to dev process)

Therefore let's have it as you proposed. Still let's slightly change format to:

/.editorconfig
/.github
/.testignore
/test
/benchmark

It's because foo will match any folder named that way at any depth, while /foo matches only top level folder. Simply feels safer

G-Rath commented 3 years ago

@medikoo would it be possible to get a new release on npm for this + the other commits on master?

medikoo commented 3 years ago

@G-Rath Sure, just published v0.4.15. Thanks for pinging