feat: added inquirer as an alternative to --template cli
- [x] I have read the contribution documentation for this project.
- [x] I agree to follow the code of conduct that this project follows, as appropriate.
- [x] The changes are appropriately documented (if applicable).
- [x] The changes have sufficient test coverage (if applicable).
- [x] The testsuite passes successfully on my local machine (if applicable).
Summarize your changes:
These are my proposed changes to the cli tool.
I added @inquirer/prompts to allow users to run the command, instead of specifying --template the user would be asked a series of questions so they could see the available options.
npx create-electron-app@latest my-app
Here's what it looks like in the console:
Example of results after completion:
Notes:
- This does not break existing "--template" option of running the command.
- I included a commented out section regarding frontend frameworks this is so in the future there could be vite-react-typescript, vite-vue-typescript, etc. templates. (referencing #3932)
@erickzhao Implemented the mentioned @listr2/prompt-adapter-inquirer in the latest commit. Thank you for the suggestion!
@erickzhao Do you know who would have the permission to approve this pull request?
Hi @sethcg, let me take a look!
@erickzhao Thank you for the review, In my last two commits I addressed your comments.
- [x] Renamed "build tools" to be "bundler"
- [x] Renamed "Base" to be "None"
- [x] Fixed webpack naming conventions
- [x] Fixed the way default parameters are determined for "skipGit", "force", and "copyCIFiles" options
Thanks for these changes @sethcg. I have a few UX tweaks that I would suggest. I think it might be easier if I just push these commits up to your branch. Sorry for the delay!
Thanks for these changes @sethcg. I have a few UX tweaks that I would suggest. I think it might be easier if I just push these commits up to your branch. Sorry for the delay!
That would be great!
Just added commit https://github.com/electron/forge/pull/3933/commits/20823ab9768e25c83a602c4d20aa3aa24b406b6e.
- prompt only appears if no flags are passed
- changed the prompt to include other initialization options (
skipGitandforce)
With this change, we lose the default values passed through commander.js in the --help text, but it's not too confusing because all flags are false by default.