From d82993f2a7caab91b3658ff2d46e60641c376480 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 18 Apr 2023 03:05:36 -0500 Subject: [PATCH] docs --- .gitignore | 1 + package-lock.json | 107 +++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- src/core/db.ts | 2 +- src/db/index.ts | 2 +- src/db/session.tsx | 2 + src/db/useUser.tsx | 2 + src/index.ts | 2 + src/routes/index.tsx | 16 ++----- src/routes/login.tsx | 2 + typedoc.config.cjs | 12 +++++ vite.config.js | 6 +++ 12 files changed, 142 insertions(+), 16 deletions(-) create mode 100644 src/index.ts create mode 100644 typedoc.config.cjs create mode 100644 vite.config.js diff --git a/.gitignore b/.gitignore index b713f9c..0d58e00 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules /generated /result* .solid +/typedoc diff --git a/package-lock.json b/package-lock.json index 57b5565..3c05123 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,9 @@ "undici": "^5.15.1" }, "devDependencies": { + "@types/debug": "^4.1.7", "solid-start-node": "^0.2.19", + "typedoc": "^0.24.4", "typescript": "^4.9.4", "vite": "^4.1.4" }, @@ -2294,11 +2296,26 @@ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.1.tgz", "integrity": "sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==" }, + "node_modules/@types/debug": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", + "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", + "dev": true, + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz", "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==" }, + "node_modules/@types/ms": { + "version": "0.7.31", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", + "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==", + "dev": true + }, "node_modules/@types/node": { "version": "18.15.5", "license": "MIT", @@ -2340,6 +2357,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz", + "integrity": "sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ==", + "dev": true + }, "node_modules/ansi-styles": { "version": "3.2.1", "license": "MIT", @@ -3136,6 +3159,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -3164,6 +3193,12 @@ "yallist": "^3.0.2" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/magic-string": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", @@ -3176,6 +3211,18 @@ "node": ">=12" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/merge-anything": { "version": "5.1.4", "license": "MIT", @@ -3226,6 +3273,21 @@ "node": ">= 0.6" } }, + "node_modules/minimatch": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", + "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", @@ -3690,6 +3752,18 @@ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" }, + "node_modules/shiki": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.1.tgz", + "integrity": "sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/sirv": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.2.tgz", @@ -4022,6 +4096,27 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, + "node_modules/typedoc": { + "version": "0.24.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.4.tgz", + "integrity": "sha512-vQuliyGhJEGeKzzCFHbkS3m0gHoIL6cfr0fHf6eX658iGELtq2J9mWe0b+X5McEYgFoMuHFt5Py3Zug6Sxjn/Q==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.0", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 14.14" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x" + } + }, "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", @@ -4273,6 +4368,18 @@ } } }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/wait-on": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-6.0.1.tgz", diff --git a/package.json b/package.json index 7d8e8b6..9dc1844 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ }, "type": "module", "devDependencies": { + "@types/debug": "^4.1.7", "solid-start-node": "^0.2.19", + "typedoc": "^0.24.4", "typescript": "^4.9.4", "vite": "^4.1.4" }, @@ -23,4 +25,4 @@ "engines": { "node": ">=16" } -} \ No newline at end of file +} diff --git a/src/core/db.ts b/src/core/db.ts index 4860566..d7447fd 100644 --- a/src/core/db.ts +++ b/src/core/db.ts @@ -5,7 +5,7 @@ import { IRegisterAppRequest, } from "./types"; -export default class Database { +export class Database { private prisma: PrismaClient; constructor() { diff --git a/src/db/index.ts b/src/db/index.ts index 9b2b39f..be523f0 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,7 +1,7 @@ // import { PrismaClient } from "@prisma/client"; // export const db = new PrismaClient(); -import Database from "~/core/db"; +import { Database } from "~/core/db"; export const db = new Database(); diff --git a/src/db/session.tsx b/src/db/session.tsx index 1a5f3a3..c5ec944 100644 --- a/src/db/session.tsx +++ b/src/db/session.tsx @@ -1,3 +1,4 @@ +/* import { PrismaClient } from "@prisma/client"; import { redirect } from "solid-start/server"; import { createCookieSessionStorage } from "solid-start/session"; @@ -93,3 +94,4 @@ export async function createUserSession(userId: string, redirectTo: string) { }, }); } +*/ diff --git a/src/db/useUser.tsx b/src/db/useUser.tsx index ed56318..b0bad7c 100644 --- a/src/db/useUser.tsx +++ b/src/db/useUser.tsx @@ -1,3 +1,4 @@ +/* import { PrismaClient } from "@prisma/client"; import { createServerData$, redirect } from "solid-start/server"; import { getUser } from "./session"; @@ -13,3 +14,4 @@ export const useUser = () => return user; }); + */ diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..d0324ac --- /dev/null +++ b/src/index.ts @@ -0,0 +1,2 @@ +export * from "./core/db"; +export * from "./core/types"; diff --git a/src/routes/index.tsx b/src/routes/index.tsx index a8a8d8b..ab3bff0 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -1,28 +1,18 @@ import { refetchRouteData, useRouteData } from "solid-start"; import { createServerAction$ } from "solid-start/server"; -import { logout } from "~/db/session"; -import { useUser } from "../db/useUser"; - -export function routeData() { - return useUser(); -} export default function Home() { + /* const user = useRouteData(); const [, { Form }] = createServerAction$((f: FormData, { request }) => logout(request) - ); + ); */ return (
-

Hello {user()?.username}

+

Hello!

Message board

-
- -
); } diff --git a/src/routes/login.tsx b/src/routes/login.tsx index 02b640d..9772c9e 100644 --- a/src/routes/login.tsx +++ b/src/routes/login.tsx @@ -1,3 +1,4 @@ +/* import { Show } from "solid-js"; import { useParams, useRouteData } from "solid-start"; import { FormError } from "solid-start/data"; @@ -134,3 +135,4 @@ export default function Login() { ); } +*/ diff --git a/typedoc.config.cjs b/typedoc.config.cjs new file mode 100644 index 0000000..5b25007 --- /dev/null +++ b/typedoc.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('typedoc').TypeDocOptions} */ +module.exports = { + entryPoints: [ + "./src/api.d.ts", + "./src/index.ts", + "./node_modules/.prisma/client/index.d.ts", + ], + out: "typedoc", + + excludeExternals: false, + excludeNotDocumented: false, +}; diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..e347acf --- /dev/null +++ b/vite.config.js @@ -0,0 +1,6 @@ +import solid from "solid-start/vite"; +import { defineConfig } from "vite"; +export default defineConfig({ + plugins: [solid()], + ssr: { external: ["@prisma/client"] }, +});