publish the public CV and fix the availability check to resolve from the project root - Vite rewrites module URLs at build so the relative walk never found public/
build-and-deploy / build (push) Failing after 14m0s
build-and-deploy / build (push) Failing after 14m0s
This commit is contained in:
Executable
BIN
Binary file not shown.
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
// Build-time checks for optional static assets.
|
// Build-time checks for optional static assets.
|
||||||
// Astro frontmatter runs at build (SSG), so the filesystem is available here.
|
// Astro frontmatter runs at build (SSG), so the filesystem is available here.
|
||||||
|
// (!) Resolve from the project root, not from import.meta.url - Vite rewrites module URLs
|
||||||
|
// during the build, so a relative walk up from this file can miss public/ entirely.
|
||||||
import { existsSync } from "node:fs";
|
import { existsSync } from "node:fs";
|
||||||
import { fileURLToPath } from "node:url";
|
import { join } from "node:path";
|
||||||
|
|
||||||
const publicDir = fileURLToPath(new URL("../../public/", import.meta.url));
|
|
||||||
|
|
||||||
/** True only when a real CV has been dropped at public/cv.pdf. */
|
/** True only when a real CV has been dropped at public/cv.pdf. */
|
||||||
export const cvAvailable = existsSync(publicDir + "cv.pdf");
|
export const cvAvailable = existsSync(join(process.cwd(), "public", "cv.pdf"));
|
||||||
|
|||||||
Reference in New Issue
Block a user