diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 622bab3..936e0a9 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -169,6 +169,10 @@ function App() { + + Version {__APP_VERSION__} + + setShowPasswordModal(true)}> diff --git a/frontend/update-version.sh b/frontend/update-version.sh new file mode 100755 index 0000000..7a86b7e --- /dev/null +++ b/frontend/update-version.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# CI script to update the frontend version +# Usage: ./update-version.sh +# Example: ./update-version.sh 1.2.3 + +if [ -z "$1" ]; then + echo "Usage: $0 " + 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" diff --git a/frontend/version.json b/frontend/version.json new file mode 100644 index 0000000..3c5c6ef --- /dev/null +++ b/frontend/version.json @@ -0,0 +1,3 @@ +{ + "version": "0.1.2" +} diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 8b0f57b..7bcdb43 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -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), + }, })