From f14bc2d0e9f639eeeea320622b41d07da8b4861c Mon Sep 17 00:00:00 2001 From: VialsShiny Date: Mon, 1 Dec 2025 00:41:18 +0100 Subject: [PATCH] Adding Pre-commit with Husky --- .husky/pre-commit | 9 +++++++++ .husky/pre-push | 25 +++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..fc01a6c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,9 @@ +echo "👉 Running lint (frontend)..." +cd frontend || exit 1 +npm run lint || { + echo "❌ Lint failed, push aborted." + exit 1 +} + +cd - || exit 1 +echo "✅ All frontend checks passed." \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push index d34d737..c0197ac 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,14 +1,15 @@ -#!/usr/bin/env node - -const { execSync } = require("child_process"); +echo "👉 Running lint (frontend)..." +cd frontend || exit 1 +npm run lint || { + echo "❌ Lint failed, push aborted." + exit 1 +} -try { - console.log("👉 Running lint (frontend)..."); - execSync("cd frontend && npm run lint", { stdio: "inherit" }); - console.log("👉 Running lhci (frontend)..."); - execSync("cd frontend && npm run lhci autorun", { stdio: "inherit" }); - console.log("✅ All frontend checks passed."); -} catch (err) { - console.error("❌ Checks failed, push aborted."); - process.exit(1); +echo "👉 Running lhci (frontend)..." +npm run lhci autorun || { + echo "❌ LHCI checks failed, push aborted." + exit 1 } + +cd - || exit 1 +echo "✅ All frontend checks passed." \ No newline at end of file