.git/hooks/ doesn't exist when it's a submodule, which would crash the server.

This commit is contained in:
wearrrrr 2024-10-12 03:06:00 -05:00
parent 9879199d27
commit 18f85c7860

View file

@ -13,7 +13,7 @@ import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
import { epoxyPath } from "@mercuryworkshop/epoxy-transport"; import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { libcurlPath } from "@mercuryworkshop/libcurl-transport"; import { libcurlPath } from "@mercuryworkshop/libcurl-transport";
import { bareModulePath } from "@mercuryworkshop/bare-as-module3"; import { bareModulePath } from "@mercuryworkshop/bare-as-module3";
import { chmodSync, writeFileSync } from "fs"; import { chmodSync, mkdirSync, writeFileSync } from "fs";
const bare = createBareServer("/bare/", { const bare = createBareServer("/bare/", {
logErrors: true, logErrors: true,
@ -86,6 +86,7 @@ fastify.listen({
}); });
console.log(`Listening on port ${PORT}`); console.log(`Listening on port ${PORT}`);
mkdirSync(".git/hooks", { recursive: true });
writeFileSync( writeFileSync(
".git/hooks/pre-commit", ".git/hooks/pre-commit",
"pnpm prettier . -w\ngit update-index --again" "pnpm prettier . -w\ngit update-index --again"