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) { - + @@ -53,5 +56,10 @@ 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",