Skip to content

Commit 86fc2b8

Browse files
committed
feat: show version in page footer
1 parent 0328848 commit 86fc2b8

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

frontend/package-lock.json

+24-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@sveltejs/vite-plugin-svelte": "^3.0.2",
1919
"@tailwindcss/typography": "^0.5.10",
2020
"@types/eslint": "^8.56.5",
21+
"@types/node": "^20.11.28",
2122
"@typescript-eslint/eslint-plugin": "^7.2.0",
2223
"@typescript-eslint/parser": "^7.2.0",
2324
"autoprefixer": "^10.4.18",
@@ -46,7 +47,7 @@
4647
"mode-watcher": "^0.3.0",
4748
"moment": "^2.30.1",
4849
"svelte-sonner": "^0.3.19",
49-
"tailwind-merge": "^2.2.1",
50+
"tailwind-merge": "^2.2.2",
5051
"tailwind-variants": "^0.2.1"
5152
}
5253
}
+15-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
<footer class="mt-4 py-3 bg-muted">
2-
<p class="text-muted-foreground text-center">
3-
Fusion is an <a href="https://github.com/0x2e/fusion" target="_blank" class="underline">
4-
Open Source Project</a
5-
>. Logo by <a href="https://icons8.com" target="_blank" class="underline">Icons8</a>
6-
</p>
1+
<script lang="ts">
2+
const version = import.meta.env.FUSION.version;
3+
</script>
4+
5+
<footer class="mt-8 py-3 bg-muted text-muted-foreground">
6+
<div class="flex justify-between max-w-[900px] mx-auto px-4">
7+
<span>
8+
Fusion version <a href="https://github.com/0x2e/fusion" target="_blank" class="underline">
9+
{version}</a
10+
>.
11+
</span>
12+
<span>
13+
Logo by <a href="https://icons8.com" target="_blank" class="underline">Icons8</a>
14+
</span>
15+
</div>
716
</footer>

frontend/vite.config.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import { sveltekit } from '@sveltejs/kit/vite';
2+
import { execSync } from 'child_process';
23
import { defineConfig } from 'vite';
34

45
export default defineConfig({
56
plugins: [sveltekit()],
7+
define: {
8+
'import.meta.env.FUSION': JSON.stringify({
9+
version:
10+
execSync('git describe --tags --abbrev=0').toString().trimEnd() ||
11+
execSync('git rev-parse --short HEAD').toString().trimEnd()
12+
})
13+
},
614
server: {
715
proxy: {
816
'/api': {

0 commit comments

Comments
 (0)