File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ update_npm_dependencies() {
2424 log " Dependency requirements changed! This will take a few seconds..."
2525
2626 local cmd=" npm install --prefer-offline"
27+ if ! command -v npm & > /dev/null; then
28+ log " NPM not found on \$ PATH, however '$cmd ' is desired. Please accomplish manually."
29+ return
30+ fi
2731 log " $> $cmd "
2832 eval " $cmd "
2933 fi
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ update_npm_dependencies() {
3030
3131 if [ " $NEEDS_INSTALL " == true ]; then
3232 cmd=" npm install"
33+ if ! command -v npm & > /dev/null; then
34+ log " NPM not found on \$ PATH, however '$cmd ' is desired. Please accomplish manually."
35+ return
36+ fi
3337 log " $> $cmd "
3438 eval " $cmd "
3539
Original file line number Diff line number Diff line change @@ -7,9 +7,14 @@ LOG_PREFIX="[.husky/pre-commit]"
77
88. " $( dirname " $0 " ) /hook-utils.sh"
99
10- log " $> npm run lint"
11- if ! npm run lint; then
12- error " ERROR: Dirty code detected!"
13- error " Fix the lint errors before committing to the repository."
10+ if command -v npm & > /dev/null; then
11+ log " $> npm run lint"
12+ if ! npm run lint; then
13+ error " ERROR: Dirty code detected!"
14+ error " Fix the lint errors before committing to the repository."
15+ exit -1
16+ fi
17+ else
18+ error " NPM not found on \$ PATH, unable to run pre-commit lint hook."
1419 exit -1
1520fi
You can’t perform that action at this time.
0 commit comments