simon | 7a7b4d5 | 2022-09-23 02:09:42 -0400 | [diff] [blame] | 1 | #!/usr/bin/env sh |
simon | 7a7b4d5 | 2022-09-23 02:09:42 -0400 | [diff] [blame] | 2 | |
simon | 718f76c | 2022-11-07 20:55:01 -0500 | [diff] [blame] | 3 | confirm () { |
| 4 | if ! eval "$@" ; then |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 5 | printf "Found some problems in the code. Do you still want to push? [y/N] " |
simon | 718f76c | 2022-11-07 20:55:01 -0500 | [diff] [blame] | 6 | read -r REPLY |
| 7 | |
| 8 | if [ "$REPLY" = "${REPLY#[Yy]}" ] |
| 9 | then |
| 10 | echo "Cancelling push..." |
| 11 | exit 1 |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 12 | else |
| 13 | return 1 |
simon | 718f76c | 2022-11-07 20:55:01 -0500 | [diff] [blame] | 14 | fi |
| 15 | else |
| 16 | echo "OK!" |
| 17 | fi |
| 18 | } |
| 19 | |
Misha Krieger-Raynauld | 173fbba | 2022-11-16 14:10:38 -0500 | [diff] [blame] | 20 | echo "Checking for ESLint errors and warnings..." |
simon | 718f76c | 2022-11-07 20:55:01 -0500 | [diff] [blame] | 21 | confirm "npm run lint --workspaces -- --max-warnings 0" |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 22 | |
| 23 | if [ $? -eq 1 ]; then |
Misha Krieger-Raynauld | 173fbba | 2022-11-16 14:10:38 -0500 | [diff] [blame] | 24 | echo "Checking for ESLint errors..." |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 25 | npm run lint --workspaces -- --quiet |
| 26 | fi |
| 27 | |
| 28 | echo "Checking for Prettier problems..." |
| 29 | confirm "npm run format:check --workspaces" |