Husky 🐶 woof!

341 阅读1分钟

Husky 🐶 woof!

然而,突然之间,一切都改变了...

iShot2022-03-06 16.45.26.png

生活总是不经意之间给你开了个玩笑,而你却无能为力,不知所措...

我要扼住生命的喉咙,我命由我不由天!!!!!!

参考官网:typicode.github.io/husky/#/ 按以下步骤进行设置:

  1. 删除 .git 目录下的 hooks 及 .husky

iShot2022-03-06 17.01.10.png

  1. 查看 git config 配置是否存在 core.hookspath=.husky

      git config --list
    

iShot2022-03-06 16.48.14.png

  1. 删除配置及卸载 Huksy:

      npm uninstall husky && git config --unset core.hookspath
    

iShot2022-03-06 16.50.10.png

  1. 再次安装 Husky:

      npm install husky --save-dev
      // npm set-script prepare "husky install"
      npx husky-init
    

iShot2022-03-06 16.52.34.png

iShot2022-03-06 16.53.29.png

  1. 新增 Hooks:

      npx husky add .husky/pre-commit "npx lint-staged"
      npx husky add .husky/pre-commit "npx pretty-quick --staged"
      npx husky add .husky/commit-msg 'npx --no-install commitlint --edit'
    

iShot2022-03-06 16.57.01.png

  1. Git Flow 设置

      git config gitflow.path.hooks .husky
    
  2. 随便改点什么吧,试下 git commit

iShot2022-03-06 17.10.51.png

从此一切又变得那么的美好,生活还是有很多值得向往与期待的 🐶 woof!

推荐一下,又一开源力作,promotion-web,基于React/Webpack/ReactRouter/Fetch 最前沿技术构建的企业级中台项目!!!

Github: github.com/wkylin/prom…

Demo: wkylin.github.io/promotion-w…

image.png

不断完善中,欢迎加入,一起成为Contributors !