FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]

Home Page:https://www.snowpack.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we have cli wizard prompts?

rajasegar opened this issue · comments

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 '

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.

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/result?p=inquirer@7.3.0
Screenshot 2020-07-08 at 8 29 51 PM

enquirer is an alternative to inquirer.js with a similar API surface.
https://bundlephobia.com/result?p=enquirer@2.3.6

@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.

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

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