const childProcess = require("child_process"); const os = require("os"); function puts(error, stdout, stderr) { if (error) { throw error; } console.log(stdout); console.error(stderr); } const osType = os.type(); switch (osType) { case "Linux": childProcess.exec("npm run build-linux", puts); break; case "Windows_NT": childProcess.exec("npm run build-windows", puts); break; default: throw new Error("Unsupported operating system found: " + osType); }