diff --git a/src/App.tsx b/src/App.tsx index 6d0bdb6..c2e8c7f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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, diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..dbb4c62 --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,3 @@ +/// + +declare const __APP_VERSION__: string; diff --git a/vite.config.mts b/vite.config.mts index 4eae5c6..334ee21 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -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(),