c3eb079fdb
自测 (scripts/selftest/main.ts) 是从**源码**跑的, 用 pty 桩, 根本不碰 app.asar。 而 asarUnpack 配错这类问题只在**打包产物**上才暴露, 且 Linux 上看不出来 (只需要一个 .node, Electron 能 dlopen 归档里的; 但 unpacked 里没有就彻底找不到), 到 Windows 才炸 (conpty.dll / OpenConsole.exe / worker 脚本都必须是真实文件)。 新增 scripts/selftest/packaging-check.cjs (npm run selftest:package): - node-pty 平台包的 prebuilds 下必须有 .node/.dll/.exe (即规则递归生效) - 其它原生模块 (node-hid / serialport / node-usb) 也要解包 - 从 app.asar 里 require node-pty 并真实 spawn, 验证拿到输出 已用人为破坏的解包布局验证过这个检查确实会失败: "平台包的 prebuilds 下没有任何原生文件 —— 规则可能没递归" "Failed to load native module: pty.node"
128 lines
4.8 KiB
JSON
128 lines
4.8 KiB
JSON
{
|
|
"name": "local-net-msg",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "局域网即时通讯 (Electron + Vue 3) - 飞书风格",
|
|
"homepage": "https://github.com/localnetmsg/local-net-msg",
|
|
"author": "LocalNetMsg <dev@localnetmsg.local>",
|
|
"main": "out/main/index.js",
|
|
"scripts": {
|
|
"dev": "electron-vite dev",
|
|
"build": "electron-vite build",
|
|
"preview": "electron-vite preview",
|
|
"start": "electron-vite preview",
|
|
"typecheck:node": "tsc --noEmit -p tsconfig.node.json",
|
|
"typecheck:web": "vue-tsc --noEmit -p src/renderer/tsconfig.json",
|
|
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
|
"selftest:build": "esbuild scripts/selftest/main.ts --bundle --platform=node --format=cjs --target=node20 --outfile=scripts/selftest/.out/selftest.cjs --alias:electron=./scripts/selftest/electron-stub.cjs --alias:@lydell/node-pty=./scripts/selftest/pty-shim.cjs --external:better-sqlite3 --external:serialport --external:usb --external:node-hid --external:sudo-prompt --external:ws",
|
|
"selftest": "npm run selftest:build && cross-env ELECTRON_RUN_AS_NODE=1 electron scripts/selftest/.out/selftest.cjs",
|
|
"selftest:package": "cross-env ELECTRON_RUN_AS_NODE=1 electron scripts/selftest/packaging-check.cjs",
|
|
"package:win": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ electron-vite build && electron-builder --win --x64",
|
|
"package:mac": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ electron-vite build && electron-builder --mac",
|
|
"package:linux": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ electron-vite build && electron-builder --linux",
|
|
"package:dir": "cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ electron-vite build && electron-builder --dir",
|
|
"postinstall": "electron-builder install-app-deps"
|
|
},
|
|
"dependencies": {
|
|
"@element-plus/icons-vue": "^2.3.1",
|
|
"@lydell/node-pty": "^1.2.0-beta.12",
|
|
"@xterm/addon-fit": "^0.11.0",
|
|
"@xterm/addon-web-links": "^0.12.0",
|
|
"@xterm/xterm": "^6.0.0",
|
|
"better-sqlite3": "^11.5.0",
|
|
"electron-store": "^8.2.0",
|
|
"element-plus": "^2.8.4",
|
|
"highlight.js": "^11.10.0",
|
|
"markdown-it": "^14.3.0",
|
|
"node-hid": "^3.3.0",
|
|
"pinia": "^2.2.4",
|
|
"serialport": "^13.0.0",
|
|
"sudo-prompt": "^9.2.1",
|
|
"usb": "^3.0.1",
|
|
"ws": "^8.18.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/better-sqlite3": "^7.6.11",
|
|
"@types/markdown-it": "^14.1.2",
|
|
"@types/node": "^22.7.5",
|
|
"@types/ws": "^8.5.12",
|
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
"cross-env": "^7.0.3",
|
|
"electron": "^32.1.2",
|
|
"electron-builder": "^24.13.3",
|
|
"electron-vite": "^2.3.0",
|
|
"typescript": "^5.6.2",
|
|
"vite": "^5.4.8",
|
|
"vue": "^3.5.10",
|
|
"vue-router": "^4.4.5",
|
|
"vue-tsc": "^2.1.6"
|
|
},
|
|
"build": {
|
|
"appId": "com.localnetmsg.app",
|
|
"productName": "LocalNetMsg",
|
|
"copyright": "Copyright © 2026",
|
|
"directories": {
|
|
"output": "dist-Electron",
|
|
"buildResources": "resources"
|
|
},
|
|
"npmRebuild": false,
|
|
"files": [
|
|
"out/**/*",
|
|
"package.json"
|
|
],
|
|
"asarUnpack": [
|
|
"**/node_modules/@lydell/node-pty/**/*",
|
|
"**/node_modules/@lydell/node-pty-*/**/*",
|
|
"**/node_modules/@node-usb/**/*",
|
|
"**/node_modules/usb/prebuilds/**/*",
|
|
"**/node_modules/@serialport/**/prebuilds/**/*",
|
|
"**/node_modules/node-hid/prebuilds/**/*"
|
|
],
|
|
"extraResources": [
|
|
{
|
|
"from": "resources/icon.png",
|
|
"to": "icon.png"
|
|
}
|
|
],
|
|
"win": {
|
|
"icon": "resources/icon.png",
|
|
"target": [
|
|
{
|
|
"target": "nsis",
|
|
"arch": [
|
|
"x64"
|
|
]
|
|
}
|
|
],
|
|
"artifactName": "${productName}-${version}-Setup.${ext}"
|
|
},
|
|
"nsis": {
|
|
"oneClick": false,
|
|
"perMachine": false,
|
|
"allowElevation": true,
|
|
"allowToChangeInstallationDirectory": true,
|
|
"createDesktopShortcut": true,
|
|
"createStartMenuShortcut": true,
|
|
"shortcutName": "LocalNetMsg"
|
|
},
|
|
"mac": {
|
|
"icon": "resources/icon.png",
|
|
"target": "dmg",
|
|
"category": "public.app-category.social-networking"
|
|
},
|
|
"linux": {
|
|
"icon": "resources/icons",
|
|
"target": [
|
|
"deb"
|
|
],
|
|
"category": "Network",
|
|
"synopsis": "LAN instant messaging",
|
|
"description": "LocalNetMsg — a LAN instant messaging desktop app.",
|
|
"maintainer": "LocalNetMsg <dev@localnetmsg.local>",
|
|
"desktop": {
|
|
"StartupWMClass": "local-net-msg"
|
|
}
|
|
}
|
|
}
|
|
}
|