diff --git a/bun.lockb b/bun.lockb index 8d67b44..6b2c3b3 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/next-env.d.ts b/next-env.d.ts index f557b4e..4f11a03 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/triple-slash-reference /// -// eslint-disable-next-line @typescript-eslint/triple-slash-reference /// // NOTE: This file should not be edited diff --git a/next.config.js b/next.config.js index cade2c9..900f350 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,4 @@ -export default function webpack(config) { +export function webpack(config) { config.resolve.fallback = { ...config.resolve.fallback, fs: false } return config } diff --git a/package.json b/package.json index e2f1a99..e649726 100644 --- a/package.json +++ b/package.json @@ -58,8 +58,10 @@ "vfile-reporter": "latest" }, "devDependencies": { + "@types/bun": "^1.0.0", "autoprefixer": "^10.4.16", "bimap": "latest", + "bun-types": "latest", "cytoscape": "latest", "eslint": "^8.0.1", "eslint-config-next": "latest", @@ -68,8 +70,7 @@ "remark-react": "latest", "remark-stringify": "latest", "tailwindcss": "latest", - "uuid": "latest", - "bun-types": "latest" + "uuid": "latest" }, "resolutions": { "react": "^18", diff --git a/pages/notes/index.tsx b/pages/notes/index.tsx index da79a57..78fcf13 100644 --- a/pages/notes/index.tsx +++ b/pages/notes/index.tsx @@ -1,11 +1,17 @@ -import Layout from "../../components/Layout"; -import Util from '../../lib/utils' -import FolderTree from "../../components/FolderTree"; -import MDContent from "../../components/MDContent"; +import Layout from "components/Layout"; +import Util from 'lib/utils' +import FolderTree from "components/FolderTree"; +import MDContent from "components/MDContent"; +interface HomeProps { + content: string + tree: Record + flattenNodes: unknown[] + backLinks: unknown[] +} // This trick is to dynamically load component that interact with window object (browser only) -export default function Home({ content, tree, flattenNodes, backLinks }) { +export default function Home({ content, tree, flattenNodes, backLinks }: HomeProps) { return (
@@ -21,12 +27,21 @@ export default function Home({ content, tree, flattenNodes, backLinks }) { export function getStaticProps() { - const { nodes, edges } = Util.constructGraphData() + const { nodes, edges }: { nodes: unknown[], edges: unknown[] } = Util.constructGraphData() const tree = Util.convertObject(Util.getDirectoryData()); const contentData = Util.getSinglePost("index"); const flattenNodes = Util.getFlattenArray(tree) - const listOfEdges = edges.filter(anEdge => anEdge.target === "index") - const internalLinks = listOfEdges.map(anEdge => nodes.find(aNode => aNode.slug === anEdge.source)).filter(element => element !== undefined) + const listOfEdges = edges + .filter((anEdge) => ( + anEdge as { target: string }).target === "index" + ) + const internalLinks = listOfEdges.map( + anEdge => nodes + .find( + aNode => ( + aNode as { slug: string }).slug === (anEdge as { source: string }).source)) + .filter( + element => element !== undefined) const backLinks = [...new Set(internalLinks)] return { diff --git a/postcss.config.cjs b/postcss.config.cjs new file mode 100644 index 0000000..85f717c --- /dev/null +++ b/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {} + } +} diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index f305d3c..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,4 +0,0 @@ -export const plugins = { - tailwindcss: {}, - autoprefixer: {} -}