From 05f4ab929ebe4a7db85358e27ba9c9639c1525e4 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sat, 30 Oct 2021 07:43:12 +0530 Subject: Do not error out if husky has not been installed. Ignore .husky folder from Docker context --- .dockerignore | 4 +--- .husky/pre-commit | 9 +++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 110334e..e97b248 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,6 +15,4 @@ docker !docker/entrypoint.sh !docker/.env node_modules - - - +.husky diff --git a/.husky/pre-commit b/.husky/pre-commit index 20d0d06..1a92cb3 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,9 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" -npm run lint +FILE_NAME="$(dirname "$0")/_/husky.sh" + +# Conditionally invoke so as to avoid running npm commands if this is a clean checkout (ie before installing npm modules) +if [ -f $FILE_NAME ]; then + . $FILE_NAME + npm run lint +fi -- cgit v1.2.3-54-g00ecf