This commit is contained in:
Michael Zhang 2023-04-18 03:05:36 -05:00
parent 1550d77ca6
commit d82993f2a7
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
12 changed files with 142 additions and 16 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ node_modules
/generated
/result*
.solid
/typedoc

107
package-lock.json generated
View file

@ -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",

View file

@ -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"
}
}
}

View file

@ -5,7 +5,7 @@ import {
IRegisterAppRequest,
} from "./types";
export default class Database {
export class Database {
private prisma: PrismaClient;
constructor() {

View file

@ -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();

View file

@ -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) {
},
});
}
*/

View file

@ -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;
});
*/

2
src/index.ts Normal file
View file

@ -0,0 +1,2 @@
export * from "./core/db";
export * from "./core/types";

View file

@ -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<typeof routeData>();
const [, { Form }] = createServerAction$((f: FormData, { request }) =>
logout(request)
);
); */
return (
<main class="full-width">
<h1>Hello {user()?.username}</h1>
<h1>Hello!</h1>
<h3>Message board</h3>
<button onClick={() => refetchRouteData()}>Refresh</button>
<Form>
<button name="logout" type="submit">
Logout
</button>
</Form>
</main>
);
}

View file

@ -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() {
</main>
);
}
*/

12
typedoc.config.cjs Normal file
View file

@ -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,
};

6
vite.config.js Normal file
View file

@ -0,0 +1,6 @@
import solid from "solid-start/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [solid()],
ssr: { external: ["@prisma/client"] },
});