mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 11:30:01 -04:00
Simplify npm scripts
This commit is contained in:
parent
976513b851
commit
5b7e418007
2 changed files with 10 additions and 12 deletions
|
@ -9,10 +9,6 @@
|
||||||
"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": "npx pm2 start ecosystem.config.js --env production --watch false",
|
|
||||||
"pm2-stop": "npx pm2 stop ecosystem.config.js",
|
|
||||||
"pm2-monit": "npx pm2 monit",
|
|
||||||
"pm2-nuke": "npx 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",
|
||||||
|
|
|
@ -28,10 +28,12 @@ for (let i = 2; i < process.argv.length; i++)
|
||||||
// config file.
|
// config file.
|
||||||
case "start":
|
case "start":
|
||||||
if (config.production)
|
if (config.production)
|
||||||
exec("npm run pm2-start", (error, stdout) => {
|
exec("npx pm2 start ecosystem.config.js --env production --watch false",
|
||||||
|
(error, stdout) => {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
console.log(stdout);
|
console.log(stdout);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
// Handle setup on Windows differently from platforms with POSIX-compliant shells.
|
// Handle setup on Windows differently from platforms with POSIX-compliant shells.
|
||||||
// This should run the server as a background process.
|
// This should run the server as a background process.
|
||||||
else if (process.platform === "win32")
|
else if (process.platform === "win32")
|
||||||
|
@ -73,7 +75,7 @@ for (let i = 2; i < process.argv.length; i++)
|
||||||
await unlink(shutdown);
|
await unlink(shutdown);
|
||||||
}
|
}
|
||||||
if (config.production && !process.argv.slice(i + 1).includes("kill"))
|
if (config.production && !process.argv.slice(i + 1).includes("kill"))
|
||||||
exec("npm run pm2-stop", (error, stdout) => {
|
exec("npx pm2 stop ecosystem.config.js", (error, stdout) => {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
console.log(stdout);
|
console.log(stdout);
|
||||||
});
|
});
|
||||||
|
@ -99,13 +101,13 @@ for (let i = 2; i < process.argv.length; i++)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill all node processes and fully reset PM2. To be used for debugging. The
|
// Kill all node processes and fully reset PM2. To be used for debugging.
|
||||||
// npm run pm2-nuke is built into the command because, if handled in Node, it
|
// Using npx pm2 monit, or npx pm2 list in the terminal will also bring up
|
||||||
// will not wait for PM2 to actually finish resetting before it closes itself.
|
// more PM2 debugging tools.
|
||||||
case "kill":
|
case "kill":
|
||||||
if (process.platform === "win32")
|
if (process.platform === "win32")
|
||||||
exec("npm run pm2-nuke ; taskkill /F /IM node*", (error, stdout) => {console.log(stdout)});
|
exec("( npx pm2 delete ecosystem.config.js ) ; taskkill /F /IM node*", (error, stdout) => {console.log(stdout)});
|
||||||
else exec("npm run pm2-nuke ; pkill node", (error, stdout) => {console.log(stdout)});
|
else exec("npx pm2 delete ecosystem.config.js; pkill node", (error, stdout) => {console.log(stdout)});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// No default case.
|
// No default case.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue