Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

vue-cli 生成的项目,在vscode使用git commit -m“--”的时候为什么没有触发package.json中的

  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,vue}": [
      "vue-cli-service lint",
      "git add"
    ]
  }

这两个命令
下面附图
1、package.json
image.png
2、vue.config.js
image.png
3、eslintrc.js
image.png

4、.git/hooks
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.7k views
Welcome To Ask or Share your Answers For Others

1 Answer

你看一眼你项目目录下的 .git/hooks/ 目录下面有这些定义好的钩子脚本么?

vue-cli 是用 yorkie 这个库帮你生成一些 .git/hooks/ 钩子脚本,但你要是自己动过 .git 目录(比如重新执行了 git init 之类的),那就没用了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...