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..f49825f --- /dev/null +++ b/fresh.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "$fresh/server.ts"; +import { initPool } from "~/server/db.ts"; +import { env } from "~/server/env.ts"; + +export default defineConfig({}); + +if (Deno.args.at(0) !== "build") { + 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) => { 利用モジュール