impress_asr_input/scripts/prepare-build.js
impressionyang 7c51542918 Initial commit: Impress ASR Input 项目基础框架
功能:
- 基于 ONNX 的语音识别引擎
- 多语言支持(中文、英文、日语、韩语)
- 模型加载器(支持 SenseVoice/Whisper/Paraformer)
- 音频采集和处理模块(VAD、重采样、归一化)
- 文本输出模块(剪贴板)
- CLI 命令行工具
- Electron GUI 界面
- Windows x64 打包配置

文档:
- PRD 产品需求文档
- README 项目说明
- 开发指南
- Windows 构建指南

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 16:10:11 +08:00

78 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 构建脚本:准备 Windows 打包
*/
import { mkdirSync, existsSync, writeFileSync } from 'fs';
import { join } from 'path';
const rootDir = process.cwd();
const buildDir = join(rootDir, 'build');
const modelsDir = join(rootDir, 'models');
console.log('🔧 准备 Windows 打包...\n');
// 创建 build 目录
if (!existsSync(buildDir)) {
mkdirSync(buildDir, { recursive: true });
console.log('✅ 创建 build 目录');
}
// 创建占位图标文件(实际使用时应替换为真实图标)
const icoPath = join(buildDir, 'icon.ico');
if (!existsSync(icoPath)) {
// 创建一个简单的占位文件
writeFileSync(icoPath, '');
console.log('⚠️ 图标文件不存在,已创建占位文件');
console.log(' 请替换为真实的 icon.ico 文件 (256x256 推荐)');
}
// 检查模型文件
const modelFiles = ['sensevoice.onnx', 'whisper.onnx', 'paraformer.onnx'];
const foundModels = [];
const missingModels = [];
for (const model of modelFiles) {
const modelPath = join(modelsDir, model);
if (existsSync(modelPath)) {
foundModels.push(model);
} else {
missingModels.push(model);
}
}
console.log('📦 模型文件检查:');
if (foundModels.length > 0) {
console.log(` ✅ 找到:${foundModels.join(', ')}`);
}
if (missingModels.length > 0) {
console.log(` ⚠️ 缺失:${missingModels.join(', ')}`);
console.log(' 模型文件将被打包,但需要用户自行下载');
}
// 创建 Windows 安装包说明
const readmePath = join(buildDir, 'BUILD_README.txt');
writeFileSync(readmePath, `Impress ASR Input - Windows 打包说明
=====================================
构建命令:
npm run build:win - 创建 NSIS 安装程序和 ZIP 包
npm run build:win:dir - 仅创建未打包的文件目录
输出位置:
release/Impress ASR Input-0.1.0-win-x64-setup.exe (安装程序)
release/Impress ASR Input-0.1.0-win-x64.zip (压缩包)
模型文件:
请将下载的 ONNX 模型放入 models/ 目录
支持的模型sensevoice.onnx, whisper.onnx, paraformer.onnx
图标文件:
请将 icon.ico (256x256) 放入 build/ 目录
`);
console.log('\n✅ 打包准备完成');
console.log('\n下一步:');
console.log(' 1. 将模型文件放入 models/ 目录 (可选)');
console.log(' 2. 将 icon.ico 放入 build/ 目录 (可选)');
console.log(' 3. 运行npm run build:win');