-
Notifications
You must be signed in to change notification settings - Fork 4
/
pre-commit
executable file
·31 lines (26 loc) · 792 Bytes
/
pre-commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
SRC_PATTERN="\.json$"
if git diff --cached --name-only | grep --quiet -E "$SRC_PATTERN"
then
echo "JSON assets changed. Running build scripts."
echo "Re-building JS and PY assets using JS script."
npm run transpile-and-build-assets
fi
pwd
if test -f .venv/bin/activate
then
echo "Python virtual environment found. Running build scripts"
echo "Re-building JS and PY assets using JS script."
source .venv/bin/activate
# Note: resolved (no include statements) schemas have to exist by this time
pre-commit run --all-files
#git add dist/py
else
echo "ERROR: Python virtual environment found. Create one in '.venv' and install '.[all]'"
exit 1
fi
npx lint-staged --allow-empty
npm run lint:fix
npm run transpile
#git add dist/js