From d33d7f85385803e373ba40a353d2cfa0a89dd9d8 Mon Sep 17 00:00:00 2001 From: Jefferson Mantovani Date: Fri, 31 Oct 2025 07:14:44 -0300 Subject: [PATCH] feat: add footer with app version --- env.d.ts | 2 ++ src/App.vue | 12 ++++++++++-- vite.config.ts | 12 ++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/env.d.ts b/env.d.ts index 11f02fe..dbb4c62 100644 --- a/env.d.ts +++ b/env.d.ts @@ -1 +1,3 @@ /// + +declare const __APP_VERSION__: string; diff --git a/src/App.vue b/src/App.vue index 7bbedfa..5aed1b2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,9 @@ const route = useRoute(); const injected = injectedModule(); const targetNetwork = ref(DEFAULT_NETWORK); +const currentYear = new Date().getFullYear(); +const appVersion = __APP_VERSION__; + const web3Onboard = init({ wallets: [injected], chains: Object.values(Networks).map((network) => ({ @@ -32,7 +35,7 @@ if (!connectedWallet) { diff --git a/vite.config.ts b/vite.config.ts index 23703a7..34dc68c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,16 +1,28 @@ import { fileURLToPath, URL } from "node:url"; +import { execSync } from "node:child_process"; import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import vueJsx from "@vitejs/plugin-vue-jsx"; import svgLoader from "vite-svg-loader"; +function getGitCommitHash(): string { + try { + return execSync("git rev-parse --short HEAD").toString().trim(); + } catch (error) { + return "unknown"; + } +} + // https://vitejs.dev/config/ export default defineConfig({ base: "./", build: { target: "esnext", }, + define: { + __APP_VERSION__: JSON.stringify(getGitCommitHash()), + }, optimizeDeps: { esbuildOptions: { target: "esnext",