mirror of
https://github.com/kyantech/Palmr.git
synced 2025-10-22 22:02:00 +00:00
feat: add Husky pre-push hook and validation script
- Introduced a pre-push hook in the Husky configuration to run validation checks for the web app before pushing changes. - Added a validation script in package.json that includes formatting, linting, and type-checking tasks to ensure code quality. - Updated pnpm-lock.yaml to include Husky as a dependency, enhancing the development workflow.
This commit is contained in:
36
.husky/_/husky.sh
Executable file
36
.husky/_/husky.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
5
.husky/pre-push
Executable file
5
.husky/pre-push
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
echo "🔍 Running pre-push validation for web app..."
|
||||
cd apps/web && pnpm validate
|
@@ -21,6 +21,9 @@
|
||||
"lint:fix": "eslint \"src/**/*.+(ts|tsx)\" --fix",
|
||||
"format": "prettier . --write",
|
||||
"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",
|
||||
@@ -86,6 +89,7 @@
|
||||
"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",
|
||||
|
11
apps/web/pnpm-lock.yaml
generated
11
apps/web/pnpm-lock.yaml
generated
@@ -176,6 +176,9 @@ 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
|
||||
@@ -2265,6 +2268,12 @@ 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== }
|
||||
@@ -5294,6 +5303,8 @@ snapshots:
|
||||
dependencies:
|
||||
function-bind: 1.1.2
|
||||
|
||||
husky@9.1.7: {}
|
||||
|
||||
ignore@5.3.2: {}
|
||||
|
||||
ignore@7.0.5: {}
|
||||
|
Reference in New Issue
Block a user