Files
claude-pet/package.json
T
JianMiauandClaude Fable 5 3f92e102cc 打包時自動遞增版號,避免同版號重包
摘要:
dist 與 dist:portable 掛上 pre 腳本自動執行 npm version patch,版本 2.0.0 → 2.0.1。

根本原因:
產物檔名帶版號(Claude Pet-<版本>-setup.exe),但版號要靠人記得改。
實際上 2.0.0 被重包了兩次而版號沒動:一次沒有 hover 跳躍、一次有,
使用者回報「滑鼠停上面沒有 jump」時,無法從檔名判斷手上是哪一份,
必須另外比對檔案時間才能確認。

影響:
同一個版號可能對應內容不同的散布檔,回報問題與確認修正都會失準。

修法:
- package.json 新增 predist 與 predist:portable,內容為
  `npm version patch --no-git-tag-version`;npm 會在對應的 dist 腳本前自動執行。
- pack 不掛(它只產 win-unpacked 供開發驗證,不是散布檔)。
- README 的「打包成 exe」補上說明:版號自動遞增、不要繞過、
  要升 minor/major 就先手動 npm version。

驗證:
執行 npm run dist,package.json 由 2.0.0 自動變成 2.0.1,
產物檔名同步為 Claude Pet-2.0.1-*;以 ELECTRON_RUN_AS_NODE 讀打包後的 app.asar
確認內含版本為 2.0.1,exe 的 FileVersion 亦為 2.0.1,
且 hover 跳躍、矩形判定、右鍵選單都還在。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 16:29:15 +08:00

90 lines
2.2 KiB
JSON
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.
{
"name": "claude-pet",
"version": "2.0.1",
"description": "Codex Pets 相容的 Claude Code 桌面寵物(spriteVersionNumber 29 個動作列 + 16 方向追視)",
"main": "main.js",
"private": true,
"scripts": {
"start": "electron .",
"hooks:install": "node scripts/install-hooks.js",
"hooks:uninstall": "node scripts/uninstall-hooks.js",
"autostart:install": "node scripts/autostart.js install",
"autostart:uninstall": "node scripts/autostart.js uninstall",
"autostart:status": "node scripts/autostart.js status",
"predist": "npm version patch --no-git-tag-version",
"dist": "electron-builder --win",
"pack": "electron-builder --win --dir",
"predist:portable": "npm version patch --no-git-tag-version",
"dist:portable": "electron-builder --win portable"
},
"devDependencies": {
"electron": "^43.4.1",
"electron-builder": "^26.0.12"
},
"author": "JianMiau",
"build": {
"appId": "com.jianmiau.claude-pet",
"productName": "Claude Pet",
"copyright": "JianMiau",
"directories": {
"output": "dist",
"buildResources": "build"
},
"files": [
"main.js",
"preload.js",
"renderer/**/*",
"lib/**/*",
"hook/**/*",
"package.json"
],
"asarUnpack": [
"hook/**/*"
],
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
},
{
"target": "portable",
"arch": [
"x64"
]
},
{
"target": "zip",
"arch": [
"x64"
]
}
],
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "Claude Pet",
"deleteAppDataOnUninstall": false,
"artifactName": "${productName}-${version}-setup.${ext}"
},
"portable": {
"artifactName": "${productName}-${version}-portable.${ext}",
"unpackDirName": "ClaudePet",
"requestExecutionLevel": "user"
},
"extraFiles": [
{
"from": "pets",
"to": "pets"
}
]
}
}