do check for .git/hooks/pre-commit in a slightly more elegant way

This commit is contained in:
wearrrrr 2024-10-12 03:13:45 -05:00
parent fda8f4e5c1
commit 0f86dbaf97

View file

@ -86,12 +86,15 @@ fastify.listen({
}); });
console.log(`Listening on port ${PORT}`); console.log(`Listening on port ${PORT}`);
mkdirSync(".git/hooks", { recursive: true }); try {
writeFileSync( writeFileSync(
".git/hooks/pre-commit", ".git/hooks/pre-commit",
"pnpm prettier . -w\ngit update-index --again" "pnpm prettier . -w\ngit update-index --again"
); );
chmodSync(".git/hooks/pre-commit", 0o755); chmodSync(".git/hooks/pre-commit", 0o755);
} catch {
}
const watch = spawn("pnpm", ["rspack", "-w"], { const watch = spawn("pnpm", ["rspack", "-w"], {
detached: true, detached: true,