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

feat(create-app): two-level prompt for framework and variants #2941

Merged
merged 3 commits into from
Apr 14, 2021

Conversation

antfu
Copy link
Member

@antfu antfu commented Apr 10, 2021

Description

As we are growing rapidly, we are now having 12 templates for users to choose from. As half of them are TypeScript variants and we might have more in the future. This PR introduces two-level prompts to make it simpler and future-proofing - one for frameworks, and one for variants.

From

Screen Shot 2021-04-11 at 6 00 11 AM

To:

Screen Shot 2021-04-11 at 6 00 44 AM

Screen Shot 2021-04-11 at 6 00 52 AM

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-dev
Copy link
Member

Nice! Do you think there will be other variants in the future? I was thinking we could use a yes/no question for TypeScript if not. Maybe interesting to think about JSX for vue. In that case we would have four variants if we want to include that option, or two yes/no questions. Typescript? Yes/no, JSX? Yes/no

@antfu
Copy link
Member Author

antfu commented Apr 11, 2021

Frankly, I don't know 😅. Just think variants could be more general. With JSX/TSX, we will have 4 variants, I guess maybe it's still ok. We can think about it when we have like 10 items-ish?

message: 'Select a variant:',
choices: frameworkInfo.variants.map((v) => ({
name: v.name,
value: v.name,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should display JavaScript or TypeScript (the variant display) instead of the template name once the user selects the option. I think it would be more clear as feedback:
image

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I actually noticed and tried, but haven't found a way to make enquirer work that way. Might need to hack it a bit?

Copy link
Member

Choose a reason for hiding this comment

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

I thought it was a simple change, your call then. This was just a small DX improvement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Found the way.
image

Copy link
Member

Choose a reason for hiding this comment

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

🎉

@Shinigami92 Shinigami92 added enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) labels Apr 11, 2021
@Shinigami92
Copy link
Member

Just an idea I want to raise here 🙂
Is it possible to pick colors of each framework and use these color values for them?
And if the used terminal doesn't support true colors, then fallback to the nearest color?

This would be a new PR 🙂

patak-dev
patak-dev previously approved these changes Apr 14, 2021
@patak-dev patak-dev merged commit 176e55d into main Apr 14, 2021
TobiasMelen pushed a commit to TobiasMelen/vite that referenced this pull request May 3, 2021
@antfu antfu deleted the feat/create-app-prompts branch September 17, 2021 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants