summaryrefslogtreecommitdiff
path: root/.husky/pre-commit
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-07-03 18:23:00 +0300
committerDawid Rycerz <dawid@rycerz.xyz>2025-07-03 18:23:00 +0300
commit78461649639dba10f9ade8b1dba9e8f2c69a4144 (patch)
treefc89a83ecc5c8500c77ebc359fd7b7b2b42f085b /.husky/pre-commit
parent0df973de7b554008383a23fd4fc2a0b8e1401b37 (diff)
Add husky pre-commit
Diffstat (limited to '.husky/pre-commit')
-rwxr-xr-x.husky/pre-commit54
1 files changed, 54 insertions, 0 deletions
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!"