pgtyped icon indicating copy to clipboard operation
pgtyped copied to clipboard

refactor: use `files` in `package.json` to whitelist files that will be published to NPM

Open GervinFung opened this issue 2 years ago • 0 comments

Hi, may I suggest adding the code snippet below to package.json, instead of using .npmignore for each package

"files": [
    "lib"
],

This works by whitelisting only the transpiled code that will be published to NPM, it will also auto include necessary files such as package.json, README.md, so instead of blacklisting what should not be published, we allowed what should be published and shrink the NPM package size even more. Also, manually adding or removing files from being blacklisted in .npmignore can be tedious, as the project may grow larger because we only need the transpiled code, package.json and nothing else IMO

But that way the test codes will need to have its own folder instead of sharing same folder with source code, or alternatively automate the removal of test files from the transpiled code, I prefer the former approach

If this proposal is accepted, I will make a new PR

GervinFung avatar May 09 '22 09:05 GervinFung