servcraft 0.1.5 → 0.1.7

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
@@ -229,19 +229,47 @@ npx servcraft init
229
229
  You'll be prompted to choose:
230
230
  - Project name
231
231
  - Language (TypeScript/JavaScript)
232
+ - Module system (ESM/CommonJS)
232
233
  - Database (PostgreSQL, MySQL, SQLite, MongoDB)
233
234
  - Validation library (Zod, Joi, Yup)
234
235
  - Features (Auth, Users, Email, etc.)
235
236
 
237
+ ### Module System Options
238
+
239
+ ServCraft supports both **ES Modules** and **CommonJS**:
240
+
241
+ | Module System | Import Style | File Extension | package.json |
242
+ |--------------|--------------|----------------|--------------|
243
+ | **ESM** (default) | `import x from 'y'` | `.js` | `"type": "module"` |
244
+ | **CommonJS** | `require('y')` | `.cjs` | (none) |
245
+
246
+ ```bash
247
+ # ESM project (recommended)
248
+ npx servcraft init my-app --esm
249
+
250
+ # CommonJS project (legacy compatibility)
251
+ npx servcraft init my-app --cjs
252
+ ```
253
+
254
+ **Note:** TypeScript projects always use ESM syntax in source files. The output format (ESM/CJS) is controlled by the `tsup` build configuration.
255
+
236
256
  ## CLI Commands
237
257
 
238
258
  ### Initialize project
239
259
 
240
260
  ```bash
241
- servcraft init [name] # Create new project
242
- servcraft init --yes # Use defaults
243
- servcraft init --js # Use JavaScript
261
+ servcraft init [name] # Create new project (interactive)
262
+ servcraft init --yes # Use defaults (TypeScript + ESM)
263
+ servcraft init --js # Use JavaScript instead of TypeScript
264
+ servcraft init --ts # Use TypeScript (default)
265
+ servcraft init --esm # Use ES Modules (default)
266
+ servcraft init --cjs # Use CommonJS
244
267
  servcraft init --db postgresql # Specify database
268
+
269
+ # Combined examples
270
+ servcraft init my-app --js --esm --db postgresql -y # JS + ESM + PostgreSQL
271
+ servcraft init my-app --js --cjs --db mongodb -y # JS + CommonJS + MongoDB
272
+ servcraft init my-app --ts --db mysql -y # TypeScript + MySQL
245
273
  ```
246
274
 
247
275
  ### Generate resources
package/ROADMAP.md ADDED
@@ -0,0 +1,320 @@
1
+ # Servcraft Roadmap
2
+
3
+ This document outlines the planned features and improvements for Servcraft.
4
+
5
+ ## Version History
6
+
7
+ - **v0.1.7** (Current) - ESM/CommonJS module system choice
8
+ - **v0.1.6.3** - JavaScript/TypeScript support, docs command, bug fixes
9
+ - **v0.1.6.2** - Fixed empty modules, added config/middleware/utils generators
10
+ - **v0.1.6.1** - Added @fastify/jwt compatibility fix
11
+ - **v0.1.6** - Fixed module copying from package
12
+
13
+ ---
14
+
15
+ ## Phase 1: Core CLI Improvements (v0.2.x)
16
+
17
+ ### v0.2.0 - CLI Enhancements
18
+
19
+ #### `servcraft list`
20
+ List available and installed modules.
21
+ ```bash
22
+ servcraft list # List all available modules
23
+ servcraft list --installed # List installed modules only
24
+ ```
25
+
26
+ #### `--dry-run` Option
27
+ Preview changes without writing files.
28
+ ```bash
29
+ servcraft init my-app --dry-run
30
+ servcraft add auth --dry-run
31
+ servcraft generate module users --dry-run
32
+ ```
33
+
34
+ #### Better Error Messages
35
+ - Descriptive error messages with suggestions
36
+ - Colored output for warnings/errors
37
+ - Links to documentation
38
+
39
+ **Estimated complexity:** Low
40
+
41
+ ---
42
+
43
+ ### v0.2.1 - Module Management
44
+
45
+ #### `servcraft remove <module>`
46
+ Remove an installed module.
47
+ ```bash
48
+ servcraft remove auth
49
+ servcraft remove auth --keep-migrations # Keep database migrations
50
+ ```
51
+
52
+ Features:
53
+ - Remove module files from `src/modules/`
54
+ - Clean up related environment variables
55
+ - Optionally remove database migrations
56
+ - Update imports in main files
57
+
58
+ #### `servcraft update [module]`
59
+ Update modules to latest version.
60
+ ```bash
61
+ servcraft update # Update all modules
62
+ servcraft update auth # Update specific module
63
+ servcraft update --check # Check for updates without applying
64
+ ```
65
+
66
+ **Estimated complexity:** Medium
67
+
68
+ ---
69
+
70
+ ### v0.2.2 - Developer Experience
71
+
72
+ #### `servcraft doctor`
73
+ Diagnose project configuration issues.
74
+ ```bash
75
+ servcraft doctor
76
+ ```
77
+
78
+ Checks:
79
+ - Node.js version compatibility
80
+ - Missing dependencies
81
+ - Environment variables validation
82
+ - Database connection
83
+ - TypeScript configuration
84
+ - Prisma schema sync status
85
+
86
+ #### Shell Auto-completion
87
+ ```bash
88
+ servcraft completion bash >> ~/.bashrc
89
+ servcraft completion zsh >> ~/.zshrc
90
+ ```
91
+
92
+ **Estimated complexity:** Medium
93
+
94
+ ---
95
+
96
+ ## Phase 2: Testing & Quality (v0.3.x)
97
+
98
+ ### v0.3.0 - CLI Tests
99
+
100
+ #### Unit Tests for CLI Commands
101
+ - Test `init` command with various options
102
+ - Test `add` command for all 20 modules
103
+ - Test `generate` command (module, controller, service, etc.)
104
+ - Test `db` commands
105
+ - Test `docs` commands
106
+
107
+ #### Integration Tests
108
+ - Full project generation and startup
109
+ - Module installation and removal
110
+ - Database operations
111
+
112
+ #### CI/CD Pipeline
113
+ - GitHub Actions for automated testing
114
+ - Test on Node.js 18, 20, 22
115
+ - Code coverage reporting
116
+
117
+ **Estimated complexity:** High
118
+
119
+ ---
120
+
121
+ ### v0.3.1 - Generated Project Tests
122
+
123
+ #### Test Templates
124
+ Generate test files alongside modules:
125
+ ```bash
126
+ servcraft generate module users --with-tests
127
+ servcraft add auth # Includes test files
128
+ ```
129
+
130
+ Generated test structure:
131
+ ```
132
+ src/modules/users/
133
+ ├── users.controller.ts
134
+ ├── users.service.ts
135
+ ├── users.repository.ts
136
+ ├── __tests__/
137
+ │ ├── users.controller.test.ts
138
+ │ ├── users.service.test.ts
139
+ │ └── users.integration.test.ts
140
+ ```
141
+
142
+ **Estimated complexity:** Medium
143
+
144
+ ---
145
+
146
+ ## Phase 3: Advanced Features (v0.4.x)
147
+
148
+ ### v0.4.0 - Scaffolding
149
+
150
+ #### `servcraft scaffold <resource>`
151
+ Generate complete CRUD with single command.
152
+ ```bash
153
+ servcraft scaffold product --fields "name:string price:number category:relation"
154
+ ```
155
+
156
+ Generates:
157
+ - Prisma model
158
+ - Controller with CRUD endpoints
159
+ - Service with business logic
160
+ - Repository with data access
161
+ - Routes with validation
162
+ - Types/DTOs
163
+ - Tests
164
+
165
+ **Estimated complexity:** High
166
+
167
+ ---
168
+
169
+ ### v0.4.1 - Custom Templates
170
+
171
+ #### Template System
172
+ Allow users to customize generated code.
173
+
174
+ ```bash
175
+ servcraft templates init # Create .servcraft/templates/
176
+ servcraft templates list # List available templates
177
+ servcraft generate module --template custom-module
178
+ ```
179
+
180
+ Template locations:
181
+ 1. Project `.servcraft/templates/`
182
+ 2. User `~/.servcraft/templates/`
183
+ 3. Built-in defaults
184
+
185
+ **Estimated complexity:** High
186
+
187
+ ---
188
+
189
+ ### v0.4.2 - Plugin System
190
+
191
+ #### Third-party Plugins
192
+ ```bash
193
+ servcraft plugin install servcraft-graphql
194
+ servcraft plugin list
195
+ servcraft plugin remove servcraft-graphql
196
+ ```
197
+
198
+ Plugin capabilities:
199
+ - Add new commands
200
+ - Add new module types
201
+ - Extend existing generators
202
+ - Add new templates
203
+
204
+ **Estimated complexity:** Very High
205
+
206
+ ---
207
+
208
+ ## Phase 4: Enterprise Features (v0.5.x)
209
+
210
+ ### v0.5.0 - Deployment
211
+
212
+ #### `servcraft deploy`
213
+ Deploy to cloud platforms.
214
+ ```bash
215
+ servcraft deploy vercel
216
+ servcraft deploy railway
217
+ servcraft deploy fly
218
+ servcraft deploy docker
219
+ ```
220
+
221
+ Features:
222
+ - Auto-detect platform
223
+ - Generate platform-specific configs
224
+ - Environment variable management
225
+ - Database provisioning guides
226
+
227
+ **Estimated complexity:** High
228
+
229
+ ---
230
+
231
+ ### v0.5.1 - Monorepo Support
232
+
233
+ #### Workspace Support
234
+ ```bash
235
+ servcraft init my-monorepo --monorepo
236
+ servcraft workspace add api
237
+ servcraft workspace add admin
238
+ ```
239
+
240
+ Structure:
241
+ ```
242
+ my-monorepo/
243
+ ├── packages/
244
+ │ ├── api/
245
+ │ ├── admin/
246
+ │ └── shared/
247
+ ├── package.json
248
+ └── pnpm-workspace.yaml
249
+ ```
250
+
251
+ **Estimated complexity:** Very High
252
+
253
+ ---
254
+
255
+ ### v0.5.2 - Eject
256
+
257
+ #### `servcraft eject`
258
+ Expose all internal configurations.
259
+ ```bash
260
+ servcraft eject # Eject everything
261
+ servcraft eject --config-only # Only configuration files
262
+ ```
263
+
264
+ Ejects:
265
+ - Build configuration
266
+ - ESLint/Prettier configs
267
+ - Docker configurations
268
+ - CI/CD templates
269
+
270
+ **Estimated complexity:** Medium
271
+
272
+ ---
273
+
274
+ ## Phase 5: Ecosystem (v1.0.x)
275
+
276
+ ### v1.0.0 - Stable Release
277
+
278
+ #### Requirements for v1.0:
279
+ - [ ] All Phase 1-3 features complete
280
+ - [ ] 90%+ test coverage
281
+ - [ ] Comprehensive documentation
282
+ - [ ] Migration guide from v0.x
283
+ - [ ] Performance benchmarks
284
+ - [ ] Security audit
285
+
286
+ ---
287
+
288
+ ### Future Considerations
289
+
290
+ #### GUI Dashboard
291
+ Web-based project management interface.
292
+ - Visual module management
293
+ - Database schema designer
294
+ - API documentation browser
295
+ - Log viewer
296
+
297
+ #### Fastify 5 Migration
298
+ - Update all dependencies
299
+ - Test compatibility
300
+ - Provide migration guide
301
+
302
+ #### GraphQL Support
303
+ - `servcraft add graphql`
304
+ - Schema generation
305
+ - Resolver templates
306
+
307
+ #### Microservices
308
+ - Service mesh templates
309
+ - Message queue integration
310
+ - Service discovery
311
+
312
+ ---
313
+
314
+ ## Contributing
315
+
316
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to contribute to this roadmap.
317
+
318
+ ## Feedback
319
+
320
+ Have suggestions? Open an issue on [GitHub](https://github.com/Le-Sourcier/servcraft/issues).