NEWS
Welche Umgebung für Entwicklung
-
Halo zusammen,
Welche Entwicklerumgebung benutzt ihr um Adapter zu entwickeln?
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
-
Ich persönlich nutze Atom.io, andere Microsoft vscode und andere noch anderes.
IDEs die sich erweitern lassen und ne git oder sogar github Integration sind von Vorteil. Ich nutze zb so ein „Remote Sync“ Plugin für Stimmens geänderte files ( vom Laptop) dann auf den Rechner Synct beim speichern auf dem mein Test iobroker läuft.
-
VSCode. Wenn das einmal ordentlich eingerichtet ist, gibts nix einfacheres IMO. Git-Integration, optional Type-Checking, etc…
-
Da möchte ich mich mal einhängen … Kämpfe mit den französischen Texten, weil die so sehr vom Kontext abhängig sind :oops:
VSCode. Wenn das einmal ordentlich eingerichtet ist, gibts nix einfacheres IMO. Git-Integration, optional Type-Checking, etc… ` Könntest Du mal Deine Einrichtung erläutern? :?
Ich nutze zb so ein „Remote Sync“ Plugin für Stimmens geänderte files ( vom Laptop) dann auf den Rechner Synct beim speichern auf dem mein Test iobroker läuft. ` Genau so etwas möchte ich benutzen, um die Übersetzungen Schritt-für-Schritt auf dem Test-ioBroker nachzuschauen
-
VSCode. Wenn das einmal ordentlich eingerichtet ist, gibts nix einfacheres IMO. Git-Integration, optional Type-Checking, etc…
Könntest Du mal Deine Einrichtung erläutern?
Konsole und Git sind ja von Haus aus drin. Mag zwar nicht jeder, aber ich bin damit einfach am schnellsten.Installierte Erweiterungen:
-
Auto Close Tag (für HTML/React)
-
Bookmarks
-
Coverage Gutters + Run on Save (Automatische Test-Coverage-Anzeige wenn package.json entsprechend konfiguriert ist)
-
ESLint (JS-Datei-Prüfung)
-
TSLint (TypeScript-Datei-Prüfung auf stilistische und typische Syntax-Fehler)
TypeChecking erfordert eine entsprechend konfigurierte tsconfig.json-Datei im Projektordner, siehe https://github.com/ioBroker/ioBroker.cl … onfig.json oder https://github.com/AlCalzone/ioBroker.t ... onfig.json und "typescript" als devDependency. Dann meckert VSCode beim Öffnen von Dateien, wenn es Fehler findet, die über einfache Fehler wie ( vergessen hinausgehen.
Für Adapter-Aktualisierung auf dem Zielhost hab ich auch ein kleines Skript.
package.json => scripts:
"deploy_local": "node --require ts-node/register maintenance/deploy_local.ts",
maintenance/deploy_local.ts sieht so aus:
! ````
// tslint:disable:no-var-requires
/*
Allows easier local debugging over SSH.
Runningnpm run deploy_local
updates remote adapter files
and restarts the instance
/
! /
CONFIGURATION:
- provide a deploy_password.json file in the local dir with contents
{
"host": "<hostname>",
"username": "<username>",
"password": "<password>"
}
- specify which dirs and files should be uploaded
- specify where the root dir is relative to this script
*/
const uploadDirs = ["admin", "build"];
const uploadFiles = ["package.json", "io-package.json", "main.js"];
const rootDir = "../";
! // =========================
// CAN'T TOUCH THIS
// =========================
! import * as nodeSSH from "node-ssh";
import * as path from "path";
! const localRoot = path.resolve(__dirname, rootDir);
! const ioPack = require(path.join(rootDir, "io-package.json"));
const ADAPTER_NAME = ioPack.common.name;
! const ssh = new nodeSSH();
const sshConfig = require(path.join(_dirname, "deploy_password.json"));
! const remoteRoot =/opt/iobroker/node_modules/iobroker.${ADAPTER_NAME}
;
! (async function main() {
await ssh.connect(sshConfig);
! for (const dir of uploadDirs) {
console.log(cleaning ${dir} dir...
);
await ssh.execCommand(rm -rf ${path.join(remoteRoot, dir)}
);
console.log(uploading ${dir} dir...
);
try {
await ssh.putDirectory(path.join(localRoot, dir), path.join(remoteRoot, dir), {
recursive: true,
concurrency: 10,
validate: (pathname) => {
const basename = path.basename(pathname);
if (basename.startsWith("deploy")) return false;
if (basename.endsWith("Thumbs.db")) return false;
if (basename.endsWith(".map") && basename.indexOf(".bundle.") === -1) return false;
if (basename.indexOf(".test.") > -1) return false;
if (basename === "src") return false;
return true;
},
});
} catch (e) {
console.error(e);
}
}
for (const file of uploadFiles) {
console.log(uploading ${file}...
);
await ssh.putFile(path.join(localRoot, file), path.join(remoteRoot, file));
}
! // update in-mem adapter
let execResult;
console.log("updating in-mem adapter");
execResult = await ssh.execCommand(iobroker upload ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
if (process.argv.indexOf("--norestart") === -1) {
execResult = await ssh.execCommand(iobroker restart ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
}
! console.log("done");
process.exit(0);
})();</password></username></hostname>und erfordert in package.json
"devDependencies": {
"node-ssh": "^5.0.0",
"ts-node": "^4.1.0",
"typescript": "^2.6.2",
}Wenn das Skript konfiguriert ist (siehe Kommentare am Skript-Anfang), reicht ein "npm run deploy_local" und die aktualisierten Adapterdateien werden per SSH auf dem Zielhost hochgeladen und der Adapter dort aktualisiert/neu gestartet. Für dein Vorhaben musst du vermutlich vorher noch 1-2 Skripte lokal ausführen, um die Übersetzungsdateien umzuwandeln.
-
-
VSCode. Wenn das einmal ordentlich eingerichtet ist, gibts nix einfacheres IMO. Git-Integration, optional Type-Checking, etc…
Könntest Du mal Deine Einrichtung erläutern?
Konsole und Git sind ja von Haus aus drin. Mag zwar nicht jeder, aber ich bin damit einfach am schnellsten.Installierte Erweiterungen:
-
Auto Close Tag (für HTML/React)
-
Bookmarks
-
Coverage Gutters + Run on Save (Automatische Test-Coverage-Anzeige wenn package.json entsprechend konfiguriert ist)
-
ESLint (JS-Datei-Prüfung)
-
TSLint (TypeScript-Datei-Prüfung auf stilistische und typische Syntax-Fehler)
TypeChecking erfordert eine entsprechend konfigurierte tsconfig.json-Datei im Projektordner, siehe https://github.com/ioBroker/ioBroker.cl … onfig.json oder https://github.com/AlCalzone/ioBroker.t ... onfig.json und "typescript" als devDependency. Dann meckert VSCode beim Öffnen von Dateien, wenn es Fehler findet, die über einfache Fehler wie ( vergessen hinausgehen.
Für Adapter-Aktualisierung auf dem Zielhost hab ich auch ein kleines Skript.
package.json => scripts:
"deploy_local": "node --require ts-node/register maintenance/deploy_local.ts",
maintenance/deploy_local.ts sieht so aus:
! ````
// tslint:disable:no-var-requires
/*
Allows easier local debugging over SSH.
Runningnpm run deploy_local
updates remote adapter files
and restarts the instance
/
! /
CONFIGURATION:
- provide a deploy_password.json file in the local dir with contents
{
"host": "<hostname>",
"username": "<username>",
"password": "<password>"
}
- specify which dirs and files should be uploaded
- specify where the root dir is relative to this script
*/
const uploadDirs = ["admin", "build"];
const uploadFiles = ["package.json", "io-package.json", "main.js"];
const rootDir = "../";
! // =========================
// CAN'T TOUCH THIS
// =========================
! import * as nodeSSH from "node-ssh";
import * as path from "path";
! const localRoot = path.resolve(__dirname, rootDir);
! const ioPack = require(path.join(rootDir, "io-package.json"));
const ADAPTER_NAME = ioPack.common.name;
! const ssh = new nodeSSH();
const sshConfig = require(path.join(_dirname, "deploy_password.json"));
! const remoteRoot =/opt/iobroker/node_modules/iobroker.${ADAPTER_NAME}
;
! (async function main() {
await ssh.connect(sshConfig);
! for (const dir of uploadDirs) {
console.log(cleaning ${dir} dir...
);
await ssh.execCommand(rm -rf ${path.join(remoteRoot, dir)}
);
console.log(uploading ${dir} dir...
);
try {
await ssh.putDirectory(path.join(localRoot, dir), path.join(remoteRoot, dir), {
recursive: true,
concurrency: 10,
validate: (pathname) => {
const basename = path.basename(pathname);
if (basename.startsWith("deploy")) return false;
if (basename.endsWith("Thumbs.db")) return false;
if (basename.endsWith(".map") && basename.indexOf(".bundle.") === -1) return false;
if (basename.indexOf(".test.") > -1) return false;
if (basename === "src") return false;
return true;
},
});
} catch (e) {
console.error(e);
}
}
for (const file of uploadFiles) {
console.log(uploading ${file}...
);
await ssh.putFile(path.join(localRoot, file), path.join(remoteRoot, file));
}
! // update in-mem adapter
let execResult;
console.log("updating in-mem adapter");
execResult = await ssh.execCommand(iobroker upload ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
if (process.argv.indexOf("--norestart") === -1) {
execResult = await ssh.execCommand(iobroker restart ${ADAPTER_NAME}
);
console.log(execResult.stdout);
console.log(execResult.stderr);
}
! console.log("done");
process.exit(0);
})();</password></username></hostname>und erfordert in package.json
"devDependencies": {
"node-ssh": "^5.0.0",
"ts-node": "^4.1.0",
"typescript": "^2.6.2",
}Wenn das Skript konfiguriert ist (siehe Kommentare am Skript-Anfang), reicht ein "npm run deploy_local" und die aktualisierten Adapterdateien werden per SSH auf dem Zielhost hochgeladen und der Adapter dort aktualisiert/neu gestartet. Für dein Vorhaben musst du vermutlich vorher noch 1-2 Skripte lokal ausführen, um die Übersetzungsdateien umzuwandeln. ` Wau danke werde mir das morgen Mal anschauen
Gesendet von meinem HUAWEI VNS-L31 mit Tapatalk
-