From c953ff6403917c449d42514c02842204d51d2f7d Mon Sep 17 00:00:00 2001 From: Sebastian C Date: Thu, 27 Jun 2024 15:10:42 -0500 Subject: [PATCH] Show branch and git hash Fixes #102 Since there are no "releases" as of yet before v0.0.1, just display the branch and commit hash --- applications/web/src/components/MainDisplay.svelte | 1 + applications/web/vite.config.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/applications/web/src/components/MainDisplay.svelte b/applications/web/src/components/MainDisplay.svelte index df6f52e1..3e01e859 100644 --- a/applications/web/src/components/MainDisplay.svelte +++ b/applications/web/src/components/MainDisplay.svelte @@ -66,6 +66,7 @@ +
{GIT_BRANCH} {GIT_HASH}
diff --git a/applications/web/vite.config.ts b/applications/web/vite.config.ts index 008bc34d..47932286 100644 --- a/applications/web/vite.config.ts +++ b/applications/web/vite.config.ts @@ -3,10 +3,15 @@ import {svelte} from "@sveltejs/vite-plugin-svelte" import wasm from "vite-plugin-wasm" import topLevelAwait from "vite-plugin-top-level-await" import {base} from "./src/base" +import child_process from "node:child_process" export default defineConfig({ base, plugins: [svelte(), wasm(), topLevelAwait()], + define: { + GIT_HASH: JSON.stringify(child_process.execSync('git rev-parse --short=10 HEAD').toString().trim()), + GIT_BRANCH: JSON.stringify(child_process.execSync('git rev-parse --abbrev-ref HEAD').toString().trim()), + }, build: { outDir: "dist", target: "esnext",