lapeh 2.1.8 → 2.2.0

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/bin/index.js CHANGED
@@ -355,8 +355,20 @@ function createProject() {
355
355
  }
356
356
 
357
357
  console.log(`\nāœ… Project ${projectName} created successfully!`);
358
- console.log(`\nNext steps:`);
359
- console.log(` cd ${projectName}`);
360
- console.log(` npm run dev`);
358
+
359
+ if (isFull) {
360
+ console.log(`\nšŸš€ Launching development server (--full detected)...`);
361
+ try {
362
+ execSync('npm run dev', { cwd: projectDir, stdio: 'inherit' });
363
+ } catch (error) {
364
+ // Graceful exit
365
+ }
366
+ console.log(`\nā„¹ļø Server stopped.`);
367
+ console.log(` To enter project folder: cd ${projectName}`);
368
+ } else {
369
+ console.log(`\nNext steps:`);
370
+ console.log(` cd ${projectName}`);
371
+ console.log(` npm run dev`);
372
+ }
361
373
  })();
362
374
  }
package/doc/CHANGELOG.md CHANGED
@@ -20,6 +20,8 @@ File ini mencatat semua perubahan, pembaruan, dan perbaikan yang dilakukan pada
20
20
  - **Struktur Folder Baru**:
21
21
  - Pemisahan konfigurasi inti ke `src/core/` (`server.ts`, `database.ts`, `redis.ts`, `realtime.ts`) agar folder `src` lebih bersih.
22
22
  - Sentralisasi route di `src/routes/index.ts` (WIP).
23
+ - **CLI Improvements**:
24
+ - `npx lapeh <project-name> --full` kini otomatis menjalankan server dev setelah instalasi selesai, sehingga user bisa langsung melihat hasil tanpa mengetik perintah tambahan.
23
25
 
24
26
  ### šŸ› ļø Perbaikan & Refactoring
25
27
  - **Controller Refactoring**:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapeh",
3
- "version": "2.1.8",
3
+ "version": "2.2.0",
4
4
  "description": "Framework API Express yang siap pakai (Standardized)",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -27,6 +27,31 @@ const startServer = async () => {
27
27
  // Initialize Redis transparently (no logs if missing)
28
28
  await initRedis();
29
29
 
30
+ // Handle specific listen errors
31
+ server.on("error", (e: any) => {
32
+ if (e.code === "EADDRINUSE") {
33
+ console.log(`\nāŒ Error: Port ${port} is already in use.`);
34
+ console.log(
35
+ `šŸ’” Suggestion: Run this command to kill the conflicting process:\n`
36
+ );
37
+
38
+ if (process.platform === "win32") {
39
+ console.log(` npx kill-port ${port}`);
40
+ console.log(
41
+ ` (PowerShell): Stop-Process -Id (Get-NetTCPConnection -LocalPort ${port}).OwningProcess -Force`
42
+ );
43
+ } else if (process.platform === "darwin") {
44
+ console.log(` npx kill-port ${port}`);
45
+ console.log(` (Terminal): kill -9 $(lsof -t -i:${port})`);
46
+ } else {
47
+ // Linux
48
+ console.log(` npx kill-port ${port}`);
49
+ console.log(` (Terminal): fuser -k ${port}/tcp`);
50
+ }
51
+ process.exit(1);
52
+ }
53
+ });
54
+
30
55
  server.listen(port, () => {
31
56
  console.log(`āœ… API running at http://localhost:${port}`);
32
57
  console.log(`šŸ›”ļø Environment: ${process.env.NODE_ENV || "development"}`);