build: streamline local and CI validation

This commit is contained in:
morluto
2026-07-22 16:06:28 +00:00
parent 9d84cad622
commit c08b9a7d6c
22 changed files with 316 additions and 231 deletions
+28
View File
@@ -0,0 +1,28 @@
import { access } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
const sourceHuskyIsAvailable = async () => {
try {
await access(join(root, "src"));
await access(join(root, "node_modules", "husky", "index.js"));
return true;
} catch (cause) {
if (
typeof cause === "object" &&
cause !== null &&
"code" in cause &&
cause.code === "ENOENT"
)
return false;
throw cause;
}
};
if (process.env.HUSKY !== "0" && (await sourceHuskyIsAvailable())) {
const { default: installHusky } = await import("husky");
const message = installHusky();
if (message.length > 0) process.stdout.write(`${message}\n`);
}