commit-verify
v1.1.0
Published
Auto commit message format verify hook
Downloads
13
Maintainers
Readme
commit-verify
Auto commit message format verify hook
Usage
pnpm add -D commit-verify
Add verify command cv
to husky hook file .husky/commit-msg
:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install cv $1
Config
example:
// `cv.config.js` or `.cvrc.json` ...
const { defineConfig } = require('commit-verify')
module.exports = defineConfig({
// auto add emoji to commit message
emoji: true,
})
Available configuration
emoji
- default:
false
whether auto add emoji to commit msg
// pos: start
feat(scope): msg -> feat(scope)🍉: msg
// pos: end
feat(scope): msg -> feat(scope): msg 🍉
emojiList
- default:
['🍓', '🍉', '🍇', '🍒', '🍡', '🍥', '🍩', '🍰', '🍭', '🌸', '🌈']
will add random emoji list
emojiPos
default:
start
enum:
start
|end
will add emoji position in commit msg
format
default:
/^(((feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release|deps?|merge|examples?|revert)(\(.+\))?:)|(Merge|Revert|Version)) .{1,50}$/i
type:
RegExp
|false
allow commit msg format.
default support:
github
Merge
/Revert
common commit type
changesets
Version Packages
transformer
- default:
(v) => v
custom commit msg transoform on format regex check after
Command line
Following options are supported for command line use:
emoji
emojiPos
example:
npx --no-install cv $1 --emoji --emoji-pos=end
License
MIT