From d4086115326b4fba59d4750d041bc707d6af26f3 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Thu, 15 Aug 2024 19:31:43 +0200 Subject: [PATCH] Include admin interface version This patch adds the admin interface build date and the git commit it was built from to the top of the HTML head section. This makes it easy for developers to check which version of the admin interface exactly they are dealing with. This is hidden from regular users and therefor shouldn't make them confuse this with the version of Opencast itself. --- index.html | 2 ++ vite.config.ts | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/index.html b/index.html index 1e1dfc4653..359418b539 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,8 @@ + + diff --git a/vite.config.ts b/vite.config.ts index 7238421677..fedf6a5200 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,10 +3,17 @@ import react from "@vitejs/plugin-react-swc"; import svgr from "vite-plugin-svgr"; import viteTsconfigPaths from "vite-tsconfig-paths"; import preserveDirectives from "rollup-preserve-directives"; +import child from "child_process"; + +const commitHash = child.execSync("git rev-parse HEAD").toString().trim(); export default defineConfig({ base: process.env.PUBLIC_URL || "", plugins: [react(), svgr(), viteTsconfigPaths(), preserveDirectives()], + define: { + 'import.meta.env.VITE_GIT_COMMIT_HASH': JSON.stringify(commitHash), + 'import.meta.env.VITE_APP_BUILD_DATE': JSON.stringify(new Date().toISOString()), + }, build: { outDir: "build", sourcemap: true,