From 70f293bca1c475dfe7a88a22038e8f8e365756d0 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Tue, 11 Jul 2023 12:41:41 +0200 Subject: [PATCH] Only run the pre-commit hooks when Husky is installed (#21587) --- js/.husky/pre-commit | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/.husky/pre-commit b/js/.husky/pre-commit index 23aef7712bb..68ab20e02e9 100755 --- a/js/.husky/pre-commit +++ b/js/.husky/pre-commit @@ -1,4 +1,14 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" + +# Get the path the the Husky script. +FILE="$(dirname "$0")/_/husky.sh" + +# Exit if Husky is not installed. +if [ ! -f "$FILE" ]; then + exit 0; +fi + +# Run the Husky script, and pre-commit hooks. +. $FILE cd js npx lint-staged