File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff 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 ""
261261npm 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
266282You can set ` HUSKY ` environment variable to ` 0 ` in your CI config file, to disable all hooks.
You can’t perform that action at this time.
0 commit comments