MattCheely / elm-app-gen

A tool for generating Elm applications
Other
24 stars 4 forks source link

Support multiple elm program types #8

Closed kalutheo closed 5 years ago

kalutheo commented 5 years ago

Be able to select a kind of program like https://github.com/kalutheo/generator-elm-starter-kit

kalutheo commented 5 years ago

I think that we should consider two scenario :

For the first scenario, in my opinion, generator-elm-starter-kit cli is more appropriate. It doesn't rely on parcel, it's just plain elm so it's blazing fast to launch.

On the other hand, for bootstraping a new project, generator-elm-parcel is more complete, and has many options that helps for the long run.

I suggest to get some inspiration from vue/cli https://cli.vuejs.org/guide/ I like the presets concept.

We can imagine the elm-app-gen to have two modes (aka presets) :

What do you think about that @MattCheely ?

MattCheely commented 5 years ago

I have been thinking about some similar things, but maybe not quite in the same way. I'm just going to make a list of ideas I think are related and you can tell me if any of them mesh well with what you're thinking:

I'm curious about what you have in mind for the details of fast prototyping. It looks like Vue's version just serves a single file with no project. Is that what you were thinking, or just something that very quickly created a project and started serving it?

You mentioned that generator-elm-starter-kit is fast to launch because it just relies on Elm and not parcel. Are you saying that's because there are fewer dependencies to fetch and install, or is there another factor at play? I would be curious to see what the actual time difference is vs using parcel without all of the setup prompts.

kalutheo commented 5 years ago

I have the same vision here

Definitely

Great :-)

Ok for me

You mentioned that generator-elm-starter-kit is fast to launch because it just relies on Elm and not parcel. Are you saying that's because there are fewer dependencies to fetch and install, or is there another factor at play?

Here i'm talking about first installation time. When using parcel, we are installing a bunch of node_modules under the hood. But it's not a bad thing , it's just normal . I suggest disabling by default parcel in quick mode but once we enter the full verbose mode, we can select parcel. We can even have a --preset parcel option .. But again it's just a matter of providing good default to our end users

MattCheely commented 5 years ago

If parcel is disabled in the quick mode, how does the transition from a quick setup to a full project work? Does the user have to run another command to upgrade to parcel, or do we set parcel as a dependency and they have to come back later and run npm install and end up using a different build server the second time around?

What if we can get the best of both approaches? Fast start-up with the hot-reloading and full build pipeline of parcel? It seems like vue-cli and generator-elm-starter-kit both get really fast startup by using build tools that are globally installed as dependencies for the cli command, so there's no npm install approach. So the speed doesn't come from parcel vs standalone elm, but from when the build tools is installed.

What if when elm-app-gen is installed globally it includes parcel and elm and the other dependencies that are loaded in a new project by default? When users create the new project, we generate the files for them (should be very fast), immediately start the parcel live-server from the global install of elm-app-gen and then run npm/yarn install in the background while the server is running. Startup is crazy fast, but next time they come back to the project they get the exact same experience as before, rather than a potentially different build tool.

MattCheely commented 5 years ago

I experimented with the approach above briefly - just the part about running parcel directly from elm-app-gen, and it took about 4-5 seconds to start the server and compile the app. Parcel still wants to install some dependencies when this happens, but it's fast enough that I think by the time the end user gets the browser open, the app should be ready. There's also no extra click-through actions for the user to take once the browser is open, as with elm-reactor.

kalutheo commented 5 years ago

Okay i got your point, we can keep parcel. I didn't think about the use case of installing the tool globally. I think opening the app straight after the building without requiring an additional click is also a good point.

I have finished migrating my templates in my feature branch. i will now need to see how it plays with parcel i hope i can finish to merge my work with yours by the end of next week

MattCheely commented 5 years ago

Sounds good. Thanks for bringing the start-up speed into the conversation, by the way. I spent quite a bit of time thinking about it the other day, and I think considering it will be a nice improvement to the project. Apologies if my response came across as pushy. I had a lot of questions and ideas after considering it, and on re-reading it seems like I didn't take much care in crafting my responses and just brain dumped directly into the thread, which usually doesn't come across well.

MattCheely commented 5 years ago

Resolved in #17