You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+35-35
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@
6
6
7
7
Husky can prevent bad `git commit`, `git push` and more 🐶 _woof!_
8
8
9
-
__Announcement: Husky v5 (alpha) has been published, to view v5 docs click [here](https://typicode.github.io/husky).__
9
+
**Announcement: Husky v5 has been published, to view v5 docs click [here](https://typicode.github.io/husky).**
10
+
11
+
**Note for npm 7 users** Currently `INIT_CWD` environment variable is missing in npm v7 and is required for Husky v4 to auto-install (https://github.com/npm/cli/issues/2033). To manually install husky v4, run `npx --no-install husky install .` or upgrade to husky v5.
10
12
11
13
## Install
12
14
@@ -49,7 +51,7 @@ _Git hooks installed by husky will be removed._
49
51
50
52
## Sponsors
51
53
52
-
### Companies ($100+/month)
54
+
### Companies (\$100+/month)
53
55
54
56
<!-- for (let i = 0; i < 40; i++) console.log(`[](https://opencollective.com/husky/backer/${i}/website)`) -->
55
57
@@ -115,32 +117,32 @@ GitHub sponsors can be viewed on my [profile](https://github.com/typicode). All
@@ -214,7 +216,7 @@ By default, Husky won't install on CI servers.
214
216
215
217
### Monorepos
216
218
217
-
If you have a multi-package repository, it's __recommended__ to use tools like [lerna](https://github.com/lerna/lerna) and have husky installed ONLY in the root `package.json` to act as the source of truth.
219
+
If you have a multi-package repository, it's **recommended** to use tools like [lerna](https://github.com/lerna/lerna) and have husky installed ONLY in the root `package.json` to act as the source of truth.
218
220
219
221
Generally speaking, you should AVOID defining husky in multiple `package.json`, as each package would overwrite previous husky installation.
220
222
@@ -252,6 +254,7 @@ Generally speaking, you should AVOID defining husky in multiple `package.json`,
252
254
If you're on Windows, husky will simply use the version installed globally on your system.
253
255
254
256
For macOS and Linux users:
257
+
255
258
- if you're running `git` commands in the terminal, husky will use the version defined in your shell `PATH`. In other words, if you're a `nvm` user, husky will use the version that you've set with `nvm`.
256
259
- if you're using a GUI client and `nvm`, it may have a different `PATH` and not load `nvm`, in this case the highest `node` version installed by `nvm` will usually be picked. You can also check `~/.node_path` to see which version is used by GUIs and edit if you want to use something else.
257
260
@@ -268,7 +271,7 @@ export NVM_DIR="$HOME/.nvm"
268
271
269
272
### Multiple commands
270
273
271
-
By design and just like `scripts` defined in `package.json`, husky will run hook scripts as a single command.
274
+
By design and just like `scripts` defined in `package.json`, husky will run hook scripts as a single command.
272
275
273
276
```json
274
277
"pre-commit": "cmd && cmd"
@@ -277,15 +280,12 @@ By design and just like `scripts` defined in `package.json`, husky will run hook
277
280
That said, if you prefer to use an array, the recommended approach is to define them in `.huskyrc.js` or `husky.config.js`.
278
281
279
282
```js
280
-
consttasks=arr=>arr.join(' && ')
283
+
consttasks=(arr)=>arr.join(' && ')
281
284
282
285
module.exports= {
283
-
'hooks': {
284
-
'pre-commit':tasks([
285
-
'cmd',
286
-
'cmd'
287
-
])
288
-
}
286
+
hooks: {
287
+
'pre-commit':tasks(['cmd', 'cmd']),
288
+
},
289
289
}
290
290
```
291
291
@@ -347,9 +347,9 @@ Verify that your version of Git is `>=2.13.0`.
347
347
348
348
## See also
349
349
350
-
*[pkg-ok](https://github.com/typicode/pkg-ok) - Prevents publishing a module with bad paths or incorrect line endings
351
-
*[please-upgrade-node](https://github.com/typicode/please-upgrade-node) - Show a message to upgrade Node instead of a stacktrace in your CLIs
352
-
*[pinst](https://github.com/typicode/pinst) - dev only postinstall hook
350
+
-[pkg-ok](https://github.com/typicode/pkg-ok) - Prevents publishing a module with bad paths or incorrect line endings
351
+
-[please-upgrade-node](https://github.com/typicode/please-upgrade-node) - Show a message to upgrade Node instead of a stacktrace in your CLIs
352
+
-[pinst](https://github.com/typicode/pinst) - dev only postinstall hook
0 commit comments