mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 10:23:41 +00:00
Merge pull request #9 from jhbruhn/feature/add-version-to-title
feature: Add application version to page title
This commit is contained in:
commit
5ededbb166
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