servcraft 0.3.1 → 0.4.3

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 CHANGED
@@ -277,6 +277,10 @@ servcraft init my-app --dry-run -y # Preview without creating
277
277
  ### Generate resources
278
278
 
279
279
  ```bash
280
+ # Scaffold complete CRUD resource (recommended)
281
+ servcraft scaffold product --fields "name:string price:number category:string?"
282
+ servcraft scaffold user --fields "name:string email:email age:number?" --validator zod
283
+
280
284
  # Generate complete module
281
285
  servcraft generate module product
282
286
  servcraft g m product --prisma # Include Prisma model
@@ -331,6 +335,28 @@ servcraft remove auth --keep-env # Keep environment variables
331
335
  servcraft doctor # Check configuration and dependencies
332
336
  ```
333
337
 
338
+ ### Custom Templates
339
+
340
+ Customize code generation templates for your project:
341
+
342
+ ```bash
343
+ # Initialize custom templates directory
344
+ servcraft templates init # Creates .servcraft/templates/
345
+
346
+ # List available templates
347
+ servcraft templates list # Shows project, user, and built-in templates
348
+ ```
349
+
350
+ **Template locations (priority order):**
351
+ 1. Project: `.servcraft/templates/` - Project-specific templates
352
+ 2. User: `~/.servcraft/templates/` - User-wide templates
353
+ 3. Built-in: Default ServCraft templates
354
+
355
+ **Available template types:**
356
+ - controller.ts, service.ts, repository.ts
357
+ - types.ts, schemas.ts, routes.ts, module-index.ts
358
+ - controller-test.ts, service-test.ts, integration-test.ts
359
+
334
360
  ### Shell Auto-completion
335
361
 
336
362
  Enable tab completion for servcraft commands in your shell:
package/ROADMAP.md CHANGED
@@ -4,7 +4,12 @@ This document outlines the planned features and improvements for Servcraft.
4
4
 
5
5
  ## Version History
6
6
 
7
- - **v0.3.0** (Current) - Shell auto-completion, update command, comprehensive CLI tests (30 tests) - Phase 2 in progress 🚧
7
+ - **v0.4.3** (Current) - ESM/CommonJS compatibility fix - Phase 3 in progress 🚧
8
+ - **v0.4.2** - Custom template loading in generate/scaffold
9
+ - **v0.4.1** - Custom templates management (init/list)
10
+ - **v0.4.0** - Scaffold command for complete CRUD generation
11
+ - **v0.3.1** - Test templates with --with-tests flag - Phase 2 complete ✅
12
+ - **v0.3.0** - Shell auto-completion, update command, comprehensive CLI tests (30 tests), CI/CD on Node.js 18/20/22
8
13
  - **v0.2.0** - Better errors, remove, doctor, update (stub) - Phase 1 complete ✅
9
14
  - **v0.1.9** - Added `--dry-run` option for all commands (init, add, generate)
10
15
  - **v0.1.8** - Added `servcraft list` command
@@ -190,28 +195,38 @@ Features:
190
195
 
191
196
  ## Phase 3: Advanced Features (v0.4.x)
192
197
 
193
- ### v0.4.0 - Scaffolding
198
+ ### v0.4.0 - Scaffolding ✅ Completed
194
199
 
195
200
  #### `servcraft scaffold <resource>`
196
201
  Generate complete CRUD with single command.
197
202
  ```bash
198
- servcraft scaffold product --fields "name:string price:number category:relation"
203
+ servcraft scaffold product --fields "name:string price:number category:string?"
204
+ servcraft scaffold user --fields "name:string email:email age:number?" --validator zod
199
205
  ```
200
206
 
201
207
  Generates:
202
- - Prisma model
203
- - Controller with CRUD endpoints
204
- - Service with business logic
205
- - Repository with data access
206
- - Routes with validation
207
- - Types/DTOs
208
- - Tests
208
+ - Prisma model (with proper types and indexes)
209
+ - Controller with CRUD endpoints
210
+ - Service with business logic
211
+ - Repository with data access
212
+ - Routes with validation
213
+ - Types/DTOs (interface, Create, Update, Filters)
214
+ - ✅ Schemas (Zod/Joi/Yup validators)
215
+ - ✅ Test files (controller, service, integration)
216
+
217
+ Features:
218
+ - Parses field definitions with types and modifiers
219
+ - Supports optional fields (?)
220
+ - Generates complete Prisma model ready to copy
221
+ - Includes all CRUD operations
222
+ - Automatically generates tests with --with-tests behavior
223
+ - Supports all validators (zod, joi, yup)
209
224
 
210
225
  **Estimated complexity:** High
211
226
 
212
227
  ---
213
228
 
214
- ### v0.4.1 - Custom Templates
229
+ ### v0.4.1 - Custom Templates ✅ Completed
215
230
 
216
231
  #### Template System
217
232
  Allow users to customize generated code.
@@ -219,10 +234,18 @@ Allow users to customize generated code.
219
234
  ```bash
220
235
  servcraft templates init # Create .servcraft/templates/
221
236
  servcraft templates list # List available templates
222
- servcraft generate module --template custom-module
223
237
  ```
224
238
 
225
- Template locations:
239
+ Features:
240
+ - ✅ `servcraft templates init` - Initialize custom template directory
241
+ - ✅ `servcraft templates list` - List project/user/built-in templates
242
+ - ✅ Project templates in `.servcraft/templates/`
243
+ - ✅ User templates in `~/.servcraft/templates/`
244
+ - ✅ Built-in template fallback
245
+ - ✅ Example template file created on init
246
+ - ✅ Support for all 10 template types
247
+
248
+ Template locations (priority order):
226
249
  1. Project `.servcraft/templates/`
227
250
  2. User `~/.servcraft/templates/`
228
251
  3. Built-in defaults
@@ -231,7 +254,24 @@ Template locations:
231
254
 
232
255
  ---
233
256
 
234
- ### v0.4.2 - Plugin System
257
+ ### v0.4.2 - Template Loading ✅ Completed
258
+
259
+ #### Custom Template Loading
260
+ Automatically use custom templates in generate/scaffold commands.
261
+
262
+ Features:
263
+ - ✅ Template loader utility with priority-based loading
264
+ - ✅ `generate` command uses custom templates automatically
265
+ - ✅ `scaffold` command uses custom templates automatically
266
+ - ✅ Falls back to built-in templates when custom not found
267
+ - ✅ Supports all 10 template types seamlessly
268
+ - ✅ No additional flags needed - works out of the box
269
+
270
+ **Estimated complexity:** Medium
271
+
272
+ ---
273
+
274
+ ### v0.4.3 - Plugin System
235
275
 
236
276
  #### Third-party Plugins
237
277
  ```bash