]>
Commit | Line | Data |
---|---|---|
a597c682 RBR |
1 | # Graphviz to Grafn |
2 | ||
3 | Converts graphviz .dot files to [Grafn][grafn] javascript code. This lets you | |
4 | define your application flow using a diagram editor first, and then fill out | |
5 | the functionality. | |
6 | ||
7 | ## How can I use it? | |
8 | ||
9 | ### As a Library | |
10 | ||
11 | ```javascript | |
12 | const Fs = require('fs/promises'); | |
13 | const GraphvizToGrafn = require('grafn-to-graphviz'); | |
14 | ||
15 | async 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 |