Minor adjustments to commands.

This commit is contained in:
00Fjongl 2024-08-07 16:07:19 -05:00
parent 3f6872f810
commit 3fa63b817c
2 changed files with 10 additions and 7 deletions

View file

@ -9,9 +9,10 @@
"restart": "node run-command.mjs stop start", "restart": "node run-command.mjs stop start",
"stop": "node run-command.mjs stop", "stop": "node run-command.mjs stop",
"test": "npm run proxy-validator", "test": "npm run proxy-validator",
"pm2-start": "pm2 start ecosystem.config.js --env production", "pm2-start": "pm2 start ecosystem.config.js --env production --watch false",
"pm2-stop": "pm2 stop ecosystem.config.js", "pm2-stop": "pm2 stop ecosystem.config.js",
"pm2-monit": "pm2 monit", "pm2-monit": "pm2 monit",
"pm2-nuke": "pm2 delete ecosystem.config.js",
"manual-start": "node run-command.mjs start", "manual-start": "node run-command.mjs start",
"kill": "node run-command.mjs stop kill", "kill": "node run-command.mjs stop kill",
"build": "node run-command.mjs build && cd lib/rammerhead && npm install && npm run build", "build": "node run-command.mjs build && cd lib/rammerhead && npm install && npm run build",

View file

@ -20,14 +20,14 @@ const shutdown = fileURLToPath(new URL("./src/.shutdown", import.meta.url));
for(let i = 2; i < process.argv.length; i++) for(let i = 2; i < process.argv.length; i++)
switch (process.argv[i]) { switch (process.argv[i]) {
case "start": { case "start":
if (config.production) if (config.production)
exec("npm run pm2-start", (error, stdout) => { exec("npm run pm2-start", (error, stdout) => {
if (error) throw error; if (error) throw error;
console.log(stdout); console.log(stdout);
}); });
else if (process.platform === "win32") else if (process.platform === "win32")
exec("START", ["/MIN", '""', '"node backend.js"'], (error, stdout) => { exec('START /MIN "" "node backend.js"', (error, stdout) => {
if (error) throw error; if (error) throw error;
console.log(stdout); console.log(stdout);
}); });
@ -39,7 +39,6 @@ for(let i = 2; i < process.argv.length; i++)
server.disconnect(); server.disconnect();
} }
break; break;
}
case "stop": case "stop":
await writeFile(shutdown, ""); await writeFile(shutdown, "");
@ -83,11 +82,14 @@ for(let i = 2; i < process.argv.length; i++)
case "kill": case "kill":
if (process.platform === "win32") if (process.platform === "win32")
exec("taskkill", ["/F", "/IM", "node*"], (error, stdout) => { exec("taskkill /F /IM node*", (error, stdout) => {
console.log(stdout); console.log(stdout);
}); });
else exec("pkill", ["node"], (error, stdout) => { else exec("pkill node", (error, stdout) => {
console.log(stdout); console.log(stdout);
});
exec("npm run pm2-nuke", (error, stdout) => {
console.log(stdout);
}); });
break; break;