-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
[CLI] Add interactive options for templates and starters #10433
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10433 +/- ##
=======================================
Coverage 58.01% 58.01%
=======================================
Files 185 185
Lines 6431 6431
Branches 1400 1400
=======================================
Hits 3731 3731
Misses 2236 2236
Partials 464 464
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
25da9e5
to
eb9f660
Compare
130bda7
to
5976b48
Compare
5976b48
to
9fa7354
Compare
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.
My comments generaly also apply to the start CLI :)
* @param {string} cliType - The type of cli: starters or templates | ||
* @returns | ||
*/ | ||
module.exports = async function promptUser(projectArgs) { |
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.
you are colling it with 2 args but only using one here
*/ | ||
module.exports = async function promptUser(projectArgs) { | ||
const questions = await getPromptQuestions(projectArgs); | ||
const prompt = await inquirer.prompt(questions); |
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.
you can return inquirer.prompt directly
return prompt; | ||
}; | ||
|
||
async function getPromptOptions() { |
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.
this is only for template not for all options you might want to rename it to something more meaningful
}); | ||
} | ||
|
||
initProject(projectName, program); |
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.
We can try to do programm.action(directory => initProject(directoru)))
maybe we will need to do .parseAsync(process.argv)
b56785c
to
3edc089
Compare
e81192b
to
4f97832
Compare
308d187
to
d82dbbc
Compare
'Would you like to use a template? (Templates are Strapi configurations designed for a specifc use case)', | ||
}, | ||
{ | ||
name: 'template', |
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.
can we fetch the question choices only when the question should be displayed ? I think we should avoid fetching the question before rendering the prompt to improve the perceived speed
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.
yes, sorry I thought that was already the behavior but it is not. I will take a look this morning.
name: 'useTemplate', | ||
when: !template, | ||
message: | ||
'Would you like to use a template? (Templates are Strapi configurations designed for a specifc use case)', |
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.
'Would you like to use a template? (Templates are Strapi configurations designed for a specifc use case)', | |
'Would you like to use a template? (Templates are Strapi configurations designed for a specific use case)', |
Noticed a tiny typo while documenting / testing the feature :-)
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.
Thanks so much Pierre!
0e976e9
to
db38b73
Compare
db38b73
to
1816825
Compare
See [this product PR](strapi/strapi#10433)
1816825
to
5cfcb14
Compare
* Merge branch dev/installation-guides--cli * Merge branch dev/installation-guides--docker * Merge branch dev/installation-guides--render * Merge branch dev/installation-guides--platformsh * Update file-structure.md to properly format comments * Merge branch dev/installation-guides--intro * Merge branch dev/installation-guides--digitalocean * Update link to database section * Rework DigitalOcean customization part * Improve install. guides introduction * Replace deployed by hosted * Finalize Render install. guide * Use our new callout style 🤓 * Finalize CLI install. guide * Switch to card-style tabs in Docker install. guide * Finalize DigitalOcean install. guide * Add first draft of dedicated DigitalOcean config. guide * Improve the DigitalOcean config. guide * Add more improvements to the DigitalOcean config. guide * Add missing MongoDB drop warnings * Update PlatformSH guide to remove unnecessary *Next* steps. * Update docs/developer-docs/latest/setup-deployment-guides/installation/cli.md Co-authored-by: DMehaffy <derrickmehaffy@gmail.com> * Update docs/developer-docs/latest/setup-deployment-guides/installation.md Co-authored-by: DMehaffy <derrickmehaffy@gmail.com> * Add consistency for PaaS / IaaS * Remove commented out starters part * Put negative first on not-in-production note * Update docs/developer-docs/latest/setup-deployment-guides/installation/digitalocean-one-click.md * Fix duplicate warning in CLI.md after Github conflict fix commit * Update CLI install guide to reflect interactive CLI enhancements See [this product PR](strapi/strapi#10433) Co-authored-by: DMehaffy <derrickmehaffy@gmail.com>
5cfcb14
to
a655f86
Compare
What does it do?
Prompts user to select a template or starter
How to test it?
./node_modules/.bin/create-strapi-app
./node_modules/.bin/create-strapi-starter