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(cli): interactive project creation (RFC #1365) #2926

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vladcos
Copy link
Contributor

@vladcos vladcos commented Sep 14, 2023

Experimenting with implementing the RFC https://github.com/projen/projen/blob/main/rfcs/project-creation-prompt.md

CleanShot.2023-09-14.at.21.13.59.mp4

I think it will improve the UX and lower the barrier of entry. I, as a relatively new user or projen, needed to invest time and effort in order to perform basic Projen configuration and turn on/off options i wanted, i had to read the whole super long API page just to find a couple of options I wanted. I think a little bit of guidance when scaffolding a new project might improve the popularity of this awesome tool.

For now I have hardcoded some options and had to integrate the yargs cli class with the prompt library in a hackish way because yargs lacks native support for it.

A few problems that need to be solved and some input from the community would be appreciated:

  1. Library choice: https://github.com/terkelg/prompts recommended in the RFC is poorly maintained. I found that https://github.com/SBoudrias/Inquirer.js is the most active and lightweight lib (although very basic).
  2. Option source: It was recommended in the RFC to use the options flagged with @featured flag in the prompts. I think the options marked with this doctag are not very useful for prompts. I would suggest adding a new flag: i.e. @prompt

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mrgrain
Copy link
Contributor

mrgrain commented Sep 15, 2023

I love this! 😍 Looking forward to having this in projen!
The RFC is quite old now, and will need some overhauling.

Library choice: https://github.com/terkelg/prompts recommended in the RFC is poorly maintained. I found that https://github.com/SBoudrias/Inquirer.js is the most active and lightweight lib (although very basic).

prompts doesn't look very maintained at the moment.
inquirer looks good and is lightweight, but has comparatively many dependencies.
enquirer is my current favorite. Maintained, no additional dependencies, still small enough.

Option source: It was recommended in the RFC to use the options flagged with @featured flag in the prompts. I think the options marked with this doctag are not very useful for prompts. I would suggest adding a new flag: i.e. @prompt

I'm okay with an extra tag. Although it makes me wonder what the difference between @featured and @prompt is supposed to be. 🤔

The best starting point in my opinion is to prompt for required, but not provided options. We don't even need to introduce --interactive for this.

For now I have hardcoded some options and had to integrate the yargs cli class with the prompt library in a hackish way because yargs lacks native support for it.

And it feels awesome! An interesting problem to solve will be how we can encode the component kind of questions into code. Which components to group? When do we need to follow-up with more questions (i.e. don't ask me follow-up questions on jest, if I didn't select it)

@mrgrain mrgrain mentioned this pull request Oct 9, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants