@jetthai/cuora 1.1.427-hotfix → 1.1.427-qa.0

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,43 +4,7 @@
4
4
 
5
5
  ---
6
6
 
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 — 檢查工作區狀態
7
+ ## Step 1 — 檢查工作區狀態
44
8
 
45
9
  ```bash
46
10
  git status
@@ -54,7 +18,7 @@ git status
54
18
 
55
19
  ---
56
20
 
57
- ## Step 3 — Stage 變更
21
+ ## Step 2 — Stage 變更
58
22
 
59
23
  將所有變更加入 staging area:
60
24
 
@@ -66,7 +30,7 @@ git add -A
66
30
 
67
31
  ---
68
32
 
69
- ## Step 4 — 選擇 Commit Message 方式
33
+ ## Step 3 — 選擇 Commit Message 方式
70
34
 
71
35
  使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
72
36
 
@@ -80,7 +44,7 @@ git add -A
80
44
 
81
45
  ---
82
46
 
83
- ## Step 5 — 生成 Commit Message
47
+ ## Step 4 — 生成 Commit Message
84
48
 
85
49
  根據使用者在 Step 3 的選擇執行:
86
50
 
@@ -91,27 +55,7 @@ git add -A
91
55
  - 格式:`type(scope): description`
92
56
  - type:feat / fix / refactor / style / docs / chore / perf / test
93
57
  - scope:根據變更的主要目錄或功能模組決定(可省略)
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
- ```
58
+ - description:簡潔描述變更內容(英文)
115
59
 
116
60
  如果是選項 2,將生成的 message 顯示給使用者,等待使用者確認或提供修改後的版本。
117
61
 
@@ -127,7 +71,7 @@ feat(payment): 新增加密貨幣存款功能
127
71
 
128
72
  ---
129
73
 
130
- ## Step 6 — 執行 Commit
74
+ ## Step 5 — 執行 Commit
131
75
 
132
76
  使用確定的 commit message 執行 commit:
133
77
 
@@ -145,20 +89,20 @@ git commit -m "<title>" -m "<body>"
145
89
 
146
90
  ---
147
91
 
148
- ## Step 7 — 確認是否 Push
92
+ ## Step 6 — 確認是否 Push
149
93
 
150
94
  使用 `AskUserQuestion` 工具顯示選單,讓使用者從以下選項中選擇:
151
95
 
152
96
  - **Push** — 立即 push 到遠端
153
- - **Skip** — 跳過 push,僅完成 commit
97
+ - **不 Push** — 只 commit,不 push
154
98
 
155
99
  等待使用者選擇。
156
100
 
157
- ---
101
+ 如果使用者選擇「不 Push」,跳過 push 直接進入 Step 8 完成回報。
158
102
 
159
- ## Step 8 — 執行 Push(如使用者選擇 Push)
103
+ ---
160
104
 
161
- 如果使用者選擇 Skip,跳過此步驟直接到 Step 9。
105
+ ## Step 7 — 執行 Push
162
106
 
163
107
  將 commit push 到遠端:
164
108
 
@@ -176,10 +120,10 @@ git push --set-upstream origin <current_branch>
176
120
 
177
121
  ---
178
122
 
179
- ## Step 9 — 完成回報
123
+ ## Step 8 — 完成回報
180
124
 
181
125
  顯示以下資訊:
182
126
 
183
127
  - 分支名稱
184
128
  - Commit message 內容
185
- - Push 結果(成功/失敗/已跳過)
129
+ - Push 結果(成功/失敗)
@@ -1,14 +1,12 @@
1
- # post-checkout hook 接收參數:prev_HEAD new_HEAD checkout_type
2
- # checkout_type:1 = 切換分支,0 = 切換檔案
1
+ # post-checkout receives: prev_HEAD new_HEAD checkout_type
2
+ # checkout_type: 1 = branch checkout, 0 = file checkout
3
3
  CHECKOUT_TYPE=$3
4
4
 
5
- # 僅在切換分支時執行,切換檔案時跳過
5
+ # Only run on branch checkout, skip file checkout
6
6
  [ "$CHECKOUT_TYPE" != "1" ] && exit 0
7
7
 
8
- # 取得切換後的當前分支名稱
9
8
  CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
10
9
 
11
- # 僅針對 dev、qa、master 這三個目標分支執行自動拉取
12
10
  TARGET_BRANCHES="dev qa master"
13
11
  match=0
14
12
  for branch in $TARGET_BRANCHES; do
@@ -16,14 +14,12 @@ for branch in $TARGET_BRANCHES; do
16
14
  done
17
15
 
18
16
  if [ "$match" = "1" ]; then
19
- # 檢查本地是否有尚未推送的 commit,有的話跳過自動拉取(避免覆蓋本地變更)
20
17
  LOCAL_AHEAD=$(git rev-list --count origin/"$CURRENT_BRANCH"..HEAD 2>/dev/null || echo 0)
21
18
  if [ "$LOCAL_AHEAD" -gt 0 ]; then
22
19
  echo "You have $LOCAL_AHEAD unpushed commit(s) on '$CURRENT_BRANCH'. Skipping auto-pull."
23
20
  exit 0
24
21
  fi
25
22
 
26
- # 自動從遠端拉取最新程式碼(使用 rebase 保持線性歷史)
27
23
  echo "Auto pulling '$CURRENT_BRANCH' from remote..."
28
24
  git pull --rebase origin "$CURRENT_BRANCH" || {
29
25
  echo "Failed to pull '$CURRENT_BRANCH'. Please resolve manually."
package/.husky/pre-commit CHANGED
@@ -1,2 +1 @@
1
- # 提交前自動格式化程式碼(Prettier),並將格式化後的變更加入暫存區
2
1
  npm run format && git add .
package/.husky/pre-push CHANGED
@@ -1,27 +1,2 @@
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
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(本地 + 遠端)
25
1
  sh scripts/clean-tags.sh
26
- # 自動升版並發布(僅 dev/qa 分支會實際執行,$1 為遠端名稱)
27
2
  sh scripts/auto-version.sh "$1"
package/CHANGELOG.md CHANGED
@@ -2,15 +2,7 @@
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-hotfix](https://github.com/jetthai/cuora-module/compare/v1.1.427...v1.1.427-hotfix) (2026-04-14)
6
-
7
- ### Features
8
-
9
- - **husky:** skip pre-push hooks on force push to dev/qa ([79e9df9](https://github.com/jetthai/cuora-module/commit/79e9df9bfd9335dca7d5aec590fa25d7580586ac))
10
-
11
- ### Bug Fixes
12
-
13
- - **withdraw:** 修正加密貨幣提款計算錯誤時的狀態轉移 ([3acbe09](https://github.com/jetthai/cuora-module/commit/3acbe0985bf5d4a85ccd02390c5f99092829c820))
5
+ ### [1.1.427-qa.0](https://github.com/jetthai/cuora-module/compare/v1.1.427...v1.1.427-qa.0) (2026-04-12)
14
6
 
15
7
  ### [1.1.427](https://github.com/jetthai/cuora-module/compare/v1.1.426...v1.1.427) (2026-04-07)
16
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.427-hotfix",
3
+ "version": "1.1.427-qa.0",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // dev/qa 分支自動計算下一個 prerelease 版號
4
- // 版號格式:{master 版號}-{分支名}.{遞增編號}
5
- // 範例:master=2.1.1,dev 第 5 次推送 → 2.1.1-dev.5
3
+ // Auto version bump for dev/qa branches
4
+ // Format: {master version}-{branch}.{number}
5
+ // Example: master=2.1.1, dev 5th push → 2.1.1-dev.5
6
6
  //
7
- // 由 auto-version.sh(pre-push hook)呼叫
8
- // 將新版號輸出至 stdout;若版號無需變更則靜默結束
7
+ // Called by auto-version.sh (pre-push hook)
8
+ // Outputs new version to stdout; silent exit if no change needed
9
9
 
10
10
  import { execSync } from 'node:child_process'
11
11
  import { readFileSync } from 'node:fs'
12
12
 
13
- // 取得當前分支,僅在 dev/qa 分支執行
13
+ // Only run on dev / qa branches
14
14
  const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
15
15
 
16
16
  if (branch !== 'dev' && branch !== 'qa') {
17
17
  process.exit(0)
18
18
  }
19
19
 
20
- // 從 origin/master 取得基礎版號,若失敗則退而使用本地 master
20
+ // Get base version from origin/master, fallback to local master
21
21
  let masterVersion
22
22
  try {
23
23
  masterVersion = JSON.parse(execSync('git show origin/master:package.json', { encoding: 'utf8' })).version
@@ -30,22 +30,21 @@ try {
30
30
  }
31
31
  }
32
32
 
33
- // 讀取當前 package.json 版號,組合 prerelease 前綴
34
33
  const currentVersion = JSON.parse(readFileSync('package.json', 'utf8')).version
35
34
  const prefix = `${masterVersion}-${branch}.`
36
35
  let nextNum = 0
37
36
 
38
- // 從當前版號推算下一個編號
39
- // 例如 currentVersion="2.1.1-dev.4" → nextNum=5
37
+ // Derive next number from current version
38
+ // e.g. currentVersion="2.1.1-dev.4" → nextNum=5
40
39
  if (currentVersion.startsWith(prefix)) {
41
40
  const num = parseInt(currentVersion.slice(prefix.length), 10)
42
41
  if (!isNaN(num)) nextNum = num + 1
43
42
  }
44
43
 
45
- // 掃描 git log 找出該前綴歷史上使用過的最大編號
46
- // 防止合併後版號回退(merge 可能覆寫 currentVersion)
47
- // 例如:合併後 currentVersion="2.0.9-dev.20",但歷史中存在 "2.1.1-dev.4"
48
- // → historyMax=4,nextNum=5(而非從 0 重新開始)
44
+ // Scan git log for the highest number ever used with this prefix
45
+ // Prevents regression when merges overwrite currentVersion
46
+ // e.g. after merge currentVersion="2.0.9-dev.20", but history has "2.1.1-dev.4"
47
+ // → historyMax=4, nextNum=5 (instead of restarting from 0)
49
48
  try {
50
49
  const log = execSync(`git log ${branch} --pretty=%s --grep="^${masterVersion}-${branch}\\\\." -n 50`, {
51
50
  encoding: 'utf8',
@@ -59,10 +58,9 @@ try {
59
58
 
60
59
  const newVersion = `${prefix}${nextNum}`
61
60
 
62
- // 版號未變更,無需升版
61
+ // No change needed
63
62
  if (currentVersion === newVersion) {
64
63
  process.exit(0)
65
64
  }
66
65
 
67
- // 輸出新版號供 auto-version.sh 使用
68
66
  console.log(newVersion)
@@ -1,19 +1,15 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # 在 dev/qa 分支自動升版並發布
4
- # 由 pre-push hook 呼叫,$1 為遠端名稱(預設 origin)
3
+ # Auto version bump on dev/qa branches
4
+ # Called from pre-push hook — receives remote name as $1
5
5
 
6
- # 取得遠端名稱(未傳入則預設為 origin)
7
6
  REMOTE=${1:-origin}
8
- # 取得當前分支名稱
9
7
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
10
8
 
11
- # 僅在 dev 或 qa 分支執行自動升版流程
12
9
  if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
13
- # 透過 Node 腳本計算下一個 prerelease 版號(會掃描 git log 避免版號回退)
10
+ # Compute next prerelease version (scans git log to prevent regression)
14
11
  NEXT_VERSION=$(node scripts/auto-version.js)
15
12
 
16
- # 若版號無變化,跳過發布流程
17
13
  if [ -z "$NEXT_VERSION" ]; then
18
14
  echo "Version unchanged, skipping release."
19
15
  exit 0
@@ -22,12 +18,12 @@ if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
22
18
  echo "Branch: $BRANCH"
23
19
  echo "Next version: $NEXT_VERSION"
24
20
 
25
- # 使用 standard-version 升版:更新 package.json 版號、產生 CHANGELOG、建立 commit + tag
21
+ # Bump version, update CHANGELOG, create commit + tag
26
22
  npx standard-version --release-as "$NEXT_VERSION"
27
23
 
28
- # 推送到遠端並執行 npm publish
24
+ # Push + npm publish
29
25
  node scripts/branch-auto-npm-publish.js "$REMOTE" "$BRANCH"
30
26
 
31
- # 以 exit 1 中斷原本的 git push(因為上面的腳本已經完成推送了)
27
+ # Abort the original git push (scripts already pushed)
32
28
  exit 1
33
29
  fi
@@ -1,23 +1,21 @@
1
- // 自動推送 commit + tag 並發布到 npm
2
- // 由 auto-version.sh 呼叫,接收參數:remote(遠端名稱)、branch(分支名稱)
3
-
4
1
  import { execSync } from 'node:child_process'
5
2
  import { readFileSync } from 'node:fs'
6
3
 
7
- // 取得遠端名稱與分支名稱(預設為 origin 和當前分支)
8
4
  const remote = process.argv[2] || 'origin'
9
5
  const branch = process.argv[3] || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim()
10
6
 
11
- // 讀取 package.json 中的版號(此時已被 standard-version 更新過)
12
7
  const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
13
8
 
14
9
  console.log(`Branch: ${branch}`)
15
10
  console.log(`Version: ${version}`)
16
11
 
17
- // 推送 commit 與 tag 到遠端(--no-verify 避免觸發 pre-push hook 造成無限迴圈)
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
18
16
  execSync(`git push --no-verify --follow-tags ${remote} ${branch}`, { stdio: 'inherit' })
19
17
 
20
- // 發布到 npm,使用分支名稱作為 dist-tag(例如 npm install @jetthai/cuora@dev)
18
+ // Publish to npm with branch dist-tag
21
19
  try {
22
20
  execSync(`npm publish --tag ${branch}`, { stdio: 'inherit' })
23
21
  console.log(`✅ npm publish succeeded: ${version} (tag: ${branch})`)
@@ -1,24 +1,22 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # 清理不符合規範的 git tag(本地 + 遠端)
4
- # 合規格式:v1.2.3(例如 v0.1.0、v1.12.123)
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)
5
5
  #
6
- # 刪除規則(符合任一條件即刪除):
7
- # 1. 當前分支為 dev 或 qa
8
- # 2. 該 tag 所指向的 commit 不屬於任何分支(孤立 commit)
9
- # 3. 該 tag 所指向的 commit 已被合併進 master
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
10
10
  PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
11
11
 
12
- # 取得當前分支名稱
13
12
  BRANCH=$(git rev-parse --abbrev-ref HEAD)
14
13
 
15
- # 取得最新的 tag(依建立時間排序),無論格式是否合規都會保留
14
+ # Find the latest tag (by creation date) regardless of format
16
15
  LATEST_TAG=$(git tag -l --sort=-creatordate | head -n 1)
17
16
 
18
- # 篩選出所有不符合合規格式的 tag
17
+ # Collect non-compliant tags
19
18
  TAGS=$(git tag -l | grep -vE "$PATTERN")
20
19
 
21
- # 若沒有不合規的 tag,直接結束
22
20
  if [ -z "$TAGS" ]; then
23
21
  echo "No non-compliant tags found."
24
22
  exit 0
@@ -26,9 +24,7 @@ fi
26
24
 
27
25
  echo "Latest tag (preserved): $LATEST_TAG"
28
26
 
29
- # 逐一檢查每個不合規的 tag
30
27
  for TAG in $TAGS; do
31
- # 最新的 tag 一律跳過,避免誤刪正在使用的版本
32
28
  if [ "$TAG" = "$LATEST_TAG" ]; then
33
29
  echo "Skipping tag $TAG (latest tag)"
34
30
  continue
@@ -37,13 +33,13 @@ for TAG in $TAGS; do
37
33
  SHOULD_DELETE=false
38
34
  REASON=""
39
35
 
40
- # 規則 1:當前在 dev 或 qa 分支,直接刪除所有不合規 tag
36
+ # Rule 1: Current branch is dev or qa
41
37
  if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
42
38
  SHOULD_DELETE=true
43
39
  REASON="on $BRANCH branch"
44
40
  fi
45
41
 
46
- # 規則 2:該 tag 的 commit 不屬於任何分支(孤立的 commit)
42
+ # Rule 2: Tag's commit is not reachable from any branch
47
43
  if [ "$SHOULD_DELETE" = false ]; then
48
44
  BRANCHES=$(git branch -a --contains "$TAG" 2>/dev/null)
49
45
  if [ -z "$BRANCHES" ]; then
@@ -52,7 +48,7 @@ for TAG in $TAGS; do
52
48
  fi
53
49
  fi
54
50
 
55
- # 規則 3:該 tag 的 commit 已合併進 master(代表該 tag 已無保留必要)
51
+ # Rule 3: Tag's commit is already merged into master
56
52
  if [ "$SHOULD_DELETE" = false ]; then
57
53
  if git merge-base --is-ancestor "$TAG" master 2>/dev/null; then
58
54
  SHOULD_DELETE=true
@@ -60,7 +56,6 @@ for TAG in $TAGS; do
60
56
  fi
61
57
  fi
62
58
 
63
- # 執行刪除:先刪遠端再刪本地,遠端刪除失敗不中斷流程
64
59
  if [ "$SHOULD_DELETE" = true ]; then
65
60
  echo "Deleting tag $TAG ($REASON)"
66
61
  git push origin --delete "$TAG" --no-verify 2>/dev/null || true
@@ -130,7 +130,7 @@ export default function (request, context) {
130
130
  },
131
131
  ],
132
132
  onError: {
133
- target: '#withdraw_crypto_cash.calculated',
133
+ target: 'idle',
134
134
  },
135
135
  },
136
136
  },