visible graph in cytoscape, fix some bundling issues

This commit is contained in:
Vivian Lim 2024-04-04 01:29:14 -07:00
parent f367f223a2
commit 98b06181bf
5 changed files with 30 additions and 12 deletions

3
.vscode/launch.json vendored
View File

@ -9,6 +9,7 @@
// Debug current file in VSCode
"program": "${workspaceFolder}/server/bin/www.js",
"cwd": "${workspaceFolder}/server/",
/*
Path to tsx binary
Assuming locally installed
@ -35,4 +36,4 @@
],
}
]
}
}

21
frontend/src/graph.ts Normal file
View File

@ -0,0 +1,21 @@
import * as cytoscape from "cytoscape";
export class ThingGraph {
private cy;
public constructor() {
this.cy = cytoscape({
container: document.getElementById("cy"),
elements: [
{ data: { id: "a" } },
{ data: { id: "b" } },
{
data: {
id: "ab",
source: "a",
target: "b",
},
},
],
});
}
}

View File

@ -1,3 +1,5 @@
import { ThingGraph } from "./graph";
function component() {
const element = document.createElement("div");
@ -7,5 +9,6 @@ function component() {
}
document.addEventListener("DOMContentLoaded", () => {
const g = new ThingGraph();
document.body.appendChild(component());
});

View File

@ -7,22 +7,14 @@ module.exports = {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
use: require.resolve("ts-loader"),
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
modules: [
path.resolve(__dirname, "node_modules"),
path.resolve(__dirname, "./"),
],
},
resolveLoader: {
extensions: [".js", ".json"],
mainFields: ["loader", "main"],
modules: [path.resolve(__dirname, "node_modules")],
symlinks: true,
},
output: {
filename: "main.js",

View File

@ -1,2 +1,3 @@
packages:
- server
- server
- frontend