diff --git a/app/assets/app.css b/app/assets/app.css
index 4962f82..70849ff 100644
--- a/app/assets/app.css
+++ b/app/assets/app.css
@@ -12,6 +12,14 @@
font-style: normal;
}
+/* NOTE: woff2 version of this font doesn't work */
+@font-face {
+ font-family: "Pokemon DP Pro";
+ src: url("/assets/fonts/pokemon-dp-pro.ttf") format("truetype");
+ font-weight: normal;
+ font-style: normal;
+}
+
* {
box-sizing: border-box;
margin: 0;
diff --git a/app/assets/fonts/pokemon-dp-pro.ttf b/app/assets/fonts/pokemon-dp-pro.ttf
new file mode 100644
index 0000000..92b78c2
Binary files /dev/null and b/app/assets/fonts/pokemon-dp-pro.ttf differ
diff --git a/app/assets/images/projects/bottom-screen/background.webp b/app/assets/images/projects/bottom-screen/background.webp
index c0770e2..9bce006 100644
Binary files a/app/assets/images/projects/bottom-screen/background.webp and b/app/assets/images/projects/bottom-screen/background.webp differ
diff --git a/app/assets/images/projects/bottom-screen/project-square.webp b/app/assets/images/projects/bottom-screen/project-square.webp
deleted file mode 100644
index 0f18f02..0000000
Binary files a/app/assets/images/projects/bottom-screen/project-square.webp and /dev/null differ
diff --git a/app/assets/images/projects/bottom-screen/selector.webp b/app/assets/images/projects/bottom-screen/selector.webp
deleted file mode 100644
index 794db16..0000000
Binary files a/app/assets/images/projects/bottom-screen/selector.webp and /dev/null differ
diff --git a/app/assets/images/projects/bottom-screen/visit-disabled.webp b/app/assets/images/projects/bottom-screen/visit-disabled.webp
deleted file mode 100644
index 20667d3..0000000
Binary files a/app/assets/images/projects/bottom-screen/visit-disabled.webp and /dev/null differ
diff --git a/app/assets/images/projects/top-screen/background.webp b/app/assets/images/projects/top-screen/background.webp
index 6f30ff3..655df55 100644
Binary files a/app/assets/images/projects/top-screen/background.webp and b/app/assets/images/projects/top-screen/background.webp differ
diff --git a/app/assets/images/projects/top-screen/scope-badge.png b/app/assets/images/projects/top-screen/scope-badge.png
deleted file mode 100644
index 6ef0ee2..0000000
Binary files a/app/assets/images/projects/top-screen/scope-badge.png and /dev/null differ
diff --git a/app/components/Projects/BottomScreen/Background.vue b/app/components/Projects/BottomScreen/Background.vue
index 5b2eae8..9efab0f 100644
--- a/app/components/Projects/BottomScreen/Background.vue
+++ b/app/components/Projects/BottomScreen/Background.vue
@@ -1,33 +1,11 @@
diff --git a/app/components/Projects/BottomScreen/Projects.vue b/app/components/Projects/BottomScreen/Projects.vue
deleted file mode 100644
index cb19a81..0000000
--- a/app/components/Projects/BottomScreen/Projects.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-
diff --git a/app/components/Projects/TopScreen/Previews.vue b/app/components/Projects/TopScreen/Previews.vue
deleted file mode 100644
index 8a8aa8b..0000000
--- a/app/components/Projects/TopScreen/Previews.vue
+++ /dev/null
@@ -1,122 +0,0 @@
-
diff --git a/app/components/Projects/TopScreen/Project.vue b/app/components/Projects/TopScreen/Project.vue
new file mode 100644
index 0000000..a054614
--- /dev/null
+++ b/app/components/Projects/TopScreen/Project.vue
@@ -0,0 +1,134 @@
+
diff --git a/app/components/Projects/TopScreen/StatusBar.vue b/app/components/Projects/TopScreen/StatusBar.vue
deleted file mode 100644
index c998f1a..0000000
--- a/app/components/Projects/TopScreen/StatusBar.vue
+++ /dev/null
@@ -1,59 +0,0 @@
-
diff --git a/app/components/Projects/TopScreen/TopScreen.vue b/app/components/Projects/TopScreen/TopScreen.vue
index 6673553..9f95050 100644
--- a/app/components/Projects/TopScreen/TopScreen.vue
+++ b/app/components/Projects/TopScreen/TopScreen.vue
@@ -1,7 +1,6 @@
@@ -9,7 +8,5 @@ const store = useProjectsStore();
-
-
-
+
diff --git a/app/stores/projects.ts b/app/stores/projects.ts
index 114a766..0ae0fb2 100644
--- a/app/stores/projects.ts
+++ b/app/stores/projects.ts
@@ -1,74 +1,15 @@
-import type { MarkdownRoot } from "@nuxt/content";
+import type {
+ DataCollectionItemBase,
+ ProjectsCollectionItem,
+} from "@nuxt/content";
import gsap from "gsap";
-type MarkdownBody = (
- | {
- type: "h1" | "p";
- text: string;
- }
- | {
- type: "img";
- image: HTMLImageElement;
- }
-)[];
-
-const createImage = (src: string): HTMLImageElement => {
- // TODO: how to cleanup ?
- const img = document.createElement("img");
- img.src = src;
- return img;
-};
-
-// TODO: move to utils or smth maybe
-const simplifyMarkdownAST = (root: MarkdownRoot) => {
- const body: MarkdownBody = [];
- for (const node of root.value) {
- if (Array.isArray(node)) {
- const [type, props, value] = node;
- console.log("--------------");
- console.log(`type = ${type}`);
- console.log(`props = ${JSON.stringify(props)}`);
- console.log(`value = ${value}`);
-
- switch (type) {
- case "h1":
- case "p": {
- if (typeof value !== "string")
- throw `Unsupported node value for '${type}': '${value}'`;
- body.push({ type, text: value });
- break;
- }
-
- case "img": {
- if (typeof props["src"] !== "string")
- throw `Unsupported type or missing node prop "src" for '${type}': '${JSON.stringify(props)}'`;
- body.push({ type, image: createImage(props.src) });
- break;
- }
-
- default: {
- throw `Unsupported '${type}'`;
- }
- }
- } else {
- throw `Unsupported node kind 'string'`;
- }
- }
-
- return body;
-};
-
export const useProjectsStore = defineStore("projects", {
state: () => ({
- projects: [] as {
- description: string;
- thumbnail: string;
- preview: string;
- url: string | null;
- technologies: string[];
- scope: "hobby" | "work";
- body: MarkdownBody;
- }[],
+ projects: [] as (Omit<
+ ProjectsCollectionItem,
+ keyof DataCollectionItemBase
+ > & { id: string })[],
currentProject: 0,
loading: true,
offsetX: 0,
@@ -77,33 +18,37 @@ export const useProjectsStore = defineStore("projects", {
actions: {
async loadProjects() {
this.loading = true;
+
const { data: projects } = await useAsyncData("projects", () =>
- queryCollection("projects").order("order", "ASC").all(),
+ queryCollection("projects")
+ .order("order", "ASC")
+ .select(
+ "id",
+ "order",
+ "scope",
+ "title",
+ "link",
+ "description",
+ "summary",
+ "technologies",
+ "tasks",
+ )
+ .all(),
);
if (!projects.value) throw "Cannot load projects";
+ this.projects = projects.value.map((project) => ({
+ ...project,
+ id: project.id.split("/")[2]!,
+ }));
- this.projects = [];
-
- for (const project of projects.value) {
- const parts = project.id.replace(".md", "").split("/");
- const id = parts[parts.length - 2]!;
- this.projects.push({
- description: project.description,
- thumbnail: `/images/projects/${id}/thumbnail.webp`,
- preview: `/images/projects/${id}/preview.webp`,
- url: project.url,
- technologies: project.technologies,
- scope: project.scope,
- body: simplifyMarkdownAST(project.body),
- });
- }
+ console.log(this.projects);
this.loading = false;
},
visitProject() {
- const url = this.projects[this.currentProject]!.url;
- if (url) navigateTo(url, { external: true, open: { target: "_blank" } });
+ const link = this.projects[this.currentProject]?.link;
+ if (link) navigateTo(link, { open: { target: "_blank" } });
},
scrollProjects(direction: "left" | "right") {
@@ -133,6 +78,7 @@ export const useProjectsStore = defineStore("projects", {
}
},
+ // TODO: not used anymore
scrollToProject(index: number) {
if (index === this.currentProject) return;
diff --git a/content.config.ts b/content.config.ts
index 8c14778..9b209b0 100644
--- a/content.config.ts
+++ b/content.config.ts
@@ -4,14 +4,17 @@ import { z } from "zod";
export default defineContentConfig({
collections: {
projects: defineCollection({
- type: "page",
- source: "projects/**/index.md",
+ type: "data",
+ source: "projects/**/index.yml",
schema: z.object({
- description: z.string(),
- url: z.url().nullable(),
order: z.number(),
- technologies: z.array(z.string()),
scope: z.enum(["hobby", "work"]),
+ title: z.string(),
+ link: z.url().nullable(),
+ description: z.string(),
+ summary: z.string(),
+ technologies: z.array(z.string()),
+ tasks: z.array(z.string()),
}),
}),
},
diff --git a/content/projects/biobleud/index.md b/content/projects/biobleud/index.md
deleted file mode 100644
index 5fd2283..0000000
--- a/content/projects/biobleud/index.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: Biobleud - Automated Excel imports\nfor an ERP system
-url: null
-order: 100
-technologies: [VBA]
-scope: work
----
diff --git a/content/projects/biobleud/index.webp b/content/projects/biobleud/index.webp
new file mode 100644
index 0000000..74a2946
Binary files /dev/null and b/content/projects/biobleud/index.webp differ
diff --git a/content/projects/biobleud/index.yml b/content/projects/biobleud/index.yml
new file mode 100644
index 0000000..938ab00
--- /dev/null
+++ b/content/projects/biobleud/index.yml
@@ -0,0 +1,14 @@
+order: 100
+scope: work
+title: Biobleud
+link: null
+
+description: Agri-food company
+summary: Temporary assignments
+technologies:
+ - VBA
+
+tasks:
+ - Developing Excel macros\nin VBA for ERP system\nimplementation
+ - Understanding client\nneeds
+ - Documentation
diff --git a/content/projects/biobleud/preview.webp b/content/projects/biobleud/preview.webp
deleted file mode 100644
index b386f88..0000000
Binary files a/content/projects/biobleud/preview.webp and /dev/null differ
diff --git a/content/projects/biobleud/thumbnail.webp b/content/projects/biobleud/thumbnail.webp
deleted file mode 100644
index 4faf0ab..0000000
Binary files a/content/projects/biobleud/thumbnail.webp and /dev/null differ
diff --git a/content/projects/lbf-bot/index.md b/content/projects/lbf-bot/index.md
deleted file mode 100644
index 241b164..0000000
--- a/content/projects/lbf-bot/index.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-description: LBF Bot - Custom Discord bot for\na gaming group
-url: https://github.com/pihkaal/lbf-bot
-order: 50
-technologies: [Node, TypeScript]
-scope: hobby
----
-
-a
diff --git a/content/projects/lbf-bot/index.webp b/content/projects/lbf-bot/index.webp
new file mode 100644
index 0000000..870f13e
Binary files /dev/null and b/content/projects/lbf-bot/index.webp differ
diff --git a/content/projects/lbf-bot/index.yml b/content/projects/lbf-bot/index.yml
new file mode 100644
index 0000000..ad79ff6
--- /dev/null
+++ b/content/projects/lbf-bot/index.yml
@@ -0,0 +1,15 @@
+order: 50
+scope: hobby
+title: LBF Bot
+link: https://github.com/pihkaal/lbf-bot
+
+description: For a gaming group
+summary: Custom Discord bot
+technologies:
+ - Node
+ - TypeScript
+
+tasks:
+ - Made for a gaming group
+ - Deployed on VPS
+ - Understanding client\nneeds
diff --git a/content/projects/lbf-bot/preview.webp b/content/projects/lbf-bot/preview.webp
deleted file mode 100644
index b905876..0000000
Binary files a/content/projects/lbf-bot/preview.webp and /dev/null differ
diff --git a/content/projects/lbf-bot/thumbnail.webp b/content/projects/lbf-bot/thumbnail.webp
deleted file mode 100644
index 84b6037..0000000
Binary files a/content/projects/lbf-bot/thumbnail.webp and /dev/null differ
diff --git a/content/projects/lilou-cat/index.md b/content/projects/lilou-cat/index.md
deleted file mode 100644
index 888db7c..0000000
--- a/content/projects/lilou-cat/index.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: lilou.cat - My cat's website
-url: https://lilou.cat
-order: 40
-technologies: [HTML, Go]
-scope: hobby
----
diff --git a/content/projects/lilou-cat/index.webp b/content/projects/lilou-cat/index.webp
new file mode 100644
index 0000000..a68c9e2
Binary files /dev/null and b/content/projects/lilou-cat/index.webp differ
diff --git a/content/projects/lilou-cat/index.yml b/content/projects/lilou-cat/index.yml
new file mode 100644
index 0000000..2956ad0
--- /dev/null
+++ b/content/projects/lilou-cat/index.yml
@@ -0,0 +1,15 @@
+order: 40
+scope: hobby
+title: lilou.cat
+link: https://lilou.cat
+
+description: Lilou <3
+summary: Lilou's website
+
+technologies:
+ - HTML
+ - Go
+
+tasks:
+ - Originally made for fun\nto celebrate my cat Lilou
+ - Now preserved in her\nmemory
diff --git a/content/projects/lilou-cat/preview.webp b/content/projects/lilou-cat/preview.webp
deleted file mode 100644
index cfceff9..0000000
Binary files a/content/projects/lilou-cat/preview.webp and /dev/null differ
diff --git a/content/projects/lilou-cat/thumbnail.webp b/content/projects/lilou-cat/thumbnail.webp
deleted file mode 100644
index f2a1d27..0000000
Binary files a/content/projects/lilou-cat/thumbnail.webp and /dev/null differ
diff --git a/content/projects/pihkaal-me/index.md b/content/projects/pihkaal-me/index.md
deleted file mode 100644
index 7e69d41..0000000
--- a/content/projects/pihkaal-me/index.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-description: pihkaal.me - my personal website
-url: https://pihkaal.me
-order: 10
-technologies: [Nuxt, TypeScript]
-scope: hobby
----
-
-# pihkaal.me
-
-My personal website has evolved significantly over time. It began as a recreation of my Arch Linux + Hyprland setup, featuring Neovim, Cava, Spotify Player, and Waybar.
-
-Now, it's designed to resemble a Nintendo DS, my first gaming console and a gift from my mother that holds special meaning to me.
-
-I started with just a few games like Mario Kart and Professor Layton. Eventually, I got an R4 card which opened up a whole new world of possibilities.
diff --git a/content/projects/pihkaal-me/index.webp b/content/projects/pihkaal-me/index.webp
new file mode 100644
index 0000000..aefcfca
Binary files /dev/null and b/content/projects/pihkaal-me/index.webp differ
diff --git a/content/projects/pihkaal-me/index.yml b/content/projects/pihkaal-me/index.yml
new file mode 100644
index 0000000..18df5f2
--- /dev/null
+++ b/content/projects/pihkaal-me/index.yml
@@ -0,0 +1,15 @@
+order: 10
+scope: hobby
+title: pihkaal.me
+link: https://pihkaal.me
+
+description: Portfolio and contact
+summary: My personnal website
+
+technologies:
+ - Nuxt
+ - TypeScript
+
+tasks:
+ - The website you are\ncurrently on!
+ - Recreation of the Nintendo\nDS because it was my first\never console
diff --git a/content/projects/pihkaal-me/preview.webp b/content/projects/pihkaal-me/preview.webp
deleted file mode 100644
index 5938550..0000000
Binary files a/content/projects/pihkaal-me/preview.webp and /dev/null differ
diff --git a/content/projects/pihkaal-me/thumbnail.webp b/content/projects/pihkaal-me/thumbnail.webp
deleted file mode 100644
index 345cda1..0000000
Binary files a/content/projects/pihkaal-me/thumbnail.webp and /dev/null differ
diff --git a/content/projects/raylib-speedruns/index.md b/content/projects/raylib-speedruns/index.md
deleted file mode 100644
index 2360aae..0000000
--- a/content/projects/raylib-speedruns/index.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-description: Raylib Speedruns - Collection of simple\nRaylib setups in multiple languages
-url: https://github.com/pihkaal/raylib-speedruns
-order: 60
-scope: hobby
----
-
-# Raylib Speedruns
diff --git a/content/projects/raylib-speedruns/index.webp b/content/projects/raylib-speedruns/index.webp
new file mode 100644
index 0000000..7317eed
Binary files /dev/null and b/content/projects/raylib-speedruns/index.webp differ
diff --git a/content/projects/raylib-speedruns/index.yml b/content/projects/raylib-speedruns/index.yml
new file mode 100644
index 0000000..e359636
--- /dev/null
+++ b/content/projects/raylib-speedruns/index.yml
@@ -0,0 +1,18 @@
+order: 60
+scope: hobby
+title: Raylib Spdrns
+link: https://github.com/pihkaal/raylib-speedruns
+
+description: Awesome video game library
+summary: Raylib Speedruns
+technologies:
+ - C
+ - C#
+ - D
+ - Python
+ - Rust
+ - Asm x86_64
+
+tasks:
+ - Simple Raylib setups in\nmultiple languages
+ - Inspired by Tsoding
diff --git a/content/projects/raylib-speedruns/preview.webp b/content/projects/raylib-speedruns/preview.webp
deleted file mode 100644
index 0842b15..0000000
Binary files a/content/projects/raylib-speedruns/preview.webp and /dev/null differ
diff --git a/content/projects/raylib-speedruns/thumbnail.webp b/content/projects/raylib-speedruns/thumbnail.webp
deleted file mode 100644
index 1647c7f..0000000
Binary files a/content/projects/raylib-speedruns/thumbnail.webp and /dev/null differ
diff --git a/content/projects/s3pweb/index.md b/content/projects/s3pweb/index.md
deleted file mode 100644
index 7f842a6..0000000
--- a/content/projects/s3pweb/index.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: S3PWeb - Intership and\napprenticeship
-url: null
-order: 80
-technologies: [Node, StencilJS, TypeScript]
-scope: work
----
diff --git a/content/projects/s3pweb/index.webp b/content/projects/s3pweb/index.webp
new file mode 100644
index 0000000..74a2946
Binary files /dev/null and b/content/projects/s3pweb/index.webp differ
diff --git a/content/projects/s3pweb/index.yml b/content/projects/s3pweb/index.yml
new file mode 100644
index 0000000..c19a33d
--- /dev/null
+++ b/content/projects/s3pweb/index.yml
@@ -0,0 +1,17 @@
+order: 80
+scope: work
+title: S3PWeb
+link: null
+
+description: The Transport Data Aggregator
+summary: Apprenticeship
+technologies:
+ - Node
+ - StencilJS
+ - TypeScript
+
+tasks:
+ - Automatized incidents\naggregation to Jira
+ - Web based map editor
+ - Chrome extension to\nvisualize Eramba assets
+ - Documentation
diff --git a/content/projects/s3pweb/preview.webp b/content/projects/s3pweb/preview.webp
deleted file mode 100644
index 32277b0..0000000
Binary files a/content/projects/s3pweb/preview.webp and /dev/null differ
diff --git a/content/projects/s3pweb/thumbnail.webp b/content/projects/s3pweb/thumbnail.webp
deleted file mode 100644
index bcb71bb..0000000
Binary files a/content/projects/s3pweb/thumbnail.webp and /dev/null differ
diff --git a/content/projects/simple-qr/index.md b/content/projects/simple-qr/index.md
deleted file mode 100644
index d288f7c..0000000
--- a/content/projects/simple-qr/index.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: Simple QR - Simple QR code generator\nwith straightforward API
-url: https://simple-qr.com
-order: 30
-technologies: [Nuxt, TypeScript]
-scope: hobby
----
diff --git a/content/projects/simple-qr/index.webp b/content/projects/simple-qr/index.webp
new file mode 100644
index 0000000..91db7bb
Binary files /dev/null and b/content/projects/simple-qr/index.webp differ
diff --git a/content/projects/simple-qr/index.yml b/content/projects/simple-qr/index.yml
new file mode 100644
index 0000000..d3c978d
--- /dev/null
+++ b/content/projects/simple-qr/index.yml
@@ -0,0 +1,15 @@
+order: 30
+scope: hobby
+title: Simple QR
+link: https://simple-qr.com
+
+description: Concise website and API
+summary: QR code generator
+technologies:
+ - Nuxt
+ - TypeScript
+
+tasks:
+ - Easy to use
+ - Large choice of logos
+ - Straightforward API
diff --git a/content/projects/simple-qr/preview.webp b/content/projects/simple-qr/preview.webp
deleted file mode 100644
index 3d2dbf6..0000000
Binary files a/content/projects/simple-qr/preview.webp and /dev/null differ
diff --git a/content/projects/simple-qr/thumbnail.webp b/content/projects/simple-qr/thumbnail.webp
deleted file mode 100644
index b1b5b3a..0000000
Binary files a/content/projects/simple-qr/thumbnail.webp and /dev/null differ
diff --git a/content/projects/tlock/index.md b/content/projects/tlock/index.md
deleted file mode 100644
index 1eaadc6..0000000
--- a/content/projects/tlock/index.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: tlock - fully customizable and cross-\nplatform terminal based clock
-url: https://github.com/pihkaal/tlock
-order: 20
-technologies: [Rust]
-scope: hobby
----
diff --git a/content/projects/tlock/index.webp b/content/projects/tlock/index.webp
new file mode 100644
index 0000000..4438594
Binary files /dev/null and b/content/projects/tlock/index.webp differ
diff --git a/content/projects/tlock/index.yml b/content/projects/tlock/index.yml
new file mode 100644
index 0000000..c128a7f
--- /dev/null
+++ b/content/projects/tlock/index.yml
@@ -0,0 +1,16 @@
+order: 20
+scope: hobby
+title: tlock
+link: https://github.com/pihkaal/tlock
+
+description: For Hyprland ricing
+summary: Terminal based clock
+technologies:
+ - Rust
+
+tasks:
+ - Fully customizable
+ - Animated
+ - Cross-platform
+ - |
+ Multiple modes: clock,\nchronometer and timer
diff --git a/content/projects/tlock/preview.webp b/content/projects/tlock/preview.webp
deleted file mode 100644
index 61a6e53..0000000
Binary files a/content/projects/tlock/preview.webp and /dev/null differ
diff --git a/content/projects/tlock/thumbnail.webp b/content/projects/tlock/thumbnail.webp
deleted file mode 100644
index 06d00ac..0000000
Binary files a/content/projects/tlock/thumbnail.webp and /dev/null differ
diff --git a/modules/content-assets.ts b/modules/content-assets.ts
index 2f4bab3..008e149 100644
--- a/modules/content-assets.ts
+++ b/modules/content-assets.ts
@@ -29,41 +29,39 @@ export default defineNuxtModule({
return;
}
+ if (!existsSync(publicDir)) {
+ await mkdir(publicDir, { recursive: true });
+ }
+
const entries = await readdir(projectsDir, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const projectName = entry.name;
- const sourceDir = join(projectsDir, projectName);
- const destDir = join(publicDir, projectName);
+ const sourcePath = join(projectsDir, projectName, "index.webp");
+ const destPath = join(publicDir, `${projectName}.webp`);
- if (!existsSync(destDir)) {
- await mkdir(destDir, { recursive: true });
+ if (!existsSync(sourcePath)) {
+ continue;
}
- const files = await readdir(sourceDir);
- for (const file of files) {
- if (!file.endsWith(".webp")) continue;
+ // only copy if destination doesn't exist, or if not the same as source
+ let shouldCopy = true;
+ if (existsSync(destPath)) {
+ const sourceChecksum = await getFileChecksum(sourcePath);
+ const destChecksum = await getFileChecksum(destPath);
- const sourcePath = join(sourceDir, file);
- const destPath = join(destDir, file);
-
- // only copy if destination doesn't exist, or if not the same as source
- let shouldCopy = true;
- if (existsSync(destPath)) {
- const sourceChecksum = await getFileChecksum(sourcePath);
- const destChecksum = await getFileChecksum(destPath);
-
- if (sourceChecksum === destChecksum) {
- shouldCopy = false;
- }
+ if (sourceChecksum === destChecksum) {
+ shouldCopy = false;
}
+ }
- if (shouldCopy) {
- await copyFile(sourcePath, destPath);
- logger.success(`Copied: ${projectName}/${file}`);
- }
+ if (shouldCopy) {
+ await copyFile(sourcePath, destPath);
+ logger.success(
+ `Copied: ${projectName}/index.webp -> ${projectName}.webp`,
+ );
}
}
} catch (error) {
@@ -77,9 +75,10 @@ export default defineNuxtModule({
if (nuxt.options.dev) {
nuxt.hook("ready", () => {
- watch(contentDir, { recursive: true }, async (_, filename) => {
- if (filename?.endsWith(".webp")) {
- logger.info(`Detected change: ${filename}`);
+ watch(contentDir, { recursive: true }, async (_, filePath) => {
+ // NOTE: only match /PROJECT_NAME/index.webp
+ if (filePath?.endsWith("/index.webp")) {
+ logger.info(`Detected change: ${filePath}`);
await copyWebpFiles();
}
});