ioBroker / dev-server

MIT License
14 stars 8 forks source link

Support for jsonConfig and React Tab at the same time #473

Open stevenengland opened 7 months ago

stevenengland commented 7 months ago

Hi there,

currently the dev-server does not fully support to have a jsonConfig.json[5] and a React tab in parallel. At least the hot reload feature is a either/or decision. You can see that here: https://github.com/ioBroker/dev-server/blob/259a1ccfb9b75f4403a58e6feb47f1353845f195/src/index.ts#L638

grafik

Might be connected to https://github.com/ioBroker/dev-server/issues/464

Maybe there are more parts like this. But before I dive into that any more: Is this intendend behaviour? Like is there a fixed guideline for adapter development out there that says: Either use HTML/React for config, tab and custom or use jsonConfig for config (no tab/custom) and do not combine approaches?

I personally really like to use a React tab and jsonConfig for the simpler config part. But if this is not the way to go then I might switch because the missing hot reload feature is a killer for itself. Other downsides I haven't recognized so far but they may exist.

Thanks for feedback in advance!

Apollon77 commented 7 months ago

I think the best way would be to parse the io.package and get the infos about "used types" from there and then do the needed things based on this and not on existing files. The io-package is already read in some places if needed. Do you want to give it a try to adjust it yourself?

stevenengland commented 7 months ago

Hi @Apollon77 , I can't promise that I will try it because of spare free time (what else ;)?), but I also do not reject this offer yet :) One thing that frightens me is that there seems to be no obvious test tooling for the dev-server. I guess if there would be automated tests I would be more confident and might give it a try more quickly. Is there anything that I miss in regards of testing? Because it is a hughe codebase and I can't imagine that everything is tested manually... (?)

Apollon77 commented 7 months ago

I would not know any automated tests for this - also because it is very hard to mock all the relevant things to have meaningful automated tests there. So tests are mainly done by really executing it on an own system.

The good in this case is that the changes are relatively limited in scope, so the risk to affect other functionality is not too high

klein0r commented 4 months ago

I've searched over an hour now why my watch:react isn't executed by the dev-server 😭

https://github.com/ioBroker/dev-server/blob/896cdaf51444442d463f2912663a06170f70fa0d/src/index.ts#L658-L664

.create-adapter.json:

    "adminUi": "json",
    "tabReact": "yes",

Workaround: Renamed the jsonConfig.json to something else when using the dev-server.

Apollon77 commented 4 months ago

What do you think ... how to best solve that ... simply always do both depending pon file existence?