mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-03 00:02:28 +08:00
feat: add version management with setuptools-scm
- Configure hatch-vcs for automatic version generation from git tags - Update pyproject.toml to use dynamic versioning - Add src/_version.py for runtime version access - Update src/__init__.py to import version from _version - Add __APP_VERSION__ to frontend vite config - Add version script to frontend package.json - Update CI workflows to trigger on version tags instead of branches
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
"test:ui": "vitest --ui",
|
||||
"test:run": "vitest run",
|
||||
"lint": "eslint . --fix",
|
||||
"type-check": "vue-tsc --noEmit"
|
||||
"type-check": "vue-tsc --noEmit",
|
||||
"version": "git describe --tags --always"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/dompurify": "^3.0.5",
|
||||
|
||||
2
frontend/src/vite-env.d.ts
vendored
2
frontend/src/vite-env.d.ts
vendored
@@ -1 +1,3 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare const __APP_VERSION__: string
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import path from 'path'
|
||||
import { execSync } from 'child_process'
|
||||
|
||||
function getGitVersion(): string {
|
||||
try {
|
||||
return execSync('git describe --tags --always').toString().trim()
|
||||
} catch {
|
||||
return '0.0.0.dev0'
|
||||
}
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(({ mode }) => ({
|
||||
// GitHub Pages 部署时使用仓库名作为 base
|
||||
base: process.env.GITHUB_PAGES === 'true' ? '/Aether/' : '/',
|
||||
plugins: [vue()],
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(getGitVersion()),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
|
||||
Reference in New Issue
Block a user