mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 02:13:41 +00:00
feature: Add application version to page title
- Read version from package.json at build time using Vite define - Create global __APP_VERSION__ constant injected by Vite - Update document title in App component to include version (e.g., "Respira v0.0.0") - Works reliably in both web and Electron builds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
abf7b9a67f
commit
ded3423a19
3 changed files with 15 additions and 0 deletions
|
|
@ -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
3
src/vite-env.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/// <reference types="vite/client" />
|
||||
|
||||
declare const __APP_VERSION__: string;
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue