Skip to content

Commit

Permalink
fix: 修复husky可能找不到npx命令的问题 (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
timi137137 authored Nov 15, 2023
1 parent 33b9eac commit 93b3492
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint -e $GIT_PARAMS
if [[ "$OS" == "Windows_NT" ]]; then
npx.cmd --no-install commitlint -e $GIT_PARAMS
else
npx --no-install commitlint -e $GIT_PARAMS
fi
6 changes: 5 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
if [[ "$OS" == "Windows_NT" ]]; then
npx.cmd lint-staged
else
npx lint-staged
fi
6 changes: 5 additions & 1 deletion .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
[ -n "$CI" ] && exit 0
. "$(dirname "$0")/_/husky.sh"

exec < /dev/tty && npx git-cz --hook || true
if [[ "$OS" == "Windows_NT" ]]; then
exec < /dev/tty && npx.cmd git-cz --hook || true
else
exec < /dev/tty && npx git-cz --hook || true
fi

0 comments on commit 93b3492

Please sign in to comment.