diff --git a/README.md b/README.md index b5d2140f2a..6065454470 100644 --- a/README.md +++ b/README.md @@ -104,18 +104,23 @@ yarn add husky --dev npx husky install # or yarn husky install +``` -# Add hook -npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"' -# Sometimes above command doesn't work in some command interpreters -# You can try other commands below to write npx --no -- commitlint --edit $1 -# in the commit-msg file. -npx husky add .husky/commit-msg \"npx --no -- commitlint --edit '$1'\" -# or -npx husky add .husky/commit-msg "npx --no -- commitlint --edit $1" +### Add hook -# or -yarn husky add .husky/commit-msg 'yarn commitlint --edit $1' +```sh +cat < .husky/commit-msg +#!/bin/sh +. "\$(dirname "\$0")/_/husky.sh" + +npx --no -- commitlint --edit "\${1}" +EEE +``` + +Make hook executable + +```sh +chmod a+x .husky/commit-msg ``` Check the [husky documentation](https://typicode.github.io/husky/#/?id=manual) on how you can automatically have Git hooks enabled after install for different `yarn` versions.