21 lines
458 B
JavaScript
21 lines
458 B
JavaScript
const childProcess = require("child_process");
|
|
const os = require("os");
|
|
|
|
function puts(error, stdout, stderr) {
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
console.log(stdout);
|
|
console.error(stderr);
|
|
}
|
|
|
|
switch (os.type()) {
|
|
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 OS found: " + os.type());
|
|
}
|