Skip to content

Commit

Permalink
[import-restrictions] Generate diagram source for visualizing the graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jul 19, 2022
1 parent 52ecbfb commit 8f6a252
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion script/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,11 @@ export const binTarget = {
dependencies: [searchWorkerTarget],
buildSelf: async (dev) => {
await esbuild.build({
entryPoints: ["src/bin/order.ts", "src/bin/puzzle-geometry-bin.ts"],
entryPoints: [
"src/bin/order.ts",
"src/bin/puzzle-geometry-bin.ts",
"src/bin/import-restrictions-mermaid-diagram.js",
],
outdir: "dist/bin/",
format: "esm",
target: "es2020",
Expand Down
12 changes: 12 additions & 0 deletions src/bin/import-restrictions-mermaid-diagram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { targetInfos } from "../../script/test/import-restrictions/target-infos";

console.log("graph TD");
for (const [target, targetInfo] of Object.entries(targetInfos)) {
for (const direct of targetInfo.deps.direct) {
console.log(` ${target} --> ${direct}`);
}
for (const dynamic of targetInfo.deps.dynamic) {
console.log(` ${target} -.-> ${dynamic}`);
}
}
console.log("%% Paste into: https://mermaid.live/");

0 comments on commit 8f6a252

Please sign in to comment.