-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add devDependencies for custom templates #8082
Comments
I want to support not only devDependencies, but also a complete package.json configuration |
Yeah that would be cool. I want to create a template that already has prettier setup with husky hooks, but I realise now In the fork I made each of my templates had a |
@tomvalorsa I agree with you. I want to overwrite it based on the custom template. It's more flexible.🌝 |
It will be more flexible if I could add any fields in template.json, such as |
@reactjser yeah. |
@tomvalorsa it is possible to create a template with prettier and husky configured. Just put your config inside |
Is anyone working on this? I'm interested in solving this issue. |
@franz899 👌。 |
Hi @tomvalorsa, the CRA team have historically been against having 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 I'd personally be in favour of adding a "additional keys" property, which would allow things like |
All right... |
Hope for this feature.😃 |
Hey, what's with all the sadness? :) Let's put the question this way:
This is an honest question, we love your feedback and want to make a product that works well for all of our users (a difficult balance of course). |
@mrmckeb Not sad, I think you are right.😄 |
I'll wait for some more feedback - and any volunteers (optional) - otherwise, I could pick this up over the weekend or next week 🎅. |
@mrmckeb 👌~ |
Hey @mrmckeb, that makes sense! To answer your questions above the main goal I have is setting up a project using a template which requires as little extra work as possible, e.g. setting up prettier so that other devs in my team don’t have to. Given this I think the ability to add additional config is more important than I think something like the I'd like to work on this 🙋♂ @lukaszfiszer thanks for the tip - I’ve been adding this config to |
You're up @tomvalorsa! Feel free to ping me on Discord, Spectrum or Twitter if you want to talk through anything. The most important thing (IMO) is that this new key has a blacklist for keys we include by default, or at least handles those. I'll talk to the rest of the team about this too and see if anyone wants to raise a red flag. |
👋 I'd like to chime in about |
@tomvalorsa I met with @ianschmitz and @iansu yesterday and we want to take this approach for now. All Example: {
"package": {
"scripts": {},
"dependencies": {},
"husky": {},
}
} The existing keys will work, but will be deprecated and removed in the next major. For now, This doc will also need to be updated as a part of your PR: You would need to document which keys are merged, and which replaced too. I think, apart from Let me know if you have any concerns, and again, I'm here to help if you have any questions. Note: PR #8209 was opened to add some of these features. I've closed for now, as it conflicts with the discussed approach - but as mentioned, this work should allow any package.json keys, excluding those blacklisted. CC @jimthedev who may want to chime in with further thoughts. |
@malept we haven't officially supported electron to date, but if you'd like to open a separate ticket and tag me in it - we can discuss there. I'd love to understand more. |
Thanks @mrmckeb. I’m in favor of the package key. It is more robust. I would just mention that the sooner the better since templates being created now would not be following that and thus it seems to be a breaking change that gets worse as time goes on. :) |
@mrmckeb makes sense, thanks for supporting info. I will get started on this properly today and will reach out if I have any questions. |
No problem @jimthedev, I'll work with the team to ship this as soon as it's ready. Thanks for the update @tomvalorsa! |
Please note that packages like husky will not correctly add hooks to the local repo when being installed as template dependency, as described in #8280 |
@mrmckeb I'm also in need of I don't think it really deserves a separate issue, since it doesn't require officially supporting Electron in any way. In addition to what @malept has said: The most common packager for Electron apps, Allowing The only other option is to not use CRA at all, which is what my team is currently doing. |
@apples This issue is meant to be closed sorry, this was an oversight. I'd ask that you create a new issue - and detail anything else that would help with electron support. We can then have a discussion specific to this, without alerting the others in this thread. I'm not opposed to allowing it for Electron apps, we just need to discuss with other team members. |
Is 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.The text was updated successfully, but these errors were encountered: