Skip to content

Commit e0068fc

Browse files
author
Tim Roes
authored
Improve pre-commit hook (#18903)
1 parent 54218f5 commit e0068fc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

airbyte-webapp/.husky/pre-commit

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
cd airbyte-webapp && npx --no lint-staged
1+
# Only run this pre-commit hook when npx is actually in the path.
2+
# Since CI will fail on misformated frontend code we consider this hook optional
3+
# and don't want to fail if the system doesn't have the requirements to run it.
4+
if command -v npx &> /dev/null; then
5+
# Only run if `npx` is at least version 8, since earlier versions didn't support the --no flag
6+
npxMajorVersion=$(npx --version | cut -d. -f1)
7+
if [ "$npxMajorVersion" -ge "8" ]; then
8+
cd airbyte-webapp && npx --no lint-staged
9+
fi
10+
fi

0 commit comments

Comments
 (0)