@momo-kits/native-kits 0.168.1-sizescale.1-debug → 0.169.1-debug
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.
- package/CLAUDE.md +4 -3
- package/PUBLISH_GUIDE.md +29 -658
- package/compose/build.gradle.kts +2 -2
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +4 -5
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +21 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +76 -83
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +11 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +8 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +57 -163
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +17 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +4 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +18 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +34 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +321 -149
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +79 -71
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +87 -261
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +2 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +1 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +3 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +9 -3
- package/gradle.properties +1 -3
- package/ios/Input/Input.swift +3 -1
- package/ios/Input/InputTextArea.swift +3 -1
- package/ios/Layout/ModalLayout.swift +152 -0
- package/ios/Layout/ScreenLayout.swift +28 -24
- package/ios/Navigation/BottomSheet.swift +29 -156
- package/ios/Navigation/BottomTab/BottomTab.swift +46 -52
- package/ios/Navigation/BottomTab/BottomTabBar.swift +281 -115
- package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
- package/ios/Navigation/BottomTab/DuoTabBar.swift +62 -195
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +84 -0
- package/ios/Navigation/Component/HeaderRight.swift +1 -1
- package/ios/Navigation/ModalScreen.swift +18 -7
- package/ios/Navigation/StackScreen.swift +3 -1
- package/ios/Popup/PopupDisplay.swift +4 -2
- package/ios/Popup/PopupInput.swift +4 -2
- package/ios/Popup/PopupLayout.swift +10 -9
- package/ios/Popup/PopupNotify.swift +32 -25
- package/ios/Typography/Text.swift +2 -2
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
- package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +272 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
- package/local.properties +8 -0
- package/package.json +1 -1
- package/publish.sh +170 -513
- package/compose/build.gradle.kts.backup +0 -198
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitSizeScale.kt +0 -45
package/PUBLISH_GUIDE.md
CHANGED
|
@@ -1,675 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Build & Publish
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Mỗi version được publish lên **GitLab Maven** (`vn.momo.kits:kits`, `vn.momo.kits:demo`) và **npm** (`@momo-kits/native-kits`, kèm bản `-debug` có source compose). Số version **không lưu trong repo**: lúc publish, CI lấy npm `latest` làm base rồi chọn số kế tiếp. Version trong `package.json`, `gradle.properties` và podspec chỉ là placeholder.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Pipeline
|
|
6
6
|
|
|
7
|
-
## 📋 Tổng Quan
|
|
8
|
-
|
|
9
|
-
Dự án sử dụng **`publish.sh`** - một script thống nhất hỗ trợ 2 modes:
|
|
10
|
-
|
|
11
|
-
- **`beta`**: Publish phiên bản beta/alpha cho testing
|
|
12
|
-
- **`release`**: Publish phiên bản release chính thức
|
|
13
|
-
|
|
14
|
-
Script có 3 phases riêng biệt:
|
|
15
|
-
1. **Check Version**: Kiểm tra và chuẩn bị version
|
|
16
|
-
2. **Publish Maven**: Publish lên GitLab Maven repository
|
|
17
|
-
3. **Publish NPM**: Publish lên NPM registry
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 🚀 Publish Từ Local
|
|
22
|
-
|
|
23
|
-
### Yêu Cầu Trước Khi Publish
|
|
24
|
-
|
|
25
|
-
1. **Login NPM:**
|
|
26
|
-
```bash
|
|
27
|
-
npm login
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
2. **Kiểm tra version hiện tại:**
|
|
31
|
-
```bash
|
|
32
|
-
cat package.json | grep version
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### 🔵 Publish Beta Từ Local
|
|
36
|
-
|
|
37
|
-
#### **Cách 1: Publish tất cả phases (Khuyến nghị)**
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
sh publish.sh beta
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### **Cách 2: Chạy từng phase riêng**
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Phase 1: Check version
|
|
47
|
-
sh publish.sh beta check
|
|
48
|
-
|
|
49
|
-
# Phase 2: Publish Maven
|
|
50
|
-
sh publish.sh beta maven
|
|
51
|
-
|
|
52
|
-
# Phase 3: Publish NPM
|
|
53
|
-
sh publish.sh beta npm
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### **Quy Trình Beta Publishing**
|
|
57
|
-
|
|
58
|
-
1. **Update version trong `package.json`:**
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"version": "0.156.2"
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
2. **Chạy check version trước (optional nhưng khuyến nghị):**
|
|
66
|
-
```bash
|
|
67
|
-
sh publish.sh beta check
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
3. **Nếu check thành công, publish:**
|
|
71
|
-
```bash
|
|
72
|
-
sh publish.sh beta
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 📦 Version Types (Beta Mode)
|
|
78
|
-
|
|
79
|
-
Beta mode hỗ trợ 2 loại version:
|
|
80
|
-
|
|
81
|
-
### **1. Specific Version (Tag: alpha)**
|
|
82
|
-
|
|
83
|
-
**Định nghĩa:** Version có suffix KHÔNG phải "beta"
|
|
84
|
-
|
|
85
|
-
**Ví dụ:**
|
|
86
|
-
- `0.156.2-test.1`
|
|
87
|
-
- `0.156.2-alpha.1`
|
|
88
|
-
- `0.156.2-rc.1`
|
|
89
|
-
|
|
90
|
-
**Behavior:**
|
|
91
|
-
- NPM tag: `alpha`
|
|
92
|
-
- Check existence: ❌ **FAIL** nếu version đã tồn tại
|
|
93
|
-
- Không auto-increment
|
|
94
|
-
- Developer phải tự quản lý version
|
|
95
|
-
|
|
96
|
-
**Use case:** Testing specific features, hotfix testing
|
|
97
|
-
|
|
98
|
-
### **2. Normal Version (Tag: beta)**
|
|
99
|
-
|
|
100
|
-
**Định nghĩa:** Version có suffix "beta" HOẶC không có suffix
|
|
101
|
-
|
|
102
|
-
**Ví dụ:**
|
|
103
|
-
- `0.156.2` (no suffix)
|
|
104
|
-
- `0.156.2-beta.1`
|
|
105
|
-
- `0.156.2-beta.5`
|
|
106
|
-
|
|
107
|
-
**Behavior:**
|
|
108
|
-
- NPM tag: `beta`
|
|
109
|
-
- Auto-format: `0.156.2` → `0.156.2-beta.1`
|
|
110
|
-
- Auto-increment nếu tồn tại: `.beta.1` → `.beta.2` → `.beta.3`...
|
|
111
|
-
|
|
112
|
-
**Use case:** Regular beta testing, continuous development
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## 🔍 Version Detection Examples
|
|
117
|
-
|
|
118
|
-
### **Example 1: Specific Version**
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# package.json
|
|
122
|
-
{
|
|
123
|
-
"version": "0.156.2-test.1"
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
# Run
|
|
127
|
-
$ sh publish.sh beta check
|
|
128
|
-
|
|
129
|
-
# Output
|
|
130
|
-
🏷️ Detected: SPECIFIC version (tag: alpha)
|
|
131
|
-
🔎 Checking if specific version 0.156.2-test.1 exists on npm...
|
|
132
|
-
✅ Specific version 0.156.2-test.1 does not exist on npm. Safe to publish.
|
|
133
|
-
✅ NPM tag: alpha
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
**Kết quả trên NPM:**
|
|
137
|
-
- `@momo-kits/native-kits@0.156.2-test.1` (tag: **alpha**)
|
|
138
|
-
- `@momo-kits/native-kits@0.156.2-test.1-debug` (tag: **alpha**)
|
|
139
|
-
|
|
140
|
-
### **Example 2: Normal Version (No Suffix)**
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# package.json
|
|
144
|
-
{
|
|
145
|
-
"version": "0.156.2"
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
# Run
|
|
149
|
-
$ sh publish.sh beta check
|
|
150
|
-
|
|
151
|
-
# Output
|
|
152
|
-
🏷️ Detected: NORMAL version (tag: beta)
|
|
153
|
-
🔄 Adding beta suffix: 0.156.2 → 0.156.2-beta.1
|
|
154
|
-
🔎 Checking version 0.156.2-beta.1 on npm...
|
|
155
|
-
✅ Version 0.156.2-beta.1 does not exist on npm. Using this version.
|
|
156
|
-
✅ NPM tag: beta
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**Kết quả trên NPM:**
|
|
160
|
-
- `@momo-kits/native-kits@0.156.2-beta.1` (tag: **beta**)
|
|
161
|
-
- `@momo-kits/native-kits@0.156.2-beta.1-debug` (tag: **beta**)
|
|
162
|
-
|
|
163
|
-
### **Example 3: Normal Version (With Beta Suffix)**
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# package.json
|
|
167
|
-
{
|
|
168
|
-
"version": "0.156.2-beta.1"
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
# Giả sử npm đã có: beta.1, beta.2
|
|
172
|
-
|
|
173
|
-
# Run
|
|
174
|
-
$ sh publish.sh beta check
|
|
175
|
-
|
|
176
|
-
# Output
|
|
177
|
-
🏷️ Detected: NORMAL version (tag: beta)
|
|
178
|
-
🔎 Checking version 0.156.2-beta.1 on npm...
|
|
179
|
-
⚠️ Version 0.156.2-beta.1 already exists on npm. Auto-incrementing...
|
|
180
|
-
Version incremented: 0.156.2-beta.1 → 0.156.2-beta.2
|
|
181
|
-
⚠️ Version 0.156.2-beta.2 already exists on npm. Auto-incrementing...
|
|
182
|
-
Version incremented: 0.156.2-beta.2 → 0.156.2-beta.3
|
|
183
|
-
✅ Version 0.156.2-beta.3 does not exist on npm. Using this version.
|
|
184
|
-
✅ NPM tag: beta
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
**Kết quả trên NPM:**
|
|
188
|
-
- `@momo-kits/native-kits@0.156.2-beta.3` (tag: **beta**)
|
|
189
|
-
- `@momo-kits/native-kits@0.156.2-beta.3-debug` (tag: **beta**)
|
|
190
|
-
|
|
191
|
-
### **Example 4: Specific Version Already Exists (FAIL)**
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
# package.json
|
|
195
|
-
{
|
|
196
|
-
"version": "0.156.2-test.1"
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
# Version đã tồn tại trên npm
|
|
200
|
-
|
|
201
|
-
# Run
|
|
202
|
-
$ sh publish.sh beta check
|
|
203
|
-
|
|
204
|
-
# Output
|
|
205
|
-
🏷️ Detected: SPECIFIC version (tag: alpha)
|
|
206
|
-
🔎 Checking if specific version 0.156.2-test.1 exists on npm...
|
|
207
|
-
|
|
208
|
-
❌ ERROR: Specific version 0.156.2-test.1 already exists on npm!
|
|
209
|
-
|
|
210
|
-
Please update the version in package.json before publishing.
|
|
211
|
-
# Exit code: 1
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 🟢 Publish Release Từ Local
|
|
217
|
-
|
|
218
|
-
### **Đặc Điểm Quan Trọng**
|
|
219
|
-
|
|
220
|
-
⚠️ **Release mode KHÔNG đọc version từ `package.json`**
|
|
221
|
-
|
|
222
|
-
✅ **Release mode đọc version từ `npm@latest`**
|
|
223
|
-
|
|
224
|
-
### **Cách Publish**
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
# Publish tất cả phases
|
|
228
|
-
sh publish.sh release
|
|
229
|
-
|
|
230
|
-
# Hoặc từng phase
|
|
231
|
-
sh publish.sh release check
|
|
232
|
-
sh publish.sh release maven
|
|
233
|
-
sh publish.sh release npm
|
|
234
7
|
```
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
npm view @momo-kits/native-kits@latest version
|
|
241
|
-
# Output: 0.156.2
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
2. **Auto-increment patch version:**
|
|
245
|
-
```
|
|
246
|
-
0.156.2 → 0.156.3
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
3. **Check existence và tiếp tục increment nếu cần:**
|
|
250
|
-
```
|
|
251
|
-
0.156.3 exists? → 0.156.4
|
|
252
|
-
0.156.4 exists? → 0.156.5
|
|
253
|
-
...
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
4. **Update `package.json` với version mới**
|
|
257
|
-
|
|
258
|
-
5. **Publish với tag `latest`**
|
|
259
|
-
|
|
260
|
-
### **Example: Release Publishing**
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
$ sh publish.sh release check
|
|
264
|
-
|
|
265
|
-
# Output
|
|
266
|
-
🔍 Reading latest version from npm@latest (NOT from package.json)...
|
|
267
|
-
📦 Current @latest version on npm: 0.156.2
|
|
268
|
-
🔼 Auto-incremented version: 0.156.2 → 0.156.3
|
|
269
|
-
🔎 Checking if version 0.156.3 exists on npm...
|
|
270
|
-
✅ Version 0.156.3 does not exist on npm. Using this version.
|
|
271
|
-
📝 Updated package.json: 0.156.2-beta.5 → 0.156.3
|
|
272
|
-
✅ Using version: 0.156.3
|
|
273
|
-
✅ NPM tag: latest
|
|
8
|
+
build:kmp + build:swiftui ──► publish (khoá kits-publish)
|
|
9
|
+
├ chọn version: base từ npm latest, kiểm tra còn trống trên npm + Maven
|
|
10
|
+
├ Maven: kits + demo
|
|
11
|
+
└ npm: <version>-debug rồi <version>
|
|
274
12
|
```
|
|
275
13
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
## 🤖 Publish Tự Động Trên GitLab CI
|
|
283
|
-
|
|
284
|
-
### 🔵 Beta Publishing (GitLab CI)
|
|
14
|
+
| Khi nào | Version | npm tag |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| Push / merge vào `main` | npm latest + 1 patch (0.169.1 → **0.169.2**) | `latest` |
|
|
17
|
+
| `main`, **Run pipeline** với `RELEASE_VERSION=0.170.1` (bump đầu sprint) | đúng **0.170.1** | `latest` |
|
|
18
|
+
| Nhánh khác, commit có `[ci build]` | `<npm latest + 1 patch>-beta.N` (**0.169.2-beta.N**) | `beta` |
|
|
285
19
|
|
|
286
|
-
|
|
20
|
+
- Beta: `N` = beta lớn nhất của base đó trên npm, +1.
|
|
21
|
+
- Một version chỉ được dùng khi **cả npm (gồm bản `-debug`) lẫn Maven đều chưa có**. Nếu đã có thì tăng tiếp. Riêng `RELEASE_VERSION` thì fail, và version này phải lớn hơn npm latest.
|
|
22
|
+
- Mỗi lúc chỉ một job `publish` được chạy, nên hai nhánh publish cùng lúc không lấy trùng số.
|
|
23
|
+
- Nhánh `engine/*` không publish.
|
|
287
24
|
|
|
288
|
-
|
|
289
|
-
git checkout develop
|
|
290
|
-
git add .
|
|
291
|
-
git commit -m "feat: add new feature [ci build]"
|
|
292
|
-
git push
|
|
293
|
-
```
|
|
25
|
+
## Bump version đầu sprint
|
|
294
26
|
|
|
295
|
-
**
|
|
296
|
-
1. `beta_check_version` (Phase 1)
|
|
297
|
-
2. `beta_publish_maven` (Phase 2)
|
|
298
|
-
3. `beta_publish_npm` (Phase 3)
|
|
27
|
+
GitLab → **Build → Pipelines → Run pipeline** → chọn `main` → `RELEASE_VERSION` = `0.170.1` → Run.
|
|
299
28
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
**Trigger:** Push vào nhánh `main`
|
|
29
|
+
## Chạy local
|
|
303
30
|
|
|
304
31
|
```bash
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
32
|
+
bash publish.sh build # build tất cả artifact sẽ publish (không upload)
|
|
33
|
+
bash publish.sh beta --dry-run # xem version sẽ ra + pack tarball npm vào build/npm
|
|
34
|
+
bash publish.sh release --version 0.170.1 # publish thật
|
|
308
35
|
```
|
|
309
36
|
|
|
310
|
-
|
|
311
|
-
1. `release_check_version` (Phase 1)
|
|
312
|
-
2. `release_publish_maven` (Phase 2)
|
|
313
|
-
3. `release_publish_npm` (Phase 3)
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
## 📊 So Sánh Beta vs Release
|
|
318
|
-
|
|
319
|
-
| Tiêu chí | Beta Mode | Release Mode |
|
|
320
|
-
|----------|-----------|--------------|
|
|
321
|
-
| **Script** | `sh publish.sh beta` | `sh publish.sh release` |
|
|
322
|
-
| **Trigger CI** | Commit có `[ci build]` (không trên main) | Push vào `main` |
|
|
323
|
-
| **Read Version** | Từ `package.json` | Từ `npm@latest` |
|
|
324
|
-
| **Version Types** | Specific (alpha) / Normal (beta) | N/A |
|
|
325
|
-
| **NPM Tag** | `alpha` hoặc `beta` | `latest` |
|
|
326
|
-
| **If Exists** | Specific: FAIL / Normal: Auto-increment | Auto-increment |
|
|
327
|
-
| **Phase Order** | Check → Maven → NPM | Check → Maven → NPM |
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## 🔧 NPM Tags Explained
|
|
332
|
-
|
|
333
|
-
### **Tag: alpha**
|
|
334
|
-
|
|
335
|
-
**Khi nào:** Beta mode + Specific version
|
|
336
|
-
|
|
337
|
-
**Cài đặt:**
|
|
338
|
-
```bash
|
|
339
|
-
npm install @momo-kits/native-kits@alpha
|
|
340
|
-
npm install @momo-kits/native-kits@0.156.2-test.1
|
|
341
|
-
```
|
|
37
|
+
Các file bị sửa trong lúc publish được trả lại nguyên trạng khi script kết thúc, kể cả khi fail.
|
|
342
38
|
|
|
343
|
-
|
|
39
|
+
## CI/CD variables
|
|
344
40
|
|
|
345
|
-
|
|
41
|
+
| Biến | Dùng cho |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `NPM_TOKEN` | npm automation token. Nếu không có thì dùng `_authToken` trong `.npmrc`. |
|
|
44
|
+
| `MAVEN_USER` / `MAVEN_TOKEN` | Deploy token upload Maven. Nếu không có thì dùng `gitlab.user` / `gitlab.password` trong `gradle.properties`. |
|
|
346
45
|
|
|
347
|
-
**
|
|
348
|
-
|
|
349
|
-
**Cài đặt:**
|
|
350
|
-
```bash
|
|
351
|
-
npm install @momo-kits/native-kits@beta
|
|
352
|
-
npm install @momo-kits/native-kits@0.156.2-beta.1
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
**Use case:** Regular beta testing, pre-release versions
|
|
356
|
-
|
|
357
|
-
### **Tag: latest**
|
|
358
|
-
|
|
359
|
-
**Khi nào:** Release mode
|
|
360
|
-
|
|
361
|
-
**Cài đặt:**
|
|
362
|
-
```bash
|
|
363
|
-
npm install @momo-kits/native-kits@latest
|
|
364
|
-
npm install @momo-kits/native-kits
|
|
365
|
-
npm install @momo-kits/native-kits@0.156.3
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
**Use case:** Production releases, stable versions
|
|
369
|
-
|
|
370
|
-
---
|
|
371
|
-
|
|
372
|
-
## 🔍 Chi Tiết Các Phases
|
|
373
|
-
|
|
374
|
-
### **Phase 1: Check Version**
|
|
375
|
-
|
|
376
|
-
**Beta Mode:**
|
|
377
|
-
1. Đọc version từ `package.json`
|
|
378
|
-
2. Phát hiện version type (specific vs normal)
|
|
379
|
-
3. Set NPM tag (alpha vs beta)
|
|
380
|
-
4. Format version:
|
|
381
|
-
- Specific: Check existence, fail if exists
|
|
382
|
-
- Normal: Add beta suffix, auto-increment if exists
|
|
383
|
-
5. Update `gradle.properties`
|
|
384
|
-
|
|
385
|
-
**Release Mode:**
|
|
386
|
-
1. Đọc version từ `npm@latest` (KHÔNG từ package.json)
|
|
387
|
-
2. Increment patch version
|
|
388
|
-
3. Check existence, auto-increment if exists
|
|
389
|
-
4. Update `package.json` và `gradle.properties`
|
|
390
|
-
5. Set NPM tag = `latest`
|
|
391
|
-
|
|
392
|
-
### **Phase 2: Publish Maven**
|
|
393
|
-
|
|
394
|
-
**Thứ tự:** Chạy SAU phase 1, TRƯỚC phase 3
|
|
395
|
-
|
|
396
|
-
**Hành động:**
|
|
397
|
-
- Publish Kotlin Multiplatform artifacts
|
|
398
|
-
- Lên GitLab Packages Repository
|
|
399
|
-
- Dành cho `compose` module
|
|
400
|
-
|
|
401
|
-
### **Phase 3: Publish NPM**
|
|
402
|
-
|
|
403
|
-
**Thứ tự:** Chạy SAU phase 2 (Maven)
|
|
404
|
-
|
|
405
|
-
**Publish 2 versions theo thứ tự:**
|
|
406
|
-
|
|
407
|
-
1. **Debug version** (với compose) - FIRST
|
|
408
|
-
- Version: `X.Y.Z-debug`
|
|
409
|
-
- Bao gồm thư mục `compose/`
|
|
410
|
-
- Tag: `alpha` / `beta` / `latest`
|
|
411
|
-
|
|
412
|
-
2. **Normal version** (không compose) - SECOND
|
|
413
|
-
- Version: `X.Y.Z`
|
|
414
|
-
- Không bao gồm `compose/`
|
|
415
|
-
- Tag: `alpha` / `beta` / `latest`
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
## 🎯 Workflow Khuyến Nghị
|
|
420
|
-
|
|
421
|
-
### Development Flow
|
|
422
|
-
|
|
423
|
-
```
|
|
424
|
-
┌──────────────────────────────────────────────────┐
|
|
425
|
-
│ 1. Develop Feature │
|
|
426
|
-
│ - Code changes │
|
|
427
|
-
│ - Update version in package.json (beta only) │
|
|
428
|
-
└─────────────────┬────────────────────────────────┘
|
|
429
|
-
↓
|
|
430
|
-
┌──────────────────────────────────────────────────┐
|
|
431
|
-
│ 2. Beta Testing │
|
|
432
|
-
│ Local: sh publish.sh beta │
|
|
433
|
-
│ CI: git commit -m "feat: xxx [ci build]" │
|
|
434
|
-
│ Tag: alpha (specific) or beta (normal) │
|
|
435
|
-
└─────────────────┬────────────────────────────────┘
|
|
436
|
-
↓
|
|
437
|
-
┌──────────────────────────────────────────────────┐
|
|
438
|
-
│ 3. Team Testing │
|
|
439
|
-
│ npm install @momo-kits/native-kits@beta │
|
|
440
|
-
│ npm install @momo-kits/native-kits@alpha │
|
|
441
|
-
└─────────────────┬────────────────────────────────┘
|
|
442
|
-
│
|
|
443
|
-
┌──────┴──────┐
|
|
444
|
-
│ Approved? │
|
|
445
|
-
└──────┬───────┘
|
|
446
|
-
│ Yes
|
|
447
|
-
↓
|
|
448
|
-
┌──────────────────────────────────────────────────┐
|
|
449
|
-
│ 4. Release Production │
|
|
450
|
-
│ Local: sh publish.sh release │
|
|
451
|
-
│ CI: merge to main │
|
|
452
|
-
│ Reads from npm@latest, auto-increment │
|
|
453
|
-
└─────────────────┬────────────────────────────────┘
|
|
454
|
-
↓
|
|
455
|
-
┌──────────────────────────────────────────────────┐
|
|
456
|
-
│ 5. Production │
|
|
457
|
-
│ npm install @momo-kits/native-kits@latest │
|
|
458
|
-
└──────────────────────────────────────────────────┘
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
---
|
|
462
|
-
|
|
463
|
-
## ⚠️ Lưu Ý Quan Trọng
|
|
464
|
-
|
|
465
|
-
### 1. Version Management
|
|
466
|
-
|
|
467
|
-
**Beta Mode:**
|
|
468
|
-
- Specific version: Phải unique, fail nếu tồn tại
|
|
469
|
-
- Normal version: Auto-increment, không cần lo
|
|
470
|
-
- Version trong `package.json` được sử dụng
|
|
471
|
-
|
|
472
|
-
**Release Mode:**
|
|
473
|
-
- ⚠️ **KHÔNG đọc từ `package.json`**
|
|
474
|
-
- ✅ **Đọc từ `npm@latest`**
|
|
475
|
-
- Auto-increment patch version
|
|
476
|
-
- `package.json` được UPDATE với version mới
|
|
477
|
-
|
|
478
|
-
### 2. NPM Tags
|
|
479
|
-
|
|
480
|
-
**Cài đặt theo tag:**
|
|
481
|
-
```bash
|
|
482
|
-
npm install @momo-kits/native-kits@alpha # Specific versions
|
|
483
|
-
npm install @momo-kits/native-kits@beta # Normal beta versions
|
|
484
|
-
npm install @momo-kits/native-kits@latest # Release versions
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
### 3. Phase Execution Order
|
|
488
|
-
|
|
489
|
-
**Cả Beta và Release:**
|
|
490
|
-
1. Check Version
|
|
491
|
-
2. ✅ **Publish Maven** (FIRST)
|
|
492
|
-
3. ✅ **Publish NPM** (SECOND)
|
|
493
|
-
|
|
494
|
-
**Lý do:** Maven artifacts cần được publish trước để NPM debug version có thể reference
|
|
495
|
-
|
|
496
|
-
### 4. File Modifications
|
|
497
|
-
|
|
498
|
-
Script tạm thời modify các file (restore sau publish):
|
|
499
|
-
- `package.json` (version)
|
|
500
|
-
- `gradle.properties` (version)
|
|
501
|
-
- `.npmignore` (cho debug version)
|
|
502
|
-
- `compose/build.gradle.kts` (cho debug version)
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
## 🐛 Troubleshooting
|
|
507
|
-
|
|
508
|
-
### Lỗi: "Specific version already exists on npm"
|
|
509
|
-
|
|
510
|
-
**Nguyên nhân:** Specific version đã được publish
|
|
511
|
-
|
|
512
|
-
**Giải pháp:**
|
|
513
|
-
```bash
|
|
514
|
-
# Option 1: Tăng version thủ công
|
|
515
|
-
vim package.json
|
|
516
|
-
# "version": "0.156.2-test.1" → "0.156.2-test.2"
|
|
517
|
-
|
|
518
|
-
# Option 2: Chuyển sang normal version
|
|
519
|
-
vim package.json
|
|
520
|
-
# "version": "0.156.2-test.1" → "0.156.2"
|
|
521
|
-
# Script sẽ auto-format thành 0.156.2-beta.1
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
### Lỗi: "Could not read version from npm@latest"
|
|
525
|
-
|
|
526
|
-
**Nguyên nhân:** Package chưa tồn tại trên npm hoặc chưa có version @latest
|
|
527
|
-
|
|
528
|
-
**Giải pháp:**
|
|
529
|
-
```bash
|
|
530
|
-
# Kiểm tra package trên npm
|
|
531
|
-
npm view @momo-kits/native-kits
|
|
532
|
-
|
|
533
|
-
# Nếu chưa có, publish beta trước
|
|
534
|
-
sh publish.sh beta
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
### Beta không trigger trên GitLab CI
|
|
538
|
-
|
|
539
|
-
**Kiểm tra:**
|
|
540
|
-
- ✅ Commit message có `[ci build]`
|
|
541
|
-
- ✅ Branch KHÔNG phải `main`
|
|
542
|
-
- ✅ Branch KHÔNG match `engine/w*`
|
|
543
|
-
|
|
544
|
-
### Release không trigger trên GitLab CI
|
|
545
|
-
|
|
546
|
-
**Kiểm tra:**
|
|
547
|
-
- ✅ Đang push vào `main` branch
|
|
548
|
-
- ✅ GitLab CI settings enabled
|
|
549
|
-
|
|
550
|
-
---
|
|
551
|
-
|
|
552
|
-
## 📦 Sử Dụng Packages
|
|
553
|
-
|
|
554
|
-
### Cài Đặt Beta/Alpha Versions
|
|
555
|
-
|
|
556
|
-
```bash
|
|
557
|
-
# Latest alpha (specific versions)
|
|
558
|
-
npm install @momo-kits/native-kits@alpha
|
|
559
|
-
|
|
560
|
-
# Latest beta (normal versions)
|
|
561
|
-
npm install @momo-kits/native-kits@beta
|
|
562
|
-
|
|
563
|
-
# Specific version
|
|
564
|
-
npm install @momo-kits/native-kits@0.156.2-beta.1
|
|
565
|
-
npm install @momo-kits/native-kits@0.156.2-test.1
|
|
566
|
-
|
|
567
|
-
# Debug version (with compose)
|
|
568
|
-
npm install @momo-kits/native-kits@0.156.2-beta.1-debug
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
### Cài Đặt Release Versions
|
|
572
|
-
|
|
573
|
-
```bash
|
|
574
|
-
# Latest release
|
|
575
|
-
npm install @momo-kits/native-kits@latest
|
|
576
|
-
# hoặc
|
|
577
|
-
npm install @momo-kits/native-kits
|
|
578
|
-
|
|
579
|
-
# Specific release version
|
|
580
|
-
npm install @momo-kits/native-kits@0.156.3
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
---
|
|
584
|
-
|
|
585
|
-
## 🎓 Best Practices
|
|
586
|
-
|
|
587
|
-
### 1. Beta Testing
|
|
588
|
-
|
|
589
|
-
**Specific versions (alpha tag):**
|
|
590
|
-
- Dùng cho testing features cụ thể
|
|
591
|
-
- Phải unique, không duplicate
|
|
592
|
-
- Ví dụ: `0.156.2-hotfix.1`, `0.156.2-experiment.1`
|
|
593
|
-
|
|
594
|
-
**Normal versions (beta tag):**
|
|
595
|
-
- Dùng cho continuous development
|
|
596
|
-
- Auto-increment, dễ quản lý
|
|
597
|
-
- Ví dụ: `0.156.2`, `0.156.2-beta.1`
|
|
598
|
-
|
|
599
|
-
### 2. Release
|
|
600
|
-
|
|
601
|
-
- Luôn merge vào `main` để trigger release
|
|
602
|
-
- Không cần lo version trong `package.json`
|
|
603
|
-
- Script tự động đọc từ npm@latest và increment
|
|
604
|
-
|
|
605
|
-
### 3. Version Naming
|
|
606
|
-
|
|
607
|
-
**Good:**
|
|
608
|
-
- `0.156.2-test.1` (specific, clear purpose)
|
|
609
|
-
- `0.156.2-beta.1` (normal, standard format)
|
|
610
|
-
- `0.156.2` (normal, will auto-format)
|
|
611
|
-
|
|
612
|
-
**Avoid:**
|
|
613
|
-
- `0.156.2-beta-test.1` (confusing)
|
|
614
|
-
- `0.156.2-v1` (unclear)
|
|
615
|
-
|
|
616
|
-
---
|
|
617
|
-
|
|
618
|
-
## 📞 Support
|
|
619
|
-
|
|
620
|
-
Nếu có vấn đề, liên hệ team hoặc tạo issue trên GitLab.
|
|
621
|
-
|
|
622
|
-
---
|
|
623
|
-
|
|
624
|
-
## 🔗 Quick Reference
|
|
625
|
-
|
|
626
|
-
```bash
|
|
627
|
-
# Beta - Local (Specific version → alpha tag)
|
|
628
|
-
# package.json: "version": "0.156.2-test.1"
|
|
629
|
-
sh publish.sh beta
|
|
630
|
-
|
|
631
|
-
# Beta - Local (Normal version → beta tag)
|
|
632
|
-
# package.json: "version": "0.156.2"
|
|
633
|
-
sh publish.sh beta
|
|
634
|
-
|
|
635
|
-
# Release - Local (reads from npm@latest)
|
|
636
|
-
sh publish.sh release
|
|
637
|
-
|
|
638
|
-
# Individual phases
|
|
639
|
-
sh publish.sh beta check # Phase 1
|
|
640
|
-
sh publish.sh beta maven # Phase 2
|
|
641
|
-
sh publish.sh beta npm # Phase 3
|
|
642
|
-
|
|
643
|
-
# Beta - CI
|
|
644
|
-
git commit -m "feat: xxx [ci build]" # Trigger beta (not on main)
|
|
645
|
-
|
|
646
|
-
# Release - CI
|
|
647
|
-
git push origin main # Trigger release
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
---
|
|
651
|
-
|
|
652
|
-
## 📋 Version Type Decision Tree
|
|
653
|
-
|
|
654
|
-
```
|
|
655
|
-
Start: Publish Beta
|
|
656
|
-
↓
|
|
657
|
-
Check version in package.json
|
|
658
|
-
↓
|
|
659
|
-
Has suffix? (contains "-")
|
|
660
|
-
├─ No → Normal Version
|
|
661
|
-
│ ├─ Auto-add: 0.156.2 → 0.156.2-beta.1
|
|
662
|
-
│ ├─ Tag: beta
|
|
663
|
-
│ └─ Auto-increment if exists
|
|
664
|
-
│
|
|
665
|
-
└─ Yes → Check suffix type
|
|
666
|
-
├─ Contains "beta" → Normal Version
|
|
667
|
-
│ ├─ Keep format: 0.156.2-beta.1
|
|
668
|
-
│ ├─ Tag: beta
|
|
669
|
-
│ └─ Auto-increment if exists
|
|
670
|
-
│
|
|
671
|
-
└─ Other suffix → Specific Version
|
|
672
|
-
├─ Keep format: 0.156.2-test.1
|
|
673
|
-
├─ Tag: alpha
|
|
674
|
-
└─ FAIL if exists
|
|
675
|
-
```
|
|
46
|
+
Đặt các biến này ở chế độ **masked**, **không bật protected**, vì beta publish từ các nhánh không được protect. Sau đó xoá token khỏi `.npmrc` / `gradle.properties`.
|