mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-22 11:28:46 +08:00
- 新建 desktop/ 作为独立 Electron 项目,包含独立 package.json 和 pnpm-lock.yaml - 迁移 electron/main.cjs、electron/preload.cjs、构建配置及打包脚本 - frontend/ 仅保留 Web 前端代码,移除所有 Electron 相关依赖和脚本 - 更新 CI workflow 和 .gitignore 路径指向 desktop/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
809 B
JavaScript
22 lines
809 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* 将 frontend 的 Vite 构建结果复制到 desktop/web-dist,供 electron-builder.full 打入安装包。
|
|
*/
|
|
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs"
|
|
import path from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
|
|
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..")
|
|
const src = path.join(root, "..", "frontend", "dist")
|
|
const dest = path.join(root, "web-dist")
|
|
|
|
if (!existsSync(path.join(src, "index.html"))) {
|
|
console.error("[sync-web-dist] 缺少 ../frontend/dist/index.html,请先执行:pnpm electron:build:dist")
|
|
process.exit(1)
|
|
}
|
|
|
|
rmSync(dest, { recursive: true, force: true })
|
|
mkdirSync(dest, { recursive: true })
|
|
cpSync(src, dest, { recursive: true })
|
|
console.log(`[sync-web-dist] 已同步 ${src} -> ${dest}`)
|