Skip to content

Commit bc39510

Browse files
authored
Merge pull request #100 from tmr232/graph-script-diagnostics
Allow saving the generated DOT files from the rendering scripts
2 parents f32ef41 + 04bf3ad commit bc39510

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

scripts/render-function.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ async function main() {
7373
colors: {
7474
type: "string",
7575
},
76+
dot: {
77+
type: "string",
78+
},
7679
},
7780
strict: true,
7881
allowPositionals: true,
@@ -137,7 +140,13 @@ async function main() {
137140

138141
const colorScheme = await getColorScheme(values.colors);
139142

140-
const svg = graphviz.dot(graphToDot(cfg, false, colorScheme));
143+
const dot = graphToDot(cfg, false, colorScheme);
144+
145+
if (values.dot) {
146+
await Bun.write(values.dot, dot);
147+
}
148+
149+
const svg = graphviz.dot(dot);
141150

142151
if (values.out) {
143152
await Bun.write(values.out, svg);

scripts/render-graph.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ async function main() {
2222
colors: {
2323
type: "string",
2424
},
25+
dot: {
26+
type: "string",
27+
},
2528
},
2629
});
2730

@@ -50,7 +53,13 @@ async function main() {
5053
const colorScheme = await getColorScheme(values.colors);
5154

5255
const graphviz = await Graphviz.load();
53-
const svg = graphviz.dot(graphToDot(cfg, false, colorScheme));
56+
const dot = graphToDot(cfg, false, colorScheme);
57+
58+
if (values.dot) {
59+
await Bun.write(values.dot, dot);
60+
}
61+
62+
const svg = graphviz.dot(dot);
5463
console.log(svg);
5564
}
5665

0 commit comments

Comments
 (0)