@udi-organization/udi-package 1.0.75-alpha.1 → 1.0.77

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.
Files changed (2) hide show
  1. package/README.md +133 -418
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,472 +1,187 @@
1
1
  # @udi-organization/udi-package
2
2
 
3
- > 基於 React 的 UI 組件庫,提供 UdiTable、Button 等可重用組件,支持 ESM 和 CommonJS 模組格式
3
+ UDI 共用元件套件,提供 `UdiTable`、`DateRangePicker` 等可重複使用的 React 元件。
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@udi-organization/udi-package.svg)](https://www.npmjs.com/package/@udi-organization/udi-package)
6
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
-
8
- ## 📦 套件資訊
9
-
10
- - **套件名稱**: `@udi-organization/udi-package`
11
- - **發布平台**: [npm Registry](https://www.npmjs.com/package/@udi-organization/udi-package)
12
- - **倉庫位置**: [GitLab](https://gitlab.com/udi3732104/udi-package/-/tree/main?ref_type=heads)
13
-
14
- ## 🎯 核心特性
15
-
16
- - **集中管理**: 統一維護跨專案共用的 Component 與 Utils Function
17
- - **提升效率**: 避免重複開發,加速專案迭代
18
- - **自動化發布**: 透過 GitLab CI/CD 實現自動化版本管理與發布
19
- - **雙模式開發**: 支援正常模式與 Link 模式,滿足不同開發場景
20
- - **完整測試**: 使用 Jest 進行單元測試,確保代碼品質
21
-
22
- ## 📋 目錄
23
-
24
- - [快速開始](#快速開始)
25
- - [專案結構](#專案結構)
26
- - [環境設定](#環境設定)
27
- - [開發模式](#開發模式)
28
- - [測試](#測試)
29
- - [版本發布](#版本發布)
30
- - [前端專案整合](#前端專案整合)
31
- - [CI/CD 自動化](#cicd-自動化)
32
- - [常見問題](#常見問題)
5
+ - **client(使用端)**:前端專案(如 imp-frontend 等)
6
+ - **package(套件端)**:udi-package
33
7
 
34
8
  ---
35
9
 
36
- ## 🚀 快速開始
37
-
38
- ### 安裝套件
39
-
40
- ```bash
41
- npm install @udi-organization/udi-package --legacy-peer
42
- ```
43
-
44
- ### 使用範例
45
-
46
- ```jsx
47
- import { UdiTable, Button } from '@udi-organization/udi-package';
48
- import { useUdiTableSync } from '@udi-organization/udi-package';
49
-
50
- function MyComponent() {
51
- const tableProps = useUdiTableSync({
52
- /* ... */
53
- });
54
-
55
- return (
56
- <div>
57
- <Button>Click Me</Button>
58
- <UdiTable {...tableProps} />
59
- </div>
60
- );
61
- }
62
- ```
63
-
64
- ---
65
-
66
- ## 📁 專案結構
67
-
68
- ```
69
- udi-package/
70
- ├── src/ # 📝 源代碼目錄
71
- │ ├── index.js # 套件入口,導出所有組件
72
- │ ├── Button.jsx # Button 組件
73
- │ ├── lib/ # 工具函數庫
74
- │ │ └── tr.js # 翻譯工具
75
- │ └── udiTable/ # UdiTable 組件模組
76
- │ ├── UdiTable.jsx # 主組件
77
- │ ├── mockFn.js # 測試用 mock 函數
78
- │ └── hooks/ # 自定義 React Hooks
79
- │ ├── useTableSort.js
80
- │ ├── useTablePagination.js
81
- │ ├── useDataRequest.js
82
- │ ├── useUdiTableSync.js
83
- │ └── useUdiTableSyncMutipleTable.js
84
-
85
- ├── dev/ # 🛠️ 本地開發環境
86
- │ ├── index.html # 開發用 HTML 模板
87
- │ └── main.jsx # 開發入口文件
88
-
89
- ├── dist/ # 📦 編譯輸出目錄(自動生成)
90
- │ ├── index.cjs.js # CommonJS 格式
91
- │ ├── index.cjs.js.map
92
- │ ├── index.esm.js # ES Module 格式
93
- │ └── index.esm.js.map
94
-
95
- ├── .husky/ # 🔐 Git Hooks
96
- │ └── pre-push # 自動版本管理 Hook
97
-
98
- ├── rollup.config.js # 📦 套件打包配置
99
- ├── webpack.config.js # 🔧 本地開發服務器配置
100
- ├── jest.config.cjs # 🧪 測試配置
101
- ├── .gitlab-ci.yml # 🚀 GitLab CI/CD 配置
102
- ├── package.json
103
- └── README.md
104
- ```
105
-
106
- ### 架構說明
107
-
108
- #### 編譯工具分工
109
-
110
- | 工具 | 用途 | 輸出 |
111
- |------|------|------|
112
- | **Rollup** | 編譯套件為標準 npm 包格式 | `dist/index.cjs.js`、`dist/index.esm.js` |
113
- | **Webpack** | 提供本地開發環境,支持熱更新 | `dist-dev/bundle.js` (僅開發用) |
114
-
115
- #### 開發模式
116
-
117
- 1. **正常開發模式**: 使用 npm 官方發布的套件版本
118
- 2. **Link 開發模式**: 使用本地 udi-package 進行即時開發
119
-
120
- #### 工作目錄結構要求
121
-
122
- ```
123
- workspace/
124
- ├── udi-package/ # 套件專案
125
- ├── imp-frontend/ # 前端專案 A
126
- ├── other-frontend/ # 前端專案 B
127
- └── ...
128
- ```
129
-
130
- ⚠️ **重要**: `udi-package` 必須與前端專案放在同一層級,因為 Docker volume 映射需要固定路徑 `/udi-package`
131
-
132
- ---
133
-
134
- ## 🔧 環境設定
135
-
136
- ### 前置要求
10
+ ## 前置作業
137
11
 
138
- | 工具 | 版本要求 |
139
- |------|----------|
140
- | Node.js | >= 20.x |
141
- | npm | >= 9.x |
142
- | Git | >= 2.x |
143
-
144
- ```bash
145
- git clone https://gitlab.com/udi3732104/udi-package.git
146
- cd udi-package
147
- ```
148
-
149
- ### 2. 安裝依賴
150
-
151
- ```bash
152
- npm install
153
- ```
154
-
155
- ### 3. 驗證環境
156
-
157
- ```bash
158
- # 執行測試
159
- npm test
160
-
161
- # 構建套件
162
- npm run build
163
- ```
12
+ 1. `udi-package` 放在與前端專案同層目錄(Docker 鏡射 volume 時需要抓取固定路徑)
13
+ ```
14
+ ├── <前端專案>/
15
+ └── udi-package/
16
+ ```
17
+ 2. 加入 npm 套件開發組織:
18
+ 1. 建立 npm 帳號(使用公司 email 註冊)
19
+ 2. 請管理員邀請至組織 `@udi-organization`
20
+ 3. 執行 `npm login`
21
+ 4. 登入後使用 `npm whoami` 確認
22
+ 3. 在 GitLab 專案中加入 `CI_PUSH_TOKEN` 和 `NPM_TOKEN` 變數,以供 CI/CD 自動佈署(若團隊中已有配置可跳過,可至專案 Settings → CI/CD → Variables 查看)
164
23
 
165
24
  ---
166
25
 
167
- ## 💻 開發模式
168
-
169
- ### 模式 1:獨立開發套件(推薦用於組件開發)
170
-
171
- 適用於開發新組件或修改現有組件時的獨立測試。
172
-
173
- ```bash
174
- # 啟動本地開發服務器(Webpack)
175
- npm run dev
176
- ```
177
-
178
- - 服務器運行於 `http://localhost:3000`
179
- - 支持熱模組替換(HMR)
180
- - 編輯 [dev/main.jsx](dev/main.jsx) 來測試組件
26
+ ## 開發流程
181
27
 
182
- ### 模式 2:與前端專案聯動開發(使用 npm link)
28
+ ### 本地開發(link 模式)
183
29
 
184
- 適用於需要在實際專案中測試套件的情況。
30
+ 1. **client 端**執行以下指令取得本地 package 連結並啟動開發伺服器:
31
+ ```bash
32
+ npm run dev-udi
33
+ ```
34
+ > 此指令會先卸載 npm 上的 `@udi-organization/udi-package`,接著透過 `npm link` 連結本地套件,最後啟動 webpack-dev-server。
185
35
 
186
- #### 步驟 1:在套件專案中建立鏈接
36
+ 2. **package 端**執行打包:
37
+ ```bash
38
+ # 單次打包
39
+ npm run build
187
40
 
188
- ```bash
189
- cd /path/to/udi-package
41
+ # 或持續監聽自動打包
42
+ npm run watch
43
+ ```
44
+ > `build` 使用 Rollup 編譯,輸出至 `dist/` 資料夾(包含 CJS 和 ESM 格式)。
45
+ > client 端會透過 link 直接取得 `dist/` 資料夾的程式。
190
46
 
191
- # 建立全局鏈接
192
- sudo npm link
47
+ 3. 若 package 有持續更動,可使用 `npm run watch` 持續監聽自動打包,或再次執行 `npm run build` 單次打包。
193
48
 
194
- # 啟動監聽模式(自動編譯變更)
195
- npm run watch
196
- ```
49
+ ### 發布測試版本
197
50
 
198
- > `npm run watch` 會監聽 [src/](src/) 目錄的變更,並自動使用 Rollup 編譯到 [dist/](dist/)
51
+ 4. 開發完畢後,在 **package 端**執行:
52
+ ```bash
53
+ # 產生測試版號(可多次執行以遞增測試版號)
54
+ npm run alpha
199
55
 
200
- #### 步驟 2:在前端專案中使用鏈接
56
+ # 推送測試版本至 npm
57
+ npm run alpha:publish
58
+ ```
59
+ > **測試版本無須推送至 GitLab。**
201
60
 
202
- ```bash
203
- cd /path/to/your-frontend-project
61
+ 5. 至 `udi-package/package.json` 查看當前版號。
204
62
 
205
- # 移除 npm 安裝的套件
206
- npm uninstall @udi-organization/udi-package --legacy-peer
63
+ 6. **client 端**安裝測試版本:
64
+ ```bash
65
+ npm install @udi-organization/udi-package@<對應版號> --legacy-peer-deps
66
+ ```
207
67
 
208
- # 鏈接本地套件
209
- npm link @udi-organization/udi-package --legacy-peer
68
+ 7. 推上測試機測試。
210
69
 
211
- # 啟動開發服務器
212
- npm run dev-normal
213
- ```
70
+ ### 正式發布
214
71
 
215
- #### 步驟 3:完成開發後恢復正常模式
216
-
217
- ```bash
218
- # 取消鏈接
219
- npm unlink @udi-organization/udi-package
220
-
221
- # 重新安裝 npm 套件
222
- npm install @udi-organization/udi-package@latest --legacy-peer
223
- ```
72
+ 8. 確認沒問題後推上 GitLab,並確認 CI/CD 是否正確執行。
73
+ 9. CI/CD 正確執行後將會自動將正式版本推上 npm,無須再手動 release。
224
74
 
225
75
  ---
226
76
 
227
- ## 🧪 測試
228
-
229
- 本專案使用 Jest 進行單元測試,配置詳見 [jest.config.cjs](jest.config.cjs)。
230
-
231
- ### 執行測試
232
-
233
- ```bash
234
- # 執行所有測試
235
- npm test
236
-
237
- # 監聽模式(開發時推薦)
238
- npm run test:watch
239
-
240
- # 生成測試覆蓋率報告
241
- npm run test:coverage
242
- ```
243
-
244
- ### 測試文件位置
245
-
246
- 測試文件與源文件放在同一目錄,命名規則:`*.test.js`
77
+ ## 套件編譯說明
247
78
 
248
- ```
249
- src/udiTable/hooks/
250
- ├── useTableSort.js
251
- └── useTableSort.test.js
252
- ```
79
+ | 工具 | 用途 |
80
+ |------|------|
81
+ | **Rollup** | 編譯出正式套件(`dist/index.cjs.js`、`dist/index.esm.js`) |
82
+ | **Webpack** | 編譯套件本地的開發環境(`dev/main.jsx`),方便簡易測試更新 |
253
83
 
254
84
  ---
255
85
 
256
- ## 📦 版本發布
257
-
258
- ### 發布流程概覽
259
-
260
- 本專案支持 **本地手動發布** **GitLab CI/CD 自動發布** 兩種方式。
261
-
262
- ### 方式 1:GitLab CI/CD 自動發布(推薦)
263
-
264
- #### 自動發布觸發條件
265
-
266
- 當你 push `dev` 分支時,會自動觸發 CI/CD Pipeline:
267
-
268
- ```bash
269
- # 提交變更
270
- git add .
271
- git commit -m "feat: 新增功能"
272
-
273
- # 推送到 dev 分支(自動觸發發布)
274
- git push origin dev
275
- ```
276
-
277
- #### 自動發布流程
278
-
279
- 1. **Pre-Push Hook 檢查** ([.husky/pre-push](.husky/pre-push))
280
- - 執行測試(測試失敗則取消 push)
281
- - 🔢 自動版本遞增(`npm version patch`)
282
- - 🚀 將版本 commit 推送到 GitLab
283
-
284
- 2. **GitLab CI/CD Pipeline** (5 個階段,詳見 [.gitlab-ci.yml](.gitlab-ci.yml))
285
- - **Install**: 安裝依賴
286
- - **Test**: 執行單元測試
287
- - **Version**: 檢查版本是否存在,若存在則自動遞增
288
- - **Build**: 編譯套件(Rollup)
289
- - **Deploy**: 發布到 npm
290
-
291
- ### 方式 2:本地手動發布(適用於緊急修復)
292
-
293
- ```bash
294
- # Patch 版本遞增(1.0.0 -> 1.0.1)
295
- npm run release
296
-
297
- # Minor 版本遞增(1.0.0 -> 1.1.0)
298
- npm run release-minor
299
-
300
- # Major 版本遞增(1.0.0 -> 2.0.0)
301
- npm run release-major
302
- ```
303
-
304
- **執行內容**:
305
- 1. 執行測試(`npm test`)
306
- 2. 編譯套件(`npm run build`)
307
- 3. 版本號遞增(`npm version patch/minor/major`)
308
- 4. 發布到 npm(`npm publish --access public`)
309
-
310
- ### 跳過 CI/CD 自動發布
311
-
312
- 在 commit 訊息中加入 `[skip ci]`:
313
-
314
- ```bash
315
- git commit -m "docs: 更新 README [skip ci]"
316
- git push origin dev
317
- ```
86
+ ## 常用指令
87
+
88
+ ### package 端(udi-package)
89
+
90
+ | 指令 | 說明 |
91
+ |------|------|
92
+ | `npm run build` | 使用 Rollup 單次編譯出 `dist/` |
93
+ | `npm run watch` | 使用 Rollup 持續監聽並自動編譯 |
94
+ | `npm run dev` | 啟動 Webpack 本地開發伺服器(port 3000) |
95
+ | `npm run alpha` | 產生 alpha 測試版號 |
96
+ | `npm run alpha:publish` | 發布 alpha 測試版本至 npm |
97
+ | `npm run beta` | 產生 beta 測試版號 |
98
+ | `npm run beta:publish` | 發布 beta 測試版本至 npm |
99
+ | `npm run release` | 正式發布(patch 版號) |
100
+ | `npm run release-minor` | 正式發布(minor 版號) |
101
+ | `npm run release-major` | 正式發布(major 版號) |
102
+ | `npm test` | 執行測試 |
103
+
104
+ ### client 端(前端專案)
105
+
106
+ | 指令 | 說明 |
107
+ |------|------|
108
+ | `npm run dev` | 安裝最新 udi-package 並啟動開發伺服器(port 8068) |
109
+ | `npm run dev-udi` | 使用 link 模式連結本地 udi-package 並啟動開發伺服器 |
110
+ | `npm run dev-normal` | 直接啟動開發伺服器(不更新套件) |
111
+ | `npm run get-udi` | 安裝最新 udi-package 並啟動開發伺服器 |
112
+ | `npm run get-udi-o` | 僅安裝最新 udi-package(不啟動伺服器) |
113
+ | `npm run dev-udi-o` | 僅建立 link 連結(不啟動伺服器) |
114
+ | `npm run commit:package` | 更新 udi-package 並自動 commit |
318
115
 
319
116
  ---
320
117
 
321
- ## 🔗 前端專案整合
322
-
323
- ### 在前端專案中安裝套件
324
-
325
- ```bash
326
- npm install @udi-organization/udi-package@latest --legacy-peer
327
- ```
328
-
329
- > `--legacy-peer` 用於處理 peer dependencies 版本衝突
330
-
331
- ### 導入並使用組件
332
-
333
- ```jsx
334
- // 導入組件
335
- import { UdiTable, Button } from '@udi-organization/udi-package';
336
-
337
- // 導入 Hooks
338
- import {
339
- useUdiTableSync,
340
- useUdiTableSyncMutipleTable
341
- } from '@udi-organization/udi-package';
342
-
343
- function MyComponent() {
344
- const tableProps = useUdiTableSync({
345
- // 配置選項...
346
- });
347
-
348
- return (
349
- <div>
350
- <Button>Click Me</Button>
351
- <UdiTable {...tableProps} />
352
- </div>
353
- );
354
- }
355
- ```
356
-
357
- ### 前端專案配置(推薦設定)
358
-
359
- 在前端專案的 [package.json](package.json) 中添加以下 scripts:
360
-
361
- ```json
362
- {
363
- "scripts": {
364
- "dev": "npm i @udi-organization/udi-package@latest --legacy-peer && npm run dev-normal",
365
- "dev-udi": "npm uninstall @udi-organization/udi-package --legacy-peer && cd /udi-package && sudo npm link && cd /build && npm link @udi-organization/udi-package --legacy-peer && npm run dev-normal",
366
- "dev-normal": "webpack-dev-server --mode=development",
367
- "get-udi": "npm i @udi-organization/udi-package@latest --legacy-peer",
368
- "get-udi-o": "npm i @udi-organization/udi-package@latest --legacy-peer",
369
- "dev-udi-o": "npm uninstall @udi-organization/udi-package --legacy-peer && cd /udi-package && sudo npm link && cd /build && npm link @udi-organization/udi-package --legacy-peer",
370
- }
371
- }
372
- ```
373
-
374
- **指令說明**:
375
-
376
- | 指令 | 用途 | 使用場景 |
377
- |-----|------|----------|
378
- | `npm run dev` | 正常開發模式(含啟動服務器) | 不需要修改 udi-package |
379
- | `npm run dev-udi` | Link 模式(含啟動服務器) | 需要同時開發套件和專案 |
380
- | `npm run dev-normal` | 啟動開發服務器 | 內部使用,不直接調用 |
381
- | `npm run get-udi` | 更新套件到最新版本 | 更新依賴或退出 Link 模式 |
382
- | `npm run get-udi-o` | 僅安裝最新套件(不啟動) | 單純更新套件版本 |
383
- | `npm run dev-udi-o` | 僅設置 Link 模式(不啟動) | 需要 Link 但手動啟動服務器 |
118
+ ## Docker Sandbox 開發
384
119
 
120
+ - **run-sandbox**:在 sandbox 中新增 volume,建立本地的套件專案 udi-package
121
+ - `udi-package` 資料夾需要與前端專案放在同一層
385
122
 
386
123
  ---
387
124
 
388
- ## 🤖 CI/CD 自動化
389
-
390
- ### 環境變數設定(僅發布者需要)
391
-
392
- #### 1. npm 帳號設定
393
-
394
- **建立 npm 帳號**:
395
- 1. 前往 [https://www.npmjs.com](https://www.npmjs.com/) 註冊帳號
396
- 2. 組織管理員邀請加入 `@udi-organization`
125
+ ## Git Push 前注意事項(pre-push)
397
126
 
398
- **登入驗證**:
399
- ```bash
400
- # 登入 npm
401
- npm login
127
+ 在 `git push` 時會先檢查目前是否為 **link 模式**。
402
128
 
403
- # 驗證登入狀態
404
- npm whoami
405
- ```
129
+ 因為 link 模式會把 `@udi-organization/udi-package` 從 `package.json` 中移除,改為運行本地端的 udi-package 作為套件依賴。因此 **git push 以前需要切換回 release 模式**,把套件依賴改成 npm 官方下載的版本。
406
130
 
407
- #### 2. 建立 npm Access Token
408
-
409
- 1. 前往 [https://www.npmjs.com](https://www.npmjs.com/) 登入
410
- 2. 點擊右上角頭像 → **"Access Tokens"**
411
- 3. 點擊 **"Generate New Token"** → 選擇 **"Classic Token"**
412
- 4. **選擇 Token 類型**: ✅ **Automation** (CI/CD 專用)
413
- 5. 複製 Token(例如:`npm_xxxxxxxxxxxx`)
414
-
415
- ⚠️ **重要**: 離開頁面後就看不到了,請立即複製
416
-
417
- #### 3. 在 GitLab 設定環境變數
131
+ ---
418
132
 
419
- | 變數名稱 | 用途 | 必要性 |
420
- |---------|------|--------|
421
- | `NPM_TOKEN` | npm 認證 token | **必要** |
422
- | `CI_PUSH_TOKEN` | GitLab push token(用於回推版本更新) | 選用 |
133
+ ## CI/CD TOKEN 配置
423
134
 
424
- **設定步驟**:
135
+ > 團隊中只要有一人設定即可。
425
136
 
426
- 1. 進入 GitLab 專案
427
- 2. **Settings** → **CI/CD** → **Variables** → **Expand**
428
- 3. 點擊 **"Add variable"**
429
- 4. 填入資訊:
430
- - **Key**: `NPM_TOKEN`
431
- - **Value**: (貼上剛才的 token)
432
- - **Type**: Variable
433
- - ✅ 勾選 **"Mask variable"**
434
- - ✅ 勾選 **"Protect variable"**
435
- 5. 點擊 **"Add variable"**
137
+ ### 1. npm 上產生 Automation Token
436
138
 
437
- ### GitLab CI/CD Pipeline 說明
139
+ 1. 前往 [https://www.npmjs.com](https://www.npmjs.com) 並登入帳號
140
+ 2. 點擊右上角頭像 → **Access Tokens**(或直接前往 `https://www.npmjs.com/settings/<帳號名稱>/tokens`)
141
+ 3. 點擊 **Generate New Token** → 選擇 **Classic Token**
142
+ 4. 選擇 Token 類型:
143
+ - ❌ Publish — 手動發布用
144
+ - ✅ **Automation** — CI/CD 自動化用(選這個)
145
+ - ❌ Read-only — 只能讀取
146
+ 5. 產生後立刻複製 token(格式如 `npm_xxxxxxxxxxxx`)
147
+ > ⚠️ 離開頁面後就看不到了!
438
148
 
439
- 詳細配置見 [.gitlab-ci.yml](.gitlab-ci.yml)
149
+ ### 2. 在 GitLab 產生 Personal Access Token
440
150
 
441
- #### Pipeline 階段
151
+ 1. 進入 GitLab → 右上角頭像 → **Edit Profile**
152
+ 2. 左側選單 → **Access Tokens**
153
+ 3. 點擊 **Add new token**,填入:
442
154
 
443
- ```mermaid
444
- graph LR
445
- A[Install] --> B[Test]
446
- B --> C[Version]
447
- C --> D[Build]
448
- D --> E[Deploy]
449
- ```
155
+ | 欄位 | 值 |
156
+ |------|-----|
157
+ | Token name | `CI Push Token` |
158
+ | Expiration date | 設一年後的日期 |
159
+ | Scopes | ✅ `write_repository` |
450
160
 
451
- | 階段 | 說明 | 關鍵操作 |
452
- |------|------|----------|
453
- | **Install** | 安裝依賴 | `npm ci` |
454
- | **Test** | 執行測試 | `npm test` |
455
- | **Version** | 版本管理 | 檢查並遞增版本號 |
456
- | **Build** | 構建套件 | `npm run build` (Rollup) |
457
- | **Deploy** | 發布到 npm | `npm publish --access public` |
161
+ 4. 點擊 **Create personal access token**
162
+ 5. 立刻複製 token(格式如 `glpat-xxxxxxxxxxxxxxxxxxxx`)
458
163
 
459
- #### Pre-Push Hook 流程
164
+ ### 3. Token 加入專案 CI/CD Variables
460
165
 
461
- 當執行 `git push origin dev` 時:
166
+ 1. 進入 GitLab 專案 **udi / udi-package**
167
+ 2. 左側選單 → **Settings** → **CI/CD**
168
+ 3. 找到 **Variables** 區塊 → 點擊 **Expand**
169
+ 4. 分別新增以下兩個變數:
462
170
 
463
- ```bash
464
- ✅ 1. 檢測分支(只在 dev 分支執行)
465
- ✅ 2. 檢查 commit 訊息(避免無限循環)
466
- 🧪 3. 執行測試(npm test)
467
- 🔢 4. 版本遞增(npm version patch)
468
- 🚀 5. 自動推送到 GitLab
469
- ```
171
+ **NPM_TOKEN:**
470
172
 
173
+ | 欄位 | 值 |
174
+ |------|-----|
175
+ | Key | `NPM_TOKEN` |
176
+ | Value | 貼上 npm Automation Token(`npm_xxxx...`) |
177
+ | Type | `Variable` |
178
+ | Flags | ✅ Mask variable、✅ Protect variable |
471
179
 
180
+ **CI_PUSH_TOKEN:**
472
181
 
182
+ | 欄位 | 值 |
183
+ |------|-----|
184
+ | Key | `CI_PUSH_TOKEN` |
185
+ | Value | 貼上 GitLab Personal Access Token(`glpat-xxxx...`) |
186
+ | Type | `Variable` |
187
+ | Flags | ✅ Mask variable、✅ Protect variable |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udi-organization/udi-package",
3
- "version": "1.0.75-alpha.1",
3
+ "version": "1.0.77",
4
4
  "description": "package for udi",
5
5
  "repository": {
6
6
  "type": "gitlab",