Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.26 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.26 KB

imports-graph

Draw dependency graph for typescript or javascript modules

Install

Download the file (imports-graph.ts) or git clone the repo or imports from JSR or just use the direct url: jsr:@invisement/imports-graph@^1

Usage

deno run --allow-read=<dir> --allow-run=git jsr:@invisement/imports-graph@^1 <dir> 
  • It creates the imports inter-dependency of your TS and JS (ESM) modules and dumps its DOT notation to stdio/terminal.
  • <dir> is the root of the directory to find all TS files (recursively). If not provided, it uses current directory.
  • If you run it from a git repo, it respects your .gitignore.

Output dot notation to stdio/terminal

deno run -A jsr:@invisement/imports-graph@^1 ./ui

or you can pipe it to clipboard and paste it in an online graph viewer

deno run -A jsr:@invisement/imports-graph@^1 ./ui | pbcopy

Generate .svg file

deno run -A jsr:@invisement/imports-graph@^1 . | dot -Tsvg > ./documentation/ui-imports-graph.svg

Import

import { toDot } from "jsr:@invisement/imports-graph";

You may want to use it with viz.js to create the svg file for your webpage.