|
|
|
|
|
echo "π Running pre-commit hook to check the code looks good... π" |
|
|
|
|
|
export NVM_DIR="$HOME/.nvm" |
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" |
|
|
|
|
|
echo "Checking if pnpm is available..." |
|
if ! command -v pnpm >/dev/null 2>&1; then |
|
echo "β pnpm not found! Please ensure pnpm is installed and available in PATH." |
|
exit 1 |
|
fi |
|
|
|
|
|
echo "Running typecheck..." |
|
if ! pnpm typecheck; then |
|
echo "β Type checking failed! Please review TypeScript types." |
|
echo "Once you're done, don't forget to add your changes to the commit! π" |
|
exit 1 |
|
fi |
|
|
|
|
|
echo "Running lint..." |
|
if ! pnpm lint; then |
|
echo "β Linting failed! Run 'pnpm lint:fix' to fix the easy issues." |
|
echo "Once you're done, don't forget to add your beautification to the commit! π€©" |
|
exit 1 |
|
fi |
|
|
|
|
|
echo "Updating commit.json with the latest commit hash..." |
|
COMMIT_HASH=$(git rev-parse HEAD) |
|
if [ $? -ne 0 ]; then |
|
echo "β Failed to get commit hash. Ensure you are in a git repository." |
|
exit 1 |
|
fi |
|
|
|
echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json |
|
git add app/commit.json |
|
|
|
echo "π All checks passed! Committing changes..." |
|
|