2024-02-26 08:18:16 +00:00
|
|
|
# Get the path the the Husky script.
|
|
|
|
DIRNAME="$(dirname "$0")"
|
|
|
|
FILE="$DIRNAME/_/husky.sh"
|
|
|
|
|
|
|
|
# Exit if Husky is not installed.
|
|
|
|
if [ ! -f "$FILE" ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
2024-08-14 22:47:30 +00:00
|
|
|
# Exit if dependencies are not installed.
|
|
|
|
if [ ! -d "node_modules" ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Exit if pnpm is not installed.
|
|
|
|
if ! [ -x "$(command -v pnpm)" ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
2024-09-11 11:57:57 +00:00
|
|
|
echo "Running pre-commit hook…";
|
|
|
|
|
|
|
|
# Ensure latest dependencies are installed, and exit if unable to install.
|
|
|
|
pnpm install --reporter=silent || {
|
|
|
|
echo "Unable to install dependencies, skipping pre-commit hook.";
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run lint-staged.
|
2024-04-12 08:34:18 +00:00
|
|
|
pnpm exec lint-staged
|