Share a dependency-cruiser report
Architecture rules fail quietly. Someone adds an import from the domain
layer to the HTTP layer, the rule fires in CI, the build goes red, and
the fastest path to green is to add an exception to
.dependency-cruiser.js. Nobody argues, because there is nowhere to
argue: the violation is a line in a log.
The graph is the argument. Put it somewhere people can point at it.
Publish it
npx depcruise src \
--output-type err-html --output-to depcruise.html || true
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html depcruise.html \
--arg title "Module graph — $REPO — $(date +%F)" \
'{title: $title, html: $html}')"
For the visual version, render the graph to SVG and publish that instead:
npx depcruise src --include-only "^src" --output-type dot \
| dot -T svg > graph.svg
Wrap the SVG in a minimal HTML page and publish. It stays vector at the link — zoomable, selectable, and readable on a laptop — unlike the PNG screenshot of a graph that usually gets pasted into a design doc.
What the URL changes
- Exceptions get a reason attached. "Allowed until the adapter lands, ARCH-12" pinned to the violation instead of buried in a config comment. See commenting on HTML.
- Cycle count over time. Revision per run at one URL. See revisions and diffs.
- Onboarding material that is current. A graph regenerated on a routine beats a hand-drawn diagram from 2023.
- Private by default — see the sharing model.
Limits
- Entry HTML: 5 MB. A dot-rendered SVG of a large monorepo can pass
it; narrow with
--include-onlyor--collapseto a package depth that is actually readable. - Scripts run, sandboxed:
allow-scripts, noallow-same-origin. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- jscpd duplication — the other structural view
- Bundle analyzer · Source map explorer
- ESLint reports · Publish from CI