tylersong 1.0.9 → 1.0.11
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/.cursor/plans/-----------8c733d2f.plan.md +158 -0
- package/.editorconfig +15 -0
- package/.eslintrc.json +33 -0
- package/.github/workflows/ci.yml +59 -25
- package/.github/workflows/deploy.yml +7 -13
- package/.github/workflows/publish.yml +30 -297
- package/.prettierrc +13 -0
- package/README.md +133 -45
- package/dist/index.js +61 -23
- package/dist/index.js.map +1 -1
- package/docs/auto-deployment.md +191 -0
- package/docs/deployment.md +82 -0
- package/docs/development.md +394 -0
- package/docs/direct-deployment.md +116 -0
- package/docs/discord-setup.md +158 -0
- package/docs/github-actions-fixes.md +142 -0
- package/docs/improvements.md +287 -0
- package/docs/pipeline.md +228 -0
- package/docs/testing.md +173 -0
- package/docs/usage.md +112 -0
- package/docs/workflows.md +176 -0
- package/package.json +16 -3
- package/src/index.ts +77 -32
- package/test/index.test.ts +167 -0
- package/tsconfig.eslint.json +9 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<!-- 8c733d2f-63d8-4158-aa6e-255c23deedca 77c7f805-6518-4181-90b0-4dff17016b38 -->
|
|
2
|
+
# 프로젝트 품질 개선 계획
|
|
3
|
+
|
|
4
|
+
## 📊 현재 프로젝트 분석
|
|
5
|
+
|
|
6
|
+
### ✅ 장점
|
|
7
|
+
|
|
8
|
+
1. **깔끔한 코드 구조**: TypeScript 기반의 명확한 단일 파일 구조
|
|
9
|
+
2. **타입 안정성**: TypeScript 사용으로 인터페이스 정의 및 strict 모드 활성화
|
|
10
|
+
3. **Bun 지원**: 최신 런타임 지원으로 성능 최적화 가능
|
|
11
|
+
4. **풍부한 문서화**: docs 폴더에 배포, 사용법 등 상세 문서 작성됨
|
|
12
|
+
5. **사용자 친화적**: Commander.js, Inquirer.js로 직관적인 CLI 경험 제공
|
|
13
|
+
6. **크로스 플랫폼**: Windows, macOS, Linux 모두 지원하는 URL 열기 기능
|
|
14
|
+
|
|
15
|
+
### ❌ 단점 및 개선 필요 사항
|
|
16
|
+
|
|
17
|
+
#### 1. **테스트 코드 부재** (Critical)
|
|
18
|
+
|
|
19
|
+
- 현재 `package.json`에 "No test specified"로 테스트 미구현
|
|
20
|
+
- 사용자 규칙에 따라 Vitest 사용 필요
|
|
21
|
+
|
|
22
|
+
#### 2. **에러 처리 부족** (High)
|
|
23
|
+
|
|
24
|
+
- `exec()` 함수의 에러 핸들링 없음
|
|
25
|
+
- URL 열기 실패 시 사용자 피드백 없음
|
|
26
|
+
- 프로미스 거부(rejection) 처리가 `.catch(console.error)`로만 처리
|
|
27
|
+
|
|
28
|
+
#### 3. **린팅/포맷팅 설정 없음** (Medium)
|
|
29
|
+
|
|
30
|
+
- ESLint, Prettier 등 코드 품질 도구 미설정
|
|
31
|
+
- 일관된 코드 스타일 관리 어려움
|
|
32
|
+
|
|
33
|
+
#### 4. **CI/CD 파이프라인 없음** (High)
|
|
34
|
+
|
|
35
|
+
- docs에 워크플로우 문서는 있으나 실제 `.github/workflows` 폴더 없음
|
|
36
|
+
- 자동 테스트, 빌드, 배포 검증 불가
|
|
37
|
+
|
|
38
|
+
#### 5. **버전 중복 관리** (Low)
|
|
39
|
+
|
|
40
|
+
- `package.json`과 `src/index.ts`에 버전이 각각 하드코딩됨
|
|
41
|
+
- 버전 업데이트 시 두 곳을 수정해야 함
|
|
42
|
+
|
|
43
|
+
#### 6. **Bun 우선 정책 미준수** (Medium)
|
|
44
|
+
|
|
45
|
+
- `prepublishOnly` 스크립트가 `npm run build` 사용
|
|
46
|
+
- 사용자 규칙에 따라 bun 사용 필요
|
|
47
|
+
|
|
48
|
+
#### 7. **Git 관리 개선 필요** (Low)
|
|
49
|
+
|
|
50
|
+
- `.gitignore`에 `dist/`, `*.log` 등 명시 필요
|
|
51
|
+
- `node_modules` 제외 확인 필요
|
|
52
|
+
|
|
53
|
+
#### 8. **보안 및 의존성 관리** (Medium)
|
|
54
|
+
|
|
55
|
+
- 의존성 취약점 자동 검사 없음
|
|
56
|
+
- 정기적인 업데이트 메커니즘 부재
|
|
57
|
+
|
|
58
|
+
#### 9. **환경별 설정 분리 없음** (Low)
|
|
59
|
+
|
|
60
|
+
- 개인정보(GitHub URL, 이메일)가 하드코딩됨
|
|
61
|
+
- 설정 파일로 분리하면 재사용성 향상
|
|
62
|
+
|
|
63
|
+
## 🔧 개선 작업 항목
|
|
64
|
+
|
|
65
|
+
### 1. 테스트 환경 구축 (`test/` 폴더)
|
|
66
|
+
|
|
67
|
+
- **파일**: `test/index.test.ts`
|
|
68
|
+
- Vitest 설치 및 설정
|
|
69
|
+
- 주요 함수(`openUrl`, `main`) 단위 테스트 작성
|
|
70
|
+
- CLI 옵션별 통합 테스트 작성
|
|
71
|
+
|
|
72
|
+
### 2. 에러 처리 강화 (`src/index.ts`)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// openUrl 함수 개선
|
|
76
|
+
const openUrl = (url: string): void => {
|
|
77
|
+
exec(`${command} ${url}`, (error) => {
|
|
78
|
+
if (error) {
|
|
79
|
+
console.error(chalk.red('❌ 브라우저를 열 수 없습니다.'));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. 린팅/포맷팅 설정
|
|
86
|
+
|
|
87
|
+
- **파일**: `.eslintrc.json`, `.prettierrc`, `.editorconfig`
|
|
88
|
+
- ESLint + TypeScript 플러그인 설치
|
|
89
|
+
- Prettier 설정
|
|
90
|
+
- pre-commit 훅 설정 (husky)
|
|
91
|
+
|
|
92
|
+
### 4. CI/CD 파이프라인 구축
|
|
93
|
+
|
|
94
|
+
- **파일**: `.github/workflows/ci.yml`, `.github/workflows/publish.yml`
|
|
95
|
+
- Pull Request 시 자동 테스트/린트
|
|
96
|
+
- main 브랜치 머지 시 자동 빌드 검증
|
|
97
|
+
- 태그 푸시 시 NPM 자동 배포
|
|
98
|
+
|
|
99
|
+
### 5. 버전 관리 개선
|
|
100
|
+
|
|
101
|
+
- `src/index.ts`에서 버전 하드코딩 제거
|
|
102
|
+
- `package.json` 버전을 동적으로 읽어오기
|
|
103
|
+
|
|
104
|
+
### 6. 프로젝트 설정 개선
|
|
105
|
+
|
|
106
|
+
- **파일**: `.gitignore`, `vitest.config.ts`
|
|
107
|
+
- Bun 우선 스크립트 수정
|
|
108
|
+
- Git ignore 규칙 추가
|
|
109
|
+
|
|
110
|
+
### 7. 문서 업데이트
|
|
111
|
+
|
|
112
|
+
- **파일**: `docs/testing.md`, `docs/development.md`
|
|
113
|
+
- 테스트 실행 방법 문서화
|
|
114
|
+
- 개발 환경 설정 가이드 추가
|
|
115
|
+
- 파이프라인 다이어그램 (Mermaid 그래프)
|
|
116
|
+
|
|
117
|
+
## 📝 생성/수정될 파일 목록
|
|
118
|
+
|
|
119
|
+
### 새로 생성
|
|
120
|
+
|
|
121
|
+
- `test/index.test.ts` - 테스트 코드
|
|
122
|
+
- `vitest.config.ts` - Vitest 설정
|
|
123
|
+
- `.eslintrc.json` - ESLint 설정
|
|
124
|
+
- `.prettierrc` - Prettier 설정
|
|
125
|
+
- `.gitignore` - Git ignore 규칙
|
|
126
|
+
- `.github/workflows/ci.yml` - CI 워크플로우
|
|
127
|
+
- `.github/workflows/publish.yml` - 배포 워크플로우
|
|
128
|
+
- `docs/testing.md` - 테스트 가이드
|
|
129
|
+
- `docs/pipeline.md` - CI/CD 파이프라인 설명 (Mermaid 그래프 포함)
|
|
130
|
+
|
|
131
|
+
### 수정
|
|
132
|
+
|
|
133
|
+
- `src/index.ts` - 에러 처리 강화, 버전 동적 로딩
|
|
134
|
+
- `package.json` - 테스트 스크립트 추가, bun 우선 스크립트 수정
|
|
135
|
+
- `README.md` - 테스트, 린팅 배지 추가
|
|
136
|
+
|
|
137
|
+
## 🎯 우선순위
|
|
138
|
+
|
|
139
|
+
1. **테스트 환경 구축** (가장 중요)
|
|
140
|
+
2. **에러 처리 강화**
|
|
141
|
+
3. **CI/CD 파이프라인**
|
|
142
|
+
4. **린팅/포맷팅 설정**
|
|
143
|
+
5. **기타 개선 사항**
|
|
144
|
+
|
|
145
|
+
### To-dos
|
|
146
|
+
|
|
147
|
+
- [ ] Vitest 설치 및 설정 파일 생성 (vitest.config.ts)
|
|
148
|
+
- [ ] test/index.test.ts 파일 작성 (주요 기능 테스트)
|
|
149
|
+
- [ ] src/index.ts의 에러 처리 강화 (openUrl, main 함수)
|
|
150
|
+
- [ ] ESLint, Prettier 설정 파일 생성
|
|
151
|
+
- [ ] .github/workflows/ci.yml 생성 (테스트, 린트 자동화)
|
|
152
|
+
- [ ] .github/workflows/publish.yml 생성 (NPM 자동 배포)
|
|
153
|
+
- [ ] src/index.ts에서 버전을 package.json에서 동적으로 읽어오기
|
|
154
|
+
- [ ] .gitignore 파일 생성 또는 개선
|
|
155
|
+
- [ ] package.json의 테스트/린트 스크립트 추가, bun 우선 수정
|
|
156
|
+
- [ ] docs/testing.md 문서 작성
|
|
157
|
+
- [ ] docs/pipeline.md 작성 (Mermaid 그래프 포함)
|
|
158
|
+
- [ ] README.md에 테스트, 린팅 배지 및 정보 추가
|
package/.editorconfig
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"node": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended",
|
|
9
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
|
10
|
+
],
|
|
11
|
+
"parser": "@typescript-eslint/parser",
|
|
12
|
+
"parserOptions": {
|
|
13
|
+
"ecmaVersion": "latest",
|
|
14
|
+
"sourceType": "module",
|
|
15
|
+
"project": "./tsconfig.eslint.json"
|
|
16
|
+
},
|
|
17
|
+
"plugins": ["@typescript-eslint"],
|
|
18
|
+
"rules": {
|
|
19
|
+
"@typescript-eslint/no-unused-vars": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
"argsIgnorePattern": "^_",
|
|
23
|
+
"varsIgnorePattern": "^_"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"@typescript-eslint/explicit-function-return-type": "warn",
|
|
27
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
28
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
29
|
+
"no-console": "off"
|
|
30
|
+
},
|
|
31
|
+
"ignorePatterns": ["dist", "node_modules", "*.config.ts", "*.config.js", "**/*.d.ts"]
|
|
32
|
+
}
|
|
33
|
+
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -7,39 +7,73 @@ on:
|
|
|
7
7
|
branches: [main, develop]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
name: Lint & Test
|
|
10
|
+
test:
|
|
11
|
+
name: Test & Lint
|
|
13
12
|
runs-on: ubuntu-latest
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [18.x, 20.x]
|
|
17
|
+
|
|
15
18
|
steps:
|
|
16
|
-
- name:
|
|
19
|
+
- name: 코드 체크아웃
|
|
17
20
|
uses: actions/checkout@v4
|
|
18
21
|
|
|
19
|
-
- name:
|
|
20
|
-
uses:
|
|
22
|
+
- name: Bun 설치
|
|
23
|
+
uses: oven-sh/setup-bun@v1
|
|
24
|
+
with:
|
|
25
|
+
bun-version: latest
|
|
26
|
+
|
|
27
|
+
- name: 의존성 캐시
|
|
28
|
+
uses: actions/cache@v3
|
|
21
29
|
with:
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
path: ~/.bun/install/cache
|
|
31
|
+
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
|
|
32
|
+
restore-keys: |
|
|
33
|
+
${{ runner.os }}-bun-
|
|
24
34
|
|
|
25
|
-
- name:
|
|
26
|
-
run:
|
|
35
|
+
- name: 의존성 설치
|
|
36
|
+
run: bun install
|
|
27
37
|
|
|
28
|
-
- name:
|
|
29
|
-
run:
|
|
38
|
+
- name: 타입 체크
|
|
39
|
+
run: bun run build
|
|
30
40
|
|
|
31
|
-
- name:
|
|
32
|
-
run:
|
|
41
|
+
- name: 린트 실행
|
|
42
|
+
run: bun run lint
|
|
33
43
|
|
|
34
|
-
- name:
|
|
35
|
-
run:
|
|
36
|
-
node dist/index.js --version
|
|
37
|
-
node dist/index.js --help
|
|
44
|
+
- name: 테스트 실행
|
|
45
|
+
run: bun run test
|
|
38
46
|
|
|
39
|
-
- name:
|
|
40
|
-
|
|
47
|
+
- name: 테스트 커버리지 업로드
|
|
48
|
+
if: matrix.node-version == '20.x'
|
|
49
|
+
uses: codecov/codecov-action@v3
|
|
50
|
+
with:
|
|
51
|
+
files: ./coverage/coverage-final.json
|
|
52
|
+
flags: unittests
|
|
53
|
+
name: codecov-umbrella
|
|
54
|
+
|
|
55
|
+
build:
|
|
56
|
+
name: Build
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
needs: test
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
steps:
|
|
61
|
+
- name: 코드 체크아웃
|
|
62
|
+
uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- name: Bun 설치
|
|
65
|
+
uses: oven-sh/setup-bun@v1
|
|
66
|
+
with:
|
|
67
|
+
bun-version: latest
|
|
68
|
+
|
|
69
|
+
- name: 의존성 설치
|
|
70
|
+
run: bun install
|
|
71
|
+
|
|
72
|
+
- name: Bun으로 빌드
|
|
73
|
+
run: bun run build:bun
|
|
74
|
+
|
|
75
|
+
- name: 빌드 결과물 업로드
|
|
76
|
+
uses: actions/upload-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: dist
|
|
79
|
+
path: dist/
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
deploy:
|
|
17
17
|
name: CI & Deploy
|
|
18
18
|
runs-on: ubuntu-latest
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
steps:
|
|
21
21
|
# === 기본 Setup ===
|
|
22
22
|
- name: Checkout
|
|
@@ -57,12 +57,12 @@ jobs:
|
|
|
57
57
|
# Git 설정
|
|
58
58
|
git config user.name "github-actions[bot]"
|
|
59
59
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
62
62
|
PUBLISHED_VERSION=$(npm view tylersong version 2>/dev/null || echo "0.0.0")
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
echo "📦 Current: $CURRENT_VERSION | Published: $PUBLISHED_VERSION"
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
# 같은 버전이면 자동 업데이트
|
|
67
67
|
if [ "$CURRENT_VERSION" == "$PUBLISHED_VERSION" ]; then
|
|
68
68
|
echo "🔄 Auto-updating version..."
|
|
@@ -83,12 +83,6 @@ jobs:
|
|
|
83
83
|
npm version $VERSION_TYPE --no-git-tag-version
|
|
84
84
|
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
85
85
|
|
|
86
|
-
# 소스코드 버전 업데이트
|
|
87
|
-
if [ -f "src/index.ts" ]; then
|
|
88
|
-
sed -i.bak "s/program\.version(\".*\")/program.version(\"$NEW_VERSION\")/g" src/index.ts
|
|
89
|
-
rm -f src/index.ts.bak
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
86
|
echo "✅ Updated to v$NEW_VERSION"
|
|
93
87
|
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
|
94
88
|
|
|
@@ -96,7 +90,7 @@ jobs:
|
|
|
96
90
|
npm run build
|
|
97
91
|
|
|
98
92
|
# 커밋 & 푸시
|
|
99
|
-
git add package.json package-lock.json
|
|
93
|
+
git add package.json package-lock.json
|
|
100
94
|
git commit -m "chore: bump version to v$NEW_VERSION [skip ci]"
|
|
101
95
|
git push origin main
|
|
102
96
|
|
|
@@ -134,7 +128,7 @@ jobs:
|
|
|
134
128
|
script: |
|
|
135
129
|
const version = process.env.NEW_VERSION;
|
|
136
130
|
const tagName = context.ref.replace('refs/tags/', '');
|
|
137
|
-
|
|
131
|
+
|
|
138
132
|
await github.rest.repos.createRelease({
|
|
139
133
|
owner: context.repo.owner,
|
|
140
134
|
repo: context.repo.repo,
|
|
@@ -167,4 +161,4 @@ jobs:
|
|
|
167
161
|
run: |
|
|
168
162
|
echo "❌ Deployment failed!"
|
|
169
163
|
echo "📋 Check the logs above for details"
|
|
170
|
-
exit 1
|
|
164
|
+
exit 1
|