#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

SRC_PATTERN="constants\.json$"
if git diff --cached --name-only | grep --quiet -E "$SRC_PATTERN"
then
  echo "JSON assets changed. Running build scripts."
  # Run your custom script to generate constants.py and constants.js
  npm run build:constants

  # Stage the newly generated files
  git add src/py/mat3ra/utils/constants.py
  git add src/js/shared/constants.js
fi

npm run transpile
npx lint-staged
git add dist/js
