| #!/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" |