diff --git a/src/App.vue b/src/App.vue
index 763b817..eae0de3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -3,6 +3,7 @@ import { useRoute } from "vue-router";
import TopBar from "@/components/TopBar/TopBar.vue";
import SpinnerComponent from "@/components/ui/SpinnerComponent.vue";
import ToasterComponent from "@/components/ui/ToasterComponent.vue";
+import VersionFooter from "@/components/ui/VersionFooter.vue";
import { init, useOnboard } from "@web3-onboard/vue";
import injectedModule from "@web3-onboard/injected-wallets";
import { Networks, DEFAULT_NETWORK } from "@/config/networks";
@@ -53,5 +54,6 @@ if (!connectedWallet) {
+
diff --git a/src/components/ui/VersionFooter.vue b/src/components/ui/VersionFooter.vue
new file mode 100644
index 0000000..3c1c798
--- /dev/null
+++ b/src/components/ui/VersionFooter.vue
@@ -0,0 +1,13 @@
+
+
+
+
+ v{{ version }}
+
+
diff --git a/vite.config.ts b/vite.config.ts
index 8cda728..7d56f6c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,18 +6,26 @@ import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import svgLoader from "vite-svg-loader";
-function getGitTag(): string {
+function sh(cmd: string): string {
try {
- const tags = execSync("git tag --sort=-version:refname")
+ return execSync(cmd, { stdio: ["ignore", "pipe", "ignore"] })
.toString()
- .trim()
- .split("\n");
- return tags.length > 0 ? tags[0] : "unknown";
- } catch (fallbackError) {
+ .trim();
+ } catch {
return "";
}
}
+function getAppVersion(): string {
+ const tag = sh("git tag --sort=-version:refname").split("\n")[0] || "";
+ const shortSha = sh("git rev-parse --short HEAD");
+ const tagSha = tag ? sh(`git rev-list -n 1 ${tag}`) : "";
+ const headSha = sh("git rev-parse HEAD");
+ if (tag && tagSha === headSha) return tag;
+ if (tag && shortSha) return `${tag}+${shortSha}`;
+ return shortSha || "dev";
+}
+
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
@@ -25,7 +33,7 @@ export default defineConfig({
target: "esnext",
},
define: {
- __APP_VERSION__: JSON.stringify(getGitTag()),
+ __APP_VERSION__: JSON.stringify(getAppVersion()),
},
optimizeDeps: {
esbuildOptions: {