Files
malio-layer-ui/pre-commit

29 lines
718 B
Bash

#!/bin/sh
set -e
echo "######### Pre-commit hook start #############"
# Prefer the exact Node version from .nvmrc for hooks (IDE + CLI consistency).
if [ -f ".nvmrc" ]; then
NVM_VERSION="$(tr -d '\r\n' < .nvmrc)"
NVM_VERSION="${NVM_VERSION#v}"
NVM_BIN="$HOME/.nvm/versions/node/v$NVM_VERSION/bin"
if [ -x "$NVM_BIN/node" ] && [ -x "$NVM_BIN/npm" ]; then
PATH="$NVM_BIN:$PATH"
export PATH
fi
fi
if ! command -v npm >/dev/null 2>&1; then
echo "npm introuvable dans le hook. Abandon du commit."
exit 1
fi
echo "Node $(node -v) / npm $(npm -v)"
echo "--- make pre-commit start ---"
make pre-commit
echo "--- make pre-commit finished ---"
echo "All checks passed. Proceeding with commit."
exit 0