✨ feat(ui): display version and git hash in header
Add version info display below "ERP Auto" logo showing format:
${version}(${git-hash})
- Inject __APP_VERSION__ and __GIT_HASH__ via vite define
- Add TypeScript declarations for global constants
- Simplify portable artifact name (remove version)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,29 @@ import { resolve } from 'path'
|
||||
import { defineConfig } from 'electron-vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { execSync } from 'child_process'
|
||||
|
||||
// Get git hash (first 7 characters)
|
||||
const getGitHash = (): string => {
|
||||
try {
|
||||
return execSync('git rev-parse --short=7 HEAD', { encoding: 'utf-8' }).trim()
|
||||
} catch {
|
||||
return 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
// Get version from package.json
|
||||
const version = require('./package.json').version
|
||||
const gitHash = getGitHash()
|
||||
|
||||
export default defineConfig({
|
||||
main: {},
|
||||
preload: {},
|
||||
renderer: {
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(version),
|
||||
__GIT_HASH__: JSON.stringify(gitHash)
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@renderer': resolve('src/renderer/src')
|
||||
|
||||
Reference in New Issue
Block a user