Skip to content

Commit cfae794

Browse files
committed
docs(readme): update Husky instructions for Husky 6+
1 parent 9c37b7d commit cfae794

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -205,28 +205,34 @@ should work with other solutions as well.
205205

206206
#### Husky Example
207207

208+
> ℹ️ See [Husky Documentation](https://typicode.github.io/husky/#/?id=usage) for
209+
> more information
210+
208211
1. Install Husky
209212

210-
> ⚠️ We're sticking with Husky 4 for now as 5+ has licensing restrictions for
211-
> commercial projects and significantly changes how hooks are configured
213+
```bash
214+
yarn add -D husky
215+
```
212216

213-
```sh
214-
yarn add -D 'husky@^4.3.8'
215-
```
217+
2. Add `prepare` script
216218

217-
2. Configure hooks in `package.json`
219+
```bash
220+
npm set-script prepare "husky install"
221+
```
218222

219-
```json
220-
{
221-
"name": "my-package",
222-
"husky": {
223-
"hooks": {
224-
"pre-commit": "hover-scripts pre-commit",
225-
"commit-msg": "hover-scripts commit-msg"
226-
}
227-
}
228-
}
229-
```
223+
3. Create hooks
224+
225+
i. 📂 **.husky/pre-commit**
226+
227+
```bash
228+
yarn husky add .husky/pre-commit "yarn hover-scripts pre-commit"
229+
```
230+
231+
ii. 📂 **.husky/commit-msg**
232+
233+
```bash
234+
yarn husky add .husky/commit-msg "yarn hover-scripts commit-msg"
235+
```
230236

231237
## License
232238

0 commit comments

Comments
 (0)