2021-01-22 15:36:30 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-14 17:08:42 +02:00
|
|
|
echo "Refreshing Kea logic types and running the TypeScript compiler in dry mode..."
|
|
|
|
echo
|
|
|
|
|
|
|
|
IGNORED_SPECS=('Type.ts') # *Type.ts* files are ignored, as they are generally created by kea-typegen
|
2021-01-22 15:36:30 +01:00
|
|
|
|
|
|
|
yarn typegen:write &> /dev/null
|
|
|
|
|
|
|
|
ALL_ERRORS=$(yarn typescript:check --strict 2> /dev/null | grep error | grep frontend)
|
|
|
|
ERRORS_COUNT=$(echo "${ALL_ERRORS}" | wc -l)
|
2021-10-14 17:08:42 +02:00
|
|
|
NEW_ERRORS=$(echo "${ALL_ERRORS}" | grep --invert-match --fixed-strings ${IGNORED_SPECS})
|
2021-01-22 15:36:30 +01:00
|
|
|
NEW_ERRORS_COUNT="$(echo "${NEW_ERRORS}" | wc -l)"
|
|
|
|
|
|
|
|
if test -z "${NEW_ERRORS}"
|
|
|
|
then
|
2021-10-14 17:08:42 +02:00
|
|
|
echo "No TypeScript errors found in this PR! 🚀"
|
2021-01-22 15:36:30 +01:00
|
|
|
exit 0
|
|
|
|
else
|
2021-10-14 17:08:42 +02:00
|
|
|
echo "Found ${NEW_ERRORS_COUNT} TypeScript errors in this PR! 💥"
|
2021-01-22 15:36:30 +01:00
|
|
|
echo "${NEW_ERRORS}"
|
|
|
|
exit 1
|
|
|
|
fi
|