metadatafy 1.0.0 → 1.0.1
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 +239 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# metadatafy
|
|
2
|
+
|
|
3
|
+
A build plugin for extracting project metadata from your codebase. Supports Vite, Next.js, and CLI usage.
|
|
4
|
+
|
|
5
|
+
코드베이스에서 프로젝트 메타데이터를 추출하는 빌드 플러그인입니다. Vite, Next.js, CLI를 지원합니다.
|
|
6
|
+
|
|
7
|
+
## Features / 기능
|
|
8
|
+
|
|
9
|
+
- **AST-based analysis** - Parses TypeScript/JavaScript files using TypeScript compiler API
|
|
10
|
+
- **Import/Export extraction** - Tracks file dependencies and call graphs
|
|
11
|
+
- **Component props detection** - Extracts React component props
|
|
12
|
+
- **Korean keyword mapping** - Automatic English-Korean keyword translation
|
|
13
|
+
- **Multiple output formats** - JSON file or API endpoint
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
- **AST 기반 분석** - TypeScript 컴파일러 API를 사용한 파일 파싱
|
|
18
|
+
- **Import/Export 추출** - 파일 의존성 및 호출 그래프 추적
|
|
19
|
+
- **컴포넌트 Props 감지** - React 컴포넌트 props 추출
|
|
20
|
+
- **한글 키워드 매핑** - 영어-한글 키워드 자동 변환
|
|
21
|
+
- **다양한 출력 형식** - JSON 파일 또는 API 엔드포인트
|
|
22
|
+
|
|
23
|
+
## Installation / 설치
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install metadatafy
|
|
27
|
+
# or
|
|
28
|
+
yarn add metadatafy
|
|
29
|
+
# or
|
|
30
|
+
pnpm add metadatafy
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage / 사용법
|
|
34
|
+
|
|
35
|
+
### CLI
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Analyze project and generate metadata
|
|
39
|
+
# 프로젝트 분석 및 메타데이터 생성
|
|
40
|
+
npx metadatafy analyze
|
|
41
|
+
|
|
42
|
+
# With options / 옵션과 함께
|
|
43
|
+
npx metadatafy analyze --project-id my-project --output ./metadata.json --verbose
|
|
44
|
+
|
|
45
|
+
# Generate config file / 설정 파일 생성
|
|
46
|
+
npx metadatafy init
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### CLI Options / CLI 옵션
|
|
50
|
+
|
|
51
|
+
| Option | Short | Description |
|
|
52
|
+
|--------|-------|-------------|
|
|
53
|
+
| `--project-id` | `-p` | Project ID (default: folder name) |
|
|
54
|
+
| `--output` | `-o` | Output file path (default: project-metadata.json) |
|
|
55
|
+
| `--config` | `-c` | Config file path |
|
|
56
|
+
| `--verbose` | | Enable detailed logging |
|
|
57
|
+
| `--help` | `-h` | Show help |
|
|
58
|
+
| `--version` | `-v` | Show version |
|
|
59
|
+
|
|
60
|
+
### Vite Plugin
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// vite.config.ts
|
|
64
|
+
import { defineConfig } from 'vite';
|
|
65
|
+
import { metadataPlugin } from 'metadatafy/vite';
|
|
66
|
+
|
|
67
|
+
export default defineConfig({
|
|
68
|
+
plugins: [
|
|
69
|
+
metadataPlugin({
|
|
70
|
+
projectId: 'my-project',
|
|
71
|
+
output: {
|
|
72
|
+
file: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
path: 'project-metadata.json',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Next.js Plugin
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// next.config.js
|
|
86
|
+
const { withMetadata } = require('metadatafy/next');
|
|
87
|
+
|
|
88
|
+
/** @type {import('next').NextConfig} */
|
|
89
|
+
const nextConfig = {
|
|
90
|
+
// your config
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
module.exports = withMetadata({
|
|
94
|
+
projectId: 'my-project',
|
|
95
|
+
})(nextConfig);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration / 설정
|
|
99
|
+
|
|
100
|
+
Create `metadata.config.json` in your project root:
|
|
101
|
+
|
|
102
|
+
프로젝트 루트에 `metadata.config.json` 파일을 생성하세요:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"projectId": "my-project",
|
|
107
|
+
"include": [
|
|
108
|
+
"app/**/*.{ts,tsx}",
|
|
109
|
+
"components/**/*.{ts,tsx}",
|
|
110
|
+
"hooks/**/*.{ts,tsx}",
|
|
111
|
+
"services/**/*.ts",
|
|
112
|
+
"lib/**/*.ts"
|
|
113
|
+
],
|
|
114
|
+
"exclude": [
|
|
115
|
+
"**/node_modules/**",
|
|
116
|
+
"**/*.test.{ts,tsx}",
|
|
117
|
+
"**/*.spec.{ts,tsx}"
|
|
118
|
+
],
|
|
119
|
+
"output": {
|
|
120
|
+
"file": {
|
|
121
|
+
"enabled": true,
|
|
122
|
+
"path": "project-metadata.json"
|
|
123
|
+
},
|
|
124
|
+
"api": {
|
|
125
|
+
"enabled": false,
|
|
126
|
+
"endpoint": "https://your-api.com/metadata",
|
|
127
|
+
"headers": {
|
|
128
|
+
"Authorization": "Bearer YOUR_TOKEN"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"koreanKeywords": {
|
|
133
|
+
"attendance": ["출석", "출결"],
|
|
134
|
+
"student": ["학생", "수강생"]
|
|
135
|
+
},
|
|
136
|
+
"verbose": false
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Output Format / 출력 형식
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"version": "1.0.0",
|
|
145
|
+
"projectId": "my-project",
|
|
146
|
+
"generatedAt": "2025-01-04T12:00:00Z",
|
|
147
|
+
"stats": {
|
|
148
|
+
"totalFiles": 150,
|
|
149
|
+
"byType": {
|
|
150
|
+
"route": 15,
|
|
151
|
+
"component": 80,
|
|
152
|
+
"hook": 20,
|
|
153
|
+
"service": 10,
|
|
154
|
+
"api": 5,
|
|
155
|
+
"table": 8,
|
|
156
|
+
"utility": 12
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"items": [
|
|
160
|
+
{
|
|
161
|
+
"id": "abc123",
|
|
162
|
+
"type": "component",
|
|
163
|
+
"name": "AttendanceModal",
|
|
164
|
+
"path": "components/attendance/AttendanceModal.tsx",
|
|
165
|
+
"keywords": ["attendance", "modal", "출석", "모달"],
|
|
166
|
+
"searchText": "attendancemodal components attendance ...",
|
|
167
|
+
"calls": ["hooks/useAttendance.ts", "services/attendanceService.ts"],
|
|
168
|
+
"calledBy": ["app/attendance/page.tsx"],
|
|
169
|
+
"metadata": {
|
|
170
|
+
"exports": ["AttendanceModal"],
|
|
171
|
+
"props": ["isOpen", "onClose", "studentId"]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## File Type Detection / 파일 타입 감지
|
|
179
|
+
|
|
180
|
+
| Pattern | Type |
|
|
181
|
+
|---------|------|
|
|
182
|
+
| `app/**/page.tsx` | route |
|
|
183
|
+
| `app/**/route.ts` | api |
|
|
184
|
+
| `components/**/*.tsx` | component |
|
|
185
|
+
| `hooks/**/*.ts` | hook |
|
|
186
|
+
| `services/**/*.ts` | service |
|
|
187
|
+
| `lib/**/*.ts` | utility |
|
|
188
|
+
| `supabase/migrations/*.sql` | table |
|
|
189
|
+
|
|
190
|
+
## API / 프로그래밍 방식 사용
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { ProjectAnalyzer, createDefaultConfig } from 'metadatafy';
|
|
194
|
+
|
|
195
|
+
const config = createDefaultConfig({
|
|
196
|
+
projectId: 'my-project',
|
|
197
|
+
verbose: true,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const analyzer = new ProjectAnalyzer(config);
|
|
201
|
+
const result = await analyzer.analyze(process.cwd());
|
|
202
|
+
|
|
203
|
+
console.log(result.stats);
|
|
204
|
+
console.log(result.items);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Korean Keyword Mapping / 한글 키워드 매핑
|
|
208
|
+
|
|
209
|
+
Built-in mappings include common development terms:
|
|
210
|
+
|
|
211
|
+
기본 제공되는 매핑에는 일반적인 개발 용어가 포함됩니다:
|
|
212
|
+
|
|
213
|
+
| English | Korean |
|
|
214
|
+
|---------|--------|
|
|
215
|
+
| create | 생성, 만들기, 추가 |
|
|
216
|
+
| update | 수정, 업데이트, 변경 |
|
|
217
|
+
| delete | 삭제, 제거 |
|
|
218
|
+
| search | 검색, 찾기 |
|
|
219
|
+
| login | 로그인 |
|
|
220
|
+
| user | 사용자, 유저, 회원 |
|
|
221
|
+
| button | 버튼 |
|
|
222
|
+
| modal | 모달, 팝업 |
|
|
223
|
+
| ... | ... |
|
|
224
|
+
|
|
225
|
+
You can extend with custom mappings in config.
|
|
226
|
+
|
|
227
|
+
설정에서 커스텀 매핑을 추가할 수 있습니다.
|
|
228
|
+
|
|
229
|
+
## License / 라이선스
|
|
230
|
+
|
|
231
|
+
MIT
|
|
232
|
+
|
|
233
|
+
## Contributing / 기여
|
|
234
|
+
|
|
235
|
+
Issues and pull requests are welcome!
|
|
236
|
+
|
|
237
|
+
이슈와 풀 리퀘스트를 환영합니다!
|
|
238
|
+
|
|
239
|
+
GitHub: https://github.com/rungchan2/get-metadata
|
package/dist/cli.cjs
CHANGED