From 5542538a6481ebe0886dcb68c97bf07cac3aea23 Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 19 Jun 2026 22:34:12 +0800 Subject: [PATCH 1/2] 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) { From 66d07d1fb098de285949d1d7036a5d679e08832a Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 19 Jun 2026 22:42:34 +0800 Subject: [PATCH 2/2] feat(webui): show app version in avatar menu using local version file --- bunfig.toml | 5 +---- packages/webui/components/user-menu.tsx | 27 +++++++++++++------------ packages/webui/global.d.ts | 6 ------ packages/webui/version.ts | 1 + scripts/release.ts | 18 ++++------------- 5 files changed, 20 insertions(+), 37 deletions(-) delete mode 100644 packages/webui/global.d.ts create mode 100644 packages/webui/version.ts diff --git a/bunfig.toml b/bunfig.toml index c2354c35..6a121e8a 100644 --- a/bunfig.toml +++ b/bunfig.toml @@ -3,7 +3,4 @@ plugins = ["bun-plugin-tailwind"] [install] minimumReleaseAge = 604800 # 7 days in seconds -exact = true - -[define] -"__APP_VERSION__" = "'0.0.8'" \ No newline at end of file +exact = true \ No newline at end of file diff --git a/packages/webui/components/user-menu.tsx b/packages/webui/components/user-menu.tsx index 1e3dbc9a..0d02c0a9 100644 --- a/packages/webui/components/user-menu.tsx +++ b/packages/webui/components/user-menu.tsx @@ -1,24 +1,25 @@ import { client } from '@/ui/api/client' import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar' import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger, - DropdownMenuSub, - DropdownMenuSubTrigger, - DropdownMenuSubContent, - DropdownMenuPortal, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuPortal, + DropdownMenuSeparator, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuTrigger, } from '@/ui/components/ui/dropdown-menu' import { useTeamId } from '@/ui/hooks/use-team-id' import { signOut } from '@/ui/lib/auth-client' import { useAuthStore } from '@/ui/stores/auth' import { useQuery } from '@tanstack/react-query' import { useNavigate } from '@tanstack/react-router' -import { useTheme } from './theme-provider' import { Check } from 'lucide-react' +import { APP_VERSION } from '../version' +import { useTheme } from './theme-provider' const Github = (props: React.SVGProps) => ( window.open('https://github.com/shumaiOne/shumai', '_blank', 'noopener,noreferrer') } > - Version {__APP_VERSION__} + Version {APP_VERSION} diff --git a/packages/webui/global.d.ts b/packages/webui/global.d.ts deleted file mode 100644 index 65d3dd50..00000000 --- a/packages/webui/global.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -declare global { - const __APP_VERSION__: string -} - -export {} diff --git a/packages/webui/version.ts b/packages/webui/version.ts new file mode 100644 index 00000000..dc28da29 --- /dev/null +++ b/packages/webui/version.ts @@ -0,0 +1 @@ +export const APP_VERSION = '0.0.8' diff --git a/scripts/release.ts b/scripts/release.ts index 1801a2b4..aaafc362 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -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}`) } }