@charzing/vehicle-utils 0.1.0

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 ADDED
@@ -0,0 +1,130 @@
1
+ # @charzing/vehicle-utils
2
+
3
+ Shared utilities for Charzing vehicle data management across all platforms.
4
+
5
+ ## 설치
6
+
7
+ ### 로컬 개발 (npm link)
8
+
9
+ ```bash
10
+ cd /Users/sungmin/charzing-vehicle-utils
11
+ npm install
12
+ npm run build
13
+ npm link
14
+
15
+ # 각 프로젝트에서
16
+ cd /Users/sungmin/charzing-admin
17
+ npm link @charzing/vehicle-utils
18
+
19
+ cd /Users/sungmin/CharzingApp-Expo
20
+ npm link @charzing/vehicle-utils
21
+
22
+ cd /Users/sungmin/desktop/project/react/charzing
23
+ npm link @charzing/vehicle-utils
24
+ ```
25
+
26
+ ## 주요 기능
27
+
28
+ ### 1. 브랜드 매핑
29
+
30
+ ```typescript
31
+ import { normalizeBrandId, getBrandNameKorean, getBrandNameEnglish } from '@charzing/vehicle-utils';
32
+
33
+ // 브랜드 ID 정규화 (모두 소문자)
34
+ const brandId = normalizeBrandId('현대'); // 'hyundai'
35
+ const brandId2 = normalizeBrandId('BMW'); // 'bmw'
36
+
37
+ // 한글 브랜드명 가져오기
38
+ const korean = getBrandNameKorean('hyundai'); // '현대'
39
+
40
+ // 영문 브랜드명 가져오기
41
+ const english = getBrandNameEnglish('hyundai'); // 'HYUNDAI'
42
+ ```
43
+
44
+ ### 2. 모델 매핑
45
+
46
+ ```typescript
47
+ import { normalizeModelId, getModelNameKorean, getModelNameEnglish } from '@charzing/vehicle-utils';
48
+
49
+ // 모델 ID 정규화 (소문자, 하이픈)
50
+ const modelId = normalizeModelId('아이오닉 5'); // 'ioniq-5'
51
+ const modelId2 = normalizeModelId('Model S'); // 'model-s'
52
+
53
+ // 한글 모델명 가져오기
54
+ const korean = getModelNameKorean('ioniq-5'); // '아이오닉 5'
55
+
56
+ // 영문 모델명 가져오기
57
+ const english = getModelNameEnglish('ioniq-5'); // 'IONIQ-5'
58
+ ```
59
+
60
+ ### 3. 이미지 URL 생성
61
+
62
+ ```typescript
63
+ import { generateVehicleImageUrl, generateImageFilename } from '@charzing/vehicle-utils';
64
+
65
+ // Firebase Storage URL 생성
66
+ const imageUrl = generateVehicleImageUrl({
67
+ brand: 'hyundai',
68
+ model: 'ioniq-5',
69
+ year: 2024,
70
+ trim: 'exclusive'
71
+ });
72
+ // → https://firebasestorage.googleapis.com/v0/b/charzing-d1600.firebasestorage.app/o/
73
+ // vehicle-images%2FHYUNDAI%2FIONIQ-5%2F2024%2Fhyundai__ioniq-5__2024__exclusive.png?alt=media
74
+
75
+ // 이미지 파일명만 생성
76
+ const filename = generateImageFilename({
77
+ brand: 'hyundai',
78
+ model: 'ioniq-5',
79
+ year: 2024,
80
+ trim: 'exclusive'
81
+ });
82
+ // → 'hyundai__ioniq-5__2024__exclusive.png'
83
+
84
+ // 트림 없는 경우
85
+ const filename2 = generateImageFilename({
86
+ brand: 'tesla',
87
+ model: 'model-s',
88
+ year: 2024
89
+ });
90
+ // → 'tesla__model-s__2024.png'
91
+ ```
92
+
93
+ ### 4. 파일명 규칙
94
+
95
+ - **패턴**: `{brandSlug}__{modelSlug}__{year}__{trimSlug}.png`
96
+ - **예시**:
97
+ - `hyundai__ioniq-5__2024.png`
98
+ - `mini__cooper__2025__jcw.png`
99
+ - `tesla__model-3__2024__highland.png`
100
+ - **규칙**:
101
+ - 전부 소문자
102
+ - 단어 구분: 하이픈 (-)
103
+ - 상위 구분: 더블 언더바 (__)
104
+ - trim 없으면 생략
105
+
106
+ ## 개발
107
+
108
+ ```bash
109
+ # 의존성 설치
110
+ npm install
111
+
112
+ # 빌드
113
+ npm run build
114
+
115
+ # Watch 모드로 빌드
116
+ npm run dev
117
+
118
+ # 테스트
119
+ npm test
120
+
121
+ # 타입 검사
122
+ npm run type-check
123
+
124
+ # 린트
125
+ npm run lint
126
+ ```
127
+
128
+ ## 라이선스
129
+
130
+ MIT