#!/bin/bash set -e echo "๐Ÿ” Running pre-commit checks..." # Check if pnpm-lock.yaml is in sync (CRITICAL - must pass) echo "๐Ÿ“ฆ Checking pnpm-lock.yaml sync..." if ! pnpm install --frozen-lockfile --dry-run > /dev/null 2>&1; then echo "โŒ CRITICAL ERROR: pnpm-lock.yaml is out of sync with package.json" echo " This will cause CI to fail!" echo " Run: pnpm install" echo " Then commit the updated pnpm-lock.yaml" exit 1 fi # Run Prettier format check (must pass) echo "๐ŸŽจ Running Prettier format check..." pnpm prettier --check . || { echo "โŒ Prettier format check failed" echo " Run 'pnpm lint:fix' to auto-fix formatting issues" exit 1 } # Run TypeScript type check (must pass) echo "๐Ÿ“˜ Running TypeScript type check..." pnpm vue-tsc --noEmit || { echo "โŒ TypeScript type check failed" echo " Fix all TypeScript errors before committing" exit 1 } # Run tests echo "๐Ÿงช Running tests..." pnpm test:run || { echo "โŒ Tests failed" exit 1 } # Check build echo "๐Ÿ—๏ธ Checking build..." pnpm build || { echo "โŒ Build failed" exit 1 } # Security audit echo "๐Ÿ”’ Running security audit..." pnpm audit --audit-level=moderate || { echo "โš ๏ธ Security vulnerabilities found (moderate or higher)" echo " Review with: pnpm audit" exit 1 } echo "โœ… All checks passed!"