A CLI tool which provides insights about a Cargo workspace. Currently, the following is supported:
- count the number of packages within a workspace
- create a Mermaid diagram to show how packages depend on each other
Install it globally:
cargo install cargo-workspace-analyzer
Then navigate to a Cargo workspace and run the tool:
cd path/to/your/workspace
cargo-workspace-analyzer
or use an argument to specify the location of the workspace.
cd path/to/your/workspace
cargo-workspace-analyzer --working-dir /path/to/your/workspace
For further details, use cargo-workspace-analyzer --help
After running the analyzer, an Mermaid diagram is printed.
graph TD
service-1 --> db-connector
API --> service-2
API --> service-1
service-2 --> db-connector
You can copy it and paste it in the Mermaid Live editor. It will give you the diagram.
graph TD
service-1 --> db-connector
API --> service-2
API --> service-1
service-2 --> db-connector
It will also display the amount of packages in your workspace.
Regarding features this is still in early stage. A lot can and will be analyzed in the future. The following is currently planed:
- show how packages are related to each other
- notice dependencies which are used in multiple packages, but not declared as workspace dependency
- notice circular dependencies
- ability to specify layers for the diagram