From 2b22d10b460e280573353097ac1c416a0625fdf4 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sat, 14 Jun 2025 20:39:25 -0700 Subject: [PATCH] chore(.husky/pre-commit): improve pre-commit hook run presentation --- .husky/pre-commit | 32 ++++++++++++++++++++++++++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index eaad2a0..ee7d44c 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,30 @@ -npx lint-staged -npm run format:sql +#!/bin/sh + +COLOR_YELLOW="\033[1;33m" +COLOR_GREEN="\033[1;32m" +COLOR_RED="\033[1;31m" +COLOR_RESET="\033[0m" + +echo "" +echo "${COLOR_YELLOW}⏱️ Running formatters and linters...${COLOR_RESET}" + +LINT_OUTPUT=$(npx lint-staged 2>&1) +if [ $? -ne 0 ]; then + echo "${COLOR_RED}❌ Lint-staged failed:${COLOR_RESET}" + echo "$LINT_OUTPUT" + exit 1 +else + echo "${COLOR_GREEN}✅ Lint-staged passed.${COLOR_RESET}" +fi + +SQL_OUTPUT=$(npm run format:sql --silent 2>&1) +if [ $? -ne 0 ]; then + echo "${COLOR_RED}❌ SQL formatting failed:${COLOR_RESET}" + echo "$SQL_OUTPUT" + exit 1 +else + echo "${COLOR_GREEN}✅ SQL formatted successfully.${COLOR_RESET}" +fi + +echo "${COLOR_GREEN}🎉 All pre-commit checks passed. Committing!${COLOR_RESET}" +echo "" diff --git a/package-lock.json b/package-lock.json index 32c3509..d373ad8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "10.3.6", + "version": "10.4.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "10.3.6", + "version": "10.4.6", "license": "MIT", "dependencies": { "minisearch": "^7.1.2", diff --git a/package.json b/package.json index cb5d2fa..9e8fa91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "10.3.6", + "version": "10.4.6", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "engines": {