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}`);
mkdirSync(".git/hooks", { recursive: true });
writeFileSync(
".git/hooks/pre-commit",
"pnpm prettier . -w\ngit update-index --again"
);
chmodSync(".git/hooks/pre-commit", 0o755);
try {
writeFileSync(
".git/hooks/pre-commit",
"pnpm prettier . -w\ngit update-index --again"
);
chmodSync(".git/hooks/pre-commit", 0o755);
} catch {
}
const watch = spawn("pnpm", ["rspack", "-w"], {
detached: true,