feat: display app version in footer

Inject version from package.json at build time via Vite's define and
show it in the layout footer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Frederic Cabassut
2026-03-06 00:05:25 +01:00
co-authored by Claude Opus 4.6
parent 4fcb21d191
commit ca8362d151
4 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "crumbs",
"private": true,
"version": "0.1.3",
"version": "0.1.4",
"type": "module",
"scripts": {
"dev": "vite dev",
+2
View File
@@ -1,5 +1,7 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare const __APP_VERSION__: string;
declare global {
namespace App {
// interface Error {}
+1 -1
View File
@@ -25,7 +25,7 @@
</main>
<footer class="pb-4 pt-8 text-center text-xs text-gray-400 lg:ml-64">
Crumbs by Bretzel &mdash; made with 🥨 in Strasbourg
Crumbs by Bretzel v{__APP_VERSION__} &mdash; made with 🥨 in Strasbourg
</footer>
<Toast />
+6
View File
@@ -1,9 +1,15 @@
import { readFileSync } from 'node:fs';
import { sveltekit } from '@sveltejs/kit/vite';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(pkg.version)
},
plugins: [
tailwindcss(),
sveltekit(),