Merge pull request #9 from jhbruhn/feature/add-version-to-title

feature: Add application version to page title
This commit is contained in:
Jan-Henrik Bruhn 2025-12-13 23:49:10 +01:00 committed by GitHub
commit 5ededbb166
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View file

@ -15,6 +15,10 @@ import { CheckCircleIcon, BoltIcon, PauseCircleIcon, ExclamationTriangleIcon, Ar
import './App.css';
function App() {
// Set page title with version
useEffect(() => {
document.title = `Respira v${__APP_VERSION__}`;
}, []);
// Machine store
const {
isConnected,

3
src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1,3 @@
/// <reference types="vite/client" />
declare const __APP_VERSION__: string;

View file

@ -4,8 +4,13 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
import tailwindcss from '@tailwindcss/vite'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
import { readFileSync } from 'fs'
import type { Plugin } from 'vite'
// Read version from package.json
const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'))
const appVersion = packageJson.version
const PYODIDE_EXCLUDE = [
'!**/*.{md,html}',
'!**/*.d.ts',
@ -133,6 +138,9 @@ export function downloadPyPIWheels(packages: PyPIPackage[]): Plugin {
// https://vite.dev/config/
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(appVersion),
},
plugins: [
react(),
tailwindcss(),