@seahworks/branch-cli 1.0.0 → 1.0.2
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/README.md +13 -12
- package/package.json +1 -1
- package/src/config.js +1 -0
- package/src/index.js +22 -5
package/README.md
CHANGED
|
@@ -6,43 +6,44 @@
|
|
|
6
6
|
|
|
7
7
|
### Yarn (권장)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
10
|
yarn global add @seah/branch-cli
|
|
11
|
-
|
|
11
|
+
```
|
|
12
12
|
|
|
13
13
|
### npm
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
```bash
|
|
16
16
|
npm install -g @seah/branch-cli
|
|
17
|
-
|
|
17
|
+
```
|
|
18
18
|
|
|
19
19
|
## 사용법
|
|
20
20
|
|
|
21
21
|
Git 저장소 내에서 다음 명령어를 실행하세요:
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
```bash
|
|
24
24
|
seah-branch
|
|
25
|
-
|
|
25
|
+
```
|
|
26
26
|
|
|
27
27
|
대화형 프롬프트를 따라 다음을 선택/입력합니다:
|
|
28
28
|
|
|
29
29
|
1. 브랜치 타입 (feature/hotfix/bugfix)
|
|
30
30
|
2. 모듈 (공통/전자결재/조직도/근태/게시판/관리자/SELIS/SETIS)
|
|
31
|
-
3. 회사 (
|
|
32
|
-
4. SR/ITS 번호 (예: SR2601-01234)
|
|
31
|
+
3. 회사 (세아홀딩스/세아베스틸지주/세아베스틸/세아창원특수강/세아제강지주/세아제강/기타)
|
|
32
|
+
4. SR/ITS 번호 (예: SR2601-01234 또는 빈 값으로 남겨두세요)
|
|
33
33
|
|
|
34
34
|
## 브랜치 네이밍 규칙
|
|
35
35
|
|
|
36
36
|
생성되는 브랜치는 다음 형식을 따릅니다:
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
```
|
|
39
39
|
{type}/{year}/{module}/{company}/{mmdd}-{sr-number}
|
|
40
|
-
|
|
40
|
+
```
|
|
41
41
|
|
|
42
42
|
**예시:**
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
```
|
|
44
45
|
feature/2024/appr/aaaa0000000/1229-sr2612-01234
|
|
45
|
-
|
|
46
|
+
```
|
|
46
47
|
|
|
47
48
|
## 요구사항
|
|
48
49
|
|
package/package.json
CHANGED
package/src/config.js
CHANGED
package/src/index.js
CHANGED
|
@@ -13,11 +13,16 @@ function getTodayMMDD() {
|
|
|
13
13
|
|
|
14
14
|
// SR/ITS 번호 검증
|
|
15
15
|
function validateSRNumber(value) {
|
|
16
|
+
// 빈 값 허용
|
|
17
|
+
if (!value || value.trim() === "") {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
const pattern = /^(SR|ITS)\d{4}-\d{5}$/i;
|
|
17
22
|
if (pattern.test(value)) {
|
|
18
23
|
return true;
|
|
19
24
|
}
|
|
20
|
-
return "SR2601-01234 또는 ITS2601-01234 형식으로
|
|
25
|
+
return "SR2601-01234 또는 ITS2601-01234 형식으로 입력하거나 빈 값으로 남겨두세요";
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
async function createBranch() {
|
|
@@ -43,16 +48,28 @@ async function createBranch() {
|
|
|
43
48
|
});
|
|
44
49
|
|
|
45
50
|
// SR/ITS 번호 입력
|
|
46
|
-
const
|
|
47
|
-
message: "SR/ITS 번호를 입력하세요 (
|
|
51
|
+
const srNumberInput = await input({
|
|
52
|
+
message: "SR/ITS 또는 티켓 번호를 입력하세요 (없으면 Enter):",
|
|
48
53
|
validate: validateSRNumber,
|
|
49
|
-
transformer: (value) =>
|
|
54
|
+
transformer: (value) => {
|
|
55
|
+
if (!value || value.trim() === "") {
|
|
56
|
+
return "없음";
|
|
57
|
+
}
|
|
58
|
+
return value.toUpperCase();
|
|
59
|
+
},
|
|
50
60
|
});
|
|
51
61
|
|
|
52
62
|
// 브랜치명 생성
|
|
53
63
|
const year = new Date().getFullYear();
|
|
54
64
|
const date = getTodayMMDD();
|
|
55
|
-
|
|
65
|
+
|
|
66
|
+
// SR 번호가 없으면 브랜치명에서 제외
|
|
67
|
+
let branchName;
|
|
68
|
+
if (!srNumberInput || srNumberInput.trim() === "") {
|
|
69
|
+
branchName = `${type}/${year}/${module}/${company}/${date}`;
|
|
70
|
+
} else {
|
|
71
|
+
branchName = `${type}/${year}/${module}/${company}/${date}-${srNumberInput.toLowerCase()}`;
|
|
72
|
+
}
|
|
56
73
|
|
|
57
74
|
console.log(chalk.yellow(`\n생성할 브랜치: ${branchName}\n`));
|
|
58
75
|
|