Add devDependencies for custom templates
See original GitHub issueIs your proposal related to a problem?
Hey đgood job on the recent release.
Iâm really keen to make a custom template for CRA but want to add dev dependencies. Are there plans to add support for this is the near-ish future? Happy to throw up a PR if youâre busy with other stuff.
I made a fork of CRA a while ago so I could add custom templates but a community-supported effort is much more appealing!
Describe the solution youâd like
Simply adding another key to template.json
for "devDependencies"
.
Where dependencies start to be installed here, there could be a function to wrap the reusable stuff (building up args, spawning process etc.) that could take an dependency type and the relevant slice of template.json
.
Describe alternatives youâve considered
Nothing at the moment as the template feature is obviously very new.
Additional context
This could potentially open up the possibility of adding peerDependencies
too but I havenât really worked with them directly before, so not sure if this is useful/appropriate.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:26 (15 by maintainers)
Top GitHub Comments
Hi @tomvalorsa, the CRA team have historically been against having
devDependencies
in the templates, as most users run tests/etc on the CI anyway, so thereâs rarely a time where you would only want to install one set of dependencies.That being said, things change, and weâre always open to discussion if people have good reasoning for change.
@lukaszfiszer is right, you can use separate configs for things like husky - but weâre open to allowing more keys to be added to the
template.json
file.Iâd personally be in favour of adding a âadditional keysâ property, which would allow things like
eslint
andprettier
keys - and would exclude dependency keys (as they would need to be processed). Or we could whitelist config keys - but that would be a slippery slope I think. Maybe we could call the keyadditionalKeys
orpackageConfigs
?I want to support not only devDependencies, but also a complete package.json configuration