NEWS
How to fork and work on an existing adapter?
-
I am currently in the process of refactoring my javascripts because they have grown significantly and become harder and harder to maintain.
I have an ancient workflow where I have multiple global/ scripts I concatenate with a bash script because - in my case - order matters.I want to get rid of that and tried to find out, in what order global scripts are concatenated. It seems like it is only mandated by the order they come out of the DB.
Now I want to fork the iobroker.javascript adapter, add debug logging and potentially make the load order deterministic (if it isn't yet). How do I do that?
I tried the following:- fork the adapter
- modify code (added log statements only for now)
- replaced all
github.com/iobroker/iobroker.javascriptwithgithub.com/fbeister/iobroker.javascript - Commited changes and pushed to master of fork
- In iobroker, "install from github" with my URL
This correctly picks up my commit hash and also puts a package.json containing my version, URL, etc. into the node_modules folder of iobroker.
Nevertheless, my changes are nowhere to be seen - I know that TS is transpiled to JS, but my changes are inside log strings for testing and main.js contains the "old" ones.Could someone shed some light on the local dev loop for this?
-
You might try to joind the english developer group at telegram: t.me/ioBroker_dev_en
But be warned - there are very few english speaking devs around an the javascript adapter is for sure not the best place to start developing an ioBroker adapter. -
Ich crossposte mal nach DE
-
Korrektur - ich darf das wohl nicht.
-
Korrektur - ich darf das wohl nicht.
@Frederic-Beister ich schieb dich mal komplett rüber
-
H Homoran verschob dieses Thema von Development
-
Wo hast du was geändert - wenn in einer
.tsDatei, hast du transpiliert? -
Ich habe in
main.tseinfach ein paarthis.log.infos angepasst und auch hinzugefügt. Ich ging davon aus, dass der "Installiere von GitHub" Workflow in ioBroker das transpilieren macht - weil ich die besagten logmessages nirgends sonst in der codebase gefunden habe, am Ende aber ein main.js mit der (unmodifizierten) message liegt. -
I am currently in the process of refactoring my javascripts because they have grown significantly and become harder and harder to maintain.
I have an ancient workflow where I have multiple global/ scripts I concatenate with a bash script because - in my case - order matters.I want to get rid of that and tried to find out, in what order global scripts are concatenated. It seems like it is only mandated by the order they come out of the DB.
Now I want to fork the iobroker.javascript adapter, add debug logging and potentially make the load order deterministic (if it isn't yet). How do I do that?
I tried the following:- fork the adapter
- modify code (added log statements only for now)
- replaced all
github.com/iobroker/iobroker.javascriptwithgithub.com/fbeister/iobroker.javascript - Commited changes and pushed to master of fork
- In iobroker, "install from github" with my URL
This correctly picks up my commit hash and also puts a package.json containing my version, URL, etc. into the node_modules folder of iobroker.
Nevertheless, my changes are nowhere to be seen - I know that TS is transpiled to JS, but my changes are inside log strings for testing and main.js contains the "old" ones.Could someone shed some light on the local dev loop for this?
Jetzt muss ich mal fragen:
Du willst am javascript Adapter etwas machen?
Oder dein Skripte überarbeiten?Wenn du am Adapter etwas machen möchtest, dann Forke den Adapter auf t GitHub in dein persönliches Account
Und clone dann dieses Repository auf die lokale Maschine.
Mit dem Iobroker dev-Server kannst du dann eine lokale Iobroker Instanz laufen lassen und auch debuggenWenn du deine Skripte besser debuggen willst dann gibt es für vscode eine Erweiterung, die dir deine Skripte synchronisiert.
Leider stehen wir unter VS Code die Iobroker Funktionen nicht zur Verfügung, aber mit stub Funktionen kann man sich behelfen.Wenn du es richtig umfangreich machen möchtest, könntest du deine Funktionalitäten auch alle in einem eigenen Adapter legen, da hast du dann alle Möglichkeiten
-
Ich habe in
main.tseinfach ein paarthis.log.infos angepasst und auch hinzugefügt. Ich ging davon aus, dass der "Installiere von GitHub" Workflow in ioBroker das transpilieren macht - weil ich die besagten logmessages nirgends sonst in der codebase gefunden habe, am Ende aber ein main.js mit der (unmodifizierten) message liegt.@Frederic-Beister sagte in How to fork and work on an existing adapter?:
Ich habe in
main.tseinfach ein paarthis.log.infos angepasst und auch hinzugefügt. Ich ging davon aus, dass der "Installiere von GitHub" Workflow in ioBroker das transpilieren macht - weil ich die besagten logmessages nirgends sonst in der codebase gefunden habe, am Ende aber ein main.js mit der (unmodifizierten) message liegt.Nein macht er nicht. Der transpilierte Code liegt in ./build. Darin code zu ändern wäre nix für mich.
Heißt: Mach das was Oliver schreibst - lokale Entwicklungsumgebung einrichten und mit dev-server oder npm run build den code transpilieren
-
Ich habe in
main.tseinfach ein paarthis.log.infos angepasst und auch hinzugefügt. Ich ging davon aus, dass der "Installiere von GitHub" Workflow in ioBroker das transpilieren macht - weil ich die besagten logmessages nirgends sonst in der codebase gefunden habe, am Ende aber ein main.js mit der (unmodifizierten) message liegt.In der Package.json sind die scripte hinterlegt mit der Build ausgeführt wird.
Suche nach Build -
Kenne jetzt nicht seinen wissenstand - die ist da aber sehr umfangreich - daher
npm run build -
Argh! Meine IDE war "hilfreich" und hat den build/ Ordner ausgeblendet. Da kann die Volltextsuche auch nix finden. Sorry for the noise!
-
Argh! Meine IDE war "hilfreich" und hat den build/ Ordner ausgeblendet. Da kann die Volltextsuche auch nix finden. Sorry for the noise!
@Frederic-Beister welche ide?