34 lines
825 B
TypeScript
34 lines
825 B
TypeScript
import { renderMermaid, renderMermaidAscii } from "beautiful-mermaid";
|
|
|
|
// Parse command line arguments
|
|
const args = process.argv.slice(2);
|
|
const renderMode = args.includes("--ascii") ? "ascii" : "normal";
|
|
|
|
const diagram = `
|
|
flowchart TD
|
|
subgraph Node1
|
|
bme280 -->|i2c| mc1[pico w]
|
|
pms5003 -->|uart| mc1
|
|
end
|
|
mc1 -->|Custom TCP| proxy[Event Proxy]
|
|
proxy -->|mqtt| ha[Home Assistant Servier]
|
|
|
|
|
|
mc2[pico w] -->|Custom TCP| proxy
|
|
subgraph Node2
|
|
wind_speed[Anemometer] --> mc2
|
|
wind_dir[Wind Vane] --> mc2
|
|
rain[Rain Detector] --> mc2
|
|
mic[MIPS Microphone] --> mc2
|
|
end
|
|
|
|
mc3[pico w] -->|Custom TCP| proxy
|
|
subgraph Node3
|
|
ltr-559 --> mc3
|
|
end`;
|
|
|
|
if (renderMode === "ascii") {
|
|
console.log(renderMermaidAscii(diagram));
|
|
} else {
|
|
console.log(await renderMermaid(diagram));
|
|
}
|