From 866a521508504099561fe16b6c55ec5f41cc1c40 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Thu, 27 Jul 2023 15:28:50 +0200 Subject: [PATCH] feat: some shit --- deno.json | 8 +++++- fresh.gen.ts | 28 +++++++++---------- main.ts | 1 - routes/resources/api/index.ts | 2 +- routes/resources/api/recipes/[name].ts | 4 +-- .../resources/api/recipes/images/[image].ts | 2 +- routes/resources/api/recipes/index.ts | 4 +-- routes/resources/index.tsx | 2 +- routes/resources/recipes/[name].tsx | 8 +++--- routes/resources/recipes/index.tsx | 8 +++--- 10 files changed, 36 insertions(+), 31 deletions(-) diff --git a/deno.json b/deno.json index 0b95123..d38f81b 100755 --- a/deno.json +++ b/deno.json @@ -21,7 +21,13 @@ "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3", "twind": "https://esm.sh/twind@0.16.19", "twind/": "https://esm.sh/twind@0.16.19/", - "$std/": "https://deno.land/std@0.193.0/" + "$std/": "https://deno.land/std@0.193.0/", + "@lib": "./lib", + "@lib/": "./lib/", + "@components": "./components", + "@components/": "./components/", + "@islands": "./islands", + "@islands/": "./islands/" }, "compilerOptions": { "jsx": "react-jsx", diff --git a/fresh.gen.ts b/fresh.gen.ts index 34517ce..56ab595 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -4,26 +4,26 @@ import * as $0 from "./routes/_404.tsx"; import * as $1 from "./routes/_app.tsx"; -import * as $2 from "./routes/api/index.ts"; -import * as $3 from "./routes/api/recipes/[name].ts"; -import * as $4 from "./routes/api/recipes/images/[image].ts"; -import * as $5 from "./routes/api/recipes/index.ts"; -import * as $6 from "./routes/index.tsx"; -import * as $7 from "./routes/recipes/[name].tsx"; -import * as $8 from "./routes/recipes/index.tsx"; +import * as $2 from "./routes/resources/api/index.ts"; +import * as $3 from "./routes/resources/api/recipes/[name].ts"; +import * as $4 from "./routes/resources/api/recipes/images/[image].ts"; +import * as $5 from "./routes/resources/api/recipes/index.ts"; +import * as $6 from "./routes/resources/index.tsx"; +import * as $7 from "./routes/resources/recipes/[name].tsx"; +import * as $8 from "./routes/resources/recipes/index.tsx"; import * as $$0 from "./islands/Counter.tsx"; const manifest = { routes: { "./routes/_404.tsx": $0, "./routes/_app.tsx": $1, - "./routes/api/index.ts": $2, - "./routes/api/recipes/[name].ts": $3, - "./routes/api/recipes/images/[image].ts": $4, - "./routes/api/recipes/index.ts": $5, - "./routes/index.tsx": $6, - "./routes/recipes/[name].tsx": $7, - "./routes/recipes/index.tsx": $8, + "./routes/resources/api/index.ts": $2, + "./routes/resources/api/recipes/[name].ts": $3, + "./routes/resources/api/recipes/images/[image].ts": $4, + "./routes/resources/api/recipes/index.ts": $5, + "./routes/resources/index.tsx": $6, + "./routes/resources/recipes/[name].tsx": $7, + "./routes/resources/recipes/index.tsx": $8, }, islands: { "./islands/Counter.tsx": $$0, diff --git a/main.ts b/main.ts index 56440ae..5ce3ec1 100644 --- a/main.ts +++ b/main.ts @@ -13,5 +13,4 @@ import twindPlugin from "$fresh/plugins/twind.ts"; import twindConfig from "./twind.config.ts"; await start(manifest, { plugins: [twindPlugin(twindConfig)], - staticDir: "/resources", }); diff --git a/routes/resources/api/index.ts b/routes/resources/api/index.ts index 35d830c..79877f3 100644 --- a/routes/resources/api/index.ts +++ b/routes/resources/api/index.ts @@ -1,5 +1,5 @@ import { HandlerContext } from "$fresh/server.ts"; -import { getDocuments } from "../../lib/documents.ts"; +import { getDocuments } from "@lib/documents.ts"; export const handler = async ( _req: Request, diff --git a/routes/resources/api/recipes/[name].ts b/routes/resources/api/recipes/[name].ts index d87b4f3..74f8b1c 100644 --- a/routes/resources/api/recipes/[name].ts +++ b/routes/resources/api/recipes/[name].ts @@ -1,6 +1,6 @@ import { HandlerContext } from "$fresh/server.ts"; -import { getDocument } from "../../../lib/documents.ts"; -import { parseRecipe } from "../../../lib/recipes.ts"; +import { getDocument } from "@lib/documents.ts"; +import { parseRecipe } from "@lib/recipes.ts"; export async function getRecipe(name: string) { const document = await getDocument(`Recipes/${name}.md`); diff --git a/routes/resources/api/recipes/images/[image].ts b/routes/resources/api/recipes/images/[image].ts index af285ae..9b5bab4 100644 --- a/routes/resources/api/recipes/images/[image].ts +++ b/routes/resources/api/recipes/images/[image].ts @@ -5,7 +5,7 @@ import { MagickGeometry, } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts"; import { parseMediaType } from "https://deno.land/std@0.175.0/media_types/parse_media_type.ts"; -import * as cache from "../../../../lib/cache.ts"; +import * as cache from "@lib/cache.ts"; await initializeImageMagick(); diff --git a/routes/resources/api/recipes/index.ts b/routes/resources/api/recipes/index.ts index 2ebb2b4..548c092 100644 --- a/routes/resources/api/recipes/index.ts +++ b/routes/resources/api/recipes/index.ts @@ -1,6 +1,6 @@ import { HandlerContext } from "$fresh/server.ts"; -import { getDocument, getDocuments } from "../../../lib/documents.ts"; -import { parseRecipe } from "../../../lib/recipes.ts"; +import { getDocument, getDocuments } from "@lib/documents.ts"; +import { parseRecipe } from "@lib/recipes.ts"; export async function getRecipes() { const documents = await getDocuments(); diff --git a/routes/resources/index.tsx b/routes/resources/index.tsx index 20bb512..b002168 100644 --- a/routes/resources/index.tsx +++ b/routes/resources/index.tsx @@ -1,6 +1,6 @@ import { Head } from "$fresh/runtime.ts"; import { useSignal } from "@preact/signals"; -import Counter from "../islands/Counter.tsx"; +import Counter from "@islands/Counter.tsx"; export default function Home() { const count = useSignal(3); diff --git a/routes/resources/recipes/[name].tsx b/routes/resources/recipes/[name].tsx index 1fd851c..6b89c3c 100644 --- a/routes/resources/recipes/[name].tsx +++ b/routes/resources/recipes/[name].tsx @@ -1,8 +1,8 @@ import { Handlers, PageProps } from "$fresh/server.ts"; -import { IngredientsList } from "../../components/IngredientsList.tsx"; -import { RecipeHero } from "../../components/RecipeHero.tsx"; -import { MainLayout } from "../../components/layouts/main.tsx"; -import { Recipe } from "../../lib/recipes.ts"; +import { IngredientsList } from "@components/IngredientsList.tsx"; +import { RecipeHero } from "@components/RecipeHero.tsx"; +import { MainLayout } from "@components/layouts/main.tsx"; +import { Recipe } from "@lib/recipes.ts"; import { getRecipe } from "../api/recipes/[name].ts"; export const handler: Handlers = { diff --git a/routes/resources/recipes/index.tsx b/routes/resources/recipes/index.tsx index 19d9b25..909bd57 100644 --- a/routes/resources/recipes/index.tsx +++ b/routes/resources/recipes/index.tsx @@ -1,8 +1,8 @@ import { Handlers, PageProps } from "$fresh/server.ts"; -import { RecipeCard } from "../../components/RecipeCard.tsx"; -import { MainLayout } from "../../components/layouts/main.tsx"; -import type { Document } from "../../lib/documents.ts"; -import { Recipe } from "../../lib/recipes.ts"; +import { RecipeCard } from "@components/RecipeCard.tsx"; +import { MainLayout } from "@components/layouts/main.tsx"; +import type { Document } from "@lib/documents.ts"; +import { Recipe } from "@lib/recipes.ts"; import { getRecipes } from "../api/recipes/index.ts"; export const handler: Handlers = {