Skip to content

packages.json: Add "files" attributes for npm #182

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

Closed
wants to merge 1 commit into from

Conversation

mingchen
Copy link

Add "files" attributes for npm to only pack necessary files.
This is can reduce package size a lot under node_modules.

see https://docs.npmjs.com/misc/developers

$ du -sh node_modules/resolve/*
 12K	node_modules/resolve/CHANGELOG.md
4.0K	node_modules/resolve/LICENSE
4.0K	node_modules/resolve/appveyor.yml
4.0K	node_modules/resolve/changelog.hbs
8.0K	node_modules/resolve/example
4.0K	node_modules/resolve/index.js
 36K	node_modules/resolve/lib
4.0K	node_modules/resolve/package.json
8.0K	node_modules/resolve/readme.markdown
244K	node_modules/resolve/test

will become to:

$ du -sh node_modules/resolve/*
4.0K	node_modules/resolve/LICENSE
4.0K	node_modules/resolve/index.js
 36K	node_modules/resolve/lib

Add "files" attributes for npm to only pack necessary files.
This is can reduce package size a lot under `node_modules`.

see https://docs.npmjs.com/misc/developers
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The files key is dangerous; if a new file is added to the package but omitted from this list, downstream consumers would break.

Separately, the tests are supposed to be published to npm. npm explore foo && npm install && npm test should always work.

@ljharb
Copy link
Member

ljharb commented Jan 17, 2019

Duplicate of #176. Duplicate of #132. Duplicate of #128. Duplicate of #99. Duplicate of #59. Duplicate of #44. Duplicate of #175.

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

Successfully merging this pull request may close these issues.

2 participants