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 option to create-strapi-app #8112
Conversation
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
Signed-off-by: Rémi de Juvigny <remi@hey.com>
See more discussion about this PR at #7626 |
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #8112 +/- ##
==========================================
+ Coverage 32.71% 32.96% +0.24%
==========================================
Files 1194 1197 +3
Lines 12969 13020 +51
Branches 1280 1286 +6
==========================================
+ Hits 4243 4292 +49
+ Misses 7886 7885 -1
- Partials 840 843 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Signed-off-by: Rémi de Juvigny <remi@hey.com>
cce7422
to
e64ac06
Compare
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Good job 💯
hey @remidej @alexandrebodin - thanks for this
When I look at the CLI documentation I only see this
is |
Hi @bernardro indeed create-strapi-app is the one you need to be using for this. |
thank you @alexandrebodin |
Description of what I did
I added a
--template
option to thecreate-strapi-app
CLI.Right now, every project created with
create-strapi-app
is an empty Strapi project. This will remain the default, but we also want to help users bootstrap projects that are preconfigured for specific use cases. After discussions with @alexandrebodin and @Convly , we designed a specification for this that relies on a new template system.It looks like this:
A template's only concern should be to adapt Strapi to a use case. It should not deal with environment-specific configs, like databases, upload or email providers. This is to make sure they are maintainable, and to avoid conflicts with other CLI options like
--quickstart
.These templates are meant to be an important piece of our upcoming starters system. To clarify:
How it works
A template is a GitHub repository. This way, it's fully open. Any community member can create a template, not just the Strapi team.
Inspired by create-react-app, here is the structure a template should follow:
README.md
and.gitignore
are meta files: They only affect the template itself, not the projects made with it.template.json
is used to extend the defaultpackage.json
of a Strapi project. We can use it to add scripts and dependencies.template/
is the folder where you can extend the file contents of a Strapi project. It can contain any of the following:README.md
: the readme of app made with this template.env.example
: to specify required environment variablesapi/
: for collections and single typescomponents/
for componentsconfig/
can only include thefunctions
directory (things likebootstrap.js
or404.js
). That's because other config files are environment-specific.data/
to store the data imported by a seed scriptplugins/
for custom Strapi pluginspublic/
to serve filesscripts/
for custom scriptsIf a template doesn't follow this structure, the installation will crash.
Try it out
You can try it by calling the node script locally:
Things to figure out