feat: configure Husky with pre-push validation

This commit is contained in:
Daniel Luiz Alves
2025-07-01 01:42:19 -03:00
parent 5b04dd6415
commit fa0684ebbd
8 changed files with 41 additions and 54 deletions

2
.gitignore vendored
View File

@@ -31,3 +31,5 @@ apps/server/dist/*
#DEFAULT
.env
data/
node_modules/

View File

@@ -1,36 +0,0 @@
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."
if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi
if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitcode="$?"
if [ $exitcode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitcode (error)"
fi
if [ $exitcode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi
exit $exitcode
fi

View File

@@ -1,5 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
echo "🔍 Running pre-push validation for web app..."
cd apps/web && pnpm validate

View File

@@ -23,7 +23,6 @@
"format:check": "prettier . --check",
"type-check": "npx tsc --noEmit",
"validate": "pnpm format && pnpm lint:fix && pnpm type-check",
"prepare": "husky",
"translations": "python3 scripts/run_translations.py all",
"translations:check": "python3 scripts/run_translations.py check",
"translations:sync": "python3 scripts/run_translations.py sync",
@@ -89,7 +88,6 @@
"eslint-config-next": "15.3.4",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.5.1",
"husky": "^9.1.7",
"prettier": "3.6.2",
"prettier-plugin-sort-json": "4.1.1",
"tailwindcss": "4.1.11",

View File

@@ -176,9 +176,6 @@ importers:
eslint-plugin-prettier:
specifier: 5.5.1
version: 5.5.1(eslint-config-prettier@9.1.0(eslint@9.30.0(jiti@2.4.2)))(eslint@9.30.0(jiti@2.4.2))(prettier@3.6.2)
husky:
specifier: ^9.1.7
version: 9.1.7
prettier:
specifier: 3.6.2
version: 3.6.2
@@ -2268,12 +2265,6 @@ packages:
{ integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== }
engines: { node: ">= 0.4" }
husky@9.1.7:
resolution:
{ integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA== }
engines: { node: ">=18" }
hasBin: true
ignore@5.3.2:
resolution:
{ integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== }
@@ -5303,8 +5294,6 @@ snapshots:
dependencies:
function-bind: 1.1.2
husky@9.1.7: {}
ignore@5.3.2: {}
ignore@7.0.5: {}

13
package.json Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "palmr-monorepo",
"version": "3.1-beta",
"description": "Palmr monorepo with Husky configuration",
"private": true,
"packageManager": "pnpm@10.6.0",
"scripts": {
"prepare": "git config core.hooksPath .husky && husky"
},
"devDependencies": {
"husky": "^9.1.7"
}
}

24
pnpm-lock.yaml generated Normal file
View File

@@ -0,0 +1,24 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
husky:
specifier: ^9.1.7
version: 9.1.7
packages:
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
snapshots:
husky@9.1.7: {}