diff --git a/development/circular-deps.sh b/development/circular-deps.sh index 717562f97d40..700d673704d3 100755 --- a/development/circular-deps.sh +++ b/development/circular-deps.sh @@ -36,12 +36,17 @@ madge_json() { if [[ "$COMMAND" == "check" ]]; then # Generate current circular dependencies - madge_json > circular-deps.temp.json + madge_json > circular-deps.temp.json || true - # Compare with existing file - if ! diff <(cat circular-deps.json | normalize_json) circular-deps.temp.json > /dev/null 2>&1; then - echo "Error: Circular dependencies have changed." - echo "Run '@metamaskbot update-circular-deps' to update the circular dependencies file." + + # Compare files silently + DIFF_OUTPUT=$(diff circular-deps.json circular-deps.temp.json || true) + + if [ -n "$DIFF_OUTPUT" ]; then + echo "Error: Codebase circular dependencies are out of sync in circular-deps.json" + echo "You can resolve this by either:" + echo "1. Add comment '@metamaskbot update-circular-deps' on this PR" + echo "2. Run 'yarn circular-deps:update' locally and commit the changes." rm circular-deps.temp.json exit 1 fi @@ -50,6 +55,7 @@ if [[ "$COMMAND" == "check" ]]; then echo "Circular dependencies check passed." else # Generate circular dependencies and update the file - madge_json > circular-deps.json - echo "Updated circular-deps.json with current circular dependencies." -fi \ No newline at end of file + madge_json > circular-deps.json || true + + echo "Wrote circular dependencies to circular-deps.json" +fi