Skip to content

Commit 8af4f8c

Browse files
authored
Fix pre-commit hook on Windows (#1555)
The pre-commit hooks do not work on Windows due to issue described in typicode/husky#1072 (comment) This means you cannot commit any changes without using `--no-verify` which is... annoying.
1 parent ecca549 commit 8af4f8c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.husky/pre-commit

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npm run compile
5-
npm run lint
6-
npm run validate-user-code
4+
# See https://github.com/typicode/husky/issues/1072#issuecomment-1784006332
5+
npm_exec=$([[ $OS == "Windows_NT" ]] && echo "npm.cmd" || echo "npm")
6+
7+
"${npm_exec}" run compile
8+
"${npm_exec}" run lint
9+
"${npm_exec}" run validate-user-code

0 commit comments

Comments
 (0)