Skip to content

Commit

Permalink
chore(pre-commit): ask to run bun run changeset
Browse files Browse the repository at this point in the history
If changes to the cli/ directory are committed, suggest adding a
changeset.
  • Loading branch information
sammoore committed Dec 7, 2023
1 parent 72379c5 commit 266622f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 266622f

Please sign in to comment.