From c057ae38b2b031d5e4330bc3296b64fec45efce2 Mon Sep 17 00:00:00 2001 From: Tomofumi Chiba Date: Tue, 19 Sep 2023 07:37:00 +0900 Subject: [PATCH 1/2] fresh version up and fix --- deno.json | 4 ++-- dev.ts | 3 ++- fresh.config.ts | 8 ++++++++ main.ts | 12 ++---------- routes/about.tsx | 7 +------ 5 files changed, 15 insertions(+), 19 deletions(-) create mode 100644 fresh.config.ts diff --git a/deno.json b/deno.json index a648fc8..48b50a9 100644 --- a/deno.json +++ b/deno.json @@ -22,7 +22,7 @@ "imports": { "$std/": "https://deno.land/std@0.193.0/", "postgres/": "https://deno.land/x/postgres@v0.17.0/", - "$fresh/": "https://deno.land/x/fresh@1.4.2/", + "$fresh/": "https://deno.land/x/fresh@1.4.3/", "preact": "https://esm.sh/preact@10.15.1", "preact/": "https://esm.sh/preact@10.15.1/", "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1", @@ -48,4 +48,4 @@ "_fresh" ] } -} \ No newline at end of file +} diff --git a/dev.ts b/dev.ts index 2b5f6a6..e581392 100644 --- a/dev.ts +++ b/dev.ts @@ -1,6 +1,7 @@ #!/usr/bin/env -S deno run -A --watch=static/,routes/ import dev from "$fresh/dev.ts"; +import config from "./fresh.config.ts"; import "$std/dotenv/load.ts"; -await dev(import.meta.url, "./main.ts"); +await dev(import.meta.url, "./main.ts", config); diff --git a/fresh.config.ts b/fresh.config.ts new file mode 100644 index 0000000..1473474 --- /dev/null +++ b/fresh.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from "$fresh/server.ts"; +import { initPool } from "~/server/db.ts"; +import { env } from "~/server/env.ts"; + +export default defineConfig({}); + +env.init(); +initPool(); diff --git a/main.ts b/main.ts index 2a7af93..1150246 100644 --- a/main.ts +++ b/main.ts @@ -6,14 +6,6 @@ import { start } from "$fresh/server.ts"; import manifest from "~/fresh.gen.ts"; -import { initPool } from "~/server/db.ts"; -import { env } from "~/server/env.ts"; +import config from "./fresh.config.ts"; -// const render: RenderFunction = (ctx, render) => { -// ctx.lang = "ja"; -// render(); -// }; - -env.init(); -initPool(); -await start(manifest); +await start(manifest, config); diff --git a/routes/about.tsx b/routes/about.tsx index bebebc0..ecf0e02 100644 --- a/routes/about.tsx +++ b/routes/about.tsx @@ -60,12 +60,7 @@ export default defineRoute(async (req, _ctx) => { 利用モジュール