Migrating from madge
madge generates dependency graphs and finds circular dependencies. rev-dep replaces its analysis commands with config-driven checks and fast text-based exploration.
Why migrate​
- Speed. rev-dep is written in Go and runs in one parallel pass - up to 207x faster than madge on large codebases.
- Enforceable, not just informational. madge prints info; rev-dep turns the same findings into CI checks that fail the build, and adds unused exports, unused/missing dependencies, module boundaries, and more.
What carries over, what changes​
- Covered well: circular dependencies, and the "what imports/depends on what" questions.
- Not replaced - visualization. madge's main feature is rendering a graph image (
--image,--dot). rev-dep has no image output; it answers reachability questions as text via the exploratory toolkit. If you rely on the visual graph, keep madge for that and use rev-dep for the checks.
Feature mapping​
| madge | rev-dep |
|---|---|
madge --circular | circular command / circularImportsDetection check |
madge --orphans (modules nothing imports) | entry-points command |
madge --leaves (modules with no deps) | - (no equivalent) |
madge --depends <module> | imported-by / resolve |
| dead/unreachable files | orphanFilesDetection (more precise - uses real entry points) |
madge --image / --dot (visual graph) | - (no image output) |
Translating your usage​
Ad-hoc madge commands:
madge --circular src
madge --orphans src
become exploratory commands, or a config check for CI:
rev-dep circular
rev-dep entry-points
{
"rules": [
{
"path": ".",
"circularImportsDetection": {
"enabled": true,
"ignoreTypeImports": true,
"algorithm": "SCC"
}
}
]
}
| madge option | rev-dep equivalent |
|---|---|
--extensions js,ts | supported source extensions are built in; see supported file types |
--exclude <regexp> | graphExclude / ignoreFiles (globs) |
--ts-config / --webpack-config | rev-dep reads tsconfig.json paths; webpack aliases must be mirrored in tsconfig - see module resolution |
Running it​
# madge
npx madge --circular src
# rev-dep (CI gate)
rev-dep config run
rev-dep circular (and config run) exit non-zero when cycles exist, ready for CI.
Next steps​
- Exploratory toolkit for the text-based equivalents of madge's queries.
- Monorepo integration guide to wire checks into CI.