Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Can we have cli wizard prompts? #168

Open
rajasegar opened this issue Jul 7, 2020 · 6 comments
Open

Can we have cli wizard prompts? #168

rajasegar opened this issue Jul 7, 2020 · 6 comments

Comments

@rajasegar
Copy link

rajasegar commented Jul 7, 2020

It's difficult to type the full name of the application templates everytime or I have to copy paste everytime from the readme, and it will be error prone with a lot of chances for typos. What I am proposing here is to have a wizard like interface for the csa like below. This gives us a lot of advantages like:

Less Typing

Users don't have to type the app name, template name and other extra options like using a different package manager
other than npm.

CLI options

Users will be able to know about the different options that can be passed to the command. We can also supply some
default values for the options like templates and package managers so that the users don't have to choose everytime.
For example, for template the default value is @snowpack/app-template-blank, for package manager it is npm

App Templates Discoverability

Users will be able to know about the list of all the available templates and choose from them

Less code

If we have this kind of wizard we can remove lot of the boilerplate code to verify whether the user has entered the correct csa template or not here
https://github.com/pikapkg/create-snowpack-app/blob/9d57b8dacb29ae3f4181a66bacce658769b69e47/packages/create-snowpack-app/index.js#L54

render1594098561711

Alternatives

We can create some alias in case if we don't want to have all the complexities of having wizard code.

alias csa-react 'npx create-snowpack-app  --template @snowpack/app-template-react --use-yarn '
@stramel
Copy link
Contributor

stramel commented Jul 8, 2020

Generally, I've stayed away from the wizard-like prompts in the CLI. They often come with ~100-200KB of code just from the library alone.

I can look into adding something like this and see what the impact would be.

@rajasegar
Copy link
Author

Yes @stramel I agree with you on the extra baggage part, this is what I found if we use something like inquirer.js
https://bundlephobia.com/[email protected]
Screenshot 2020-07-08 at 8 29 51 PM

@jamesgeorge007
Copy link
Contributor

enquirer is an alternative to inquirer.js with a similar API surface.
https://bundlephobia.com/[email protected]

@stramel
Copy link
Contributor

stramel commented Jul 9, 2020

@jamesgeorge007 Good point, I have previously looked at the package but it looked unmaintained. Seems like they're maintaining it again. I can throw this in soon.

@stramel
Copy link
Contributor

stramel commented Jul 16, 2020

Sorry for the delay, I'm working to clean up some duplicated logic between the cli flags and the prompts.

@FredKSchott
Copy link
Owner

If we can add this in a really simple way (without too much new complexity) then I think this is a great idea!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants