Bladeren bron

chore(custom): 构建测试

linyuanjie 3 maanden geleden
bovenliggende
commit
6f2099f994
3 gewijzigde bestanden met toevoegingen van 23 en 1 verwijderingen
  1. 4 0
      .husky/commit-msg
  2. 18 0
      .husky/pre-commit
  3. 1 1
      src/App.tsx

+ 4 - 0
.husky/commit-msg

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname "$0")/h"
+
+npx --no-install commitlint --edit ""

+ 18 - 0
.husky/pre-commit

@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+. "$(dirname "$0")/h"
+
+# 获取当前分支名
+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

+ 1 - 1
src/App.tsx

@@ -6,7 +6,7 @@ import { ThemeProvider } from './theme/theme-provider'
 import { MotionLazy } from './components/animate/motion-lazy'
 import Toast from './components/toast'
 
-const a: boolean = 1
+const a: boolean = 'a'
 console.log(a + '2')
 const { VITE_APP_TITLE: APPTITLE } = import.meta.env