Closed Balint66 closed 1 year ago
Thanks for looking into this. Maybe we can combine boach approaches by using webdev as a package and using the deamon api.
When I run webdev as daemon, it serves the page just as the serve
command does. The only difference is that the console output is in json.
Yes, from the outside it does look like that it does nothing but the same as the serve
but with json output.
But in the inside, it does more:
daemon
domain, so in the beginning, only those commands, and the preregistered ones, like restart
, can be executed.DevWorkflow
. This is where it starts the serving.app
domain.What's different, is that you can give it commands via jsonRPC on stdin. So, you can restart the app, stop the daemon, get it's version., and it will respond on stdout. Most things are documented on the flutter page, how one should attach to the process, the communication workflow.
I tried to pass more arguments than specified in the help, because in the code it looks like that the other arguments are passed to the mentioned workflow, so it wouldn't launch chrome, but the args parser wouldn't let me do it.
Fyi the new cli uses the DevWorkflow directly.
As mentioned in #49 there is other ways of using the webdev package. I had quick a look at the source code of webdev and there is an "undocumented" command line option to use it as a daemon, just like someone can use flutter as described in the documentation.
pro:
con:
Maybe a mixed implementation could be used:
I wanted to create this issue to signal my finding, and start a conversation. Eventually I want to work on this and the mentioned issue's implementation, and I'm curious if creating such feature would be any help. 😄