Skip to content

Commit

Permalink
Add PNPM Install command to start script
Browse files Browse the repository at this point in the history
  • Loading branch information
TecEash1 committed Apr 12, 2024
1 parent 9ac7101 commit b0f8dc2
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions start.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,27 @@ function restartBot() {
writeToConsole(
chalk.italic(`[GIT] child process exited with code ${code}`),
);
setTimeout(() => {
startBot();
writeToConsole(chalk.red("Bot restarted."));
}, 1000);

const pnpmInstall = spawn("pnpm", ["install"], { shell: true });

pnpmInstall.stdout.on("data", (data) => {
const message = data.toString().trim();
message && writeToConsole(chalk.italic(`[PNPM] stdout: ${message}`));
});

pnpmInstall.stderr.on("data", (data) => {
writeToConsole(chalk.italic(`[PNPM] stderr: ${data}`));
});

pnpmInstall.on("close", (code) => {
writeToConsole(
chalk.italic(`[PNPM] child process exited with code ${code}`),
);
setTimeout(() => {
startBot();
writeToConsole(chalk.red("Bot restarted."));
}, 1000);
});
});
}

Expand Down

0 comments on commit b0f8dc2

Please sign in to comment.