rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

Replace .npmignore with the package.json 'files' property.

Open iclanton opened this issue 3 years ago • 3 comments

This field is more intuitive than the .npmignore file.

pnpm pack doesn't support the negative patterns yet, so we can't merge this in until that's fixed.

iclanton avatar Jul 03 '22 01:07 iclanton

🤔 Interesting. I can understand "files" being more intuitive because it doesn't have that "reversed pattern" problem, but it also is tucked away in package.json (it isn't a file you can copy between projects anymore).

I also just want to double-check whether this change is honored by the other pieces of Rush that honor .npmignore -- for example, will rush deploy correctly behave the same way if your projects only have "files": entries?

elliot-nelson avatar Jul 04 '22 16:07 elliot-nelson

I also just want to double-check whether this change is honored by the other pieces of Rush that honor .npmignore -- for example, will rush deploy correctly behave the same way if your projects only have "files": entries?

Hmm. Probably not. That needs to be investigated.

iclanton avatar Jul 08 '22 00:07 iclanton

Is there a solution that doesn't rely on package.json?

  • package.json cannot store code comments to document why the globs were added (this is arguably more important than the glob not being inverted)
  • with .npmignore you can quickly check whether a folder is configured, copy+paste recipes between folders, and diff them to see if they're up to date -- package.json lacks all those features
  • package.json by design cannot validate its settings (e.g. what if someone mistypes "files" as "files "?

I agree with the criticisms of .npmignore, but maybe we can make the situation better rather than differently bad. 😃

octogonz avatar Jul 12 '22 21:07 octogonz