Adding husky hooks

This commit is contained in:
a8trejo
2024-12-10 13:33:35 -08:00
parent 6e1f6833b8
commit 84c808a620
5 changed files with 787 additions and 1 deletions

8
.husky/pre-commit Normal file
View File

@@ -0,0 +1,8 @@
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]; then
echo "You can't commit directly to main - please check out a branch."
exit 1
fi
# TO DO: npx lint-staged

17
.husky/pre-push Normal file
View File

@@ -0,0 +1,17 @@
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]; then
echo "You can't push directly to main - please check out a branch."
exit 1
fi
# TO DO: npx tsc-silent -p tsconfig.json --suppressConfig tsc-silent.config.js
# Check for new changesets
NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
echo "Changeset files: $NEW_CHANGESETS"
if [ "$NEW_CHANGESETS" == "0" ]; then
echo "-------------------------------------------------------------------------------------"
echo "Changes detected. Please run 'npm run changeset' to create a changeset if applicable."
echo "-------------------------------------------------------------------------------------"
fi