diff --git a/docs/modules/README.md b/docs/modules/README.md index a09649d9..cc17fa8b 100644 --- a/docs/modules/README.md +++ b/docs/modules/README.md @@ -61,6 +61,7 @@ ESLint plugin. - [`glob`](./glob.md) - [`globby`](./globby.md) - [`graphemer`](./graphemer.md) +- [`graphviz`](./graphviz.md) - [`gzip-size`](./gzip-size.md) - [`inherits`](./inherits.md) - [`invariant`](./invariant.md) diff --git a/docs/modules/graphviz.md b/docs/modules/graphviz.md new file mode 100644 index 00000000..39491c4e --- /dev/null +++ b/docs/modules/graphviz.md @@ -0,0 +1,56 @@ +--- +description: Modern alternatives to the graphviz package +--- + +# Replacements for `graphviz` + +`graphviz` did not receive a new update for more than 6 years and requires GraphViz to be installed + +## `ts-graphviz` + +[`ts-graphviz`](https://github.com/ts-graphviz/ts-graphviz) graphviz implementation in pure TypeScript. + +Example: + +```ts +import { + attribute as _, + Digraph, + Subgraph, + Node, + Edge, + toDot +} from 'ts-graphviz' + +const G = new Digraph() +const A = new Subgraph('A') +const node1 = new Node('node1', { + [_.color]: 'red' +}) +const node2 = new Node('node2', { + [_.color]: 'blue' +}) +const edge = new Edge([node1, node2], { + [_.label]: 'Edge Label', + [_.color]: 'pink' +}) +G.addSubgraph(A) +A.addNode(node1) +A.addNode(node2) +A.addEdge(edge) +const dot = toDot(G) +// digraph { +// subgraph "A" { +// "node1" [ +// color = "red", +// ] +// "node2" [ +// color = "blue", +// ] +// "node1" -> "node2" [ +// label = "Edge Label", +// color = "pink", +// ] +// } +// } +``` diff --git a/manifests/preferred.json b/manifests/preferred.json index f78b0c18..100ee4ee 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -366,6 +366,12 @@ "replacements": ["Intl.Segmenter", "unicode-segmenter"], "url": {"type": "e18e", "id": "graphemer"} }, + "graphviz": { + "type": "module", + "moduleName": "graphviz", + "replacements": ["ts-graphviz"], + "url": {"type": "e18e", "id": "graphviz"} + }, "gzip-size": { "type": "module", "moduleName": "gzip-size", @@ -3383,6 +3389,12 @@ "url": {"type": "e18e", "id": "express"}, "replacementModule": "@tinyhttp/app" }, + "ts-graphviz": { + "id": "ts-graphviz", + "type": "documented", + "url": {"type": "e18e", "id": "graphviz"}, + "replacementModule": "ts-graphviz" + }, "unicode-segmenter": { "id": "unicode-segmenter", "type": "documented",