nsgm-cli 2.1.25 → 2.1.27

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
@@ -39,6 +39,7 @@ NSGM CLI is a comprehensive full-stack development framework that combines the p
39
39
  ### ⚡ **Rapid Development**
40
40
 
41
41
  - **Code Generation**: Automatic CRUD operations, API endpoints, and database schemas
42
+ - **Config-Based Generation**: Batch create multiple modules from JSON configuration files
42
43
  - **Hot Reload**: Instant development feedback
43
44
  - **Type Safety**: Full TypeScript support throughout the stack
44
45
 
@@ -139,14 +140,15 @@ Your application will be available at `http://localhost:3000` with:
139
140
 
140
141
  ### Core Commands
141
142
 
142
- | Command | Description | Mode | Example |
143
- | ------------- | ----------------------------- | --------------- | --------------------- |
144
- | `nsgm init` | Initialize new project | Interactive/CLI | `nsgm init blog-app` |
145
- | `nsgm create` | Generate controller with CRUD | Interactive/CLI | `nsgm create user` |
146
- | `nsgm delete` | Remove controller and files | Interactive/CLI | `nsgm delete product` |
147
- | `nsgm dev` | Start development server | CLI | `nsgm dev` |
148
- | `nsgm build` | Build for production | CLI | `nsgm build` |
149
- | `nsgm start` | Start production server | CLI | `nsgm start` |
143
+ | Command | Description | Mode | Example |
144
+ | ---------------- | ------------------------------- | --------------- | ----------------------------- |
145
+ | `nsgm init` | Initialize new project | Interactive/CLI | `nsgm init blog-app` |
146
+ | `nsgm create` | Generate controller with CRUD | Interactive/CLI | `nsgm create user` |
147
+ | `nsgm delete` | Remove controller and files | Interactive/CLI | `nsgm delete product` |
148
+ | `nsgm create-config` | Batch create from config file | CLI | `nsgm create-config config/modules.json` |
149
+ | `nsgm dev` | Start development server | CLI | `nsgm dev` |
150
+ | `nsgm build` | Build for production | CLI | `nsgm build` |
151
+ | `nsgm start` | Start production server | CLI | `nsgm start` |
150
152
 
151
153
  ### Advanced Commands
152
154
 
@@ -154,6 +156,11 @@ Your application will be available at `http://localhost:3000` with:
154
156
  # Database operations
155
157
  nsgm deletedb user # Delete controller + database table
156
158
 
159
+ # Batch module creation
160
+ nsgm create-config config/modules.json # Create all modules from config
161
+ nsgm create-config config/modules.json --module category # Create specific module
162
+ nsgm create-config config/modules.json --dry-run # Preview without creating
163
+
157
164
  # Project maintenance
158
165
  nsgm upgrade # Upgrade project base files
159
166
  nsgm export # Export static pages
@@ -455,10 +462,103 @@ npm run tsbuild
455
462
  ## 📖 Documentation
456
463
 
457
464
  - [Security Guide](SECURITY.md) - Security best practices
465
+ - [Config-Based Generation Guide](docs/CONFIG-CMD-IMPLEMENTATION.md) - Batch module creation from config files
458
466
  - [API Reference](docs/api.md) - Complete API documentation
459
467
  - [Migration Guide](docs/migration.md) - Upgrade instructions
460
468
  - [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions
461
469
 
470
+ ## 📋 Configuration File-Based Generation
471
+
472
+ NSGM CLI supports batch module creation from JSON configuration files, making it easy to generate multiple modules at once.
473
+
474
+ ### Configuration File Format
475
+
476
+ Create a JSON file (e.g., `config/modules.json`) with your module definitions:
477
+
478
+ ```json
479
+ [
480
+ {
481
+ "controller": "category",
482
+ "action": "manage",
483
+ "dictionary": ".",
484
+ "fields": [
485
+ {
486
+ "name": "id",
487
+ "type": "integer",
488
+ "required": true,
489
+ "comment": "Primary key",
490
+ "isPrimaryKey": true,
491
+ "isAutoIncrement": true
492
+ },
493
+ {
494
+ "name": "name",
495
+ "type": "varchar",
496
+ "length": 100,
497
+ "required": true,
498
+ "comment": "Category name",
499
+ "showInList": true,
500
+ "showInForm": true,
501
+ "searchable": true
502
+ }
503
+ ]
504
+ }
505
+ ]
506
+ ```
507
+
508
+ ### Usage Examples
509
+
510
+ ```bash
511
+ # Create all modules from config
512
+ nsgm create-config config/modules.json
513
+
514
+ # Or use npm script with default config
515
+ npm run create-config
516
+
517
+ # Create specific module
518
+ nsgm create-config config/modules.json --module category
519
+
520
+ # Preview mode (dry-run)
521
+ nsgm create-config config/modules.json --dry-run
522
+ ```
523
+
524
+ ### Field Naming Convention
525
+
526
+ **Always use snake_case for field names:**
527
+
528
+ ```json
529
+ {
530
+ "name": "user_id", // ✅ Correct
531
+ "name": "category_id", // ✅ Correct
532
+ "name": "total_amount", // ✅ Correct
533
+ "name": "create_date", // ✅ Correct
534
+ "name": "update_date" // ✅ Correct
535
+ }
536
+ ```
537
+
538
+ Avoid camelCase:
539
+
540
+ ```json
541
+ {
542
+ "name": "userId", // ❌ Not recommended
543
+ "name": "categoryId", // ❌ Not recommended
544
+ "name": "totalAmount", // ❌ Not recommended
545
+ }
546
+ ```
547
+
548
+ ### Configuration File Location
549
+
550
+ Generated projects include a `config/` directory with example configuration files:
551
+
552
+ ```
553
+ project/
554
+ ├── config/
555
+ │ ├── modules.json # Default module configuration
556
+ └── your-custom-config.json # Your custom configurations
557
+ ├── server/
558
+ ├── client/
559
+ └── ...
560
+ ```
561
+
462
562
  ## 🐛 Troubleshooting
463
563
 
464
564
  ### Common Issues
@@ -5,55 +5,44 @@ export const Container = styled.div`
5
5
  margin: 20px 0 0 0;
6
6
  padding-bottom: 32px;
7
7
 
8
- .ant-table {
9
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
10
- border-radius: 8px;
11
- overflow: hidden;
12
- transition: all 0.3s ease;
13
-
14
- &:hover {
15
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
16
- }
17
- }
18
-
19
8
  .table-row-light {
20
- background-color: #ffffff;
9
+ background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
10
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
21
11
  }
22
12
 
23
13
  .table-row-dark {
24
- background-color: #f9f9f9;
25
- }
26
-
27
- .ant-table-thead > tr > th {
28
- background-color: #f0f5ff;
29
- color: #1890ff;
30
- font-weight: 500;
31
- padding: 12px 16px;
32
- }
33
-
34
- .ant-table-tbody > tr > td {
35
- padding: 12px 16px;
36
- transition: background-color 0.3s;
14
+ background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(243, 246, 248, 0.9) 100%);
15
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
37
16
  }
38
17
 
39
18
  .page-title {
40
- font-size: 24px;
41
- font-weight: 500;
19
+ font-size: 28px;
20
+ font-weight: 700;
42
21
  color: #1890ff;
43
- margin-bottom: 20px;
44
- padding-bottom: 10px;
45
- border-bottom: 1px solid #f0f0f0;
22
+ margin-bottom: 24px;
23
+ padding-bottom: 12px;
24
+ border-bottom: 2px solid #f0f0f0;
46
25
  position: relative;
47
26
 
48
27
  &:after {
49
28
  content: "";
50
29
  position: absolute;
51
- bottom: -1px;
30
+ bottom: -2px;
52
31
  left: 0;
53
- width: 100px;
54
- height: 3px;
55
- background: linear-gradient(90deg, #1890ff, #69c0ff);
56
- border-radius: 3px;
32
+ width: 120px;
33
+ height: 4px;
34
+ background: linear-gradient(90deg, #1890ff 0%, #52c41a 50%, #faad14 100%);
35
+ border-radius: 2px;
36
+ animation: slideIn 0.5s ease-out;
37
+ }
38
+ }
39
+
40
+ @keyframes slideIn {
41
+ from {
42
+ width: 0;
43
+ }
44
+ to {
45
+ width: 120px;
57
46
  }
58
47
  }
59
48
  `;
@@ -77,26 +66,32 @@ export const SearchRow = styled.div`
77
66
  `;
78
67
 
79
68
  export const ModalContainer = styled.div`
69
+ padding: 8px 0;
70
+
80
71
  .line {
81
72
  display: flex;
82
- flex: 1;
83
73
  flex-direction: row;
84
74
  justify-content: flex-start;
85
- align-items: flex-start;
86
- height: 50px;
87
- margin-bottom: 16px;
75
+ align-items: center;
76
+ min-height: 40px;
77
+ margin-bottom: 20px;
78
+
79
+ &:last-child {
80
+ margin-bottom: 0;
81
+ }
88
82
 
89
83
  label {
90
84
  display: flex;
91
85
  flex-direction: column;
92
86
  justify-content: center;
93
87
  align-items: flex-start;
94
- width: 80px;
95
- height: 32px;
88
+ width: 100px;
89
+ min-height: 32px;
96
90
  margin-right: 16px;
97
91
  font-weight: 500;
98
92
  color: #333;
99
93
  position: relative;
94
+ flex-shrink: 0;
100
95
 
101
96
  &:after {
102
97
  content: "";
@@ -106,34 +101,27 @@ export const ModalContainer = styled.div`
106
101
  transform: translateY(-50%);
107
102
  width: 3px;
108
103
  height: 16px;
109
- background: #1890ff;
104
+ background: linear-gradient(180deg, #1890ff 0%, #52c41a 100%);
110
105
  border-radius: 3px;
111
106
  }
112
107
  }
113
108
 
114
- input {
109
+ input,
110
+ .ant-input-affix-wrapper {
115
111
  flex: 1;
116
- border-radius: 6px;
117
- transition: all 0.3s ease;
112
+ border-radius: 8px;
113
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
114
+ min-height: 36px;
118
115
 
119
116
  &:hover,
120
117
  &:focus {
121
118
  border-color: #40a9ff;
122
- box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
119
+ box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.15);
123
120
  }
124
121
  }
125
122
 
126
- .row {
127
- display: flex;
128
- flex-direction: row;
129
- justify-content: center;
130
- align-items: center;
131
-
132
- .item {
133
- flex-direction: row;
134
- justify-content: flex-start;
135
- align-items: center;
136
- }
123
+ .ant-input-affix-wrapper input {
124
+ min-height: auto;
137
125
  }
138
126
  }
139
127
  `;
@@ -185,18 +173,292 @@ export const StyledInput = styled(Input)`
185
173
 
186
174
  export const StyledTable = styled(Table)`
187
175
  margin-top: 16px;
188
- border-radius: 8px;
176
+ border-radius: 12px;
189
177
  overflow: hidden;
178
+ box-shadow:
179
+ 0 4px 16px rgba(0, 0, 0, 0.08),
180
+ 0 2px 8px rgba(0, 0, 0, 0.04),
181
+ inset 0 1px 0 rgba(255, 255, 255, 0.8);
182
+ background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
183
+ backdrop-filter: blur(10px);
184
+ border: 1px solid rgba(255, 255, 255, 0.5);
185
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
186
+
187
+ &:hover {
188
+ box-shadow:
189
+ 0 8px 24px rgba(0, 0, 0, 0.12),
190
+ 0 4px 12px rgba(0, 0, 0, 0.06),
191
+ inset 0 1px 0 rgba(255, 255, 255, 0.9);
192
+ transform: translateY(-2px);
193
+ }
194
+
195
+ .ant-table-container {
196
+ position: relative;
197
+ border-radius: 12px 12px 0 0;
198
+ overflow: auto;
199
+ }
200
+
201
+ .ant-table-content {
202
+ overflow: auto;
203
+ }
204
+
205
+ .ant-table-thead > tr > th {
206
+ background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
207
+ color: #1890ff;
208
+ font-weight: 600;
209
+ padding: 16px;
210
+ font-size: 14px;
211
+ border-bottom: 2px solid #bae7ff;
212
+ position: relative;
213
+ white-space: nowrap;
214
+ overflow: hidden;
215
+ text-overflow: ellipsis;
216
+
217
+ &::before {
218
+ content: "";
219
+ position: absolute;
220
+ top: 0;
221
+ left: 0;
222
+ right: 0;
223
+ height: 3px;
224
+ background: linear-gradient(90deg, #1890ff 0%, #52c41a 50%, #faad14 100%);
225
+ opacity: 0.5;
226
+ }
227
+
228
+ .ant-table-column-sorter {
229
+ color: #1890ff;
230
+ font-size: 12px;
231
+ transition: all 0.3s ease;
232
+ display: inline-flex;
233
+ align-items: center;
234
+ margin-left: 4px;
235
+
236
+ &:hover {
237
+ color: #40a9ff;
238
+ transform: scale(1.1);
239
+ }
240
+ }
241
+
242
+ .ant-table-column-title {
243
+ white-space: nowrap;
244
+ overflow: hidden;
245
+ text-overflow: ellipsis;
246
+ display: inline;
247
+ }
248
+ }
249
+
250
+ .ant-table-tbody > tr {
251
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
252
+ border-bottom: 1px solid #f0f0f0;
253
+
254
+ &:hover > td {
255
+ background: linear-gradient(135deg, rgba(24, 144, 255, 0.05) 0%, rgba(82, 196, 26, 0.03) 100%) !important;
256
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
257
+ }
258
+ }
259
+
260
+ .ant-table-tbody > tr > td {
261
+ padding: 14px 16px;
262
+ color: #333;
263
+ font-size: 14px;
264
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
265
+ border-bottom: 1px solid #f0f0f0;
266
+ white-space: nowrap;
267
+ overflow: hidden;
268
+ text-overflow: ellipsis;
269
+ }
270
+
271
+ .ant-table-tbody > tr:last-child > td {
272
+ border-bottom: none;
273
+ }
274
+
275
+ .ant-table-selection-column {
276
+ width: 60px;
277
+ text-align: center;
278
+
279
+ .ant-checkbox-wrapper {
280
+ display: flex;
281
+ justify-content: center;
282
+ align-items: center;
283
+ }
284
+ }
285
+
286
+ .ant-table-cell-fix-right {
287
+ position: sticky !important;
288
+ right: 0;
289
+ z-index: 2;
290
+ background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
291
+ box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
292
+ }
293
+
294
+ .ant-table-pagination.ant-pagination {
295
+ margin: 20px 16px !important;
296
+ padding: 12px 20px;
297
+ background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(243, 246, 248, 0.9) 100%);
298
+ border-radius: 8px;
299
+ border: 1px solid rgba(255, 255, 255, 0.5);
300
+ display: flex;
301
+ justify-content: flex-end;
302
+ align-items: center;
303
+ flex-wrap: wrap;
304
+ gap: 8px;
305
+
306
+ .ant-pagination-total-text {
307
+ color: #1890ff;
308
+ font-weight: 600;
309
+ margin-right: 16px;
310
+ font-size: 14px;
311
+ }
312
+ }
190
313
 
191
314
  .styled-pagination {
192
- margin-top: 16px;
193
- margin-bottom: 16px;
315
+ &.ant-pagination {
316
+ color: #666;
317
+ }
318
+
319
+ .ant-pagination-item {
320
+ border-radius: 6px;
321
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
322
+ border: 1px solid #d9d9d9;
323
+ background: #fff;
324
+
325
+ a {
326
+ color: #666 !important;
327
+ transition: all 0.3s ease;
328
+ }
329
+
330
+ &:hover {
331
+ border-color: #1890ff;
332
+ transform: translateY(-2px);
333
+ box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
334
+
335
+ a {
336
+ color: #1890ff !important;
337
+ }
338
+ }
339
+
340
+ &.ant-pagination-item-active {
341
+ background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
342
+ border-color: #1890ff;
343
+ font-weight: 600;
344
+ box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
345
+ transform: translateY(-2px);
346
+
347
+ a {
348
+ color: #fff !important;
349
+ }
350
+ }
351
+ }
352
+
353
+ .ant-pagination-prev,
354
+ .ant-pagination-next {
355
+ border-radius: 6px;
356
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
357
+
358
+ &:hover {
359
+ border-color: #1890ff;
360
+ color: #1890ff;
361
+ transform: translateY(-2px);
362
+ }
363
+
364
+ .ant-pagination-item-link {
365
+ border-radius: 6px;
366
+ transition: all 0.3s ease;
367
+ }
368
+ }
369
+
370
+ .ant-pagination-jump-prev,
371
+ .ant-pagination-jump-next {
372
+ border-radius: 6px;
373
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
374
+
375
+ &:hover {
376
+ color: #1890ff;
377
+ }
378
+ }
379
+
380
+ .ant-pagination-options {
381
+ .ant-select-selector {
382
+ border-radius: 6px !important;
383
+ transition: all 0.3s ease;
384
+
385
+ &:hover {
386
+ border-color: #1890ff;
387
+ }
388
+ }
389
+
390
+ .ant-pagination-options-quick-jumper input {
391
+ border-radius: 6px !important;
392
+ transition: all 0.3s ease;
393
+
394
+ &:hover,
395
+ &:focus {
396
+ border-color: #1890ff;
397
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
398
+ }
399
+ }
400
+ }
401
+ }
402
+
403
+ /* 横向滚动条样式 */
404
+ .ant-table-body {
405
+ overflow-x: auto !important;
406
+
407
+ &::-webkit-scrollbar {
408
+ height: 8px;
409
+ width: 8px;
410
+ }
411
+
412
+ &::-webkit-scrollbar-track {
413
+ background: #f1f1f1;
414
+ border-radius: 4px;
415
+ }
416
+
417
+ &::-webkit-scrollbar-thumb {
418
+ background: #c1c1c1;
419
+ border-radius: 4px;
420
+
421
+ &:hover {
422
+ background: #a8a8a8;
423
+ }
424
+ }
425
+ }
426
+
427
+ /* 响应式设计 */
428
+ @media (max-width: 768px) {
429
+ .ant-table-thead > tr > th {
430
+ padding: 12px;
431
+ font-size: 13px;
432
+ }
433
+
434
+ .ant-table-tbody > tr > td {
435
+ padding: 12px;
436
+ font-size: 13px;
437
+ }
438
+
439
+ .ant-table-pagination.ant-pagination {
440
+ margin: 16px !important;
441
+ padding: 10px 16px;
442
+ }
194
443
  }
195
444
  `;
196
445
 
197
446
  export const ModalTitle = styled.div`
198
447
  color: #1890ff;
199
- font-weight: 500;
448
+ font-weight: 600;
449
+ font-size: 18px;
450
+ display: flex;
451
+ align-items: center;
452
+ gap: 8px;
453
+
454
+ &:before {
455
+ content: "";
456
+ display: inline-block;
457
+ width: 4px;
458
+ height: 20px;
459
+ background: linear-gradient(180deg, #1890ff 0%, #52c41a 100%);
460
+ border-radius: 2px;
461
+ }
200
462
  `;
201
463
 
202
464
  export const ModalInput = styled(Input)`
@@ -213,7 +475,16 @@ export const RoundedButton = styled(Button)`
213
475
 
214
476
  export const GlobalStyle = styled.div`
215
477
  .rounded-button {
216
- border-radius: 4px;
478
+ border-radius: 8px;
479
+ height: 36px;
480
+ padding: 0 20px;
481
+ font-weight: 500;
482
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
483
+
484
+ &:hover {
485
+ transform: translateY(-1px);
486
+ box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
487
+ }
217
488
  }
218
489
 
219
490
  /* 防止Modal打开时滚动条消失 */
@@ -221,4 +492,31 @@ export const GlobalStyle = styled.div`
221
492
  overflow: auto !important;
222
493
  padding-right: 0 !important;
223
494
  }
495
+
496
+ /* Modal 样式优化 */
497
+ .ant-modal-content {
498
+ border-radius: 16px;
499
+ overflow: hidden;
500
+ box-shadow:
501
+ 0 24px 48px rgba(0, 0, 0, 0.15),
502
+ 0 12px 24px rgba(0, 0, 0, 0.1);
503
+ }
504
+
505
+ .ant-modal-header {
506
+ padding: 20px 24px;
507
+ border-bottom: 1px solid #f0f0f0;
508
+ background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
509
+ }
510
+
511
+ .ant-modal-body {
512
+ padding: 24px;
513
+ max-height: 60vh;
514
+ overflow-y: auto;
515
+ }
516
+
517
+ .ant-modal-footer {
518
+ padding: 16px 24px;
519
+ border-top: 1px solid #f0f0f0;
520
+ background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
521
+ }
224
522
  `;
@@ -245,14 +245,20 @@ module.exports = {
245
245
  ### 使用方法
246
246
 
247
247
  ```bash
248
- # 创建所有模块
249
- npm run create-config config/modules.json
248
+ # 创建所有模块(使用默认配置文件 config/modules.json)
249
+ npm run create-config
250
+
251
+ # 或指定配置文件路径
252
+ nsgm create-config config/modules.json
250
253
 
251
254
  # 创建指定模块
252
- npm run create-config config/modules.json --module category
255
+ npm run create-config --module category
253
256
 
254
257
  # 预览模式(不实际创建)
255
- npm run create-config config/modules.json --dry-run
258
+ npm run create-config --dry-run
259
+
260
+ # 使用自定义配置文件
261
+ nsgm create-config path/to/your-config.json
256
262
  ```
257
263
 
258
264
  ### 字段命名规范
@@ -13,7 +13,7 @@
13
13
  "create": "nsgm create",
14
14
  "delete": "nsgm delete",
15
15
  "deletedb": "nsgm deletedb",
16
- "create-config": "nsgm create-config",
16
+ "create-config": "nsgm create-config config/modules.json",
17
17
  "generate-password": "node scripts/generate-password-hash.js",
18
18
  "postversion": "git push && git push --tags",
19
19
  "test": "jest",
@@ -44,7 +44,13 @@ exports.createConfigCommand = {
44
44
  try {
45
45
  // 获取配置文件路径
46
46
  const args = process.argv.slice(2);
47
- if (args.length === 0 || args[0].startsWith("-")) {
47
+ // 跳过命令名和别名
48
+ let configPathIndex = 0;
49
+ const commandNames = ["create-config", "-cc", "--create-config"];
50
+ while (configPathIndex < args.length && commandNames.includes(args[configPathIndex])) {
51
+ configPathIndex++;
52
+ }
53
+ if (configPathIndex >= args.length || args[configPathIndex].startsWith("-")) {
48
54
  utils_1.Console.error("请指定配置文件路径");
49
55
  utils_1.Console.info("使用方法:");
50
56
  utils_1.Console.info(" nsgm create-config <config-file> [--module <name>]");
@@ -56,7 +62,7 @@ exports.createConfigCommand = {
56
62
  utils_1.Console.info(" nsgm create-config config/modules.json --all");
57
63
  process.exit(1);
58
64
  }
59
- const configPath = args[0];
65
+ const configPath = args[configPathIndex];
60
66
  // 检查配置文件是否存在
61
67
  if (!fs_1.default.existsSync(configPath)) {
62
68
  utils_1.Console.error(`配置文件不存在: ${configPath}`);