打包時自動遞增版號,避免同版號重包
摘要: 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>
This commit is contained in:
@@ -323,6 +323,12 @@ npm run dist:portable # 只做免安裝單檔
|
|||||||
npm run pack # 只產 win-unpacked 資料夾,最快,改程式時驗證用
|
npm run pack # 只產 win-unpacked 資料夾,最快,改程式時驗證用
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> **版號會自動遞增**
|
||||||
|
> `dist` 與 `dist:portable` 都掛了 `pre` 腳本執行 `npm version patch --no-git-tag-version`,
|
||||||
|
> 每次打包 patch 版號自動 +1。**產物檔名帶版號,同版號重包會讓人分不清手上是哪一份**,
|
||||||
|
> 所以不要繞過這個機制。要改 minor / major 就先手動 `npm version minor --no-git-tag-version`。
|
||||||
|
> `pack` 不遞增(它只產 `win-unpacked` 供開發驗證,不是散布用的檔案)。
|
||||||
|
|
||||||
產物在 `dist\`:
|
產物在 `dist\`:
|
||||||
|
|
||||||
| 檔案 | 大小 | 說明 |
|
| 檔案 | 大小 | 說明 |
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claude-pet",
|
"name": "claude-pet",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "Codex Pets 相容的 Claude Code 桌面寵物(spriteVersionNumber 2:9 個動作列 + 16 方向追視)",
|
"description": "Codex Pets 相容的 Claude Code 桌面寵物(spriteVersionNumber 2:9 個動作列 + 16 方向追視)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -11,8 +11,10 @@
|
|||||||
"autostart:install": "node scripts/autostart.js install",
|
"autostart:install": "node scripts/autostart.js install",
|
||||||
"autostart:uninstall": "node scripts/autostart.js uninstall",
|
"autostart:uninstall": "node scripts/autostart.js uninstall",
|
||||||
"autostart:status": "node scripts/autostart.js status",
|
"autostart:status": "node scripts/autostart.js status",
|
||||||
|
"predist": "npm version patch --no-git-tag-version",
|
||||||
"dist": "electron-builder --win",
|
"dist": "electron-builder --win",
|
||||||
"pack": "electron-builder --win --dir",
|
"pack": "electron-builder --win --dir",
|
||||||
|
"predist:portable": "npm version patch --no-git-tag-version",
|
||||||
"dist:portable": "electron-builder --win portable"
|
"dist:portable": "electron-builder --win portable"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user