问题原因: - UI 文件 (index.html) 没有被复制到 dist 目录 - Electron 主进程加载路径不正确 修复内容: - 新增 scripts/copy-ui.js: 编译后复制 UI 文件到 dist/ui/ - 修改 electron-main.ts: - 修正 UI 文件加载路径为 'ui/index.html' - 添加 sandbox: false 配置 - 添加 ready-to-show 事件监听,避免窗口闪烁 - 修改 package.json: 在构建脚本中添加 copy-ui 步骤 使用说明: - npm run build: 自动编译并复制 UI 文件 - npm run dev:electron: 开发模式运行 Electron GUI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
84 lines
2.3 KiB
JSON
84 lines
2.3 KiB
JSON
{
|
|
"name": "impress-asr-input",
|
|
"version": "0.1.0",
|
|
"description": "基于 ONNX 的本地语音识别输入工具,支持多语言实时识别",
|
|
"main": "dist/main.js",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "tsx watch src/main.ts",
|
|
"build": "tsc && node scripts/copy-ui.js",
|
|
"start": "node dist/main.js",
|
|
"dev:electron": "tsc && node scripts/copy-ui.js && electron .",
|
|
"build:electron": "tsc && node scripts/copy-ui.js && electron-builder",
|
|
"build:win": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run build:electron -- --win --x64",
|
|
"build:win:zip": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ tsc && node scripts/copy-ui.js && electron-builder --win zip --x64 --publish=never",
|
|
"build:win:dir": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ tsc && node scripts/copy-ui.js && electron-builder --win --x64 --dir --publish=never",
|
|
"test": "vitest run",
|
|
"lint": "eslint src --ext .ts"
|
|
},
|
|
"keywords": [
|
|
"asr",
|
|
"speech-to-text",
|
|
"onnx",
|
|
"voice-input",
|
|
"electron"
|
|
],
|
|
"author": "",
|
|
"license": "MIT",
|
|
"devDependencies": {
|
|
"@types/node": "^20.11.0",
|
|
"cross-env": "^7.0.3",
|
|
"electron": "^28.0.0",
|
|
"electron-builder": "^24.9.0",
|
|
"tsx": "^4.22.3",
|
|
"typescript": "^5.3.0",
|
|
"vitest": "^1.2.0"
|
|
},
|
|
"dependencies": {
|
|
"clipboardy": "^4.0.0",
|
|
"commander": "^12.0.0",
|
|
"onnxruntime-web": "^1.17.0"
|
|
},
|
|
"build": {
|
|
"appId": "com.impress.asr-input",
|
|
"productName": "Impress ASR Input",
|
|
"buildVersion": "1.0.0",
|
|
"publish": null,
|
|
"directories": {
|
|
"output": "release",
|
|
"buildResources": "build"
|
|
},
|
|
"files": [
|
|
"dist/**/*",
|
|
"src/ui/**/*",
|
|
"models/**/*"
|
|
],
|
|
"extraResources": [
|
|
"models/*.onnx"
|
|
],
|
|
"win": {
|
|
"target": "zip",
|
|
"requestedExecutionLevel": "asInvoker",
|
|
"forceCodeSigning": false,
|
|
"artifactName": "${productName}-${version}-win-${arch}.${ext}"
|
|
},
|
|
"mac": {
|
|
"target": [
|
|
"dmg",
|
|
"zip"
|
|
],
|
|
"category": "public.app-category.utilities"
|
|
},
|
|
"linux": {
|
|
"target": [
|
|
"AppImage",
|
|
"deb"
|
|
],
|
|
"category": "Utility"
|
|
}
|
|
},
|
|
"engines": {
|
|
"node": ">=20.0.0"
|
|
}
|
|
}
|