From 726346895193aef1e5a7ca9e6657e8aefb5522d1 Mon Sep 17 00:00:00 2001 From: soraefir Date: Tue, 1 Aug 2023 14:45:26 +0200 Subject: [PATCH] Pushed hooks --- .dev/hooks/post-commit | 2 ++ .dev/hooks/pre-commit | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100755 .dev/hooks/post-commit create mode 100755 .dev/hooks/pre-commit diff --git a/.dev/hooks/post-commit b/.dev/hooks/post-commit new file mode 100755 index 0000000..917569b --- /dev/null +++ b/.dev/hooks/post-commit @@ -0,0 +1,2 @@ +#!/bin/sh +git update-index -g diff --git a/.dev/hooks/pre-commit b/.dev/hooks/pre-commit new file mode 100755 index 0000000..2858327 --- /dev/null +++ b/.dev/hooks/pre-commit @@ -0,0 +1,11 @@ +#!/bin/sh +FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') +[ -z "$FILES" ] && exit 0 + +# Prettify all selected files +echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write --plugin=@prettier/plugin-pug + +# Add back the modified/prettified files to staging +echo "$FILES" | xargs git add + +exit 0