feat: Refactor frontend project for Electron integration and build pr…#2
Open
feat: Refactor frontend project for Electron integration and build pr…#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the frontend project to support Electron integration and implements a comprehensive build process for creating desktop applications. The changes include adding Electron main and preload scripts, configuring electron-builder, updating the Vite configuration for Electron compatibility, and creating build automation scripts.
Changes:
- Added Electron support with main and preload scripts for desktop application functionality
- Configured package.json with electron-builder settings for Windows, macOS, and Linux builds
- Updated Vite configuration to use relative paths and add path aliases for Electron compatibility
- Created Python build automation script for end-to-end application building
Reviewed changes
Copilot reviewed 9 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/vite.config.js | Added path alias, relative base path, and build optimization for Electron |
| frontend/src/types/electron.d.ts | TypeScript definitions for Electron API |
| frontend/src/api/index.js | Dynamic API base URL detection for dev/prod environments |
| frontend/package.json | Added Electron dependencies and build configuration |
| frontend/electron/main.cjs | Electron main process managing backend lifecycle and window |
| frontend/electron/preload.cjs | Preload script exposing safe APIs to renderer |
| build_app.py | Python script automating backend and frontend build process |
| frontend/ELECTRON.md | Comprehensive documentation for Electron setup |
| frontend/.gitignore | Git ignore patterns for build artifacts |
| frontend/components.d.ts | Auto-generated component type definitions |
| frontend/auto-imports.d.ts | Auto-generated import type definitions |
| frontend/build-resources/README.md | Documentation for build resources |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| python build_app.py [--skip-backend] [--skip-frontend] [--target windows|mac|linux] | ||
| """ | ||
|
|
||
| import os |
There was a problem hiding this comment.
Import of 'os' is not used.
Suggested change
| import os |
feat(core): 实现动态数据目录配置支持打包环境 - 添加 get_data_dir() 函数,区分开发环境和打包后环境的数据目录路径 - 将 DATABASE_URL、SESSION_DIR、STATION_FILE 等配置改为动态属性, 使用统一的数据目录 - 更新 ensure_directories() 函数,确保所有必要目录创建 - 添加日志相关配置项 LOG_LEVEL、TERMINAL_LOG_BUFFER_SIZE、LOG_DIR feat(electron): 实现后端端口自动发现和URL传递机制 - 添加 findAvailablePort() 函数,支持端口冲突时自动选择可用端口 - 修改后端启动逻辑,通过环境变量传递端口信息 - 实现主进程向渲染进程传递后端URL的机制 - 更新预加载脚本,支持同步获取后端URL feat(api): 添加后端日志终端输出WebSocket接口 - 新增 logs 路由模块,提供终端日志WebSocket接口 - 实现 terminal_logs 模块,捕获和转发终端输出 - 在应用生命周期中安装/卸载终端日志捕获 - 更新构建脚本,修正数据文件复制路径 feat(frontend): 添加后端日志页面和WebSocket连接支持 - 创建 Logs.vue 页面,显示后端终端日志输出 - 实现 WebSocket 连接终端日志流功能 - 更新 axios 配置,支持动态获取后端URL - 添加菜单项导航到日志页面 - 配置 Vite 代理支持 WebSocket 连接 refactor(build): 优化构建脚本路径配置 - 修正 build_exe.py 中的构建路径,从 backend/* 移除前缀 - 更新数据文件复制路径,确保打包后资源正确放置 - 统一路径处理逻辑,支持开发和生产环境 ```
- 新增完整的Electron桌面应用打包文档说明 - 实现Python构建脚本支持后端PyInstaller打包 - 集成Electron Builder实现一键构建Windows安装包 - 添加后端进程管理和健康检查机制 fix(cors): 支持Electron file协议跨域访问 - 添加null和file://协议到CORS白名单 - 解决Electron环境下API请求跨域问题 refactor(build): 优化后端构建脚本和错误处理 - 改进build_exe.py的错误处理和重试机制 - 添加构建状态文件记录和日志输出 - 修复PyInstaller隐藏导入模块问题 refactor(main): 简化启动日志输出格式 - 移除不必要的火车表情符号 - 统一服务启动日志格式 refactor(electron): 重构主进程后端启动逻辑 - 添加后端服务健康检查和等待机制 - 优化进程管理和错误处理 - 改进开发模式下的调试体验 chore(config): 调整Vue路由为hash模式 - 切换路由历史模式为hash模式以支持Electron环境
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ocess