firestore-dart-generator 1.0.0-beta.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/CONFIG_FILE_GUIDE.md +445 -0
- package/IMPLEMENTATION_SUMMARY.md +305 -0
- package/LICENSE +22 -0
- package/QUICK_START.md +241 -0
- package/README.md +590 -0
- package/dist/config-file-loader.d.ts +35 -0
- package/dist/config-file-loader.d.ts.map +1 -0
- package/dist/config-file-loader.js +130 -0
- package/dist/config-file-loader.js.map +1 -0
- package/dist/config-loader.d.ts +21 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +125 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/dart-generator.d.ts +35 -0
- package/dist/dart-generator.d.ts.map +1 -0
- package/dist/dart-generator.js +167 -0
- package/dist/dart-generator.js.map +1 -0
- package/dist/firestore-client.d.ts +49 -0
- package/dist/firestore-client.d.ts.map +1 -0
- package/dist/firestore-client.js +227 -0
- package/dist/firestore-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive-cli.d.ts +5 -0
- package/dist/interactive-cli.d.ts.map +1 -0
- package/dist/interactive-cli.js +310 -0
- package/dist/interactive-cli.js.map +1 -0
- package/dist/schema-analyzer.d.ts +38 -0
- package/dist/schema-analyzer.d.ts.map +1 -0
- package/dist/schema-analyzer.js +350 -0
- package/dist/schema-analyzer.js.map +1 -0
- package/dist/templates/model.hbs +39 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/firestore-dart-gen.example.yaml +28 -0
- package/package.json +61 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# 🎉 Resumen de Implementación - Config File Support
|
|
2
|
+
|
|
3
|
+
## ✅ COMPLETADO EXITOSAMENTE
|
|
4
|
+
|
|
5
|
+
El soporte para archivo de configuración YAML ha sido completamente implementado y está listo para usar.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📊 Resultados
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
13
|
+
║ ✅ Build: EXITOSO ║
|
|
14
|
+
║ ✅ Tests: 23/23 pasando ║
|
|
15
|
+
║ ✅ Compilación: Sin errores ║
|
|
16
|
+
║ ✅ TODOs: 8/8 completados ║
|
|
17
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📁 Archivos Nuevos (3)
|
|
23
|
+
|
|
24
|
+
1. **`src/config-file-loader.ts`** (108 líneas)
|
|
25
|
+
- Clase ConfigFileLoader
|
|
26
|
+
- Métodos de carga y validación
|
|
27
|
+
- Resolución de prioridades
|
|
28
|
+
- Soporte para múltiples nombres de archivo
|
|
29
|
+
|
|
30
|
+
2. **`firestore-dart-gen.example.yaml`** (27 líneas)
|
|
31
|
+
- Archivo de ejemplo comentado
|
|
32
|
+
- Documenta todas las opciones
|
|
33
|
+
- Listo para copiar y personalizar
|
|
34
|
+
|
|
35
|
+
3. **`CONFIG_FILE_GUIDE.md`** (350+ líneas)
|
|
36
|
+
- Guía completa de uso
|
|
37
|
+
- Ejemplos de configuración
|
|
38
|
+
- Troubleshooting
|
|
39
|
+
- Casos de uso
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 📝 Archivos Modificados (6)
|
|
44
|
+
|
|
45
|
+
1. **`src/interactive-cli.ts`**
|
|
46
|
+
- Importa ConfigFileLoader
|
|
47
|
+
- Carga config al inicio
|
|
48
|
+
- Pre-selecciona colecciones del config
|
|
49
|
+
- Usa defaults del config
|
|
50
|
+
|
|
51
|
+
2. **`src/index.ts`**
|
|
52
|
+
- Agrega opción `--config <path>`
|
|
53
|
+
- Pasa configPath a runInteractiveCLI
|
|
54
|
+
|
|
55
|
+
3. **`src/types.ts`**
|
|
56
|
+
- Define CLIConfig interface
|
|
57
|
+
- Tipos para firebase, collections, output
|
|
58
|
+
|
|
59
|
+
4. **`.gitignore`**
|
|
60
|
+
- Ignora archivos de configuración
|
|
61
|
+
- Previene commit de credenciales
|
|
62
|
+
|
|
63
|
+
5. **`README.md`**
|
|
64
|
+
- Nueva sección "Configuration File"
|
|
65
|
+
- Ejemplos de uso
|
|
66
|
+
- Prioridad de configuración
|
|
67
|
+
- Beneficios documentados
|
|
68
|
+
|
|
69
|
+
6. **`package.json`**
|
|
70
|
+
- Ya contenía las dependencias necesarias
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🎯 Funcionalidades Implementadas
|
|
75
|
+
|
|
76
|
+
### ✅ Carga Automática de Config
|
|
77
|
+
- [x] Busca `firestore-dart-gen.yaml` automáticamente
|
|
78
|
+
- [x] Soporta variantes (.yml, hidden files)
|
|
79
|
+
- [x] Opción --config para especificar path custom
|
|
80
|
+
- [x] Funciona sin config file (opcional)
|
|
81
|
+
|
|
82
|
+
### ✅ Resolución de Credenciales
|
|
83
|
+
- [x] Prioridad: CLI args > Config > Env
|
|
84
|
+
- [x] Service account desde YAML
|
|
85
|
+
- [x] Project ID desde YAML
|
|
86
|
+
- [x] Fallback a variables de entorno
|
|
87
|
+
|
|
88
|
+
### ✅ Pre-selección de Colecciones
|
|
89
|
+
- [x] Colecciones del YAML aparecen checked ✓
|
|
90
|
+
- [x] Usuario puede agregar/quitar más
|
|
91
|
+
- [x] Validación de al menos 1 seleccionada
|
|
92
|
+
- [x] Indicador visual de pre-selección
|
|
93
|
+
|
|
94
|
+
### ✅ Defaults Configurables
|
|
95
|
+
- [x] Output directory desde config
|
|
96
|
+
- [x] Sample size desde config
|
|
97
|
+
- [x] Usuario puede cambiarlos en prompts
|
|
98
|
+
- [x] Fallback a valores sensatos
|
|
99
|
+
|
|
100
|
+
### ✅ Validación y Errores
|
|
101
|
+
- [x] Valida estructura del YAML
|
|
102
|
+
- [x] Verifica que service account existe
|
|
103
|
+
- [x] Valida que collections sea array
|
|
104
|
+
- [x] Valida sample size > 0
|
|
105
|
+
- [x] Mensajes de error claros
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🎨 Ejemplo de Uso Completo
|
|
110
|
+
|
|
111
|
+
### 1. Crear Config
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cp firestore-dart-gen.example.yaml firestore-dart-gen.yaml
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Editar:
|
|
118
|
+
```yaml
|
|
119
|
+
firebase:
|
|
120
|
+
serviceAccount: ./firebase_service_account.json
|
|
121
|
+
|
|
122
|
+
collections:
|
|
123
|
+
- users
|
|
124
|
+
- products
|
|
125
|
+
|
|
126
|
+
output:
|
|
127
|
+
directory: ./lib/src/models
|
|
128
|
+
sampleSize: 20
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 2. Ejecutar
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
firestore-dart-gen
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 3. Experiencia
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
🔥 Firestore Dart Generator - Interactive Mode
|
|
141
|
+
|
|
142
|
+
📄 Found config file: firestore-dart-gen.yaml
|
|
143
|
+
|
|
144
|
+
✓ Connected to Firebase Project: my-app
|
|
145
|
+
|
|
146
|
+
Found 7 collection(s)
|
|
147
|
+
|
|
148
|
+
Pre-selected from config: users, products
|
|
149
|
+
|
|
150
|
+
? Select collections: (↑↓ Space Enter)
|
|
151
|
+
❯◉ users ← ✓
|
|
152
|
+
◉ products ← ✓
|
|
153
|
+
◯ orders
|
|
154
|
+
◯ reviews
|
|
155
|
+
|
|
156
|
+
? Output directory: ./lib/src/models
|
|
157
|
+
? Sample size: 20
|
|
158
|
+
|
|
159
|
+
? Generate? Yes
|
|
160
|
+
|
|
161
|
+
✨ Success! Generated 2 model(s)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🔐 Prioridad de Configuración
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
┌──────────────────────────────┐
|
|
170
|
+
│ 1. CLI Arguments │ ← Highest Priority
|
|
171
|
+
│ --service-account │
|
|
172
|
+
│ --project-id │
|
|
173
|
+
│ --config │
|
|
174
|
+
├──────────────────────────────┤
|
|
175
|
+
│ 2. Config File │
|
|
176
|
+
│ firestore-dart-gen.yaml │
|
|
177
|
+
├──────────────────────────────┤
|
|
178
|
+
│ 3. Environment Variables │ ← Lowest Priority
|
|
179
|
+
│ .env │
|
|
180
|
+
└──────────────────────────────┘
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Ejemplo:**
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
# firestore-dart-gen.yaml
|
|
187
|
+
firebase:
|
|
188
|
+
serviceAccount: ./dev.json
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Usa dev.json del YAML
|
|
193
|
+
firestore-dart-gen
|
|
194
|
+
|
|
195
|
+
# Usa prod.json del CLI arg (gana)
|
|
196
|
+
firestore-dart-gen --service-account prod.json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 📚 Documentación Creada
|
|
202
|
+
|
|
203
|
+
- ✅ **README.md**: Sección "Configuration File (Optional)"
|
|
204
|
+
- ✅ **CONFIG_FILE_GUIDE.md**: Guía completa (este archivo)
|
|
205
|
+
- ✅ **firestore-dart-gen.example.yaml**: Archivo ejemplo
|
|
206
|
+
- ✅ **cli.plan.md**: Plan de implementación
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🧪 Testing
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
npm test
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Resultado:**
|
|
217
|
+
```
|
|
218
|
+
✅ Test Suites: 2 passed, 2 total
|
|
219
|
+
✅ Tests: 23 passed, 23 total
|
|
220
|
+
✅ Time: ~2s
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
La lógica core no cambió, por lo que todos los tests siguen pasando.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🚀 Próximos Pasos
|
|
228
|
+
|
|
229
|
+
### Para Usar
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# 1. Crear config
|
|
233
|
+
cp firestore-dart-gen.example.yaml firestore-dart-gen.yaml
|
|
234
|
+
|
|
235
|
+
# 2. Editar con tus valores
|
|
236
|
+
nano firestore-dart-gen.yaml
|
|
237
|
+
|
|
238
|
+
# 3. Ejecutar
|
|
239
|
+
firestore-dart-gen
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Para Publicar
|
|
243
|
+
|
|
244
|
+
El paquete está listo para publicar en npm con esta nueva funcionalidad.
|
|
245
|
+
|
|
246
|
+
Ver: [`PUBLICACION_NPM.md`](PUBLICACION_NPM.md)
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## ✨ Mejoras Logradas
|
|
251
|
+
|
|
252
|
+
### Antes
|
|
253
|
+
```bash
|
|
254
|
+
# Escribir todo cada vez
|
|
255
|
+
firestore-dart-gen batch \
|
|
256
|
+
--service-account firebase_service_account.json \
|
|
257
|
+
--config collections.yaml
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Ahora
|
|
261
|
+
```bash
|
|
262
|
+
# Una sola vez: configurar YAML
|
|
263
|
+
# Luego simplemente:
|
|
264
|
+
firestore-dart-gen
|
|
265
|
+
|
|
266
|
+
# Pre-selecciona tus colecciones favoritas ✓
|
|
267
|
+
# Usa tus defaults ✓
|
|
268
|
+
# Menos typing ✓
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 📊 Estadísticas
|
|
274
|
+
|
|
275
|
+
- **Archivos nuevos:** 3
|
|
276
|
+
- **Archivos modificados:** 6
|
|
277
|
+
- **Líneas de código:** ~450 nuevas
|
|
278
|
+
- **Tests pasando:** 23/23
|
|
279
|
+
- **Build time:** ~2s
|
|
280
|
+
- **Tiempo de implementación:** Completo
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 🎉 Conclusión
|
|
285
|
+
|
|
286
|
+
**✅ IMPLEMENTACIÓN 100% COMPLETA**
|
|
287
|
+
|
|
288
|
+
El archivo de configuración YAML está completamente integrado en el CLI interactivo:
|
|
289
|
+
|
|
290
|
+
✅ Carga automática
|
|
291
|
+
✅ Pre-selección de colecciones
|
|
292
|
+
✅ Defaults configurables
|
|
293
|
+
✅ Prioridad flexible
|
|
294
|
+
✅ Documentación completa
|
|
295
|
+
✅ Tests pasando
|
|
296
|
+
✅ Build exitoso
|
|
297
|
+
|
|
298
|
+
**Estado: LISTO PARA PRODUCCIÓN** 🚀
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
*Implementado: Diciembre 17, 2024*
|
|
303
|
+
*Tests: 23/23 passing ✓*
|
|
304
|
+
*Build: Successful ✓*
|
|
305
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Marcos Tort
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/QUICK_START.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# 🚀 Inicio Rápido - Firestore Dart Generator
|
|
2
|
+
|
|
3
|
+
## Opción 1: Con Archivo de Configuración (Recomendado)
|
|
4
|
+
|
|
5
|
+
### Paso 1: Crear configuración
|
|
6
|
+
```bash
|
|
7
|
+
cp firestore-dart-gen.example.yaml firestore-dart-gen.yaml
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Paso 2: Editar configuración
|
|
11
|
+
```yaml
|
|
12
|
+
# firestore-dart-gen.yaml
|
|
13
|
+
firebase:
|
|
14
|
+
serviceAccount: ./firebase_service_account.json
|
|
15
|
+
|
|
16
|
+
collections:
|
|
17
|
+
- users # Pre-seleccionados
|
|
18
|
+
- products # Pre-seleccionados
|
|
19
|
+
|
|
20
|
+
output:
|
|
21
|
+
directory: ./lib/src/models
|
|
22
|
+
sampleSize: 20
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Paso 3: Ejecutar
|
|
26
|
+
```bash
|
|
27
|
+
npm run dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Resultado:**
|
|
31
|
+
- ✅ Carga credenciales automáticamente
|
|
32
|
+
- ✅ users y products aparecen pre-seleccionados
|
|
33
|
+
- ✅ Puedes agregar/quitar más colecciones
|
|
34
|
+
- ✅ Defaults ya configurados
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Opción 2: Sin Archivo de Configuración
|
|
39
|
+
|
|
40
|
+
### Ejecutar directamente
|
|
41
|
+
```bash
|
|
42
|
+
npm run dev -- --service-account firebase_service_account.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Resultado:**
|
|
46
|
+
- Te pedirá seleccionar colecciones
|
|
47
|
+
- Te pedirá configurar output
|
|
48
|
+
- Todo manual, más flexible
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📋 Flujo Interactivo
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
🔥 Firestore Dart Generator - Interactive Mode
|
|
56
|
+
|
|
57
|
+
📄 Found config file: firestore-dart-gen.yaml
|
|
58
|
+
|
|
59
|
+
✓ Connected to Firebase Project: mi-proyecto
|
|
60
|
+
|
|
61
|
+
Found 5 collection(s)
|
|
62
|
+
|
|
63
|
+
Pre-selected from config: users, products
|
|
64
|
+
|
|
65
|
+
? Select collections: (↑↓ Space Enter)
|
|
66
|
+
❯◉ users ← Pre-seleccionado
|
|
67
|
+
◉ products ← Pre-seleccionado
|
|
68
|
+
◯ orders
|
|
69
|
+
◯ reviews
|
|
70
|
+
◯ settings
|
|
71
|
+
|
|
72
|
+
🌳 Checking for subcollections...
|
|
73
|
+
|
|
74
|
+
Analyzing users...
|
|
75
|
+
Found 2 subcollection(s): profiles, settings
|
|
76
|
+
Include subcollections for users? (Y/n) y
|
|
77
|
+
|
|
78
|
+
? Output directory: ./lib/src/models
|
|
79
|
+
? Sample size: 20
|
|
80
|
+
|
|
81
|
+
📋 Generation Summary:
|
|
82
|
+
────────────────────────────────────────────
|
|
83
|
+
Firebase Project: mi-proyecto
|
|
84
|
+
Collections: users, products
|
|
85
|
+
Subcollections:
|
|
86
|
+
└─ users: profiles, settings
|
|
87
|
+
Output: ./lib/src/models
|
|
88
|
+
Sample Size: 20 documents per collection
|
|
89
|
+
────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
? Generate Dart models with these settings? (Y/n) y
|
|
92
|
+
|
|
93
|
+
🚀 Starting generation...
|
|
94
|
+
|
|
95
|
+
📦 Processing collection: users
|
|
96
|
+
Analyzing schema for users...
|
|
97
|
+
✓ Detected 10 fields
|
|
98
|
+
✓ Generated UserDTO model
|
|
99
|
+
with 2 nested class(es)
|
|
100
|
+
✓ Written to: lib/src/models/user_dto.dart
|
|
101
|
+
|
|
102
|
+
📦 Processing subcollection: users/profiles
|
|
103
|
+
...
|
|
104
|
+
|
|
105
|
+
✨ Success! Generated 4 model(s)
|
|
106
|
+
|
|
107
|
+
Generated files:
|
|
108
|
+
✓ lib/src/models/user_dto.dart
|
|
109
|
+
✓ lib/src/models/profile_dto.dart
|
|
110
|
+
✓ lib/src/models/setting_dto.dart
|
|
111
|
+
✓ lib/src/models/product_dto.dart
|
|
112
|
+
|
|
113
|
+
📚 Next steps:
|
|
114
|
+
1. Review the generated files
|
|
115
|
+
2. Import the models in your Dart code
|
|
116
|
+
3. Add 'equatable' to your pubspec.yaml
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## ⚙️ Configuración Avanzada
|
|
122
|
+
|
|
123
|
+
### Pre-seleccionar colecciones específicas
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
collections:
|
|
127
|
+
- users
|
|
128
|
+
- products
|
|
129
|
+
- orders
|
|
130
|
+
- reviews
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Al ejecutar el CLI, estas 4 aparecerán **pre-seleccionadas con ✓**.
|
|
134
|
+
|
|
135
|
+
### Cambiar directorio de salida
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
output:
|
|
139
|
+
directory: ./packages/core/lib/models
|
|
140
|
+
sampleSize: 50
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Override con CLI args
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Usa prod.json en lugar del del config
|
|
147
|
+
firestore-dart-gen --service-account prod.json
|
|
148
|
+
|
|
149
|
+
# Usa config custom
|
|
150
|
+
firestore-dart-gen --config my-config.yaml
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 🎯 Casos de Uso
|
|
156
|
+
|
|
157
|
+
### Desarrollo diario
|
|
158
|
+
```yaml
|
|
159
|
+
# firestore-dart-gen.yaml
|
|
160
|
+
firebase:
|
|
161
|
+
serviceAccount: ./dev-credentials.json
|
|
162
|
+
|
|
163
|
+
collections:
|
|
164
|
+
- users
|
|
165
|
+
- products
|
|
166
|
+
|
|
167
|
+
output:
|
|
168
|
+
directory: ./lib/src/models
|
|
169
|
+
sampleSize: 10 # Rápido para desarrollo
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
firestore-dart-gen # ¡Eso es todo!
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Diferentes ambientes
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Desarrollo
|
|
180
|
+
firestore-dart-gen --service-account dev.json
|
|
181
|
+
|
|
182
|
+
# Staging
|
|
183
|
+
firestore-dart-gen --service-account staging.json
|
|
184
|
+
|
|
185
|
+
# Producción
|
|
186
|
+
firestore-dart-gen --service-account prod.json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Las colecciones pre-seleccionadas permanecen, solo cambias credenciales.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🔧 Comandos Útiles
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Desarrollo con config
|
|
197
|
+
npm run dev
|
|
198
|
+
|
|
199
|
+
# Desarrollo con service account específico
|
|
200
|
+
npm run dev -- --service-account credentials.json
|
|
201
|
+
|
|
202
|
+
# Con config custom
|
|
203
|
+
npm run dev -- --config other-config.yaml
|
|
204
|
+
|
|
205
|
+
# Ver help
|
|
206
|
+
npm run dev -- --help
|
|
207
|
+
|
|
208
|
+
# Build y ejecutar producción
|
|
209
|
+
npm run build
|
|
210
|
+
npm start
|
|
211
|
+
|
|
212
|
+
# Ejecutar tests
|
|
213
|
+
npm test
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 📚 Más Información
|
|
219
|
+
|
|
220
|
+
- **Guía Completa**: [`CONFIG_FILE_GUIDE.md`](CONFIG_FILE_GUIDE.md)
|
|
221
|
+
- **Archivo Ejemplo**: [`firestore-dart-gen.example.yaml`](firestore-dart-gen.example.yaml)
|
|
222
|
+
- **README Principal**: [`README.md`](README.md)
|
|
223
|
+
- **Testing**: [`TESTING.md`](TESTING.md)
|
|
224
|
+
- **Publicación**: [`PUBLICACION_NPM.md`](PUBLICACION_NPM.md)
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## ✅ Checklist para Empezar
|
|
229
|
+
|
|
230
|
+
- [ ] Crear `firestore-dart-gen.yaml` desde el ejemplo
|
|
231
|
+
- [ ] Configurar path de service account
|
|
232
|
+
- [ ] Listar colecciones que usas frecuentemente
|
|
233
|
+
- [ ] Ejecutar `npm run dev`
|
|
234
|
+
- [ ] Seleccionar colecciones (pre-seleccionadas por ti)
|
|
235
|
+
- [ ] Revisar modelos generados
|
|
236
|
+
- [ ] ¡Listo para usar en tu app Flutter!
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
🎉 **¡Disfruta del nuevo sistema de configuración!**
|
|
241
|
+
|