Skip to content

Commit 16d0f9b

Browse files
authored
build: replace husky with lefthook for git hooks (#123)
1 parent 5a1a5ab commit 16d0f9b

File tree

5 files changed

+29
-36
lines changed

5 files changed

+29
-36
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ coverage
3535
*.env
3636
.worktrees/
3737
.claude/
38+
lefthook-local.yml

.husky/commit-msg

Lines changed: 0 additions & 32 deletions
This file was deleted.

.husky/pre-push

Lines changed: 0 additions & 2 deletions
This file was deleted.

lefthook.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
commit-msg:
2+
commands:
3+
conventional-commit:
4+
run: |
5+
MSG=$(grep -v '^#' "{1}" | head -1)
6+
if [ -z "$MSG" ]; then exit 0; fi
7+
PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?: .+'
8+
if ! echo "$MSG" | grep -qE "$PATTERN"; then
9+
echo ""
10+
echo " Bad commit message: $MSG"
11+
echo ""
12+
echo " Must match: <type>(<scope>): <description>"
13+
echo ""
14+
echo " Types: feat fix docs style refactor perf test build ci chore revert"
15+
echo " Examples:"
16+
echo " feat: add shadow DOM diagnostics"
17+
echo " fix(solver): resolve WS leak race"
18+
echo " chore: update dependencies"
19+
echo ""
20+
exit 1
21+
fi
22+
23+
pre-push:
24+
commands:
25+
test:
26+
run: npx vitest run

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"test:integration": "vitest run --project=integration",
4242
"coverage": "npm run build:ts && c8 --reporter=text --reporter=html --reporter=lcov cross-env DEBUG=quiet mocha",
4343
"start": "env-cmd -f .env bun build",
44-
"prepare": "husky || true"
44+
"prepare": "lefthook install"
4545
},
4646
"files": [
4747
"assets/*",
@@ -195,7 +195,7 @@
195195
"devDependencies": {
196196
"@effect/vitest": "4.0.0-beta.31",
197197
"env-cmd": "^11.0.0",
198-
"husky": "^9.1.7",
198+
"lefthook": "^1.11.13",
199199
"vitest": "^4.0.18"
200200
}
201201
}

0 commit comments

Comments
 (0)