MCPcopy Create free account
hub / github.com/codename-co/stack / graphData

Function graphData

packages/website/src/helpers/graph.ts:8–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6const tags = await getCollection("tags");
7
8export const graphData = () => ({
9 nodes: [
10 ...stacks.map((node) => ({
11 type: "stack",
12 id: `stack-${node.data.slug}`,
13 name: node.data.name,
14 icon: node.data.icon,
15 path: `/${node.data.slug}`,
16 val: (node.data.stars ?? 0) / 500,
17 license: node.data.license,
18 date: node.data.updated_at,
19 })),
20 ...alternatives.map((node) => ({
21 type: "alt",
22 id: `alt-${node.data.slug}`,
23 name: node.data.name,
24 icon: node.data.icon,
25 path: `/alternatives/${node.data.slug}`,
26 })),
27 ...tags.map((node) => ({
28 type: "tag",
29 id: `tag-${node.data.slug}`,
30 name: node.data.name,
31 path: `/?q=${encodeURIComponent(node.data.slug)}`,
32 })),
33 ],
34 links: [
35 ...stacks
36 .map((node) =>
37 node.data.tags?.map((tag) => ({
38 source: `stack-${node.data.slug}`,
39 target: `tag-${tag}`,
40 }))
41 )
42 .flat()
43 .filter(Boolean),
44 ...stacks
45 .map((node) =>
46 node.data.alternativeTo?.map((alternative) => ({
47 source: `stack-${node.data.slug}`,
48 target: `alt-${alternative}`,
49 }))
50 )
51 .flat()
52 .filter(Boolean),
53 ],
54});

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected