diff --git a/plugin/plugin.ts b/plugin/plugin.ts index e2e248e..9d9b9a6 100644 --- a/plugin/plugin.ts +++ b/plugin/plugin.ts @@ -105,19 +105,24 @@ async function makePhotos(ctx: PluginContext) { ); return Promise.all( infoPaths.map(async (info) => { - const contents = await fs.readFile(info, { encoding: "utf-8" }); + const infoPath = path.resolve(info); + ctx.addWatchFile(infoPath); + + const contents = await fs.readFile(infoPath, { encoding: "utf-8" }); const match = contents.match(/photo\(\{(?[\S\s]*)\}\);/); if (match === null) { - throw new Error(`Could not parse ${info}`); + throw new Error(`Could not parse ${infoPath}`); } const infoMap = match.groups!["description"]; - const infoDir = path.dirname(info); + const infoDir = path.dirname(infoPath); const dirName = path.basename(infoDir); const id = dirName.replace(/^\d+-/, ""); idToDirName.set(id, dirName); const src = path.join(infoDir, CONTENT_PHOTO); + ctx.addWatchFile(src); + const previewWidth = calcWidth(512, await sharp(src).metadata()); // imageOutPath and previewOutPath are @@ -137,18 +142,21 @@ async function makePhotos(ctx: PluginContext) { ); } -async function makePosts(): Promise { +async function makePosts(ctx: PluginContext): Promise { const posts: string[] = []; for await (const info of fs.glob( path.join("src/Content/blogs", "*", "post.tsx"), )) { - const contents = await fs.readFile(info, { encoding: "utf-8" }); + const infoPath = path.resolve(info); + ctx.addWatchFile(infoPath); + + const contents = await fs.readFile(infoPath, { encoding: "utf-8" }); const match = contents.match(/post\(\{(?[\S\s]*)\}\);/); if (match === null) { - throw new Error(`Could not parse ${info}`); + throw new Error(`Could not parse ${infoPath}`); } const infoMap = match.groups!["description"]; - const infoDir = path.dirname(info); + const infoDir = path.dirname(infoPath); const id = path.basename(infoDir); // TODO: this is awful, I should really use ts parser @@ -183,7 +191,7 @@ function contentPlugin(): Plugin { ]; export const posts = [ - ${(await makePosts()).join(",\n")} + ${(await makePosts(this)).join(",\n")} ]; export function post(any) {} diff --git a/src/Content/photos/0021-vienna-rathaus/image.jpg b/src/Content/photos/0021-vienna-rathaus/image.jpg new file mode 100644 index 0000000..3e1c28e Binary files /dev/null and b/src/Content/photos/0021-vienna-rathaus/image.jpg differ diff --git a/src/Content/photos/0021-vienna-rathaus/info.tsx b/src/Content/photos/0021-vienna-rathaus/info.tsx new file mode 100644 index 0000000..3e38996 --- /dev/null +++ b/src/Content/photos/0021-vienna-rathaus/info.tsx @@ -0,0 +1,8 @@ +import photo from "virtual:photo"; + +photo({ + name: "Vienna Rathaus", + camera: "Sony α7c", + lens: "Tamron 28-75mm f2.8 Di III VXD G2", + tags: ["digital", "architecture", "austria"], +}); diff --git a/src/Content/photos/0022-sudbahnhotel/image.jpg b/src/Content/photos/0022-sudbahnhotel/image.jpg new file mode 100644 index 0000000..194beb2 Binary files /dev/null and b/src/Content/photos/0022-sudbahnhotel/image.jpg differ diff --git a/src/Content/photos/0022-sudbahnhotel/info.tsx b/src/Content/photos/0022-sudbahnhotel/info.tsx new file mode 100644 index 0000000..b3690f5 --- /dev/null +++ b/src/Content/photos/0022-sudbahnhotel/info.tsx @@ -0,0 +1,8 @@ +import photo from "virtual:photo"; + +photo({ + name: "Südbahnhotel Semmering", + camera: "Sony α7c", + lens: "Tamron 28-75mm f2.8 Di III VXD G2", + tags: ["digital", "architecture", "austria"], +}); diff --git a/src/Content/photos/0023-aurum/image.jpg b/src/Content/photos/0023-aurum/image.jpg new file mode 100644 index 0000000..fee970a Binary files /dev/null and b/src/Content/photos/0023-aurum/image.jpg differ diff --git a/src/Content/photos/0023-aurum/info.tsx b/src/Content/photos/0023-aurum/info.tsx new file mode 100644 index 0000000..0a678dc --- /dev/null +++ b/src/Content/photos/0023-aurum/info.tsx @@ -0,0 +1,8 @@ +import photo from "virtual:photo"; + +photo({ + name: "Aurum", + camera: "Sony α7c", + lens: "Tamron 70-300mm F4.5-6.3 Di III RXD", + tags: ["digital", "architecture", "veliky novgorod"], +}); diff --git a/src/Content/photos/0025-axes/image.jpg b/src/Content/photos/0025-axes/image.jpg new file mode 100644 index 0000000..74befda Binary files /dev/null and b/src/Content/photos/0025-axes/image.jpg differ diff --git a/src/Content/photos/0025-axes/info.tsx b/src/Content/photos/0025-axes/info.tsx new file mode 100644 index 0000000..86eafca --- /dev/null +++ b/src/Content/photos/0025-axes/info.tsx @@ -0,0 +1,9 @@ +import photo from "virtual:photo"; + +photo({ + name: "Axes", + camera: "Minolta Dynax 500si", + lens: "Tamron 28-80 f/3.5-5.6", + film: "Kodacolor vr 200 plus (expired)", + tags: ["film", "architecture", "moscow"], +}); diff --git a/src/Content/photos/0026-sandy-cliffs/image.jpg b/src/Content/photos/0026-sandy-cliffs/image.jpg new file mode 100644 index 0000000..dc41146 Binary files /dev/null and b/src/Content/photos/0026-sandy-cliffs/image.jpg differ diff --git a/src/Content/photos/0026-sandy-cliffs/info.tsx b/src/Content/photos/0026-sandy-cliffs/info.tsx new file mode 100644 index 0000000..b734d88 --- /dev/null +++ b/src/Content/photos/0026-sandy-cliffs/info.tsx @@ -0,0 +1,8 @@ +import photo from "virtual:photo"; + +photo({ + name: "Sandy cliffs", + camera: "Sony α7c", + lens: "Tamron 28-75mm f2.8 Di III VXD G2", + tags: ["digital", "landscape", "lake baikal"], +}); diff --git a/src/Virtual/photo.d.ts b/src/Virtual/photo.d.ts index 35cf86e..a8fce71 100644 --- a/src/Virtual/photo.d.ts +++ b/src/Virtual/photo.d.ts @@ -2,7 +2,12 @@ import { JSX } from "solid-js"; declare module "virtual:photo" { type Medium = "digital" | "film" | "infrared"; - type Location = "moscow" | "saint petersburg" | "veliky novgorod"; + type Location = + | "moscow" + | "saint petersburg" + | "veliky novgorod" + | "austria" + | "lake baikal"; type Genre = | "architecture" | "landscape"