feat: footer commit hash

This commit is contained in:
Maya 2025-11-22 17:52:43 +03:00
parent 7e73c505f8
commit 3b443e16be
No known key found for this signature in database
3 changed files with 14 additions and 0 deletions

2
src/app.d.ts vendored
View File

@ -29,6 +29,8 @@ declare global {
interface Window {
plausible: TrackEvent;
}
const __COMMIT_HASH__: string;
}
/**

View File

@ -6,6 +6,7 @@
[m["footer.source_code"](), GITHUB_URL_VERT],
[m["footer.discord_server"](), DISCORD_URL],
[m["footer.privacy_policy"](), "/privacy"],
[__COMMIT_HASH__, `${GITHUB_URL_VERT}/commit/${__COMMIT_HASH__}`]
]);
const year = new Date().getFullYear();

View File

@ -3,6 +3,14 @@ import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, type PluginOption } from "vite";
import svg from "@poppanator/sveltekit-svg";
import wasm from "vite-plugin-wasm";
import { execSync } from "child_process";
let commitHash = "unknown";
try {
commitHash = execSync("git rev-parse --short HEAD").toString().trim();
} catch (e) {
console.warn("Could not determine Git commit hash:", e);
}
export default defineConfig(({ command }) => {
const plugins: PluginOption[] = [
@ -50,5 +58,8 @@ export default defineConfig(({ command }) => {
build: {
target: "esnext",
},
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
};
});