Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新版husky的使用(2022-05-20) #161

Open
yaogengzhu opened this issue May 20, 2022 · 0 comments
Open

新版husky的使用(2022-05-20) #161

yaogengzhu opened this issue May 20, 2022 · 0 comments
Labels
工程配置 Extra attention is needed

Comments

@yaogengzhu
Copy link
Owner

新版husky 实践

  1. 安装husky
pnpm add husky -D
  1. 在package.json 中加入prepare脚本

prepare 脚本会在 pnpm install (不带参数) 之后自动执行。

{
  "scripts": {
      "prepare": "husky install"
  }
}
  1. 添加git hooks 。可以执行下 pnpm prepare 新增
npx husky add .husky/pre-commit "npm run test"

执行完该脚本,可以看到新建了一个.husky文件.里面会存在一个pre-commit 脚本内容。

@yaogengzhu yaogengzhu added the 工程配置 Extra attention is needed label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
工程配置 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant