quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.97k stars 3.53k forks source link

Preset option in quasar create #5537

Open adrianreu opened 5 years ago

adrianreu commented 5 years ago

I want to automate the creation of quasar projects. Therefore a configuration for the starter template over JSON would be very nice. The Vue CLI supports presets and makes it easy to automate the creation.

I know I could create a vue cli project but I want to use the quasar cli. Are there any plans for the future to implement this? Or are there reasons why this isn't implemented yet?

pdanpdan commented 5 years ago

For the moment you can create new projects from a template by specifying the source template (https://quasar.dev/quasar-cli/cli-documentation/commands-list#create).

Can you help us and add some more details on what options do you need?

rstoenescu commented 5 years ago

Hi,

Yes, presets saving is planned.

adrianreu commented 5 years ago

For the moment you can create new projects from a template by specifying the source template (https://quasar.dev/quasar-cli/cli-documentation/commands-list#create).

Can you help us and add some more details on what options do you need?

Yes thats the way I do it. But when I want to generate a new project programmatically then I get problems because I have to select different options (like SCSS, CSS or STYLUS etc.) with my keyboard.

I want to type quasar create <projectname> --preset <linkToJsonConfiguration> pointing a JSON file which holds the whole configuration.

Richie765 commented 4 years ago

I'm looking for the same thing. I'm creating multiple smaller projects and I'd like to automate quasar create. That way I can create a project without any user interaction, and make some standard changes to the new project as well. For instance the default layout will need to be replaced and some common npm packages can be installed as well. The forced interactive nature of quasar create makes this currently impossible.

tohagan commented 3 years ago

Ideally permit --preset <JsonFile> OR --preset <JsonValue>

I think this is useful in many contexts e.g. Code samples / blog posts were you just want to say "run this one step" to create a new Quasar project.

julie777 commented 3 years ago

More examples:

Creating my own quasar starter template would be usable, but there are cases where I want to use the available templates to create different kinds of quasar apps, but with my customization. I don't want to create a custom copy of every quasar template.

A side note, hopefully, quasar will have a growing repository of starter templates to make it even easier for users to create common types of apps. And/or, there could be a set of post create customization packs, which would reduce the number of starter packs. If you will imagine that the changes that are part of quasar create to use vuex could be extacted to a starter pack add on, and an amplify datastore addon created, and my custom addon pack to add the custom directives I use, or maybe I always use some vue add-ons like vuex-pathify.

I like the idea of having quasar-framework/starter-kits which has all the various kinds of things I would build with quasar (ui-component, app-extension, umd-app, pwa, etc.) And quasar-framework/extensions which includes many standard extensions such as eslint, vuex, vue-router, etc. where an extension always has an install file that can be used by quasar create to do the setup work. For my custom extions, I just need to tell quasar create where to find my extension in addition to the name. This allows any post create steps to be encapsulated in an extension. There are already extensions, some built in such as eslint and vuex and some external such as quasar testing.

I'm sorry, I got a little carried away and probably I just created a new feature request.

IlCallo commented 2 years ago

I'm working on this feature, do anyone have examples of other frameworks which already implement this pattern?

Aside Vue CLI I'm not finding much around, probably because I'm searching the wrong keywords

tohagan commented 2 years ago

Another suggestion ... when you create a project using the current interactive UX, it would be great to always save a create-quasar.json file as part of the new project that can then just be used next time to quickly create another project with the same settings. This makes it quick and easy to discover and configure setting values rather than killing time reading docs.

IlCallo commented 2 years ago

After a bit of reading and asking around, I've come to the conclusion that adding a preset system in Quasar CLI may not be a good idea

If added, CLI prompts would become part of our public API and as such we would need to manage versioning and avoid breaking changes, limiting what we can do without bumping a major version Both Svelte and Vue guys shared the same opinion on the topic, so I'm pretty sure it's the correct one Angular and React too don't have any preset system in place and don't seem interested into adding one

What IS a good idea is adding a --default option which automatically accept the default value for all prompts It COULD be a good idea to add a couple of shortcut options too, eg --vite/--webpack/--pinia/--ts/etc, but I haven't made a list of the most used ones

An better idea would be to expose a create method from Quasar CLI when imported into code able to manage presets, but the effort to do this is unknown

Meanwhile, I created a simple helper which can be used with any create-xxx package, using this moves the responsability of checking changing prompts on the dev automating the generation, instead of Quasar team

Check it out: https://gist.github.com/IlCallo/288ccdc2cac782854bb4d78783389fd5

IlCallo commented 2 years ago

Here's the script as an installable package: https://github.com/dreamonkey/cli-ghostwriter

alanpoulain commented 1 year ago

For information, Nuxt handles it with an answers option: https://github.com/nuxt/create-nuxt-app/blob/2f58b48a9e1fb3f78c465569e8441313cfc89642/packages/create-nuxt-app/lib/cli.js#L32 It would be really useful for end-to-end testing the generated Quasar application for an app generator (https://github.com/api-platform/create-client). See https://github.com/api-platform/create-client/blob/main/testapp.sh.

IlCallo commented 1 year ago

The interesting fact here is that they implemented that but never documented it, probably on purpose to avoid making it a "public API"

alanpoulain commented 1 year ago

Or maybe it has been forgotten :sweat_smile: See https://github.com/nuxt/create-nuxt-app/issues/858. There is also a PR to add default answers in order to avoid setting all the answers: https://github.com/nuxt/create-nuxt-app/pull/630