https://github.com/jamen/import-graph
Create a graph of imports with Graphviz.
https://github.com/jamen/import-graph
Last synced: about 1 year ago
JSON representation
Create a graph of imports with Graphviz.
- Host: GitHub
- URL: https://github.com/jamen/import-graph
- Owner: jamen
- License: mit
- Created: 2019-04-27T17:54:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T16:47:07.000Z (almost 7 years ago)
- Last Synced: 2025-02-08T01:48:18.729Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# @jamen/import-graph
Create import graphs with [Graphviz][2].
![example][1]
## Usage
The easiest way to use it is `npx`:
```
npx @jamen/import-graph src/**.js | dot -T svg > imports.svg
```
The command takes file paths and outputs [DOT][3].
The folloing options may be supplied:
- `-i`, `--ignore `: Omit files that match the pattern. Defaults to defaults to `node_modules` and `.git`.
- `-f`, `--from `: Change where paths in labels are relative from. Defaults to cwd.
- `-o`, `--output `: Outputs to a file instead of stdout.
### What languages are supported?
This tool uses regex patterns to build the graph, making it easy to support many languages with different import syntax, without parsing every language.
The files it supports by default are:
- JavaScript ESM & Commonjs
- TypeScript
- package.json (i.e. `main` and `bin` fields)
- CSS
- SCSS/SASS
- Less.js
- Stylus
[1]: example.svg
[2]: http://graphviz.org/
[3]: https://en.wikipedia.org/wiki/DOT_(graph_description_language)