Add frontend version

This commit is contained in:
lowcarbdev
2025-11-15 15:08:43 -07:00
parent 557ad1fc46
commit 848bf84341
4 changed files with 40 additions and 0 deletions
+4
View File
@@ -169,6 +169,10 @@ function App() {
</svg>
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.ItemText className="small text-muted">
Version {__APP_VERSION__}
</Dropdown.ItemText>
<Dropdown.Divider />
<Dropdown.Item onClick={() => setShowPasswordModal(true)}>
<svg style={{width: '1rem', height: '1rem'}} className="me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" />
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# CI script to update the frontend version
# Usage: ./update-version.sh <version>
# Example: ./update-version.sh 1.2.3
if [ -z "$1" ]; then
echo "Usage: $0 <version>"
echo "Example: $0 1.2.3"
exit 1
fi
VERSION=$1
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VERSION_FILE="$SCRIPT_DIR/version.json"
echo "Updating version to: $VERSION"
echo "{\"version\": \"$VERSION\"}" | jq '.' > "$VERSION_FILE"
echo "Version updated successfully in $VERSION_FILE"
+3
View File
@@ -0,0 +1,3 @@
{
"version": "0.1.2"
}
+15
View File
@@ -1,7 +1,22 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { readFileSync } from 'fs'
import { resolve } from 'path'
// Read version from version.json
let version = 'unknown'
try {
const versionFile = readFileSync(resolve(__dirname, 'version.json'), 'utf-8')
const versionData = JSON.parse(versionFile)
version = versionData.version
} catch (error) {
console.warn('Warning: Could not read version.json, using default version')
}
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(version),
},
})