From 9cf77ad93a5364ca911997de5bd4fe117b8d2a3b Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 26 Apr 2025 19:15:35 +0200 Subject: [PATCH] Pass TIMESTAMP and GIT_VERSION from Astro config. --- astro.config.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/astro.config.mjs b/astro.config.mjs index 9b72331dc..8ac660189 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -11,12 +11,19 @@ import metaTags from "astro-meta-tags"; import pagefind from "astro-pagefind"; import deleteUnusedImages from "astro-delete-unused-images"; import preload from "astro-preload"; +import { execSync } from "node:child_process"; // https://astro.build/config export default defineConfig({ vite: { define: { - "process.env.VITE_BUILD_TIME": JSON.stringify(new Date().toISOString()), + "import.meta.env.TIMESTAMP": new Date() + .toISOString() + .replace(/[-:T.Z]/g, "") + .slice(0, 14), + "import.meta.env.GIT_VERSION": new String( + execSync("git rev-parse --short HEAD") + ), }, resolve: { alias: {