Skip to content

Commit

Permalink
fixed circular-deps.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrans committed Jan 15, 2025
1 parent 545e700 commit 078a37c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions development/circular-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
madge_json > circular-deps.json || true

echo "Wrote circular dependencies to circular-deps.json"
fi

0 comments on commit 078a37c

Please sign in to comment.