servcraft 0.4.6 → 0.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servcraft",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "A modular, production-ready Node.js backend framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -926,3 +926,6 @@ async function performSmartMerge(
926
926
 
927
927
  InteractivePrompt.showMergeSummary(stats);
928
928
  }
929
+
930
+ // Export helper functions for use in other commands
931
+ export { generateModuleFiles, EnvManager, TemplateManager };
@@ -7,6 +7,7 @@ import chalk from 'chalk';
7
7
  import { execSync } from 'child_process';
8
8
  import { ensureDir, writeFile, error, warn } from '../utils/helpers.js';
9
9
  import { DryRunManager } from '../utils/dry-run.js';
10
+ import { generateModuleFiles } from './add-module.js';
10
11
 
11
12
  interface InitOptions {
12
13
  name: string;
@@ -54,26 +55,26 @@ export const initCommand = new Command('init')
54
55
  console.log(chalk.cyan('│') + ' ' + chalk.cyan('│'));
55
56
  console.log(
56
57
  chalk.cyan('│') +
57
- ' ' +
58
+ ' ' +
58
59
  chalk.bold.white('🚀 Servcraft') +
59
60
  chalk.gray(' - Project Generator') +
60
- ' ' +
61
+ ' ' +
61
62
  chalk.cyan('│')
62
63
  );
63
64
  console.log(
64
65
  chalk.cyan('│') +
65
- ' ' +
66
+ ' ' +
66
67
  chalk.gray('by ') +
67
68
  chalk.blue('Yao Logan') +
68
69
  chalk.gray(' (@Le-Sourcier)') +
69
- ' ' +
70
+ ' ' +
70
71
  chalk.cyan('│')
71
72
  );
72
73
  console.log(
73
74
  chalk.cyan('│') +
74
- ' ' +
75
+ ' ' +
75
76
  chalk.bgBlue.white(' in/yao-logan ') +
76
- ' ' +
77
+ ' ' +
77
78
  chalk.cyan('│')
78
79
  );
79
80
  console.log(chalk.cyan('│') + ' ' + chalk.cyan('│'));
@@ -161,7 +162,7 @@ export const initCommand = new Command('init')
161
162
  { name: 'Email Service', value: 'email', checked: true },
162
163
  { name: 'Audit Logs', value: 'audit', checked: false },
163
164
  { name: 'File Upload', value: 'upload', checked: false },
164
- { name: 'Redis Cache', value: 'redis', checked: false },
165
+ { name: 'Redis Cache', value: 'cache', checked: false },
165
166
  ],
166
167
  },
167
168
  ]);
@@ -305,6 +306,24 @@ export const initCommand = new Command('init')
305
306
 
306
307
  spinner.succeed('Project files generated!');
307
308
 
309
+ // Install selected feature modules
310
+ if (options.features && options.features.length > 0 && !cmdOptions?.dryRun) {
311
+ const moduleSpinner = ora('Installing selected modules...').start();
312
+
313
+ try {
314
+ for (const feature of options.features) {
315
+ moduleSpinner.text = `Installing ${feature} module...`;
316
+ const moduleDir = path.join(projectDir, 'src/modules', feature);
317
+ await ensureDir(moduleDir);
318
+ await generateModuleFiles(feature, moduleDir);
319
+ }
320
+ moduleSpinner.succeed(`${options.features.length} module(s) installed!`);
321
+ } catch (err) {
322
+ moduleSpinner.fail('Failed to install some modules');
323
+ warn(` Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
324
+ }
325
+ }
326
+
308
327
  // Install dependencies (skip in dry-run mode)
309
328
  if (!cmdOptions?.dryRun) {
310
329
  const installSpinner = ora('Installing dependencies...').start();