Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use an allowlist-based .npmignore file (#250)
Reconcile the package.json "files" field and .npmignore into the .npmignore file. Like package.json "files", an allowlist approach is used by first ignoring everything (with `/*`) and then listing the patterns that should be published using inverted patterns using the leading `!`. After, filter out nested paths for tests to avoid publishing such unnecessary files. Note that the leading "**/" for tests is necessary as otherwise test files would still be published (this was manually verified). The previous approach, using both "files" and .npmignore, does not work and only the "files" value was respected (this can be seen from the files present in v4.2.0). It appears only one of the two can be used, though I was unable to find a statement in the npm docs that say this explicitly. An alternative to the approach taken here would be to increase the specificity of file patterns in the "files" array to avoid including test files.
- Loading branch information