rlidwka / jju

Set of utilities to work with JSON / JSON5 documents.

Home Page:http://rlidwka.github.io/jju/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you add a files array to `package.json` for smaller builds?

blakeembrey opened this issue · comments

It's extremely simple and will ensure packages from NPM are smaller and only contain what people need. For example:

"files": [
  "lib/"
]

Yes, but I would rather put all the extra stuff to .npmignore. The reason is: if I add another file in the future that's not listed in files, and forget to include it, all CI tests will pass but the package will still be broken after publish.

Also, files should include README.md in order not to rely on npm undocumented and ever-changing behavior.

Anyway, back to what really matters. There are docs, benchmark and test folders that aren't required at runtime. Do you suggest to exclude all of them? npm includes tests to its distribution last I checked, and isaacs religiously defended it a while ago, so I don't know what the best practice is.

@rlidwka Sure, .npmignore would do the same job. I normally just include a directory with files and don't have any more issues, but I can definitely understand as I've done it myself too. As for README.md, it is documented but I guess it doesn't hurt. (https://docs.npmjs.com/files/package.json#files)

I would personally, yes. Anything not related to the runtime of the code is overhead to installation. If I want to run the tests, I would clone the repo and check out the tagged version. I'd be curious about reading the entry on npm reasoning, so I'll look around for that.

fixed and published as jju@1.2.1 with only lib/ files inside

Awesome, thanks 👍