1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
checktheroads-hyperglass/.tests/pre-commit-frontend.sh

32 lines
586 B
Bash
Raw Normal View History

2021-01-03 10:59:19 -07:00
#!/usr/bin/env bash
2021-01-03 23:21:40 -07:00
UI_DIR="$(pwd)/hyperglass/ui"
2021-09-08 01:02:25 -07:00
check_typescript() {
yarn --cwd $UI_DIR typecheck
2021-01-03 23:21:40 -07:00
}
2021-09-08 01:02:25 -07:00
check_eslint() {
yarn --cwd $UI_DIR lint
2021-01-03 23:21:40 -07:00
}
2021-09-08 01:02:25 -07:00
check_prettier() {
yarn --cwd $UI_DIR prettier -c .
2021-01-03 23:21:40 -07:00
}
2021-09-08 01:02:25 -07:00
for arg in "$@"; do
if [ "$arg" == "--typescript" ]; then
2021-01-03 23:21:40 -07:00
check_typescript
2021-01-04 00:18:23 -07:00
exit $?
2021-09-08 01:02:25 -07:00
elif [ "$arg" == "--eslint" ]; then
2021-01-03 23:21:40 -07:00
check_eslint
2021-01-04 00:18:23 -07:00
exit $?
2021-09-08 01:02:25 -07:00
elif [ "$arg" == "--prettier" ]; then
2021-01-03 23:21:40 -07:00
check_prettier
2021-01-04 00:18:23 -07:00
exit $?
2021-01-03 23:24:48 -07:00
else
echo "Arguments --typescript, --eslint, or --prettier required."
exit 1
2021-01-03 23:21:40 -07:00
fi
done