f851d8b8f2
Electron desktop application for Neverwinter Nights module development. Clone, edit, build, and run a complete Layonara NWNX server with only Docker required. - React 19 + Vite frontend with Monaco editor and NWScript LSP - Node.js + Express backend managing Docker sibling containers - Electron shell with Docker availability check and auto-setup - Builder image auto-builds on first use from bundled Dockerfile - Cross-platform: Windows (.exe), macOS (.dmg), Linux (.AppImage) - Gitea Actions CI for automated release builds
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { exec } from "child_process";
|
|
|
|
export interface DockerStatus {
|
|
available: boolean;
|
|
version?: string;
|
|
error?: string;
|
|
}
|
|
|
|
export function checkDocker(): Promise<DockerStatus> {
|
|
return new Promise((resolve) => {
|
|
exec("docker version --format '{{.Server.Version}}'", (err, stdout) => {
|
|
if (err) {
|
|
resolve({
|
|
available: false,
|
|
error: "Docker is not running or not installed.",
|
|
});
|
|
return;
|
|
}
|
|
resolve({
|
|
available: true,
|
|
version: stdout.trim().replace(/'/g, ""),
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
export function dockerDownloadUrl(): string {
|
|
switch (process.platform) {
|
|
case "win32":
|
|
return "https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe";
|
|
case "darwin":
|
|
return process.arch === "arm64"
|
|
? "https://desktop.docker.com/mac/main/arm64/Docker.dmg"
|
|
: "https://desktop.docker.com/mac/main/amd64/Docker.dmg";
|
|
default:
|
|
return "https://docs.docker.com/engine/install/";
|
|
}
|
|
}
|