From 8e1ff764498f0a74fee76c97f15e60b110ae9aa6 Mon Sep 17 00:00:00 2001 From: typicode Date: Sun, 20 Feb 2022 17:43:31 +0100 Subject: [PATCH] docs: add another way to disable husky in prod --- docs/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 29a84464c..a96fb3f72 100644 --- a/docs/README.md +++ b/docs/README.md @@ -246,9 +246,9 @@ For Git commands that don't have a `--no-verify` option, you can use `HUSKY` env HUSKY=0 git push # yolo! ``` -## Disable husky in CI/Docker +## Disable husky in CI/Docker/Prod -There's no right or wrong way to disable husky in CI/Docker context and is highly __dependent on your use-case__. +There's no right or wrong way to disable husky in CI/Docker/Prod context and is highly __dependent on your use-case__. ### With npm @@ -281,6 +281,12 @@ if (!isCi) { } ``` +Or make `prepare` script fail silently if husky is not installed: + +```json +"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\"' +``` + ### With env variables You can set `HUSKY` environment variable to `0` in your CI config file, to disable all hooks.