Skip to content

Commit

Permalink
docs: update husky hook adding (#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdzialowski-godaddy committed May 1, 2022
1 parent 20122e8 commit 552593b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions README.md
Expand Up @@ -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 <<EEE > .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.
Expand Down

0 comments on commit 552593b

Please sign in to comment.