Automatically generate layer diagram view of your source code dependencies.
Supports JavaScript, TypeScript, Dart (Flutter), Swift, and DOT graph files.
View and Keep your project source files layer dependencies clean. Avoid circular reference or referencing an upper layer from a lower layer.
- NodeJS - source files of type JS & TS
- Flutter/Dart - package dependencies
- Swift - iOS/macOS projects using Tree-Sitter parsing
- DOT - GraphViz DOT file input for custom diagrams
Simply launch the glad command and open the resulting glad.svg file.
- Optional grouping of layers by folders.
- Rendering views as Posters, Layers, or Grid.
- Render with or without edges connection lines.
- Orphan node detection - highlights files/folders with no dependencies.
npm install -g .npm install -D @jpdup/gladBy adding "glad" to your build step, you will be alerted if you introduce a circular dependencies.
{
"scripts": {
"build": "glad ."
}
}glad returns explicit status codes so CI can fail on architecture issues:
0success2invalid input (for example invalid or missing DOT file)3output write error4no files found to analyze99upward dependencies found100circular dependencies found
When both upward and circular dependencies are present, 100 is returned.
gladglad -h
Usage: glad < path | file.dot > [options] "Generates an SVG layer diagram file based on your source code dependencies or DOT graph files"
Options:
-h, --help Show help [boolean]
--align Set the horizontal position of the nodes [string] [choices: "left", "center", "right"] [default: "center"]
--debug For tech support [boolean] [default: false]
-d, --details Show additional values for each folders [boolean] [default: false]
--dev Show Dev dependencies [boolean] [default: false]
--edges Type of rendering for all edges [string] [choices: "files", "folders"] [default: "files"]
-e, --exclude File glob patterns to exclude from the analysis, eg: "**/*.test.js" "**/AppLogger*" [array]
--externals, --ex Show external dependencies [boolean] [default: false]
-i, --input File path to scan [string]
--json Output the graph to file called glad.json [boolean] [default: false]
-l, --layers Display the layers background and numbers [boolean] [default: false]
--lineEffect, --le Special effect on the lines [string] [default: "flat"]
--lines Type of rendering for all edges [string] [choices: "curve", "strait", "elbow", "angle", "hide", "warnings"] [default: "curve"]
--listFiles List all input files found [boolean] [default: false]
--orphans List all orphan nodes (nodes with no edges) [boolean] [default: false]
-o, --output File path to output svg [string] [default: "./glad.svg"]
-s, --silent No output except for errors [boolean] [default: false]
--view Type of diagram to generate [string] [choices: "poster", "layers", "grid"] [default: "poster"]
-v, --version Show version number [boolean]
Examples:
glad . --view layers -l --edges -hide ">>> Produce a diagram with no edges, each layers are numbered."
glad myGraph.dot --view layers -l ">>> Generate layers diagram from DOT graph file."
for more information visit https://github.com/amzn/generate-layer-architecture-diagram
This project is licensed under the Apache-2.0 License.