Skip to content
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

Merged
merged 2 commits into from
Jun 23, 2021

Conversation

markkaylor
Copy link
Contributor

@markkaylor markkaylor commented Jun 3, 2021

What does it do?

Prompts user to select a template or starter

How to test it?

  • create-strapi-app: ./node_modules/.bin/create-strapi-app
  • create-strapi-starter: ./node_modules/.bin/create-strapi-starter

@markkaylor markkaylor self-assigned this Jun 3, 2021
@codecov
Copy link

codecov bot commented Jun 3, 2021

Codecov Report

Merging #10433 (e41e96c) into master (a860d74) will not change coverage.
The diff coverage is n/a.

❗ Current head e41e96c differs from pull request most recent head 32c36bc. Consider uploading reports for the commit 32c36bc to get more accurate results
Impacted file tree graph

@@           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           
Flag Coverage Δ
front ∅ <ø> (∅)
unit 58.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a860d74...32c36bc. Read the comment docs.

@markkaylor markkaylor force-pushed the feat/interactive-cli branch 3 times, most recently from 25da9e5 to eb9f660 Compare June 4, 2021 14:54
@markkaylor markkaylor changed the title [CLI] Interactive CLI [CLI] Add interactive options for templates and starters Jun 4, 2021
@markkaylor markkaylor force-pushed the feat/interactive-cli branch 2 times, most recently from 130bda7 to 5976b48 Compare June 4, 2021 16:03
@markkaylor markkaylor marked this pull request as ready for review June 7, 2021 09:30
Copy link
Member

@alexandrebodin alexandrebodin left a 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 :)

packages/create-strapi-app/utils/prompt-user.js Outdated Show resolved Hide resolved
* @param {string} cliType - The type of cli: starters or templates
* @returns
*/
module.exports = async function promptUser(projectArgs) {
Copy link
Member

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);
Copy link
Member

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() {
Copy link
Member

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);
Copy link
Member

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)

packages/create-strapi-app/create-strapi-app.js Outdated Show resolved Hide resolved
packages/create-strapi-app/create-strapi-app.js Outdated Show resolved Hide resolved
packages/create-strapi-app/utils/prompt-user.js Outdated Show resolved Hide resolved
packages/create-strapi-app/utils/prompt-user.js Outdated Show resolved Hide resolved
@markkaylor markkaylor force-pushed the feat/interactive-cli branch 2 times, most recently from e81192b to 4f97832 Compare June 18, 2021 14:55
@alexandrebodin alexandrebodin added this to the 3.6.7 milestone Jun 21, 2021
@alexandrebodin alexandrebodin added source: cli Source is cli package issue: enhancement Issue suggesting an enhancement to an existing feature labels Jun 21, 2021
'Would you like to use a template? (Templates are Strapi configurations designed for a specifc use case)',
},
{
name: 'template',
Copy link
Member

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

Copy link
Contributor Author

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)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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 :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much Pierre!

@markkaylor markkaylor force-pushed the feat/interactive-cli branch 2 times, most recently from 0e976e9 to db38b73 Compare June 22, 2021 08:29
pwizla added a commit to strapi/documentation that referenced this pull request Jun 22, 2021
pwizla added a commit to strapi/documentation that referenced this pull request Jun 23, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature source: cli Source is cli package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants