From ec1a8410a0035e1ba6816ecda13970054ad160b1 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Wed, 19 Jan 2022 17:54:08 -0800 Subject: [PATCH] fix(commitlint): husky hooks --- .husky/common.sh | 12 ++++++++++++ .husky/prepare-commit-msg | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 .husky/common.sh create mode 100644 .husky/prepare-commit-msg diff --git a/.husky/common.sh b/.husky/common.sh new file mode 100644 index 000000000..a40e51d1f --- /dev/null +++ b/.husky/common.sh @@ -0,0 +1,12 @@ +# Common script to add support on windows +# https://typicode.github.io/husky/#/?id=yarn-on-windows +# https://github.com/commitizen/cz-cli/issues/627 + +command_exists () { + command -v "$1" >/dev/null 2>&1 +} + +# Workaround for Windows 10, Git Bash and Yarn +if command_exists winpty && test -t 1; then + exec < /dev/tty +fi \ No newline at end of file diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100644 index 000000000..b2c4ed393 --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1,7 @@ +#!/bin/sh +# Call common windows fix +. "$(dirname "$0")/common.sh" + +# Call commitlint from bin (faster than yarn) +node_modules/.bin/commitlint --edit $1 +