Skip to content

Commit

Permalink
Fix finding left-hook binary under node_modules
Browse files Browse the repository at this point in the history
No matter what package manager is used, the binaries will be always under node_modules/.bin.

The previous script only worked with "npm" which hoists the dependencies to node_modules.

It also fixes finding binaries for the cases where $dir has spaces in it
  • Loading branch information
aminya committed May 15, 2021
1 parent e0d4765 commit e4d45dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/templates/hook.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ call_lefthook()
if lefthook -h >/dev/null 2>&1
then
eval $1
elif test -f "$dir/node_modules/@arkweid/lefthook/bin/lefthook"
elif test -f "$dir/node_modules/.bin/lefthook"
then
eval $dir/node_modules/@arkweid/lefthook/bin/$1
eval "$dir/node_modules/.bin/$1"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec $1
Expand Down

0 comments on commit e4d45dd

Please sign in to comment.