// electron-builder afterPack 钩子:把 package.json 版本号写入 exe 同级 shell.version。 // shell-updater 靠这个文件判定"打包态 + 本机版本",缺失会被误判为源码开发模式、 // 不参与壳子自更新(win-unpacked 根目录 = 安装后 exe 同级目录)。 "use strict"; const fs = require("fs"); const path = require("path"); exports.default = async function afterPack(context) { const pkg = require(path.join(__dirname, "..", "package.json")); const target = path.join(context.appOutDir, "shell.version"); fs.writeFileSync(target, `${pkg.version}\n`, "utf-8"); console.log(`[after-pack] shell.version -> ${target} (${pkg.version})`); };