Files
Homepage/logos/simple-icons.manual-backup-20251123-234134/.husky/pre-commit

22 lines
714 B
Bash
Executable File

#!/usr/bin/env sh
# ^^^^^^^^^^^^^^^ Husky doesn't require this shebang,
# but code editors need it to recognize the file as a script.
# Format and add the changes to the staging area
npm run format
git add --update
# POSIX shell (sh) run time parameters.
# -e: Exit immediately if a command exits with a non-zero status.
# -u: Treat unset variables as errors when substituting.
set -eu
# Track exit code in case that we want to add other lints in the future
EXITCODE=0
# If there are changed icons, lint them with SVGLint
changed_icons=$(git diff --cached --name-only --diff-filter=ACM 'icons/' | xargs)
[ -n "$changed_icons" ] && { npm run svglint:base -- $changed_icons || EXITCODE=$?; }
exit $EXITCODE