astring icon indicating copy to clipboard operation
astring copied to clipboard

chore(package): use `files` in `package.json` instead of `.npmignore`

Open GervinFung opened this issue 3 years ago • 4 comments

Motivation

It’s better to explicitly mention what should be packaged instead of listing everything that should not be included, as it requires more effort and it's possible to forget to add a new file/folder to .npmignore

Expected behavior

It will publish the files/folders that were whitelisted in package.json

GervinFung avatar May 11 '22 08:05 GervinFung

@GervinFung Thanks for this suggestion. Are there any files that shouldn't be in the package?

davidbonnet avatar Jul 19 '22 13:07 davidbonnet

@GervinFung Thanks for this suggestion. Are there any files that shouldn't be in the package?

Hey, as of now I think it published what it should, except for .eslintrc.json, but that is ok, it's not a big issue. Just that I think it would be much easier to whitelist files/folders with package.json instead of blacklisting with .npmignore of what should not be published as you have to tally it manually.

For instance, if you whitelist with package.json, you only need to add bin, dist and astring.d.ts to files in package.json, it will automatically include what it needs like package.json itself, README.md and LICENSE

GervinFung avatar Jul 19 '22 14:07 GervinFung

Right, .eslintrc.json shouldn't be there.

davidbonnet avatar Jul 20 '22 09:07 davidbonnet

If you are ok with it, I can create a PR that solve this issue by whitelisting what should be published instead

GervinFung avatar Jul 20 '22 15:07 GervinFung