https://github.com/go-courier/husky
https://github.com/go-courier/husky
githooks husky
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/go-courier/husky
- Owner: go-courier
- License: mit
- Created: 2020-02-05T09:43:31.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T23:56:59.000Z (over 2 years ago)
- Last Synced: 2024-06-18T23:11:16.377Z (over 1 year ago)
- Topics: githooks, husky
- Language: Go
- Size: 310 KB
- Stars: 71
- Watchers: 2
- Forks: 11
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Husky
[](https://godoc.org/github.com/go-courier/husky)
[](https://codecov.io/gh/go-courier/husky)
[](https://goreportcard.com/report/github.com/go-courier/husky)Husky.js like, but pure in golang
## Usage
install
```
go install github.com/go-courier/husky/cmd/husky@latest
```install git hooks
```
husky init
```## Configuration `.husky.toml`
`.husky.yaml` supported too.
```toml
# version-file which will write or read current semver
version-file = "internal/version/version"# hook scripts
[hooks]# after version calc,
# with use the {{ .Version }} to upgrade other files.
post-version = [
"sed -i -e 's/\"version\": \"[^\"]*\"/\"version\": \"{{ .Version }}\"/g' testdata/package.json",
"sed -i -e 's/version: [^\\n]*/version: {{ .Version }}/g' testdata/pubspec.yaml"
]# git hook pre commit
pre-commit = [
"golangci-lint run",
"husky lint-staged",
]# git hook commit msg
commit-msg = [
"husky lint-commit",
]# list staged files do some pre-process and git add
[lint-staged]
"*.go" = [
"goimports -l -w",
"gofmt -l -w",
]# commit msg rule default support conventional commits
[lint-commit]
# could check if this exists
# email = "^(.+@gmail.com|.+@qq.com)$"
# optional custom types check regex
# types = "^(feat|fix|build|chore|ci|docs|perf|refactor|revert|style|test)$"
# optional header check regex
# header = "^(?P\w+)(\((?P[\w/.-]+)\))?(?P!)?:( +)?(?P.+)"
```Commit msg rule follow
```
type(scope?): headerbody?
footer?
```