Skip to content

Commit 50ea409

Browse files
committed
docs: update Docker section
1 parent 8c7d015 commit 50ea409

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ HUSKY=0 git push # yolo!
244244

245245
## Disable husky in CI/Docker
246246

247-
There's no right or wrong way to disable husky in CI/Docker context and it's highly dependent on your use-case.
247+
There's no right or wrong way to disable husky in CI/Docker context and is highly __dependent on your use-case__.
248248

249249
### With npm
250250

@@ -261,6 +261,22 @@ npm set-script prepare ""
261261
npm ci --only-production
262262
```
263263

264+
### With a custom script
265+
266+
You can create a custom JS script and conditionally require husky and install hooks.
267+
268+
```json
269+
"prepare": "node ./prepare.js"
270+
```
271+
272+
```js
273+
// prepare.js
274+
const someConditions = process.env.CI !== undefined
275+
if (someConditions) {
276+
require('husky').install()
277+
}
278+
```
279+
264280
### With env variables
265281

266282
You can set `HUSKY` environment variable to `0` in your CI config file, to disable all hooks.

0 commit comments

Comments
 (0)