summaryrefslogtreecommitdiff
path: root/.husky/pre-commit
blob: 32f797b3f20a9d01c87e934aa5c31ebe2f8f2160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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!"