diff --git a/.husky/pre-commit b/.husky/pre-commit index 6fd7168f..dadf7563 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,20 @@ #!/bin/sh +set -e + bun run lint-staged -git diff-index --cached HEAD | xargs -I{} echo {} +# offer to run `bun run changeset` when changes are committed within the cli/ directory +if git diff-index --cached HEAD | tr '\t' ' ' | sed 's/^.*[ ]//' | grep '^cli/' >/dev/null; then + echo "" + echo "It looks likes you've made changes within the \`cli/\` folder." + printf "Would you like to run \`bun run changeset\` to update the changelog? (Y/n): " + + read res < /dev/tty + case $res in + ""|Y|y) + bun run changeset < /dev/tty + ;; + esac + + echo "" +fi