feat: TypeScript + Electron v2.0.0 构建系统完善
- 添加 vite.config.ts 构建配置 - 添加 tsconfig.main.json(主进程单独编译) - 修复主进程模块化(menu/tray 使用 setQuitting) - 修复渲染进程导入路径 - 删除旧版 JS/Web 文件(js/、electron/、sw.js、manifest.json) - 构建验证通过:NSIS 安装包 + 便携版
This commit is contained in:
+4
-6
@@ -2,8 +2,8 @@
|
||||
* Metona Ollama Desktop - 原生菜单
|
||||
*/
|
||||
|
||||
import { Menu, dialog, shell } from 'electron';
|
||||
import { mainWindow, isQuitting, getIconPath } from './main.js';
|
||||
import { Menu, dialog, shell, app } from 'electron';
|
||||
import { mainWindow, setQuitting, getIconPath } from './main.js';
|
||||
|
||||
export function createMenu(): void {
|
||||
const template: Electron.MenuItemConstructorOptions[] = [
|
||||
@@ -30,8 +30,7 @@ export function createMenu(): void {
|
||||
label: '退出',
|
||||
accelerator: 'Ctrl+Q',
|
||||
click: () => {
|
||||
const { app } = require('electron');
|
||||
(require('./main.js') as Record<string, unknown>).isQuitting = true;
|
||||
setQuitting();
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
@@ -112,8 +111,7 @@ export function createMenu(): void {
|
||||
}
|
||||
];
|
||||
|
||||
const IS_DEV = !require('electron').app.isPackaged;
|
||||
if (IS_DEV) {
|
||||
if (!app.isPackaged) {
|
||||
template.push({
|
||||
label: 'Dev',
|
||||
submenu: [
|
||||
|
||||
Reference in New Issue
Block a user