]> git.r.bdr.sh - rbdr/graphviz-to-grafn/blame - README.md
Initial version
[rbdr/graphviz-to-grafn] / README.md
CommitLineData
a597c682
RBR
1# Graphviz to Grafn
2
3Converts graphviz .dot files to [Grafn][grafn] javascript code. This lets you
4define your application flow using a diagram editor first, and then fill out
5the functionality.
6
7## How can I use it?
8
9### As a Library
10
11```javascript
12const Fs = require('fs/promises');
13const GraphvizToGrafn = require('grafn-to-graphviz');
14
15async function convert() {
16 const graphvizCode = await Fs.read('/path/to/graphviz.dot');
17 const grafnCode = await GraphvizToGrafn(graphvizCode.toString());
18
19 console.log(grafnCode); // will print the JS code
20}
21```
22
23### As a Binary
24
25```
26$ npm install -g graphviz-to-grafn
27$ cat ./path/to/graphviz.dot | g2g > grafn_code.js
28```
29
30[grafn]: https://gitlab.com/rbdr/grafn