Skip to main content

dependency_graph 0.1.0 copy "dependency_graph: ^0.1.0" to clipboard
dependency_graph: ^0.1.0 copied to clipboard

Who imports whom in a Dart package or pub workspace, and which pub libraries it pulls in: one interactive HTML page of graphs.

[Frame]

πŸ•ΈοΈ Dependency Graph #

A Dart command-line tool that shows who imports whom in a Dart package or a pub workspace β€” and which pub libraries it pulls in β€” as one interactive HTML page.

[Packages]

πŸ“‹ Features #

  • πŸ“¦ Packages graph β€” one node per package, edges weighted by the number of directives
  • πŸ” Package graph β€” its files boxed by folder, every neighbour package as one node
  • πŸ—‚οΈ All files graph β€” every file, boxed by package and folder
  • 🌐 External libraries β€” every library pubspec.lock downloaded, with its version and who imports it
  • πŸ”΄ Packages that depend on each other are marked red
  • 🧲 Live physics, Obsidian-style β€” drag a node and its neighbours follow
  • πŸŽ›οΈ Adjustable forces β€” center, repel, link force, link distance, damping
  • πŸŒ— Light and dark theme, following the system

πŸš€ Installation #

In a project (as dev dependency) #

dart pub add -d dependency_graph

Or manually in pubspec.yaml:

dev_dependencies:
  dependency_graph: ^0.1.0

Globally #

dart pub global activate dependency_graph

Then run as:

dependency_graph [root] [out.html]

πŸ“– Usage #

dart run dependency_graph [root] [out.html]

Arguments #

Argument Description Default
root The package or workspace root .
out.html Where to write the page <root>/build/dependency_graph/index.html
-h, --help Print usage information

Run dart pub get first, so pubspec.lock lists the external libraries. The page loads Cytoscape.js and d3 from a CDN, so it needs a network connection to open.

🎯 Views #

Packages #

One node per package, sized by its file count. Packages are coloured by the folder they sit in (apps, packages), split by a name prefix several packages share (feature_*). Tick external libraries to add the pub packages the code imports.

What it shows:

  • πŸ“Š How many directives go from one package to another
  • πŸ”΄ Packages that import each other
  • 🌐 Every downloaded library, and the ones the code actually imports

Package #

Double-click a package to open it: its files boxed by folder, and each package it touches as one node.

[Package]

What it shows:

  • ➑️ What the package depends on, and how much
  • ⬅️ Who uses it
  • 🌐 Which external libraries it imports

Click any node to highlight its edges: outgoing in orange, incoming in blue. Dashed edges are export, dotted are part.

Forces #

Open the Forces panel to tune the physics. The settings are kept in the browser; Reset brings back the defaults.

[Forces]

Slider Effect
Center Pull towards the middle
Repel How hard nodes push each other away
Link force Stiffness of the edges β€” lower is softer
Link distance Length of the edges
Damping How fast the motion settles

Views above 600 nodes keep still; untick and tick physics to run it there anyway.

πŸ’‘ As a library #

import 'dart:io';

import 'package:dependency_graph/dependency_graph.dart';

void main() {
  final graph = scan(Directory('.'));
  File('graph.html').writeAsStringSync(render(graph));
}

scan returns plain data β€” packages, files, edges, external, uses β€” if you'd rather feed it to something else.

3
likes
0
points
568
downloads

Publisher

verified publisherbangertstudio.kz

Weekly Downloads

Who imports whom in a Dart package or pub workspace, and which pub libraries it pulls in: one interactive HTML page of graphs.

Repository (GitHub)
View/report issues

Topics

#dependency-graph #visualization #cli #workspace

License

unknown (license)

More

Packages that depend on dependency_graph