Skip to content

Commit 2ca359a

Browse files
committed
Switch to Bun
1 parent 5451884 commit 2ca359a

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

bun.lockb

7.35 KB
Binary file not shown.

examples/components/CytoscapeGraph.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import cytoscape, { CytoscapeOptions } from "cytoscape";
1+
import cytoscape, { CytoscapeOptions, ElementDefinition } from "cytoscape";
22
import { useEffect, useRef, useState } from "react";
33

44
import dagre from "cytoscape-dagre";
55
import edgeConnections from "cytoscape-edge-connections";
6+
import { toCytoscapeElements } from "graph-selector";
67

78
cytoscape.use(edgeConnections);
89
cytoscape.use(dagre);
@@ -12,8 +13,8 @@ export function CytoscapeGraph({
1213
style = [],
1314
containerStyle = {},
1415
}: {
15-
elements: cytoscape.ElementDefinition[];
16-
style?: cytoscape.Stylesheet[];
16+
elements: ReturnType<typeof toCytoscapeElements>;
17+
style?: cytoscape.StylesheetStyle[];
1718
containerStyle?: React.CSSProperties;
1819
}) {
1920
const cy = useRef<cytoscape.Core>();
@@ -23,11 +24,12 @@ export function CytoscapeGraph({
2324
useEffect(() => {
2425
setError("");
2526
try {
26-
let options: CytoscapeOptions = {
27+
let options = {
2728
elements,
2829
layout: {
2930
// @ts-ignore
3031
name: "dagre",
32+
// @ts-ignore
3133
spacingFactor: 2,
3234
rankDir: "LR",
3335
},
@@ -71,7 +73,7 @@ export function CytoscapeGraph({
7173
},
7274
...style,
7375
],
74-
};
76+
} as CytoscapeOptions;
7577
// test with error first
7678
cyError.current = cytoscape({ ...options, headless: true });
7779
let cyE = cyError.current;

examples/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"check": "tsc --noEmit"
1011
},
1112
"dependencies": {
1213
"@monaco-editor/react": "^4.5.2",

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@
2929
"graph-selector/**/*.{js,ts}": [
3030
"bun --filter graph-selector lint:staged"
3131
]
32+
},
33+
"dependencies": {
34+
"@types/cytoscape": "^3.21.9",
35+
"cytoscape": "^3.31.0"
3236
}
3337
}

pnpm-workspace.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)