Files
bamort/frontend/VERSION.md
T
2025-12-30 22:47:52 +01:00

1.9 KiB

Frontend Version Management

Current Version: 0.1.30

The frontend version is managed independently from the backend.

Version Locations

  1. Primary source: /frontend/src/version.js

    • Contains the VERSION constant
    • Exports version info functions
  2. Package metadata: /frontend/package.json

    • Standard npm version field
    • Should match version.js

Updating the Version

# Updates both backend and frontend
./scripts/update-version.sh 0.1.31

Option 2: Manual update

Edit /frontend/src/version.js:

export const VERSION = '0.1.31'  // Update this

And /frontend/package.json:

{
  "version": "0.1.31"  // Update this
}

Git Commit Information

The git commit is injected via environment variable:

  • Set VITE_GIT_COMMIT in .env or at build time
  • Falls back to "unknown" if not set

Example .env:

VITE_GIT_COMMIT=d0c177b

Usage in Components

import { getVersion, getGitCommit, getVersionInfo } from '@/version'

// Get version string
const version = getVersion()  // "0.1.30"

// Get git commit
const commit = getGitCommit()  // "d0c177b" or "unknown"

// Get full info object
const info = getVersionInfo()  // { version: "0.1.30", gitCommit: "d0c177b" }

Landing Page Display

The landing page shows both:

  • Frontend Version: From /frontend/src/version.js
  • Backend Version: Fetched from /api/public/version

This allows users to see if frontend and backend are in sync.

Build-time Version Injection

To inject git commit at build time, update vite.config.js:

import { defineConfig } from 'vite'
import { execSync } from 'child_process'

const gitCommit = execSync('git rev-parse --short HEAD').toString().trim()

export default defineConfig({
  define: {
    'import.meta.env.VITE_GIT_COMMIT': JSON.stringify(gitCommit)
  }
})