diff --git a/.husky/post-checkout b/.husky/post-checkout index 9319c38..07330df 100755 --- a/.husky/post-checkout +++ b/.husky/post-checkout @@ -24,6 +24,10 @@ update_npm_dependencies() { log "Dependency requirements changed! This will take a few seconds..." local cmd="npm install --prefer-offline" + if ! command -v npm &>/dev/null; then + log "NPM not found on \$PATH, however '$cmd' is desired. Please accomplish manually." + return + fi log "$> $cmd" eval "$cmd" fi diff --git a/.husky/post-merge b/.husky/post-merge index e40976e..492426e 100755 --- a/.husky/post-merge +++ b/.husky/post-merge @@ -30,6 +30,10 @@ update_npm_dependencies() { if [ "$NEEDS_INSTALL" == true ]; then cmd="npm install" + if ! command -v npm &>/dev/null; then + log "NPM not found on \$PATH, however '$cmd' is desired. Please accomplish manually." + return + fi log "$> $cmd" eval "$cmd" diff --git a/.husky/pre-commit b/.husky/pre-commit index 689d179..1f3b10a 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -7,9 +7,14 @@ LOG_PREFIX="[.husky/pre-commit]" . "$(dirname "$0")/hook-utils.sh" -log "$> npm run lint" -if ! npm run lint; then - error "ERROR: Dirty code detected!" - error "Fix the lint errors before committing to the repository." +if command -v npm &>/dev/null; then + log "$> npm run lint" + if ! npm run lint; then + error "ERROR: Dirty code detected!" + error "Fix the lint errors before committing to the repository." + exit -1 + fi +else + error "NPM not found on \$PATH, unable to run pre-commit lint hook." exit -1 fi