-
-
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 template support #6514
Add template support #6514
Conversation
OK, so I need to work on tests for this - and make sure it all works correctly - but the idea is in place. The biggest issue I see with this implementation is that a) the template may require a different scripts version than the one the user set, and b) as the template is handled by |
Would be awesome to have the ability to add custom scripts to the package.json. Say, my template has internationalisation, and I want to add extraction script to the project. |
This can be tested with: node ./create-react-app/packages/create-react-app test-project \
--template file:./create-react-app/packages/create-react-app-template/ \
--scripts-version file:./create-react-app/packages/react-scripts/ |
Ok |
After cloning your branch, and running your exact command, I get this error:
Yarn v1.12.3 EDIT: I tried debugging this but I'm not really sure whats wrong or causing it, a couple observations I made are:
|
I'm working on Ubuntu (WSL actually), but it may be an issue we need to look into. That being said, the |
Any further work on this? |
Hi @Ugzuzg, this is a 3.2 goal now - I'll be restarting work on this next week. We had some more urgent matters and wanted to think about this a little more. Perhaps you can share a little more about what you'd like to see from templates? |
Custom scripts, as mentioned above. Also would be great to install additional dependencies. This PR achieves custom dependencies installing peerDependencies of a template, I believe? So this case is covered. Thank you! |
This is a work in progress. Do not merge.
This has become a little more complicated than I first envisioned. Right now, I'm still working through the init part of this. The plan is as follows:
react-scripts
andcreate-react-app-template-*
are installed as dependencies. Either or both of those can be defined via CLI.peerDependencies
, this is not used during install.react-scripts
init, the template is copied from template package, andpeerDependencies
are installed from that package (excluding the scripts-version). That package is then removed, as it no longer has any value.peerDependencies
of the template, appropriate warnings will be shown - but the user can still continue. This, importantly, allows custom scripts versions to work with the template.The
typescript
flag is deprecated under this process.