tylersong 1.0.4 → 1.0.5

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/docs/usage.md ADDED
@@ -0,0 +1,112 @@
1
+ # tylersong CLI 사용법
2
+
3
+ ## 설치
4
+
5
+ NPX를 통해 바로 실행할 수 있습니다:
6
+
7
+ ```bash
8
+ npx tylersong
9
+ ```
10
+
11
+ ## 옵션
12
+
13
+ ### 기본 사용법
14
+
15
+ ```bash
16
+ npx tylersong
17
+ ```
18
+
19
+ 인터랙티브 모드로 개발자 프로필 정보를 확인할 수 있습니다.
20
+
21
+ ### 명령어 옵션
22
+
23
+ - `-V, --version`: 버전 정보 출력
24
+ - `-g, --github`: GitHub 프로필을 브라우저에서 바로 열기
25
+ - `-h, --help`: 도움말 출력
26
+
27
+ ### 예시
28
+
29
+ ```bash
30
+ # 버전 확인
31
+ npx tylersong --version
32
+
33
+ # GitHub 프로필 열기
34
+ npx tylersong --github
35
+
36
+ # 도움말 보기
37
+ npx tylersong --help
38
+ ```
39
+
40
+ ## 개발
41
+
42
+ ### TypeScript로 개발
43
+
44
+ #### NPM 사용
45
+
46
+ ```bash
47
+ # 의존성 설치
48
+ npm install
49
+
50
+ # 개발 모드 실행
51
+ npm run dev
52
+
53
+ # 빌드
54
+ npm run build
55
+
56
+ # 빌드된 파일 실행
57
+ npm start
58
+ ```
59
+
60
+ #### Bun 사용 (더 빠른 성능!)
61
+
62
+ ```bash
63
+ # 의존성 설치
64
+ bun install
65
+
66
+ # 개발 모드 실행 (TypeScript 직접 실행)
67
+ bun run dev:bun
68
+
69
+ # 빌드 (bun 번들러 사용)
70
+ bun run build:bun
71
+
72
+ # 빌드된 파일 실행
73
+ bun run start:bun
74
+
75
+ # 또는 TypeScript 소스를 직접 실행
76
+ bun run src/index.ts
77
+ ```
78
+
79
+ ### 프로젝트 구조
80
+
81
+ ```
82
+ tylersong/
83
+ ├── src/
84
+ │ └── index.ts # 메인 TypeScript 소스 파일
85
+ ├── dist/ # 빌드된 JavaScript 파일들
86
+ ├── docs/ # 문서 파일들
87
+ ├── package.json # 패키지 설정
88
+ └── tsconfig.json # TypeScript 설정
89
+ ```
90
+
91
+ ## 기능
92
+
93
+ - 🚀 개발자 프로필 정보 표시
94
+ - 💻 GitHub 프로필 바로 열기
95
+ - ✨ 터미널에서 색상과 아이콘으로 꾸며진 출력
96
+ - 📧 이메일 연락처 정보 제공
97
+
98
+ ## 배포
99
+
100
+ 자세한 배포 가이드는 [docs/deployment.md](./deployment.md)를 참고해주세요.
101
+
102
+ ### 빠른 배포
103
+
104
+ ```bash
105
+ # 패치 버전 업데이트 후 자동 배포
106
+ npm version patch
107
+ git push origin main
108
+
109
+ # 또는 태그와 함께 즉시 배포
110
+ npm version patch
111
+ git push origin main --tags
112
+ ```
@@ -0,0 +1,176 @@
1
+ # GitHub Actions 워크플로우 가이드
2
+
3
+ 이 프로젝트는 모듈화된 GitHub Actions 워크플로우를 사용합니다.
4
+
5
+ ## 📁 워크플로우 구조
6
+
7
+ ```
8
+ .github/
9
+ ├── actions/
10
+ │ └── setup-runtime/ # 재사용 가능한 컴포지트 액션
11
+ │ └── action.yml
12
+ └── workflows/
13
+ ├── ci.yml # 지속적 통합 (테스트, 빌드, 린팅)
14
+ └── publish.yml # NPM 배포
15
+ ```
16
+
17
+ ## 🔄 워크플로우 설명
18
+
19
+ ### 1. Continuous Integration (ci.yml)
20
+
21
+ **트리거:**
22
+
23
+ - `main`, `develop` 브랜치로의 push
24
+ - `main`, `develop` 브랜치로의 pull request
25
+
26
+ **작업:**
27
+
28
+ - **test**: Node.js와 Bun 환경에서 테스트 실행
29
+ - **build**: TypeScript 빌드 및 아티팩트 업로드
30
+ - **lint**: 코드 품질 검사, 타입 체크, 보안 감사
31
+
32
+ ### 2. Publish to NPM (publish.yml)
33
+
34
+ **트리거:**
35
+
36
+ - `main` 브랜치로의 push
37
+ - `v*` 형태의 태그 push
38
+ - CI 워크플로우 완료 후 (workflow_run)
39
+
40
+ **작업:**
41
+
42
+ - **check-ci**: CI 워크플로우 성공 여부 확인
43
+ - **version-check**: 버전 변경 사항 확인
44
+ - **publish**: NPM에 패키지 배포
45
+ - **notify**: 배포 결과 알림
46
+
47
+ ## 🔧 재사용 가능한 액션
48
+
49
+ ### setup-runtime
50
+
51
+ Node.js 또는 Bun 런타임 환경을 설정하고 의존성을 설치합니다.
52
+
53
+ **입력:**
54
+
55
+ - `runtime`: 'node' 또는 'bun'
56
+ - `node-version`: Node.js 버전 (기본: '20.x')
57
+ - `bun-version`: Bun 버전 (기본: 'latest')
58
+
59
+ **사용 예:**
60
+
61
+ ```yaml
62
+ - name: Setup runtime environment
63
+ uses: ./.github/actions/setup-runtime
64
+ with:
65
+ runtime: node
66
+ ```
67
+
68
+ ### discord-notify
69
+
70
+ Discord 웹후크를 통해 알림을 전송합니다.
71
+
72
+ **입력:**
73
+
74
+ - `webhook-url`: Discord 웹후크 URL (필수)
75
+ - `status`: 워크플로우 상태 (success/failure/cancelled)
76
+ - `title`: 알림 제목 (필수)
77
+ - `description`: 알림 설명
78
+ - `color`: Embed 색상 (hex, # 제외)
79
+ - `fields`: 추가 필드 (JSON 배열)
80
+
81
+ **사용 예:**
82
+
83
+ ```yaml
84
+ - name: Send Discord notification
85
+ uses: ./.github/actions/discord-notify
86
+ with:
87
+ webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
88
+ status: success
89
+ title: "배포 완료!"
90
+ description: "새 버전이 배포되었습니다."
91
+ ```
92
+
93
+ ## 🚀 배포 시나리오
94
+
95
+ ### 자동 배포 (main 브랜치)
96
+
97
+ 1. 코드를 `main` 브랜치에 push
98
+ 2. CI 워크플로우 실행 (테스트, 빌드, 린팅)
99
+ 3. CI 성공 시 배포 워크플로우 실행
100
+ 4. package.json 버전이 NPM과 다르면 자동 배포
101
+
102
+ ### 즉시 배포 (태그)
103
+
104
+ 1. 버전 태그 push (`v1.0.5` 등)
105
+ 2. CI와 배포 워크플로우 동시 실행
106
+ 3. CI 성공 시 무조건 NPM에 배포
107
+ 4. GitHub Release 자동 생성
108
+
109
+ ### Pull Request
110
+
111
+ 1. PR 생성 시 CI 워크플로우만 실행
112
+ 2. 테스트, 빌드, 린팅 검사
113
+ 3. 배포는 실행되지 않음 (dry-run만)
114
+
115
+ ## 📋 워크플로우 흐름도
116
+
117
+ ```mermaid
118
+ graph TD
119
+ A[코드 Push/PR] --> B[CI 워크플로우]
120
+ B --> C{테스트 통과?}
121
+ C -->|실패| D[❌ 빌드 실패]
122
+ C -->|성공| E[빌드 & 아티팩트 업로드]
123
+ E --> F{main 브랜치?}
124
+ F -->|No| G[✅ CI 완료]
125
+ F -->|Yes| H[배포 워크플로우]
126
+ H --> I{버전 변경?}
127
+ I -->|No| J[⏭️ 배포 스킵]
128
+ I -->|Yes| K[NPM 배포]
129
+ K --> L[✅ 배포 완료]
130
+ ```
131
+
132
+ ## ⚙️ 환경 설정
133
+
134
+ ### GitHub Secrets
135
+
136
+ Repository Settings → Secrets and variables → Actions에서 설정:
137
+
138
+ - `NPM_TOKEN`: NPM 액세스 토큰
139
+ - `DISCORD_WEBHOOK_URL`: Discord 웹후크 URL (선택사항)
140
+ - `GITHUB_TOKEN`: 자동으로 제공됨 (Release 생성용)
141
+
142
+ > 💬 **Discord 알림**: 자세한 설정은 [Discord 설정 가이드](./discord-setup.md)를 참고하세요.
143
+
144
+ ### GitHub Environment
145
+
146
+ `production` 환경 설정을 통해 배포 시 추가 보안 검토 가능
147
+
148
+ ## 🔍 모니터링
149
+
150
+ ### CI 상태 확인
151
+
152
+ - Actions 탭에서 각 워크플로우 실행 상태 확인
153
+ - 실패 시 로그를 통해 문제 진단
154
+
155
+ ### 배포 상태 확인
156
+
157
+ - NPM: https://www.npmjs.com/package/tylersong
158
+ - GitHub Releases: 태그 배포 시 자동 생성
159
+ - 알림 작업에서 성공/실패 상태 확인
160
+
161
+ ## 🛠️ 트러블슈팅
162
+
163
+ ### CI 실패 시
164
+
165
+ 1. 테스트 실패: 코드 수정 후 재푸시
166
+ 2. 빌드 실패: TypeScript 오류 확인
167
+ 3. 린팅 실패: 코드 품질 이슈 해결
168
+
169
+ ### 배포 실패 시
170
+
171
+ 1. NPM_TOKEN 확인
172
+ 2. package.json 버전 확인
173
+ 3. 빌드 아티팩트 존재 확인
174
+ 4. NPM 패키지명 중복 확인
175
+
176
+ 이 구조를 통해 각 워크플로우의 책임이 명확히 분리되어 유지보수가 쉬워집니다.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "tylersong",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "나의 CLI 자기소개 도구",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
6
  "bin": {
7
- "tylersong": "index.js"
7
+ "tylersong": "dist/index.js"
8
8
  },
9
9
  "type": "module",
10
10
  "keywords": [
@@ -13,11 +13,26 @@
13
13
  "author": "송민성",
14
14
  "license": "MIT",
15
15
  "scripts": {
16
- "test": "echo \"No test specified\""
16
+ "build": "tsc",
17
+ "build:bun": "bun build src/index.ts --outdir dist --target node",
18
+ "dev": "tsx src/index.ts",
19
+ "dev:bun": "bun run src/index.ts",
20
+ "start": "node dist/index.js",
21
+ "start:bun": "bun run dist/index.js",
22
+ "test": "echo \"No test specified\"",
23
+ "prepublishOnly": "npm run build"
17
24
  },
18
25
  "dependencies": {
19
26
  "chalk": "^5.4.1",
20
27
  "commander": "^13.1.0",
21
28
  "inquirer": "^12.4.2"
29
+ },
30
+ "devDependencies": {
31
+ "@types/chalk": "^0.4.31",
32
+ "@types/inquirer": "^9.0.8",
33
+ "@types/node": "^24.1.0",
34
+ "ts-node": "^10.9.2",
35
+ "tsx": "^4.20.3",
36
+ "typescript": "^5.9.2"
22
37
  }
23
38
  }
@@ -5,8 +5,16 @@ import chalk from "chalk";
5
5
  import { program } from "commander";
6
6
  import { exec } from "child_process";
7
7
 
8
- const openUrl = (url) => {
9
- const command =
8
+ interface ProgramOptions {
9
+ github?: boolean;
10
+ }
11
+
12
+ interface UserAnswer {
13
+ showInfo: boolean;
14
+ }
15
+
16
+ const openUrl = (url: string): void => {
17
+ const command: string =
10
18
  process.platform === "win32"
11
19
  ? "start"
12
20
  : process.platform === "darwin"
@@ -15,20 +23,20 @@ const openUrl = (url) => {
15
23
  exec(`${command} ${url}`);
16
24
  };
17
25
 
18
- program.version("1.0.3").description("송민성의 개발자 프로필 CLI");
26
+ program.version("1.0.5").description("송민성의 개발자 프로필 CLI");
19
27
 
20
28
  program.option("-g, --github", "GitHub 프로필 열기");
21
29
 
22
30
  program.parse(process.argv);
23
31
 
24
- const options = program.opts();
32
+ const options: ProgramOptions = program.opts();
25
33
 
26
34
  if (Object.keys(options).length > 0) {
27
35
  if (options.github) openUrl("https://github.com/alstjd0051");
28
36
  process.exit(0);
29
37
  }
30
38
 
31
- const main = async () => {
39
+ const main = async (): Promise<void> => {
32
40
  // 도움말 옵션 체크
33
41
  if (process.argv.includes("--help")) {
34
42
  console.log(
@@ -49,7 +57,7 @@ const main = async () => {
49
57
  }
50
58
 
51
59
  // 사용자 질문
52
- const answer = await inquirer.prompt([
60
+ const answer: UserAnswer = await inquirer.prompt([
53
61
  {
54
62
  type: "confirm",
55
63
  name: "showInfo",
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "resolveJsonModule": true,
16
+ "allowSyntheticDefaultImports": true
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": ["node_modules", "dist"]
20
+ }
@@ -1,48 +0,0 @@
1
- name: Node.js Package
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- tags: ["v*"]
7
- pull_request:
8
- branches: [main]
9
-
10
- jobs:
11
- build:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v3
15
-
16
- - name: Setup Node.js
17
- uses: actions/setup-node@v3
18
- with:
19
- node-version: "18.x"
20
- registry-url: "https://registry.npmjs.org/"
21
-
22
- - name: Install dependencies
23
- run: npm ci || npm install
24
-
25
- - name: Run tests
26
- run: npm test || true
27
-
28
- publish:
29
- needs: build
30
- runs-on: ubuntu-latest
31
- if: startsWith(github.ref, 'refs/tags/v')
32
-
33
- steps:
34
- - uses: actions/checkout@v3
35
-
36
- - name: Setup Node.js
37
- uses: actions/setup-node@v3
38
- with:
39
- node-version: "18.x"
40
- registry-url: "https://registry.npmjs.org/"
41
-
42
- - name: Install dependencies
43
- run: npm ci || npm install
44
-
45
- - name: Publish to npm
46
- run: npm publish
47
- env:
48
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}