From 4987b048521b7ea7a28513e961253384d2d98646 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 15 May 2021 09:47:30 -0500 Subject: [PATCH] Fix finding left-hook binary under node_modules 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 --- cmd/templates/hook.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/templates/hook.tmpl b/cmd/templates/hook.tmpl index 4648b028..69dd0dfb 100644 --- a/cmd/templates/hook.tmpl +++ b/cmd/templates/hook.tmpl @@ -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