feat(webui): show app version in avatar menu using local version file

This commit is contained in:
yiling
2026-06-19 22:57:26 +08:00
parent 5542538a64
commit 66d07d1fb0
5 changed files with 20 additions and 37 deletions
+4 -14
View File
@@ -92,20 +92,10 @@ function updateVersions(newVersion: string) {
console.log(` Updated version in ${file}`)
}
if (existsSync('bunfig.toml')) {
let content = readFileSync('bunfig.toml', 'utf-8')
const appVersionLine = `"__APP_VERSION__" = "'${newVersion}'"`
if (content.includes('__APP_VERSION__')) {
content = content.replace(/"__APP_VERSION__"\s*=\s*['"].*?['"]/, appVersionLine)
} else {
if (content.includes('[define]')) {
content = content.replace('[define]', `[define]\n${appVersionLine}`)
} else {
content = content.trimEnd() + `\n\n[define]\n${appVersionLine}\n`
}
}
writeFileSync('bunfig.toml', content, 'utf-8')
console.log(' Updated version in bunfig.toml')
const versionFile = 'packages/webui/version.ts'
if (existsSync(versionFile)) {
writeFileSync(versionFile, `export const APP_VERSION = '${newVersion}'\n`, 'utf-8')
console.log(` Updated version in ${versionFile}`)
}
}