Jelajahi Sumber

10310 pre commit yarn (#10315)

* #10310 run yarn pre-commit only if static files changed
Arthur Hanson 3 tahun lalu
induk
melakukan
721cd578bb
1 mengubah file dengan 7 tambahan dan 4 penghapusan
  1. 7 4
      scripts/git-hooks/pre-commit

+ 7 - 4
scripts/git-hooks/pre-commit

@@ -40,10 +40,13 @@ if [ $? != 0 ]; then
 	EXIT=1
 	EXIT=1
 fi
 fi
 
 
-echo "Checking UI ESLint, TypeScript, and Prettier compliance..."
-yarn --cwd "$PWD/netbox/project-static" validate
-if [ $? != 0 ]; then
-	EXIT=1
+git diff --cached --name-only | if grep --quiet 'netbox/project-static/'
+then
+    echo "Checking UI ESLint, TypeScript, and Prettier compliance..."
+    yarn --cwd "$PWD/netbox/project-static" validate
+    if [ $? != 0 ]; then
+    	EXIT=1
+    fi
 fi
 fi
 
 
 if [ $EXIT != 0 ]; then
 if [ $EXIT != 0 ]; then