会议室那台电脑是 Windows 7 x64。Electron 从 23 起不再支持 Windows 7/8/8.1
(Chromium 用到了 Win7 没有的 API,典型报错是 GetPackageFamilyName 找不到入口点)。
客观对比(同一份代码、只换 Electron 版本,用 file 读 PE 子系统版本):
Electron 38 → PE32+ executable for MS Windows 10.00 ← 声明需要 Win10
Electron 22 → PE32+ executable for MS Windows 5.02 ← 兼容到 XP 时代
代码零改动(我们只用基础 API:BrowserWindow frame/resizable/setAlwaysOnTop/setBounds、
screen.getAllDisplays、contextBridge、ipcMain/ipcRenderer);152 条测试不受影响。
Electron 22 在 Windows 10/11 上同样能跑,所以这一版两边通吃,只是**不能让 Win7 用 38**。
⚠️ 以后想升级 Electron 的话:23 以上会议室那台就起不来了。
76 lines
1.8 KiB
JSON
76 lines
1.8 KiB
JSON
{
|
|
"name": "clocklab",
|
|
"version": "1.0.0",
|
|
"description": "ClockLab - 可调速桌面时钟(数字/表盘,支持倍率、暂停、倒转、快进)",
|
|
"author": "AskaEth",
|
|
"license": "MIT",
|
|
"private": true,
|
|
"main": "main.js",
|
|
"scripts": {
|
|
"start": "electron .",
|
|
"selftest": "electron . --selftest",
|
|
"test": "node test/clock-model.test.js && node test/resize.test.js && node test/presented-time.test.js && node test/renderer-clock.dom-test.js && node test/renderer-clock-anim.dom-test.js && node test/renderer-control.dom-test.js",
|
|
"dist:win": "electron-builder --win --x64",
|
|
"dist:linux": "electron-builder --linux --arm64"
|
|
},
|
|
"devDependencies": {
|
|
"electron": "22.3.27",
|
|
"electron-builder": "26.16.1"
|
|
},
|
|
"build": {
|
|
"appId": "com.askasoft.clocklab",
|
|
"productName": "ClockLab",
|
|
"directories": {
|
|
"output": "dist",
|
|
"buildResources": "build"
|
|
},
|
|
"files": [
|
|
"main.js",
|
|
"preload.js",
|
|
"src/**/*",
|
|
"renderer/**/*",
|
|
"!**/*.md"
|
|
],
|
|
"win": {
|
|
"icon": "build/icon.ico",
|
|
"artifactName": "ClockLab-${version}-${arch}.${ext}",
|
|
"target": [
|
|
{
|
|
"target": "portable",
|
|
"arch": [
|
|
"x64"
|
|
]
|
|
},
|
|
{
|
|
"target": "zip",
|
|
"arch": [
|
|
"x64"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"portable": {
|
|
"artifactName": "ClockLab-${version}-portable-x64.exe"
|
|
},
|
|
"linux": {
|
|
"icon": "build/icon.png",
|
|
"category": "Utility",
|
|
"artifactName": "ClockLab-${version}-${arch}.${ext}",
|
|
"target": [
|
|
{
|
|
"target": "tar.gz",
|
|
"arch": [
|
|
"arm64"
|
|
]
|
|
},
|
|
{
|
|
"target": "AppImage",
|
|
"arch": [
|
|
"arm64"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|