From 78461649639dba10f9ade8b1dba9e8f2c69a4144 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 18:23:00 +0300 Subject: Add husky pre-commit --- .husky/pre-commit | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 .husky/pre-commit (limited to '.husky') diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..32f797b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,54 @@ +echo "🔍 Running pre-commit checks..." + +# Run lint +echo "📋 Running lint..." +pnpm run lint +if [ $? -ne 0 ]; then + echo "❌ Lint failed" + exit 1 +fi + +# Run format +echo "🎨 Running format..." +pnpm run format +if [ $? -ne 0 ]; then + echo "❌ Format failed" + exit 1 +fi + +# Run format:code +echo "🎨 Running format:code..." +pnpm run format:code +if [ $? -ne 0 ]; then + echo "❌ Format:code failed" + exit 1 +fi + +# Run format:imports +echo "📦 Running format:imports..." +pnpm run format:imports +if [ $? -ne 0 ]; then + echo "❌ Format:imports failed" + exit 1 +fi + +# Run check +echo "✅ Running check..." +pnpm run check +if [ $? -ne 0 ]; then + echo "❌ Check failed" + exit 1 +fi + +# Check if dist directory exists before running lychee +if [ -d "dist" ]; then + echo "🔗 Running lychee check on dist directory..." + lychee src/content --no-progress --exclude-private --max-retries 1 --timeout 10 + if [ $? -ne 0 ]; then + echo "⚠️ Lychee found broken links (this won't block the commit)" + fi +else + echo "⚠️ Dist directory not found, skipping lychee check" +fi + +echo "✅ All pre-commit checks passed!" -- cgit v1.2.3