Complete wrapper migration to shared message types

This commit is contained in:
2026-07-20 19:18:58 +02:00
parent 5c56208c8b
commit e93524c403
2 changed files with 18 additions and 17 deletions
+17 -16
View File
@@ -301,55 +301,56 @@ class Wrapper {
const command =
const rawCommand =
JSON.parse(
msg.content.toString()
) as ServerStartCommand | ServerStopCommand | {
type: string;
[key: string]: unknown;
};
) as unknown;
switch(command.type){
const commandType = (rawCommand as { type?: string }).type;
switch(commandType){
case "test":
case "test": {
const command = rawCommand as {
type: string;
message?: unknown;
};
console.log(
"TEST COMMAND:",
command.message
);
break;
}
case "server.start":
case "server.start": {
const command = rawCommand as ServerStartCommand;
this.processManager.startServer(
command
);
break;
}
case "server.stop":
case "server.stop": {
const command = rawCommand as ServerStopCommand;
this.processManager.stopServer(
command.serverId
);
break;
}
default:
@@ -357,7 +358,7 @@ class Wrapper {
console.log(
"Unbekannter Command:",
command
rawCommand
);
+1 -1
View File
@@ -1,5 +1,5 @@
import { spawn, ChildProcess } from "child_process";
import { ServerStartCommand } from "server-manager-shared";
interface ServerProcess {