mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
The pre-push hook runs a full yarn type-check across all workspaces before every push. On large monorepos this adds significant latency to every push (often 30–90 seconds), blocks pushes in environments where corepack/network access is restricted, and duplicates a check that CI already runs on every PR. Co-authored-by: Hanzo Dev <[email protected]>
36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
|
|
# Store the initial git status
|
|
initial_status=$(git status --porcelain)
|
|
|
|
# Run the lint command
|
|
yarn run lint --fix
|
|
|
|
# Store the status after running lint
|
|
post_lint_status=$(git status --porcelain)
|
|
|
|
# Compare the initial and post-lint statuses
|
|
if [ "$initial_status" != "$post_lint_status" ]; then
|
|
echo "===================================="
|
|
echo "Linters gonna lint!"
|
|
echo "Linting made changes. Please commit these changes before pushing or push with --no-verify flag to omit this check."
|
|
echo "===================================="
|
|
exit 1
|
|
fi
|
|
|
|
# Check if the user wants to run tests on push
|
|
if [ "${RUN_TESTS_ON_PUSH:-}" == "true" ]; then
|
|
echo "Running tests..."
|
|
if ! yarn test; then
|
|
echo "===================================="
|
|
echo "Tests failed. Guess they need more 'exercise'!"
|
|
echo "Please fix the issues before pushing or push with --no-verify flag to omit this check."
|
|
echo "===================================="
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# All goooood in safe's land!
|
|
exit 0
|