refactor(desktop): 从 Tauri 迁移到 Electrobun

- 移除 Tauri v2 代码 (src-tauri/, copy.ts)
- 添加 Electrobun 配置和入口 (electrobun.config.ts, src/bun/index.ts)
- 更新 package.json 使用 catalog 管理 electrobun 依赖
- 移除 server 中的 @tauri-apps/api 依赖
- 更新 AGENTS.md 文档
This commit is contained in:
2026-02-07 05:04:53 +08:00
parent 9aa3b46ee5
commit 29969550ed
38 changed files with 332 additions and 6296 deletions

View File

@@ -0,0 +1,49 @@
import Electrobun, { BrowserWindow } from 'electrobun/bun'
const DEV_SERVER_URL = 'http://localhost:3000'
async function waitForServer(url: string, timeoutMs = 30000): Promise<boolean> {
const start = Date.now()
while (Date.now() - start < timeoutMs) {
try {
const response = await fetch(url, { method: 'HEAD' })
if (response.ok) return true
} catch {
await Bun.sleep(100)
}
}
return false
}
async function main() {
console.log('Starting Furtherverse Desktop...')
console.log('Waiting for dev server at', DEV_SERVER_URL)
const ready = await waitForServer(DEV_SERVER_URL)
if (!ready) {
console.error(
'Dev server not responding. Make sure to run: cd apps/server && bun dev',
)
process.exit(1)
}
console.log('Dev server ready!')
new BrowserWindow({
title: 'Furtherverse',
url: DEV_SERVER_URL,
frame: {
x: 100,
y: 100,
width: 1200,
height: 800,
},
})
Electrobun.events.on('will-quit', () => console.log('Quitting...'))
}
main().catch((error) => {
console.error('Failed to start:', error)
process.exit(1)
})