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