Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .husky/commit-msg

This file was deleted.

1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ task install_tools
- **[mvdan/gofumpt](https://github.com/mvdan/gofumpt)** - A stricter gofmt
- **[golang.org/x/tools/cmd/goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)** - Updates Go import lines
- **[go-task/task](https://github.com/go-task/task)** - A task runner / simpler Make alternative
- **[typicode/husky](https://github.com/typicode/husky)** - Git hooks made easy
- **[evilmartians/lefthook](https://github.com/evilmartians/lefthook)** - Fast and powerful Git hooks manager
- **[conventional-changelog/commitlint](https://github.com/conventional-changelog/commitlint)** - Lint commit messages
18 changes: 18 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pre-commit:
commands:
format:
run: task format
lint:
run: task lint
stage:
run: git add -A .

pre-push:
commands:
test:
run: task test

commit-msg:
commands:
commitlint:
run: pnpm exec commitlint --edit {1}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "",
"packageManager": "pnpm@10.32.1",
"scripts": {
"preinstall": "npx only-allow pnpm",
"prepare": "husky"
"preinstall": "npx only-allow pnpm"
},
"repository": {
"type": "git",
Expand All @@ -20,7 +19,6 @@
"devDependencies": {
"@commitlint/cli": "19.8.1",
"@commitlint/config-conventional": "19.8.1",
"@commitlint/types": "^20.5.0",
"husky": "9.1.7"
"@commitlint/types": "^20.5.0"
}
}
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ fi
# install node.js tools
pnpm install

# add husky hooks
pnpm exec husky init
cat > .husky/pre-commit << 'HOOK'
task format && task lint && git add -A .
HOOK
cat > .husky/pre-push << 'HOOK'
task test
HOOK
echo "pnpm exec commitlint --edit \$1" > .husky/commit-msg
# install lefthook (git hooks manager) if missing — pinned via @vX.Y.Z
if ! command -v lefthook >/dev/null 2>&1; then
if command -v go >/dev/null 2>&1; then
go install github.com/evilmartians/lefthook/v2@v2.1.8
else
echo "go not found on PATH; skipping lefthook install (git hooks will NOT be wired)"
fi
fi

# wire git hooks via lefthook (config lives in lefthook.yml)
if command -v lefthook >/dev/null 2>&1; then
lefthook install
fi
Loading