frontend-hamroun 1.1.42 → 1.1.43

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.
Files changed (2) hide show
  1. package/bin/cli.js +22 -7
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -64,14 +64,21 @@ async function init() {
64
64
  const program = new Command();
65
65
 
66
66
  program
67
- .name('create-frontend-app')
68
- .description('Create a new Frontend Hamroun application')
67
+ .name('frontend-hamroun')
68
+ .description('Frontend Hamroun CLI')
69
+ .version('1.0.0');
70
+
71
+ // Create command
72
+ program
73
+ .command('create')
74
+ .description('Create a new project')
69
75
  .argument('[name]', 'Project name')
70
76
  .action(async (name) => {
71
77
  const projectName = name || await askProjectName();
72
78
  await createProject(projectName);
73
79
  });
74
80
 
81
+ // Dev command
75
82
  program
76
83
  .command('dev')
77
84
  .description('Start development server')
@@ -80,19 +87,27 @@ async function init() {
80
87
  .action(async (options) => {
81
88
  const spinner = createSpinner('Starting development server...').start();
82
89
  try {
83
- await createDevServer({
90
+ const { server, ctx } = await createDevServer({
84
91
  port: parseInt(options.port),
85
92
  isSSR: options.ssr
86
93
  });
87
- spinner.success({ text: 'Development server started' });
94
+
95
+ spinner.success({ text: `Development server running at http://localhost:${options.port}` });
96
+
97
+ // Handle cleanup
98
+ process.on('SIGINT', async () => {
99
+ await ctx.dispose();
100
+ server.close();
101
+ process.exit(0);
102
+ });
88
103
  } catch (error) {
89
- spinner.error({ text: chalk.red('Failed to start server') });
90
- console.error(error);
104
+ spinner.error({ text: 'Failed to start development server' });
105
+ console.error(chalk.red(error));
91
106
  process.exit(1);
92
107
  }
93
108
  });
94
109
 
95
- program.parse();
110
+ program.parse(process.argv);
96
111
  }
97
112
 
98
113
  async function askProjectName() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.1.42",
3
+ "version": "1.1.43",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",