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 +