2.0.1 • Published 5 months ago
@fe-qianxun/verify-commit v2.0.1
@fe-qianxun/verify-commit
一个简单的 commit message 校验工具
安装与使用
有两种使用方式,可使用simple-git-hooks运行 和 也可使用husky运行。
使用 simple-git-hooks 运行
安装
pnpm add -D @fe-qianxun/verify-commit simple-git-hooks
# OR
npm i -D @fe-qianxun/verify-commit simple-git-hooks添加配置项到 package.json
# 使用 npx + bin 运行
npm pkg set simple-git-hooks.commit-msg='npx fe-qianxun-verify-commit $1'
# OR 使用 pnpm + bin 运行
npm pkg set simple-git-hooks.commit-msg='pnpm fe-qianxun-verify-commit $1'
# OR 使用 node 运行
npm pkg set simple-git-hooks.commit-msg='node ./node_modules/@fe-qianxun/verify-commit/index.js $1'注册 git-hooks
当
simple-git-hooks有更新时,需要重新注册
npx simple-git-hooks添加
prepare脚本,可以在install时自动注册已经配置的git-hooks,第一次使用时需要手动运行一次npm run prepare
npm pkg set scripts.prepare="npx simple-git-hooks"使用 husky 运行
安装
pnpm dlx husky-init && pnpm add -D @fe-qianxun/verify-commit
# OR
npx husky-init && npm i -D @fe-qianxun/verify-commit注册 git-hooks
npx husky add .husky/commit-msg 'npx fe-qianxun-verify-commit $1'