holochain / launcher-tauri

Desktop launcher to install and use Holochain apps locally
261 stars 21 forks source link

"Development Mode" for hc launch #114

Closed mattyg closed 1 year ago

mattyg commented 1 year ago

Is your feature request related to a problem? Please describe. Needing to wait for your app's front-end to rebuild in order to see any changes is a bit frustrating and disruptive. It makes it cumbersome to iterate on a front-end when experimenting with minor changes.

Describe the solution you'd like A "development mode" for hc launch where instead of passing in a path to built front-end, you pass in a local port where your front-end is being served from it's own development server.

matthme commented 1 year ago

There is the --watch flag that watches for file changes. Does this help?

matthme commented 1 year ago

Here is an example of a workflow using the watch flag: https://github.com/holochain/scaffolding/blob/515cff2b3471b37ab9154c84070b1a9ccbc9c656/templates/lit/web-app/package.json.hbs#L12

matthme commented 1 year ago

But adding localhost support might be possible as well, I'll check it out.

mattyg commented 1 year ago

Here is an example of a workflow using the watch flag: https://github.com/holochain/scaffolding/blob/515cff2b3471b37ab9154c84070b1a9ccbc9c656/templates/lit/web-app/package.json.hbs#L12

Yeah that's what I'm using -- it works fine. It's just that waiting 10-15 seconds to make a new production build so I can see a change gets a bit tiring. Also harder to track down front-end errors when their source is obscured in production build optimizations.

mattyg commented 1 year ago

just found this plugin, figured I should note it here: https://github.com/tauri-apps/tauri-plugin-localhost

matthme commented 1 year ago

By the way, it only took 1-2 seconds to reload smaller changes when I used it recently (in an app built with the scaffolding tool cloned directly from github to have the latest main branch). I wonder what the difference is between our setup...

matthme commented 1 year ago

It was not too hard fortunately :). Here it is: https://github.com/holochain/launcher/tree/feat/hc-launch-localhost

I have it still on a separate branch and it will certainly take a while until it makes its way into holonix. But I'd be more than happy if you'd already test it and report whether it works fine for you.

To test it just install hc launch globally:

cargo install holochain_cli_launch --git https://github.com/holochain/launcher --branch feat/hc-launch-localhost

(And then make sure you're using the right version if you call it within nix-shell. It should show the --ui-port <ui-port> field in the help section)

mattyg commented 1 year ago

cargo install holochain_cli_launch --git https://github.com/holochain/launcher --branch feat/hc-launch-localhost

You rock!! Thank you so much!!! I'll try it out now.

By the way, it only took 1-2 seconds to reload smaller changes when I used it recently (in an app built with the scaffolding tool cloned directly from github to have the latest main branch). I wonder what the difference is between our setup...

I'm guessing my CPU is just a bit underpowered.

mattyg commented 1 year ago

This works great -- thank you!!

matthme commented 1 year ago

It's also in holonix now fyi (not sure it was already at the point you closed the issue)