@jetthai/cuora 1.1.427-dev.3 → 1.1.427-hotfix

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,43 @@
4
4
 
5
5
  ---
6
6
 
7
- ## Step 1 — 檢查工作區狀態
7
+ ## Step 1 — 同步遠端分支
8
+
9
+ 檢查當前分支的遠端是否有更新:
10
+
11
+ ```bash
12
+ git fetch origin
13
+ git status
14
+ ```
15
+
16
+ 如果本地已經是最新(沒有 behind commits),直接進入 Step 2。
17
+
18
+ 如果遠端有更新(本地 behind),執行 pull:
19
+
20
+ ```bash
21
+ git pull
22
+ ```
23
+
24
+ 如果 pull 發生衝突:
25
+
26
+ 1. 取消 merge:
27
+ ```bash
28
+ git merge --abort
29
+ ```
30
+ 2. 告知使用者:「遠端有更新且與本地變更衝突,請先還原當前所有檔案的異動,還原完成後請回覆。」
31
+ 3. 等待使用者回覆。
32
+ 4. 使用者回覆後,重新執行 pull:
33
+ ```bash
34
+ git pull
35
+ ```
36
+ 5. Pull 成功後,告知使用者:「遠端同步完成,請將剛才還原的異動重新加回,完成後請回覆。」
37
+ 6. 等待使用者回覆確認已全部加回,再繼續後續流程。
38
+
39
+ 出現錯誤則停止,詢問使用者要怎麼做。
40
+
41
+ ---
42
+
43
+ ## Step 2 — 檢查工作區狀態
8
44
 
9
45
  ```bash
10
46
  git status
@@ -18,7 +54,7 @@ git status
18
54
 
19
55
  ---
20
56
 
21
- ## Step 2 — Stage 變更
57
+ ## Step 3 — Stage 變更
22
58
 
23
59
  將所有變更加入 staging area:
24
60
 
@@ -30,7 +66,7 @@ git add -A
30
66
 
31
67
  ---
32
68
 
33
- ## Step 3 — 選擇 Commit Message 方式
69
+ ## Step 4 — 選擇 Commit Message 方式
34
70
 
35
71
  使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
36
72
 
@@ -44,7 +80,7 @@ git add -A
44
80
 
45
81
  ---
46
82
 
47
- ## Step 4 — 生成 Commit Message
83
+ ## Step 5 — 生成 Commit Message
48
84
 
49
85
  根據使用者在 Step 3 的選擇執行:
50
86
 
@@ -55,7 +91,27 @@ git add -A
55
91
  - 格式:`type(scope): description`
56
92
  - type:feat / fix / refactor / style / docs / chore / perf / test
57
93
  - scope:根據變更的主要目錄或功能模組決定(可省略)
58
- - description:簡潔描述變更內容(英文)
94
+ - description:簡潔描述變更內容(中文)
95
+
96
+ 當變更涉及多個不同類型或模組時,自行分類並以條列式呈現:
97
+
98
+ ```
99
+ type(scope): 主要描述
100
+
101
+ - type(scope): 細項描述 1
102
+ - type(scope): 細項描述 2
103
+ - type(scope): 細項描述 3
104
+ ```
105
+
106
+ 例如:
107
+
108
+ ```
109
+ feat(payment): 新增加密貨幣存款功能
110
+
111
+ - feat(deposit): 新增 USDT 存款方式
112
+ - fix(withdraw): 修正提款金額驗證邏輯
113
+ - style(modal): 調整存款彈窗樣式
114
+ ```
59
115
 
60
116
  如果是選項 2,將生成的 message 顯示給使用者,等待使用者確認或提供修改後的版本。
61
117
 
@@ -71,7 +127,7 @@ git add -A
71
127
 
72
128
  ---
73
129
 
74
- ## Step 5 — 執行 Commit
130
+ ## Step 6 — 執行 Commit
75
131
 
76
132
  使用確定的 commit message 執行 commit:
77
133
 
@@ -89,20 +145,20 @@ git commit -m "<title>" -m "<body>"
89
145
 
90
146
  ---
91
147
 
92
- ## Step 6 — 確認是否 Push
148
+ ## Step 7 — 確認是否 Push
93
149
 
94
150
  使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
95
151
 
96
152
  - **Push** — 立即 push 到遠端
97
- - **不 Push** — 只 commit,不 push
153
+ - **Skip** — 跳過 push,僅完成 commit
98
154
 
99
155
  等待使用者選擇。
100
156
 
101
- 如果使用者選擇「不 Push」,跳過 push 直接進入 Step 8 完成回報。
102
-
103
157
  ---
104
158
 
105
- ## Step 7 — 執行 Push
159
+ ## Step 8 — 執行 Push(如使用者選擇 Push)
160
+
161
+ 如果使用者選擇 Skip,跳過此步驟直接到 Step 9。
106
162
 
107
163
  將 commit push 到遠端:
108
164
 
@@ -120,10 +176,10 @@ git push --set-upstream origin <current_branch>
120
176
 
121
177
  ---
122
178
 
123
- ## Step 8 — 完成回報
179
+ ## Step 9 — 完成回報
124
180
 
125
181
  顯示以下資訊:
126
182
 
127
183
  - 分支名稱
128
184
  - Commit message 內容
129
- - Push 結果(成功/失敗)
185
+ - Push 結果(成功/失敗/已跳過)
@@ -17,9 +17,7 @@
17
17
  "mcp__sentry__get_issue_details",
18
18
  "mcp__sentry__search_issues",
19
19
  "Bash(git add:*)",
20
- "Bash(git commit:*)",
21
- "Bash(git branch:*)",
22
- "Bash(git merge:*)"
20
+ "Bash(git commit:*)"
23
21
  ]
24
22
  }
25
23
  }
@@ -1,25 +1,29 @@
1
- # post-checkout receives: prev_HEAD new_HEAD checkout_type
2
- # checkout_type: 1 = branch checkout, 0 = file checkout
1
+ # post-checkout hook 接收參數:prev_HEAD new_HEAD checkout_type
2
+ # checkout_type:1 = 切換分支,0 = 切換檔案
3
3
  CHECKOUT_TYPE=$3
4
4
 
5
- # Only run on branch checkout, skip file checkout
5
+ # 僅在切換分支時執行,切換檔案時跳過
6
6
  [ "$CHECKOUT_TYPE" != "1" ] && exit 0
7
7
 
8
+ # 取得切換後的當前分支名稱
8
9
  CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
9
10
 
10
- TARGET_BRANCHES="dev qa"
11
+ # 僅針對 dev、qa、master 這三個目標分支執行自動拉取
12
+ TARGET_BRANCHES="dev qa master"
11
13
  match=0
12
14
  for branch in $TARGET_BRANCHES; do
13
15
  [ "$CURRENT_BRANCH" = "$branch" ] && match=1 && break
14
16
  done
15
17
 
16
18
  if [ "$match" = "1" ]; then
19
+ # 檢查本地是否有尚未推送的 commit,有的話跳過自動拉取(避免覆蓋本地變更)
17
20
  LOCAL_AHEAD=$(git rev-list --count origin/"$CURRENT_BRANCH"..HEAD 2>/dev/null || echo 0)
18
21
  if [ "$LOCAL_AHEAD" -gt 0 ]; then
19
22
  echo "You have $LOCAL_AHEAD unpushed commit(s) on '$CURRENT_BRANCH'. Skipping auto-pull."
20
23
  exit 0
21
24
  fi
22
25
 
26
+ # 自動從遠端拉取最新程式碼(使用 rebase 保持線性歷史)
23
27
  echo "Auto pulling '$CURRENT_BRANCH' from remote..."
24
28
  git pull --rebase origin "$CURRENT_BRANCH" || {
25
29
  echo "Failed to pull '$CURRENT_BRANCH'. Please resolve manually."
package/.husky/pre-commit CHANGED
@@ -1,4 +1,2 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
1
+ # 提交前自動格式化程式碼(Prettier),並將格式化後的變更加入暫存區
4
2
  npm run format && git add .
package/.husky/pre-push CHANGED
@@ -1,5 +1,27 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
1
+ # 從 stdin 偵測是否為 force push(非 fast-forward)
2
+ # pre-push hook 會收到:<local_ref> <local_sha> <remote_ref> <remote_sha>
3
+ IS_FORCE=false
4
+ while read local_ref local_sha remote_ref remote_sha; do
5
+ # 跳過新建分支或刪除分支的情況(sha 全為 0)
6
+ [ "$remote_sha" = "0000000000000000000000000000000000000000" ] && continue
7
+ [ "$local_sha" = "0000000000000000000000000000000000000000" ] && continue
8
+ # 若遠端 sha 不是本地 sha 的祖先,代表是 force push
9
+ if ! git merge-base --is-ancestor "$remote_sha" "$local_sha" 2>/dev/null; then
10
+ IS_FORCE=true
11
+ break
12
+ fi
13
+ done
3
14
 
15
+ # 取得當前分支名稱
16
+ BRANCH=$(git rev-parse --abbrev-ref HEAD)
17
+
18
+ # 在 dev/qa 分支的 force push 跳過所有 pre-push hook(避免干擾強制推送)
19
+ if [ "$IS_FORCE" = true ] && { [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; }; then
20
+ echo "Force push detected on $BRANCH, skipping pre-push hooks."
21
+ exit 0
22
+ fi
23
+
24
+ # 清理不合規的 tag(本地 + 遠端)
4
25
  sh scripts/clean-tags.sh
26
+ # 自動升版並發布(僅 dev/qa 分支會實際執行,$1 為遠端名稱)
5
27
  sh scripts/auto-version.sh "$1"
package/.prettierignore CHANGED
@@ -1,2 +1 @@
1
- dist/
2
- CHANGELOG.md
1
+ dist/
package/CHANGELOG.md CHANGED
@@ -2,79 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### [1.1.427-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.427-dev.2...v1.1.427-dev.3) (2026-04-09)
6
-
7
- ### [1.1.427-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.427-dev.1...v1.1.427-dev.2) (2026-04-09)
8
-
9
- ### [1.1.427-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.427-dev.1) (2026-04-09)
10
-
5
+ ### [1.1.427-hotfix](https://github.com/jetthai/cuora-module/compare/v1.1.427...v1.1.427-hotfix) (2026-04-14)
11
6
 
12
7
  ### Features
13
8
 
14
- * **scripts:** auto pull --rebase before push in branch-auto-npm-publish ([761f5c8](https://github.com/jetthai/cuora-module/commit/761f5c8ac653d0a1578cbc610b7c9b1798066875))
15
- * **scripts:** extend clean-tags to delete orphan and master-merged tags ([f24bc33](https://github.com/jetthai/cuora-module/commit/f24bc3337bcf558e67e613818ba5a79983675a26))
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * **scripts:** add --no-verify to git push in branch-auto-npm-publish to prevent pre-push hook infinite recursion ([4214aee](https://github.com/jetthai/cuora-module/commit/4214aeeed05834bce2537acd6ef816719c388b64))
21
- * **scripts:** add CHANGELOG.md to prettierignore to prevent format conflict with standard-version ([0cd508f](https://github.com/jetthai/cuora-module/commit/0cd508ff7fe91c4c6a4ed9df0a534ca3a0d6b731))
22
- * **scripts:** format and stage changes before standard-version to prevent rebase failure ([fbdd7f1](https://github.com/jetthai/cuora-module/commit/fbdd7f1f69a9576bb80c78607abf19dc19557cc6))
23
- * **scripts:** prevent infinite recursion in clean-tags pre-push hook ([5e9db84](https://github.com/jetthai/cuora-module/commit/5e9db84f1a655318b73839ab9a215f4dbe980772))
24
-
25
- ### [1.1.427-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.427...v1.1.427-dev.0) (2026-04-09)
26
-
27
-
28
- ### Bug Fixes
29
-
30
- * **scripts:** add CHANGELOG.md to prettierignore to prevent format conflict with standard-version ([0cd508f](https://github.com/jetthai/cuora-module/commit/0cd508ff7fe91c4c6a4ed9df0a534ca3a0d6b731))
31
- * **scripts:** format and stage changes before standard-version to prevent rebase failure ([fbdd7f1](https://github.com/jetthai/cuora-module/commit/fbdd7f1f69a9576bb80c78607abf19dc19557cc6))
32
-
33
- ### [1.1.426-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.426-dev.1...v1.1.426-dev.2) (2026-04-01)
34
-
35
-
36
- ### Bug Fixes
37
-
38
- * **scripts:** add CHANGELOG.md to prettierignore to prevent format conflict with standard-version ([d254b54](https://github.com/jetthai/cuora-module/commit/d254b54335c06b69f8af54d1bdb3f2995f75436f))
39
-
40
- ### [1.1.426-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.426-dev.0...v1.1.426-dev.1) (2026-04-01)
41
-
42
-
43
- ### Bug Fixes
44
-
45
- * **scripts:** format and stage changes before standard-version to prevent rebase failure ([b5cb701](https://github.com/jetthai/cuora-module/commit/b5cb70155a0eaf516f96b76e6790cf57d80886a2))
46
-
47
- ### [1.1.426-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.426-dev.0) (2026-04-01)
48
-
49
- ### Features
50
-
51
- - **scripts:** auto pull --rebase before push in branch-auto-npm-publish ([761f5c8](https://github.com/jetthai/cuora-module/commit/761f5c8ac653d0a1578cbc610b7c9b1798066875))
52
- - **scripts:** extend clean-tags to delete orphan and master-merged tags ([f24bc33](https://github.com/jetthai/cuora-module/commit/f24bc3337bcf558e67e613818ba5a79983675a26))
53
-
54
- ### Bug Fixes
55
-
56
- - **scripts:** add --no-verify to git push in branch-auto-npm-publish to prevent pre-push hook infinite recursion ([4214aee](https://github.com/jetthai/cuora-module/commit/4214aeeed05834bce2537acd6ef816719c388b64))
57
- - **scripts:** prevent infinite recursion in clean-tags pre-push hook ([5e9db84](https://github.com/jetthai/cuora-module/commit/5e9db84f1a655318b73839ab9a215f4dbe980772))
58
-
59
- ### [1.1.425-dev.4](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.3...v1.1.425-dev.4) (2026-03-31)
60
-
61
- ### [1.1.425-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.425-dev.3) (2026-03-31)
62
-
63
- ### Features
64
-
65
- - **scripts:** auto pull --rebase before push in branch-auto-npm-publish ([761f5c8](https://github.com/jetthai/cuora-module/commit/761f5c8ac653d0a1578cbc610b7c9b1798066875))
66
- - **scripts:** extend clean-tags to delete orphan and master-merged tags ([f24bc33](https://github.com/jetthai/cuora-module/commit/f24bc3337bcf558e67e613818ba5a79983675a26))
9
+ - **husky:** skip pre-push hooks on force push to dev/qa ([79e9df9](https://github.com/jetthai/cuora-module/commit/79e9df9bfd9335dca7d5aec590fa25d7580586ac))
67
10
 
68
11
  ### Bug Fixes
69
12
 
70
- - **scripts:** add --no-verify to git push in branch-auto-npm-publish to prevent pre-push hook infinite recursion ([4214aee](https://github.com/jetthai/cuora-module/commit/4214aeeed05834bce2537acd6ef816719c388b64))
71
- - **scripts:** prevent infinite recursion in clean-tags pre-push hook ([5e9db84](https://github.com/jetthai/cuora-module/commit/5e9db84f1a655318b73839ab9a215f4dbe980772))
13
+ - **withdraw:** 修正加密貨幣提款計算錯誤時的狀態轉移 ([3acbe09](https://github.com/jetthai/cuora-module/commit/3acbe0985bf5d4a85ccd02390c5f99092829c820))
72
14
 
73
- ### [1.1.425-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.1...v1.1.425-dev.2) (2026-03-31)
15
+ ### [1.1.427](https://github.com/jetthai/cuora-module/compare/v1.1.426...v1.1.427) (2026-04-07)
74
16
 
75
- ### [1.1.425-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.425-dev.0...v1.1.425-dev.1) (2026-03-30)
76
-
77
- ### [1.1.425-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.425-dev.0) (2026-03-30)
17
+ ### [1.1.426](https://github.com/jetthai/cuora-module/compare/v1.1.425...v1.1.426) (2026-03-31)
78
18
 
79
19
  ### Features
80
20
 
@@ -90,77 +30,7 @@ All notable changes to this project will be documented in this file. See [standa
90
30
 
91
31
  ### [1.1.424](https://github.com/jetthai/cuora-module/compare/v1.1.423...v1.1.424) (2026-03-17)
92
32
 
93
- ### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
94
-
95
- ### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
96
-
97
- ### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
98
-
99
- ### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
100
-
101
- ### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
102
-
103
- ### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
104
-
105
- ### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
106
-
107
- ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
108
-
109
- ### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
110
-
111
- ### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
112
-
113
- ### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
114
-
115
- ### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
116
-
117
- ### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
118
-
119
- ### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
120
-
121
- ### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
122
-
123
- ### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
124
-
125
- ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
126
-
127
- ### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
128
-
129
- ### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
130
-
131
- ### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
132
-
133
- ### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
134
-
135
- ### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
136
-
137
- ### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
138
-
139
- ### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
140
-
141
- ### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
142
-
143
- ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
144
-
145
- ### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
146
-
147
- ### [1.1.422-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.422-dev-1...v1.1.422-dev-2) (2026-03-17)
148
-
149
- ### [1.1.422-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.422-dev-1) (2026-03-16)
150
-
151
- ### [1.1.413-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-10...v1.1.413-dev-11) (2026-03-12)
152
-
153
- ### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
154
-
155
- ### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
156
-
157
- ### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
158
-
159
- ### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
160
-
161
- ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
162
-
163
- ### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
33
+ ### [1.1.423](https://github.com/jetthai/cuora-module/compare/v1.1.422...v1.1.423) (2026-03-17)
164
34
 
165
35
  ### [1.1.422](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.422) (2026-03-16)
166
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.427-dev.3",
3
+ "version": "1.1.427-hotfix",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -1,24 +1,23 @@
1
1
  #!/usr/bin/env node
2
- // Copyright 2024 The Terasology Foundation
3
2
 
4
- // Auto version bump for dev/qa branches
5
- // Format: {master version}-{branch}.{number}
6
- // Example: master=2.1.1, dev 5th push → 2.1.1-dev.5
3
+ // dev/qa 分支自動計算下一個 prerelease 版號
4
+ // 版號格式:{master 版號}-{分支名}.{遞增編號}
5
+ // 範例:master=2.1.1,dev 第 5 次推送 → 2.1.1-dev.5
7
6
  //
8
- // Called by auto-version.sh (pre-push hook)
9
- // Outputs new version to stdout; silent exit if no change needed
7
+ // 由 auto-version.sh(pre-push hook)呼叫
8
+ // 將新版號輸出至 stdout;若版號無需變更則靜默結束
10
9
 
11
10
  import { execSync } from 'node:child_process'
12
11
  import { readFileSync } from 'node:fs'
13
12
 
14
- // Only run on dev / qa branches
13
+ // 取得當前分支,僅在 dev/qa 分支執行
15
14
  const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
16
15
 
17
16
  if (branch !== 'dev' && branch !== 'qa') {
18
17
  process.exit(0)
19
18
  }
20
19
 
21
- // Get base version from origin/master, fallback to local master
20
+ // 從 origin/master 取得基礎版號,若失敗則退而使用本地 master
22
21
  let masterVersion
23
22
  try {
24
23
  masterVersion = JSON.parse(execSync('git show origin/master:package.json', { encoding: 'utf8' })).version
@@ -31,21 +30,22 @@ try {
31
30
  }
32
31
  }
33
32
 
33
+ // 讀取當前 package.json 版號,組合 prerelease 前綴
34
34
  const currentVersion = JSON.parse(readFileSync('package.json', 'utf8')).version
35
35
  const prefix = `${masterVersion}-${branch}.`
36
36
  let nextNum = 0
37
37
 
38
- // Derive next number from current version
39
- // e.g. currentVersion="2.1.1-dev.4" → nextNum=5
38
+ // 從當前版號推算下一個編號
39
+ // 例如 currentVersion="2.1.1-dev.4" → nextNum=5
40
40
  if (currentVersion.startsWith(prefix)) {
41
41
  const num = parseInt(currentVersion.slice(prefix.length), 10)
42
42
  if (!isNaN(num)) nextNum = num + 1
43
43
  }
44
44
 
45
- // Scan git log for the highest number ever used with this prefix
46
- // Prevents regression when merges overwrite currentVersion
47
- // e.g. after merge currentVersion="2.0.9-dev.20", but history has "2.1.1-dev.4"
48
- // → historyMax=4, nextNum=5 (instead of restarting from 0)
45
+ // 掃描 git log 找出該前綴歷史上使用過的最大編號
46
+ // 防止合併後版號回退(merge 可能覆寫 currentVersion)
47
+ // 例如:合併後 currentVersion="2.0.9-dev.20",但歷史中存在 "2.1.1-dev.4"
48
+ // → historyMax=4,nextNum=5(而非從 0 重新開始)
49
49
  try {
50
50
  const log = execSync(`git log ${branch} --pretty=%s --grep="^${masterVersion}-${branch}\\\\." -n 50`, {
51
51
  encoding: 'utf8',
@@ -59,9 +59,10 @@ try {
59
59
 
60
60
  const newVersion = `${prefix}${nextNum}`
61
61
 
62
- // No change needed
62
+ // 版號未變更,無需升版
63
63
  if (currentVersion === newVersion) {
64
64
  process.exit(0)
65
65
  }
66
66
 
67
+ // 輸出新版號供 auto-version.sh 使用
67
68
  console.log(newVersion)
@@ -1,15 +1,19 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # Auto version bump on dev/qa branches
4
- # Called from pre-push hook — receives remote name as $1
3
+ # 在 dev/qa 分支自動升版並發布
4
+ # 由 pre-push hook 呼叫,$1 為遠端名稱(預設 origin)
5
5
 
6
+ # 取得遠端名稱(未傳入則預設為 origin)
6
7
  REMOTE=${1:-origin}
8
+ # 取得當前分支名稱
7
9
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
8
10
 
11
+ # 僅在 dev 或 qa 分支執行自動升版流程
9
12
  if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
10
- # Compute next prerelease version (scans git log to prevent regression)
13
+ # 透過 Node 腳本計算下一個 prerelease 版號(會掃描 git log 避免版號回退)
11
14
  NEXT_VERSION=$(node scripts/auto-version.js)
12
15
 
16
+ # 若版號無變化,跳過發布流程
13
17
  if [ -z "$NEXT_VERSION" ]; then
14
18
  echo "Version unchanged, skipping release."
15
19
  exit 0
@@ -18,12 +22,12 @@ if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
18
22
  echo "Branch: $BRANCH"
19
23
  echo "Next version: $NEXT_VERSION"
20
24
 
21
- # Bump version, update CHANGELOG, create commit + tag
25
+ # 使用 standard-version 升版:更新 package.json 版號、產生 CHANGELOG、建立 commit + tag
22
26
  npx standard-version --release-as "$NEXT_VERSION"
23
27
 
24
- # Push + npm publish
28
+ # 推送到遠端並執行 npm publish
25
29
  node scripts/branch-auto-npm-publish.js "$REMOTE" "$BRANCH"
26
30
 
27
- # Abort the original git push (scripts already pushed)
31
+ # 以 exit 1 中斷原本的 git push(因為上面的腳本已經完成推送了)
28
32
  exit 1
29
33
  fi
@@ -1,21 +1,23 @@
1
+ // 自動推送 commit + tag 並發布到 npm
2
+ // 由 auto-version.sh 呼叫,接收參數:remote(遠端名稱)、branch(分支名稱)
3
+
1
4
  import { execSync } from 'node:child_process'
2
5
  import { readFileSync } from 'node:fs'
3
6
 
7
+ // 取得遠端名稱與分支名稱(預設為 origin 和當前分支)
4
8
  const remote = process.argv[2] || 'origin'
5
9
  const branch = process.argv[3] || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
6
10
 
11
+ // 讀取 package.json 中的版號(此時已被 standard-version 更新過)
7
12
  const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
8
13
 
9
14
  console.log(`Branch: ${branch}`)
10
15
  console.log(`Version: ${version}`)
11
16
 
12
- // Pull remote changes before push (avoid rejection)
13
- execSync(`git pull --rebase --no-verify ${remote} ${branch}`, { stdio: 'inherit' })
14
-
15
- // Push commit and tags
17
+ // 推送 commit 與 tag 到遠端(--no-verify 避免觸發 pre-push hook 造成無限迴圈)
16
18
  execSync(`git push --no-verify --follow-tags ${remote} ${branch}`, { stdio: 'inherit' })
17
19
 
18
- // Publish to npm with branch dist-tag
20
+ // 發布到 npm,使用分支名稱作為 dist-tag(例如 npm install @jetthai/cuora@dev)
19
21
  try {
20
22
  execSync(`npm publish --tag ${branch}`, { stdio: 'inherit' })
21
23
  console.log(`✅ npm publish succeeded: ${version} (tag: ${branch})`)
@@ -1,22 +1,24 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # Delete local and remote tags that do NOT match the compliant pattern
4
- # Compliant pattern: v1.2.3 (e.g., v0.1.0, v1.12.123)
3
+ # 清理不符合規範的 git tag(本地 + 遠端)
4
+ # 合規格式:v1.2.3(例如 v0.1.0、v1.12.123)
5
5
  #
6
- # Deletion rules (any match triggers deletion):
7
- # 1. Current branch is dev or qa
8
- # 2. Tag's commit is not reachable from any branch
9
- # 3. Tag's commit is already merged into master
6
+ # 刪除規則(符合任一條件即刪除):
7
+ # 1. 當前分支為 dev 或 qa
8
+ # 2. 該 tag 所指向的 commit 不屬於任何分支(孤立 commit)
9
+ # 3. 該 tag 所指向的 commit 已被合併進 master
10
10
  PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
11
11
 
12
+ # 取得當前分支名稱
12
13
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
13
14
 
14
- # Find the latest tag (by creation date) regardless of format
15
+ # 取得最新的 tag(依建立時間排序),無論格式是否合規都會保留
15
16
  LATEST_TAG=$(git tag -l --sort=-creatordate | head -n 1)
16
17
 
17
- # Collect non-compliant tags
18
+ # 篩選出所有不符合合規格式的 tag
18
19
  TAGS=$(git tag -l | grep -vE "$PATTERN")
19
20
 
21
+ # 若沒有不合規的 tag,直接結束
20
22
  if [ -z "$TAGS" ]; then
21
23
  echo "No non-compliant tags found."
22
24
  exit 0
@@ -24,7 +26,9 @@ fi
24
26
 
25
27
  echo "Latest tag (preserved): $LATEST_TAG"
26
28
 
29
+ # 逐一檢查每個不合規的 tag
27
30
  for TAG in $TAGS; do
31
+ # 最新的 tag 一律跳過,避免誤刪正在使用的版本
28
32
  if [ "$TAG" = "$LATEST_TAG" ]; then
29
33
  echo "Skipping tag $TAG (latest tag)"
30
34
  continue
@@ -33,13 +37,13 @@ for TAG in $TAGS; do
33
37
  SHOULD_DELETE=false
34
38
  REASON=""
35
39
 
36
- # Rule 1: Current branch is dev or qa
40
+ # 規則 1:當前在 dev 或 qa 分支,直接刪除所有不合規 tag
37
41
  if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
38
42
  SHOULD_DELETE=true
39
43
  REASON="on $BRANCH branch"
40
44
  fi
41
45
 
42
- # Rule 2: Tag's commit is not reachable from any branch
46
+ # 規則 2:該 tag 的 commit 不屬於任何分支(孤立的 commit)
43
47
  if [ "$SHOULD_DELETE" = false ]; then
44
48
  BRANCHES=$(git branch -a --contains "$TAG" 2>/dev/null)
45
49
  if [ -z "$BRANCHES" ]; then
@@ -48,7 +52,7 @@ for TAG in $TAGS; do
48
52
  fi
49
53
  fi
50
54
 
51
- # Rule 3: Tag's commit is already merged into master
55
+ # 規則 3:該 tag 的 commit 已合併進 master(代表該 tag 已無保留必要)
52
56
  if [ "$SHOULD_DELETE" = false ]; then
53
57
  if git merge-base --is-ancestor "$TAG" master 2>/dev/null; then
54
58
  SHOULD_DELETE=true
@@ -56,6 +60,7 @@ for TAG in $TAGS; do
56
60
  fi
57
61
  fi
58
62
 
63
+ # 執行刪除:先刪遠端再刪本地,遠端刪除失敗不中斷流程
59
64
  if [ "$SHOULD_DELETE" = true ]; then
60
65
  echo "Deleting tag $TAG ($REASON)"
61
66
  git push origin --delete "$TAG" --no-verify 2>/dev/null || true
@@ -120,9 +120,4 @@ export default {
120
120
  method: 'post',
121
121
  params: { startDate, endDate, appSecret },
122
122
  }),
123
- getMissionHistory: ({ activityNo, appSecret }) => ({
124
- url: 'activities/mission-history',
125
- method: 'get',
126
- params: { activityNo, appSecret },
127
- }),
128
123
  }
@@ -110,28 +110,6 @@ export default function (request) {
110
110
  },
111
111
  },
112
112
  otpChecking: {
113
- initial: 'pending',
114
- states: {
115
- pending: {
116
- after: {
117
- TIMEOUT: {
118
- target: 'fetching',
119
- },
120
- },
121
- },
122
- fetching: {
123
- invoke: {
124
- src: 'fetchUserInfo',
125
- onDone: {
126
- target: 'pending',
127
- actions: ['setUserInfo', 'extendToken'],
128
- },
129
- onError: {
130
- target: 'pending',
131
- },
132
- },
133
- },
134
- },
135
113
  on: {
136
114
  OTP_VERIFIED: {
137
115
  target: 'loginSuccess',
@@ -130,7 +130,7 @@ export default function (request, context) {
130
130
  },
131
131
  ],
132
132
  onError: {
133
- target: 'idle',
133
+ target: '#withdraw_crypto_cash.calculated',
134
134
  },
135
135
  },
136
136
  },