@diagramers/cli 1.0.16 → 1.0.18

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
@@ -1,91 +1,490 @@
1
1
  # @diagramers/cli
2
2
 
3
- Command-line tools for managing Diagramers projects.
3
+ A powerful command-line interface for rapid API development with TypeScript, Node.js, and MongoDB. Streamline your development workflow with automated code generation, project scaffolding, and database management.
4
4
 
5
- ## 🚀 Installation
5
+ ## 🚀 Features
6
+
7
+ - **Project Initialization**: Create new API and admin projects from templates
8
+ - **Code Generation**: Generate complete CRUD modules, database tables, and relationships
9
+ - **Project Management**: Update and extend existing projects with new features
10
+ - **Database Management**: Create tables, relationships, and manage database context
11
+ - **Template Processing**: Customize project templates for different environments
12
+
13
+ ## 📦 Installation
6
14
 
7
15
  ```bash
8
16
  npm install -g @diagramers/cli
9
17
  ```
10
18
 
11
- ## 📋 Commands
19
+ ## 🎯 Quick Start
20
+
21
+ ```bash
22
+ # Create a new API project
23
+ diagramers init api my-ecommerce-api
24
+
25
+ # Navigate to your project
26
+ cd my-ecommerce-api
27
+
28
+ # Generate a complete product module
29
+ diagramers api generate:module product
12
30
 
13
- ### Initialize Projects
31
+ # Generate database tables
32
+ diagramers api generate:table category
33
+ diagramers api generate:table brand
34
+
35
+ # Create relationships between tables
36
+ diagramers api generate:relation product category
37
+ diagramers api generate:relation product brand
38
+ ```
39
+
40
+ ## 📋 Command Reference
41
+
42
+ ### Project Initialization
14
43
 
15
44
  ```bash
16
- # Create new API project
17
- diagramers init api my-new-api
45
+ # Create new API project with TypeScript, MongoDB, and Express
46
+ diagramers init api <project-name>
18
47
 
19
- # Create new admin project
20
- diagramers init admin my-admin-dashboard
48
+ # Create new admin dashboard project
49
+ diagramers init admin <project-name>
21
50
  ```
22
51
 
23
- ### Update Projects
52
+ **What's included:**
53
+ - TypeScript configuration
54
+ - Express.js server setup
55
+ - MongoDB with Mongoose
56
+ - Firebase Functions integration
57
+ - Socket.io for real-time features
58
+ - Authentication system
59
+ - Email and SMS services
60
+ - Audit logging
61
+ - Environment configurations
62
+
63
+ ### Project Updates
24
64
 
25
65
  ```bash
26
- # Update existing project with latest features
66
+ # Update with latest features
27
67
  diagramers update
28
68
 
29
- # Update with backup
69
+ # Update with backup (recommended)
30
70
  diagramers update --backup
31
71
 
32
- # Force update (overwrite conflicts)
72
+ # Force update (overwrites conflicts)
33
73
  diagramers update --force
34
74
  ```
35
75
 
36
- ### Extend Projects
76
+ ### Project Extensions
37
77
 
38
78
  ```bash
39
79
  # List available features
40
80
  diagramers extend --list
41
81
 
42
- # Add authentication feature
82
+ # Add authentication system
43
83
  diagramers extend --feature auth
44
84
 
45
- # Add email system
85
+ # Add email service
46
86
  diagramers extend --feature email
47
87
 
48
88
  # Add WebSocket support
49
89
  diagramers extend --feature socket
50
90
 
51
- # Add cron jobs
91
+ # Add cron job system
52
92
  diagramers extend --feature cron
53
93
 
54
94
  # Add audit logging
55
95
  diagramers extend --feature audit
56
96
  ```
57
97
 
58
- ## 🔧 Development
98
+ ## 🔧 API Development Commands
99
+
100
+ ### Generate Complete Module
101
+
102
+ Creates a full CRUD module with all layers:
103
+
104
+ ```bash
105
+ diagramers api generate:module <name>
106
+ ```
107
+
108
+ **Example:**
109
+ ```bash
110
+ diagramers api generate:module product
111
+ ```
112
+
113
+ **Generated Files:**
114
+ ```
115
+ src/
116
+ ├── entities/product.ts # TypeScript interface
117
+ ├── schemas/product.ts # Mongoose schema
118
+ ├── services/product-service.ts # Business logic
119
+ ├── controllers/product-controller.ts # Request handlers
120
+ └── routes/product-routes.ts # API endpoints
121
+ ```
122
+
123
+ **API Endpoints Created:**
124
+ - `GET /api/products` - List all products
125
+ - `GET /api/products/:id` - Get product by ID
126
+ - `POST /api/products` - Create new product
127
+ - `PUT /api/products/:id` - Update product
128
+ - `DELETE /api/products/:id` - Delete product
129
+
130
+ ### Generate Database Table
131
+
132
+ Creates only the database layer (entity and schema):
133
+
134
+ ```bash
135
+ diagramers api generate:table <name>
136
+ ```
137
+
138
+ **Example:**
139
+ ```bash
140
+ diagramers api generate:table category
141
+ diagramers api generate:table brand
142
+ diagramers api generate:table inventory
143
+ ```
144
+
145
+ **Generated Files:**
146
+ ```
147
+ src/
148
+ ├── entities/category.ts # TypeScript interface
149
+ └── schemas/category.ts # Mongoose schema
150
+ ```
151
+
152
+ **Use Cases:**
153
+ - Lookup tables (categories, brands, statuses)
154
+ - Configuration tables (settings, preferences)
155
+ - Reference data (countries, currencies)
156
+ - Internal data models
157
+
158
+ ### Generate Table Relationships
159
+
160
+ Creates relationships between existing tables:
161
+
162
+ ```bash
163
+ diagramers api generate:relation <table1> <table2> [type]
164
+ ```
165
+
166
+ **Relationship Types:**
167
+ - `one-to-one` (default)
168
+ - `one-to-many`
169
+ - `many-to-many`
170
+
171
+ **Examples:**
172
+ ```bash
173
+ # One-to-many: Product belongs to Category
174
+ diagramers api generate:relation product category one-to-many
175
+
176
+ # Many-to-many: Product has many Tags
177
+ diagramers api generate:relation product tag many-to-many
178
+
179
+ # One-to-one: User has one Profile
180
+ diagramers api generate:relation user profile one-to-one
181
+ ```
182
+
183
+ **What it does:**
184
+ - Updates entity interfaces with relationship fields
185
+ - Updates schemas with references and indexes
186
+ - Adds population methods to services
187
+ - Updates database context
188
+
189
+ ### Process Template
190
+
191
+ Customize your project for different environments:
192
+
193
+ ```bash
194
+ diagramers api process:template <project-name>
195
+ ```
196
+
197
+ **Example:**
198
+ ```bash
199
+ diagramers api process:template ecommerce-production
200
+ ```
201
+
202
+ **What it updates:**
203
+ - Package.json name and description
204
+ - README.md title and description
205
+ - Database names in configuration files
206
+ - Environment-specific settings
207
+ - Creates .env.example template
208
+
209
+ ## 🏗️ Project Structure
210
+
211
+ After using the CLI, your project will have this structure:
212
+
213
+ ```
214
+ src/
215
+ ├── entities/ # TypeScript interfaces
216
+ │ ├── user.ts
217
+ │ ├── product.ts
218
+ │ └── category.ts
219
+ ├── schemas/ # Mongoose schemas
220
+ │ ├── user.ts
221
+ │ ├── product.ts
222
+ │ └── category.ts
223
+ ├── services/ # Business logic layer
224
+ │ ├── user-service.ts
225
+ │ ├── product-service.ts
226
+ │ └── category-service.ts
227
+ ├── controllers/ # Request handlers
228
+ │ ├── user-controller.ts
229
+ │ ├── product-controller.ts
230
+ │ └── category-controller.ts
231
+ ├── routes/ # API endpoints
232
+ │ ├── user-routes.ts
233
+ │ ├── product-routes.ts
234
+ │ ├── category-routes.ts
235
+ │ └── index.ts
236
+ ├── helpers/ # Utilities and helpers
237
+ │ ├── dbcontext.ts # Database context
238
+ │ ├── auth.ts
239
+ │ ├── mailer.ts
240
+ │ └── result.ts
241
+ └── config/ # Environment configurations
242
+ ├── development.ts
243
+ ├── staging.ts
244
+ └── production.ts
245
+ ```
246
+
247
+ ## 🎯 Real-World Examples
248
+
249
+ ### E-commerce API Development
250
+
251
+ ```bash
252
+ # 1. Initialize project
253
+ diagramers init api ecommerce-api
254
+ cd ecommerce-api
255
+
256
+ # 2. Generate main entities with full CRUD
257
+ diagramers api generate:module product
258
+ diagramers api generate:module user
259
+ diagramers api generate:module order
260
+
261
+ # 3. Generate supporting tables
262
+ diagramers api generate:table category
263
+ diagramers api generate:table brand
264
+ diagramers api generate:table tag
265
+ diagramers api generate:table shipping_method
266
+ diagramers api generate:table payment_method
267
+
268
+ # 4. Create relationships
269
+ diagramers api generate:relation product category one-to-many
270
+ diagramers api generate:relation product brand one-to-many
271
+ diagramers api generate:relation product tag many-to-many
272
+ diagramers api generate:relation order user one-to-many
273
+ diagramers api generate:relation order shipping_method one-to-one
274
+
275
+ # 5. Customize for production
276
+ diagramers api process:template ecommerce-production
277
+ ```
278
+
279
+ ### Blog API Development
280
+
281
+ ```bash
282
+ # 1. Initialize project
283
+ diagramers init api blog-api
284
+ cd blog-api
285
+
286
+ # 2. Generate main entities
287
+ diagramers api generate:module post
288
+ diagramers api generate:module user
289
+ diagramers api generate:module comment
290
+
291
+ # 3. Generate supporting tables
292
+ diagramers api generate:table category
293
+ diagramers api generate:table tag
294
+
295
+ # 4. Create relationships
296
+ diagramers api generate:relation post user one-to-many
297
+ diagramers api generate:relation post category one-to-many
298
+ diagramers api generate:relation post tag many-to-many
299
+ diagramers api generate:relation comment post one-to-many
300
+ diagramers api generate:relation comment user one-to-many
301
+ ```
302
+
303
+ ## 🔄 Database Relationships
304
+
305
+ ### One-to-Many Relationship
306
+
307
+ ```typescript
308
+ // Product belongs to Category
309
+ interface IProduct {
310
+ _id: ObjectId;
311
+ name: string;
312
+ categoryId: ObjectId; // Reference to category
313
+ category?: ICategory; // Populated field
314
+ }
315
+
316
+ interface ICategory {
317
+ _id: ObjectId;
318
+ name: string;
319
+ products?: IProduct[]; // Virtual field
320
+ }
321
+ ```
322
+
323
+ ### Many-to-Many Relationship
324
+
325
+ ```typescript
326
+ // Product has many Tags
327
+ interface IProduct {
328
+ _id: ObjectId;
329
+ name: string;
330
+ tagIds: ObjectId[]; // Array of references
331
+ tags?: ITag[]; // Populated field
332
+ }
333
+
334
+ interface ITag {
335
+ _id: ObjectId;
336
+ name: string;
337
+ productIds: ObjectId[]; // Array of references
338
+ products?: IProduct[]; // Virtual field
339
+ }
340
+ ```
341
+
342
+ ### One-to-One Relationship
343
+
344
+ ```typescript
345
+ // User has one Profile
346
+ interface IUser {
347
+ _id: ObjectId;
348
+ email: string;
349
+ profileId: ObjectId; // Reference to profile
350
+ profile?: IProfile; // Populated field
351
+ }
352
+
353
+ interface IProfile {
354
+ _id: ObjectId;
355
+ firstName: string;
356
+ lastName: string;
357
+ userId: ObjectId; // Reference back to user
358
+ user?: IUser; // Populated field
359
+ }
360
+ ```
361
+
362
+ ## 🛠️ Development Workflow
59
363
 
364
+ ### 1. Project Setup
60
365
  ```bash
61
- # Clone the repository
62
- git clone https://github.com/diagramers/diagramers-cli.git
63
- cd diagramers-cli
366
+ # Create new project
367
+ diagramers init api my-api
368
+ cd my-api
64
369
 
65
370
  # Install dependencies
66
371
  npm install
67
372
 
68
- # Build the CLI
69
- npm run build
373
+ # Start development server
374
+ npm run serve
375
+ ```
376
+
377
+ ### 2. Database Design
378
+ ```bash
379
+ # Generate main entities
380
+ diagramers api generate:module user
381
+ diagramers api generate:module product
382
+
383
+ # Generate supporting tables
384
+ diagramers api generate:table category
385
+ diagramers api generate:table brand
386
+
387
+ # Create relationships
388
+ diagramers api generate:relation product category one-to-many
389
+ diagramers api generate:relation product brand one-to-many
390
+ ```
391
+
392
+ ### 3. API Development
393
+ ```bash
394
+ # Test your endpoints
395
+ curl http://localhost:4000/api/products
396
+ curl http://localhost:4000/api/categories
397
+ ```
398
+
399
+ ### 4. Production Deployment
400
+ ```bash
401
+ # Process template for production
402
+ diagramers api process:template my-api-production
403
+
404
+ # Build and deploy
405
+ npm run build:prod
406
+ npm run deploy
407
+ ```
408
+
409
+ ## 🔧 Configuration
70
410
 
71
- # Link locally
72
- npm link
411
+ ### Environment Variables
73
412
 
74
- # Test the CLI
75
- diagramers --help
413
+ The CLI creates a comprehensive `.env.example` file with:
414
+
415
+ ```env
416
+ # Server Configuration
417
+ PORT=4000
418
+ HOST=localhost
419
+
420
+ # Database Configuration
421
+ MONGODB_URI=mongodb://127.0.0.1:27017/my-api-development
422
+
423
+ # Firebase Configuration
424
+ FIREBASE_API_KEY=your-api-key
425
+ FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
426
+
427
+ # JWT Configuration
428
+ JWT_SECRET=your-jwt-secret-key
429
+
430
+ # Email Configuration
431
+ SMTP_HOST=smtp.gmail.com
432
+ SMTP_PORT=587
433
+ SMTP_USER=your-email@gmail.com
434
+ SMTP_PASS=your-app-password
76
435
  ```
77
436
 
78
- ## 📚 Documentation
437
+ ### Database Configuration
438
+
439
+ The CLI automatically configures different database names for each environment:
440
+
441
+ - **Development**: `my-api-development`
442
+ - **Staging**: `my-api-staging`
443
+ - **Production**: `my-api-production`
444
+
445
+ ## 🚀 Best Practices
79
446
 
80
- For detailed documentation, visit our [docs](https://github.com/diagramers/diagramers-cli/wiki).
447
+ ### 1. Naming Conventions
448
+ - Use singular names for entities: `product`, `user`, `category`
449
+ - Use descriptive names: `user_profile`, `product_inventory`
450
+ - Follow camelCase for multi-word names
451
+
452
+ ### 2. Database Design
453
+ - Generate tables first, then relationships
454
+ - Use `generate:table` for lookup data
455
+ - Use `generate:module` for main business entities
456
+ - Always create relationships after both tables exist
457
+
458
+ ### 3. API Development
459
+ - Test endpoints after generation
460
+ - Customize generated code for your business logic
461
+ - Add validation and error handling
462
+ - Implement proper authentication and authorization
463
+
464
+ ### 4. Project Organization
465
+ - Keep related files together
466
+ - Use consistent naming patterns
467
+ - Document your API endpoints
468
+ - Version your API properly
81
469
 
82
470
  ## 🤝 Contributing
83
471
 
84
472
  1. Fork the repository
85
- 2. Create a feature branch
86
- 3. Make your changes
87
- 4. Submit a pull request
473
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
474
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
475
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
476
+ 5. Open a Pull Request
88
477
 
89
478
  ## 📄 License
90
479
 
91
- MIT
480
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
481
+
482
+ ## 🆘 Support
483
+
484
+ - **Documentation**: [GitHub Wiki](https://github.com/diagramers/diagramers-cli/wiki)
485
+ - **Issues**: [GitHub Issues](https://github.com/diagramers/diagramers-cli/issues)
486
+ - **Discussions**: [GitHub Discussions](https://github.com/diagramers/diagramers-cli/discussions)
487
+
488
+ ---
489
+
490
+ **Built with ❤️ by the Diagramers Team**
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/commands/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,WAoC1C"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/commands/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,WAoE1C"}
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.apiCommand = apiCommand;
7
7
  const api_generator_1 = require("../services/api-generator");
8
+ const table_generator_1 = require("../services/table-generator");
9
+ const relation_generator_1 = require("../services/relation-generator");
8
10
  const template_processor_1 = require("../services/template-processor");
9
11
  const chalk_1 = __importDefault(require("chalk"));
10
12
  function apiCommand(program) {
@@ -41,6 +43,38 @@ function apiCommand(program) {
41
43
  process.exit(1);
42
44
  }
43
45
  });
46
+ // Generate table command
47
+ api
48
+ .command('generate:table <name>')
49
+ .description('Generate a new database table with entity and schema only')
50
+ .action(async (name) => {
51
+ try {
52
+ console.log(chalk_1.default.blue(`🚀 Generating table: ${name}`));
53
+ await (0, table_generator_1.generateTable)(name);
54
+ console.log(chalk_1.default.green(`✅ Table '${name}' generated successfully!`));
55
+ }
56
+ catch (error) {
57
+ console.error(chalk_1.default.red(`❌ Error generating table: ${error.message}`));
58
+ process.exit(1);
59
+ }
60
+ });
61
+ // Generate relation command
62
+ api
63
+ .command('generate:relation <table1> <table2> [type]')
64
+ .description('Generate a relationship between two existing tables')
65
+ .option('-t, --type <type>', 'Relationship type: one-to-one, one-to-many, many-to-many', 'one-to-one')
66
+ .action(async (table1, table2, options) => {
67
+ try {
68
+ const relationType = options.type || 'one-to-one';
69
+ console.log(chalk_1.default.blue(`🔗 Creating ${relationType} relationship between ${table1} and ${table2}...`));
70
+ await (0, relation_generator_1.generateRelation)(table1, table2, relationType);
71
+ console.log(chalk_1.default.green(`✅ Relationship created successfully!`));
72
+ }
73
+ catch (error) {
74
+ console.error(chalk_1.default.red(`❌ Error creating relationship: ${error.message}`));
75
+ process.exit(1);
76
+ }
77
+ });
44
78
  return api;
45
79
  }
46
80
  //# sourceMappingURL=api.js.map
@@ -1 +1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ACH,CAAC,CAAC,CAAC;IAEL,4BAA4B;IAC5B,GAAG;SACA,OAAO,CAAC,4CAA4C,CAAC;SACrD,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CAAC,mBAAmB,EAAE,0DAA0D,EAAE,YAAY,CAAC;SACrG,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,MAAc,EAAE,OAAY,EAAE,EAAE;QAC7D,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,eAAe,YAAY,yBAAyB,MAAM,QAAQ,MAAM,KAAK,CAAC,CAAC,CAAC;YACvG,MAAM,IAAA,qCAAgB,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/index.js CHANGED
@@ -24,6 +24,8 @@ Examples:
24
24
  $ diagramers update
25
25
  $ diagramers extend --feature auth
26
26
  $ diagramers api generate:module product
27
+ $ diagramers api generate:table category
28
+ $ diagramers api generate:relation product category one-to-many
27
29
  $ diagramers api process:template my-api-project
28
30
  `);
29
31
  program.parse();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,0CAA8C;AAC9C,8CAAkD;AAClD,8CAAkD;AAClD,wCAA4C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AAC;AAEhB,uCAAuC;AACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type RelationType = 'one-to-one' | 'one-to-many' | 'many-to-many';
2
+ export declare function generateRelation(table1: string, table2: string, relationType?: RelationType): Promise<void>;
3
+ //# sourceMappingURL=relation-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-generator.d.ts","sourceRoot":"","sources":["../../src/services/relation-generator.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,cAAc,CAAC;AAEzE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,YAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC/H"}