nx-audit
v1.2.1
Published
CLI that reads an Nx project graph and reports **circular dependencies** and **orphan projects** (nothing depends on them).
Maintainers
Readme
nx-audit
CLI that reads an Nx project graph and reports circular dependencies and orphan projects (nothing depends on them).
Prerequisites
- Node.js (current LTS is fine)
- An Nx workspace where you can export the dependency graph
Install
From this repository:
npm install
npm run buildCompiled output is written to dist/.
Quick start
Run everything from the root of your Nx workspace (the same folder where nx.json lives).
1. Export the graph
npx nx graph --file=graph.jsonThis creates graph.json in the current directory. The analyzer expects that exact filename in the working directory.
2. Analyze
Run the built CLI directly:
npx nx-audit analyzeWhat you get
| Check | Meaning | |--------|--------| | Circular dependencies | Projects involved in dependency cycles (first node hit when a cycle is detected). | | Orphan libraries | Projects that never appear as a dependency target—often unused entry points or mis-wired libs. |
Troubleshooting
graph.json not found— Runnx graph --file=graph.jsonfrom the Nx workspace root, or run the analyzer with that file present in the current working directory.- Empty or surprising results — Confirm
graph.jsonis fresh and that you are analyzing the same workspace you exported.
License
ISC
