blob: 99fc09bd7922f10bfb3e92c81ee1762cf66ff5cb [file] [log] [blame]
#!/usr/bin/env sh
confirm () {
if ! eval "$@" ; then
printf "Found some problems in the code. Do you still want to push? [y/N] "
read -r REPLY
if [ "$REPLY" = "${REPLY#[Yy]}" ]
then
echo "Cancelling push..."
exit 1
else
return 1
fi
else
echo "OK!"
fi
}
echo "Checking for EsLint errors and warnings..."
confirm "npm run lint --workspaces -- --max-warnings 0"
if [ $? -eq 1 ]; then
echo "Checking for EsLint errors..."
npm run lint --workspaces -- --quiet
fi
echo "Checking for Prettier problems..."
confirm "npm run format:check --workspaces"