From 5542538a6481ebe0886dcb68c97bf07cac3aea23 Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 19 Jun 2026 22:34:12 +0800 Subject: [PATCH] feat(webui): show app version in avatar menu --- bunfig.toml | 5 ++++- packages/webui/components/user-menu.tsx | 28 +++++++++++++++++++++++++ packages/webui/global.d.ts | 6 ++++++ scripts/release.ts | 16 ++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 packages/webui/global.d.ts diff --git a/bunfig.toml b/bunfig.toml index 6a121e8a..c2354c35 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -3,4 +3,7 @@ plugins = ["bun-plugin-tailwind"] [install] minimumReleaseAge = 604800 # 7 days in seconds -exact = true \ No newline at end of file +exact = true + +[define] +"__APP_VERSION__" = "'0.0.8'" \ No newline at end of file diff --git a/packages/webui/components/user-menu.tsx b/packages/webui/components/user-menu.tsx index daed3d46..1e3dbc9a 100644 --- a/packages/webui/components/user-menu.tsx +++ b/packages/webui/components/user-menu.tsx @@ -20,6 +20,24 @@ import { useNavigate } from '@tanstack/react-router' import { useTheme } from './theme-provider' import { Check } from 'lucide-react' +const Github = (props: React.SVGProps) => ( + + + + +) + export function UserMenu() { const { clearAuth } = useAuthStore() const teamId = useTeamId() @@ -125,6 +143,16 @@ export function UserMenu() { Log out + + + window.open('https://github.com/shumaiOne/shumai', '_blank', 'noopener,noreferrer') + } + > + + Version {__APP_VERSION__} + ) diff --git a/packages/webui/global.d.ts b/packages/webui/global.d.ts new file mode 100644 index 00000000..65d3dd50 --- /dev/null +++ b/packages/webui/global.d.ts @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +declare global { + const __APP_VERSION__: string +} + +export {} diff --git a/scripts/release.ts b/scripts/release.ts index c2f244a6..1801a2b4 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -91,6 +91,22 @@ function updateVersions(newVersion: string) { writeFileSync(file, JSON.stringify(content, null, 2) + '\n', 'utf-8') 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') + } } function shellQuote(value: string) {