chore(dashboard): add elkjs, graphology, vitest

This commit is contained in:
Lum1104
2026-05-03 10:42:34 +08:00
Unverified
parent fec05f6278
commit 28362dbfe0
4 changed files with 138 additions and 3 deletions
@@ -7,7 +7,9 @@
"dev": "vite",
"build": "tsc -b && vite build",
"build:demo": "tsc -b && vite build --config vite.config.demo.ts",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@dagrejs/dagre": "^2.0.4",
@@ -15,6 +17,9 @@
"@xyflow/react": "^12.0.0",
"d3-force": "^3.0.0",
"devlop": "^1.1.0",
"elkjs": "^0.9.3",
"graphology": "^0.25.4",
"graphology-communities-louvain": "^2.0.1",
"hast-util-to-jsx-runtime": "^2.3.6",
"prism-react-renderer": "^2.4.1",
"react": "^19.0.0",
@@ -28,8 +33,10 @@
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.0",
"@vitest/coverage-v8": "^3.2.4",
"tailwindcss": "^4.0.0",
"typescript": "^5.7.0",
"vite": "^6.0.0"
"vite": "^6.0.0",
"vitest": "^3.1.0"
}
}
@@ -0,0 +1,20 @@
import { describe, it, expect } from "vitest";
import ELK from "elkjs/lib/elk.bundled.js";
import Graph from "graphology";
import louvain from "graphology-communities-louvain";
describe("dependency smoke test", () => {
it("imports elkjs", () => {
expect(typeof ELK).toBe("function");
});
it("imports graphology", () => {
const g = new Graph();
g.addNode("a");
expect(g.order).toBe(1);
});
it("imports graphology-communities-louvain", () => {
expect(typeof louvain).toBe("function");
});
});
@@ -1,3 +1,4 @@
/// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
@@ -176,6 +177,11 @@ function readSourceFile(url: URL) {
}
export default defineConfig({
test: {
environment: "node",
include: ["src/**/__tests__/**/*.test.ts"],
},
// FIX 1 — bind only to localhost, not 0.0.0.0
// This blocks access from any other device on the same LAN / WiFi.
server: {