057285ed89
配置 electron-builder files 仅打 out 产物,移除未用依赖并将 Vue 生态移至 devDependencies;koffi 仅解包 win32_x64 并在 afterPack 裁剪;打包前清理旧 zip。
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
const fs = require('fs')
|
||
const path = require('path')
|
||
|
||
const nativeDir = path.join(__dirname, '..', 'resources', 'native')
|
||
const required = [
|
||
'workDll.dll',
|
||
'FCSDK.dll',
|
||
'SeaorySDK.dll',
|
||
'dcrf32.dll',
|
||
'Entry.dll',
|
||
'libpng16.dll',
|
||
'zint.dll',
|
||
'freetype.dll',
|
||
'opencv_world490d.dll'
|
||
]
|
||
|
||
const opencvRelease = path.join(nativeDir, 'opencv_world490.dll')
|
||
const opencvDebug = path.join(nativeDir, 'opencv_world490d.dll')
|
||
if (fs.existsSync(opencvRelease)) {
|
||
console.warn('提示: 检测到 opencv_world490.dll,生产环境建议用 Release 版替换 Debug 版 opencv_world490d.dll 以减小体积')
|
||
} else if (fs.existsSync(opencvDebug)) {
|
||
const mb = Math.round(fs.statSync(opencvDebug).size / 1024 / 1024)
|
||
console.warn(`提示: 当前使用 Debug 版 OpenCV (${mb} MB),可从 docs/API/lib 换 Release 版 opencv_world490.dll`)
|
||
}
|
||
|
||
const missing = required.filter((name) => !fs.existsSync(path.join(nativeDir, name)))
|
||
if (missing.length) {
|
||
console.error(`resources/native 缺少: ${missing.join(', ')}`)
|
||
console.error('请从 docs/API/lib 复制完整 native 依赖(不含 .lib)')
|
||
process.exit(1)
|
||
}
|
||
console.log(`resources/native: ${required.length} dll 齐全`)
|