Skip to content

Commit 189184f

Browse files
committed
feat(desktop): show real version in top-bar badge
Vite `define` injects __APP_VERSION__ from apps/desktop/package.json into both main and renderer at build time; the Wordmark badge now renders 'v0.1.2' instead of the static 'pre-alpha' / '预览版' i18n string. The i18n key stays in place for anyone who still references it from elsewhere. Also re-pins productName to 'Open CoDesign' (artifact filenames remain pinned to the open-codesign slug) and updates the macOS install hint path to /Applications/Open CoDesign.app with a parenthetical for the legacy 0.1.x bundle path.
1 parent f23655b commit 189184f

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

apps/desktop/electron.vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { resolve } from 'node:path';
22
import react from '@vitejs/plugin-react';
33
import { defineConfig } from 'electron-vite';
4+
import pkg from './package.json' with { type: 'json' };
5+
6+
const APP_VERSION = JSON.stringify(pkg.version);
47

58
export default defineConfig({
69
main: {
10+
define: { __APP_VERSION__: APP_VERSION },
711
build: {
812
outDir: 'out/main',
913
rollupOptions: {
@@ -23,6 +27,7 @@ export default defineConfig({
2327
},
2428
renderer: {
2529
root: resolve(__dirname, 'src/renderer'),
30+
define: { __APP_VERSION__: APP_VERSION },
2631
build: {
2732
outDir: 'out/renderer',
2833
rollupOptions: {

apps/desktop/src/renderer/src/components/TopBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function TopBar() {
3434
}}
3535
>
3636
<div className="flex items-center gap-[var(--space-8)] min-w-0 h-full" style={noDragStyle}>
37-
<Wordmark badge={t('common.preAlpha')} size="md" />
37+
<Wordmark badge={`v${__APP_VERSION__}`} size="md" />
3838

3939
{view === 'settings' ? (
4040
<div className="flex items-center gap-[var(--space-2)]">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/// <reference types="vite/client" />
2+
3+
// Injected by electron.vite.config.ts `define` at build time.
4+
declare const __APP_VERSION__: string;

website/.vitepress/theme/SmartDownload.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const secondaryAssets = () => {
138138
<p class="install-hint">
139139
<strong>macOS 安装</strong>:拖到「应用程序」。双击打开若被 Gatekeeper 拦截(常见于 Sequoia 15+),终端跑一次:<br/>
140140
<code>xattr -cr "/Applications/Open CoDesign.app"</code><br/>
141-
然后再双击就能打开。下载历史版本(文件名仍是 <code>open-codesign.app</code>)请把路径对应替换。
141+
然后再双击就能打开。(0.1.x 旧 build 路径是 <code>/Applications/open-codesign.app</code>。)
142142
</p>
143143
</div>
144144
</template>

0 commit comments

Comments
 (0)