File size: 994 Bytes
2e1ab99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/sh

echo "πŸ” Running pre-commit hook to check the code looks good... πŸ”"

# Load NVM if available (useful for managing Node.js versions)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Ensure `pnpm` is available
echo "Checking if pnpm is available..."
if ! command -v pnpm >/dev/null 2>&1; then
    echo "❌ pnpm not found! Please ensure pnpm is installed and available in PATH."
    exit 1
fi

# Run typecheck
echo "Running typecheck..."
if ! pnpm typecheck; then
    echo "❌ Type checking failed! Please review TypeScript types."
    echo "Once you're done, don't forget to add your changes to the commit! πŸš€"
    exit 1
fi

# Run lint
echo "Running lint..."
if ! pnpm lint; then
    echo "❌ Linting failed! Run 'pnpm lint:fix' to fix the easy issues."
    echo "Once you're done, don't forget to add your beautification to the commit! 🀩"
    exit 1
fi

echo "πŸ‘ All checks passed! Committing changes..."