]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
chore: add message for about Husky at precommit & prepush
authorNicolas Coden <nicolas@ncoden.fr>
Sun, 1 Apr 2018 16:24:53 +0000 (18:24 +0200)
committerDaniel Ruf <daniel@daniel-ruf.de>
Sun, 1 Apr 2018 23:41:34 +0000 (01:41 +0200)
package.json
script/husky-precommit [new file with mode: 0755]
script/husky-prepush [new file with mode: 0755]

index 1098c225e871df49d1f18d6adb9ed42fe191ee82..e1879eb3db2fea2ce5e0fabee424525632ac72c1 100644 (file)
@@ -23,8 +23,8 @@
     "deploy:prep": "gulp deploy:prep",
     "deploy:docs": "gulp deploy:docs",
     "deploy:beta": "gulp deploy:beta",
-    "precommit": "npm test",
-    "prepush": "npm test"
+    "precommit": "./script/husky-precommit",
+    "prepush": "./script/husky-prepush"
   },
   "dependencies": {
     "jquery": ">=3.0.0",
diff --git a/script/husky-precommit b/script/husky-precommit
new file mode 100755 (executable)
index 0000000..9c15613
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+{
+  echo -e "\033[33m🐶  Checking tests before committing with Husky...\033[0m" &&
+  npm run test &&
+  echo -e "\033[33m🐶  ✓ Tests run well, we can commit...\033[0m"
+} || {
+  echo -e "\033[33m🐶  ✗ Tests are failing, please fix them before committing.\033[0m"
+  exit 1
+}
diff --git a/script/husky-prepush b/script/husky-prepush
new file mode 100755 (executable)
index 0000000..a5c7e63
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+{
+  echo -e "\033[33m🐶  Checking tests before pushing with Husky...\033[0m" &&
+  npm run test &&
+  echo -e "\033[33m🐶  ✓ Tests run well, we can push...\033[0m"
+} || {
+  echo -e "\033[33m🐶  ✗ Tests are failing, please fix them before pushing.\033[0m"
+  exit 1
+}