Leveraging package.json files field to optimize the tarball size that npm produces.
See: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files
In order to test it run:
$ npm pack --dry-run
Before
npm notice === Tarball Details ===
npm notice name: doipjs
npm notice version: 1.2.8
npm notice filename: doipjs-1.2.8.tgz
npm notice package size: 2.2 MB
npm notice unpacked size: 6.7 MB
npm notice shasum: fb2cc25248601eb60dd697404b4b31adaca95543
npm notice integrity: sha512-E++7WedEo0CXS[...]8b/ShTpPM//IQ==
npm notice total files: 93
npm notice
doipjs-1.2.8.tgz
After
npm notice === Tarball Details ===
npm notice name: doipjs
npm notice version: 1.2.8
npm notice filename: doipjs-1.2.8.tgz
npm notice package size: 2.2 MB
npm notice unpacked size: 6.6 MB
npm notice shasum: 37212d80268c374409ad80deba8a00407ffc6552
npm notice integrity: sha512-Q1BM+vAFDqwK6[...]JUDQhDjhmEixg==
npm notice total files: 64
npm notice
doipjs-1.2.8.tgz
It is not much in terms of actual tarball size, but the number of files packaged went down significantly.
Leveraging `package.json` `files` field to optimize the tarball size that `npm` produces.
See: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files
In order to test it run:
```sh
$ npm pack --dry-run
```
## Before
```
npm notice === Tarball Details ===
npm notice name: doipjs
npm notice version: 1.2.8
npm notice filename: doipjs-1.2.8.tgz
npm notice package size: 2.2 MB
npm notice unpacked size: 6.7 MB
npm notice shasum: fb2cc25248601eb60dd697404b4b31adaca95543
npm notice integrity: sha512-E++7WedEo0CXS[...]8b/ShTpPM//IQ==
npm notice total files: 93
npm notice
doipjs-1.2.8.tgz
```
## After
```
npm notice === Tarball Details ===
npm notice name: doipjs
npm notice version: 1.2.8
npm notice filename: doipjs-1.2.8.tgz
npm notice package size: 2.2 MB
npm notice unpacked size: 6.6 MB
npm notice shasum: 37212d80268c374409ad80deba8a00407ffc6552
npm notice integrity: sha512-Q1BM+vAFDqwK6[...]JUDQhDjhmEixg==
npm notice total files: 64
npm notice
doipjs-1.2.8.tgz
```
It is not much in terms of actual tarball size, but the number of files packaged went down significantly.