rfcs
rfcs copied to clipboard
RFC: add preferDev field to package.json
Certain packages are used almost exclusively for development. Eg. typescript, tslint etc. It's usually a mistake to add them as normal dependencies.
I suggest to add field "preferDev": boolean (with default false) to package.json. User can't install preferDev package as production package without specifying --save-prod
flag.
References
npm/cli#1337
eslint presumably would preferDev, but it’s a runtime dep in standard, for example. I’m not sure package authors have sufficient context to know whether their package needs to be dev or prod.
If this goes the direction of a warning, I would think you only show it on explicit package installs:
npm i eslint --save-prod
and not:
npm i
My comments on this are essentially the same as my comments on preferPeer
, for all the same reasons.
Also making sure that is appears as the default install suggestion on NPM would be convenient!
Using the format npm i [package-name] -D
for example.