install pnpm first
npm install pnpm -g
pnpm install
pnpm test
- 将当前包进行 npm link
- 到项目下进行 npm link myhusky 操作
Edit package.json > prepare script and run it once:
npm set-script prepare "myhusky install"
npm run prepare
Add a hook:
npx husky add .husky/pre-commit "npm test"
git add .husky/pre-commit
Make a commit:
git commit -m "Keep calm and commit"
# `npm test` will run every time you commit