#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# 获取当前分支名
branch_name=$(git rev-parse --abbrev-ref HEAD)

echo "Current branch: $branch_name"

# 检查是否在 main 或 pre 分支
if [[ "$branch_name" == "main" || "$branch_name" == "pre" ]]; then
  echo "Running full project type check and linting for branch $branch_name..."
  npm run lint
  npm run format
  npm run tsc
else
  echo "Running staged files check for branch $branch_name..."
  npx --no-install lint-staged
fi
