This is an initiative to visualize NuGet package dependencies in a given project. The side effect of this project is a library of ProjectAssets.Core.
-
Clone the repo
-
Go to CLI folder
cd src/ProjectAssets.CLI
- Run
dotnet run -- -i obj
This generates the package reference mermaid chart at data/output.mmd
.
-
Visual
-
Copy & paste the text in
data/output.mmd
to any mermaid visualizer. For example: https://mermaid.live -
There are VSCode extensions to render
*.mmd
files in the editor too.
-
You could choose to use the artifacts in releases.
Chances are, that not all packages are interested. You can specify a target package for analysis. For example:
dotnet run -- -i obj -t "Microsoft.Extensions.Configuration"
You will get:
stateDiagram-v2
net6.0 --> 📦Microsoft.Extensions.Configuration.Json/6.0.0
📦Microsoft.Extensions.Configuration.Json/6.0.0 --> 📦Microsoft.Extensions.Configuration.FileExtensions/6.0.0
📦Microsoft.Extensions.Configuration.FileExtensions/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
📦Microsoft.Extensions.Configuration.Json/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
net6.0 --> 📦Microsoft.Extensions.Logging.Console/6.0.0
📦Microsoft.Extensions.Logging.Console/6.0.0 --> 📦Microsoft.Extensions.Logging.Configuration/6.0.0
📦Microsoft.Extensions.Logging.Configuration/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
📦Microsoft.Extensions.Configuration/6.0.0 --> 📦Microsoft.Extensions.Configuration.Abstractions/6.0.0
📦Microsoft.Extensions.Configuration.Abstractions/6.0.0 --> 📦Microsoft.Extensions.Primitives/6.0.0
📦Microsoft.Extensions.Primitives/6.0.0 --> 📦System.Runtime.CompilerServices.Unsafe/6.0.0
📦System.Runtime.CompilerServices.Unsafe/6.0.0 --> [*]
📦Microsoft.Extensions.Configuration/6.0.0 --> 📦Microsoft.Extensions.Primitives/6.0.0
dotnet run -- -i obj -t "Microsoft.Extensions.Configuration" -d Up
And get:
stateDiagram-v2
net6.0 --> 📦Microsoft.Extensions.Configuration.Json/6.0.0
📦Microsoft.Extensions.Configuration.Json/6.0.0 --> 📦Microsoft.Extensions.Configuration.FileExtensions/6.0.0
📦Microsoft.Extensions.Configuration.FileExtensions/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
📦Microsoft.Extensions.Configuration.Json/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
net6.0 --> 📦Microsoft.Extensions.Logging.Console/6.0.0
📦Microsoft.Extensions.Logging.Console/6.0.0 --> 📦Microsoft.Extensions.Logging.Configuration/6.0.0
📦Microsoft.Extensions.Logging.Configuration/6.0.0 --> 📦Microsoft.Extensions.Configuration/6.0.0
Docker image CLI is supported. A quick use:
- Pull the image
docker pull saars/ast-cli
The container looks for input files in /data. So for example, if you have a project.assets.json
defined on your system in c:\src\project\obj
, you can use the container to generate a Mermaid(mmd) file as follows:
docker run -it -v c:\src\project\obj:/data saars/ast-cli
This will map c:\src\project\obj
into /data
in the container. And you will find the output file at:
c:\src\project\obj\output.mmd
For more use, invoke the cli with -h
.
When running with source code, you need --
as a separator for dotnet cli:
dotnet -- -h
For docker image:
docker run -it saars/ast-cli -h
This project is inspired and helped by: