Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tests from npm package to reduce npm package size #206

Merged
merged 1 commit into from
Dec 5, 2022
Merged

Remove tests from npm package to reduce npm package size #206

merged 1 commit into from
Dec 5, 2022

Conversation

boidolr
Copy link
Contributor

@boidolr boidolr commented Dec 4, 2022

Excluding the tests with the lib/.npmignore file does not work, as can be seen by installing the package.
Adding the exclude pattern to the files section in package.json directly works (tested with npm 8.15.0).
Before:

❯ npm pack
...
npm notice === Tarball Details ===
npm notice name:          nise
npm notice version:       5.1.0
npm notice filename:      nise-5.1.0.tgz
npm notice package size:  276.4 kB
npm notice unpacked size: 1.0 MB
npm notice shasum:        2a9cc94327c00439aa5527ad2a6dcba137225e23
npm notice integrity:     sha512-+tNrmuEAXD0Pe[...]tnsqhCxqbzOfA==
npm notice total files:   23

After:

❯ npm pack
...
npm notice === Tarball Details ===
npm notice name:          nise
npm notice version:       5.1.0
npm notice filename:      nise-5.1.0.tgz
npm notice package size:  255.2 kB
npm notice unpacked size: 853.0 kB
npm notice shasum:        22aee618ad3f5537e0997cf4aa06f9577ff3264a
npm notice integrity:     sha512-Vtxx24zhelAl9[...]UitUs4EGZld/g==
npm notice total files:   16

@fatso83 fatso83 merged commit a2de180 into sinonjs:main Dec 5, 2022
@fatso83
Copy link
Contributor

fatso83 commented Dec 5, 2022

Thanks! Good find.

@boidolr boidolr deleted the reduce-npm-package-size branch December 5, 2022 12:01
@fatso83
Copy link
Contributor

fatso83 commented Dec 5, 2022

Published as 5.1.3

@mroderick
Copy link
Member

Very nice! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants