lapeh 2.6.6 → 2.6.7

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
@@ -95,8 +95,12 @@ switch (command) {
95
95
  await upgradeProject();
96
96
  })();
97
97
  break;
98
+ case 'init':
99
+ case 'create':
100
+ createProject(true);
101
+ break;
98
102
  default:
99
- createProject();
103
+ createProject(false);
100
104
  break;
101
105
  }
102
106
 
@@ -425,8 +429,9 @@ async function upgradeProject() {
425
429
  console.log(' Please check your .env file against .env.example for any new required variables.');
426
430
  }
427
431
 
428
- function createProject() {
429
- const projectName = args.find(arg => !arg.startsWith('-'));
432
+ function createProject(skipFirstArg = false) {
433
+ const searchArgs = skipFirstArg ? args.slice(1) : args;
434
+ const projectName = searchArgs.find(arg => !arg.startsWith('-'));
430
435
  const isFull = args.includes('--full');
431
436
  const useDefaults = args.includes('--defaults') || args.includes('--default') || args.includes('-y');
432
437
 
@@ -2,17 +2,38 @@
2
2
 
3
3
  File ini mencatat semua perubahan, pembaruan, dan perbaikan yang dilakukan pada framework Lapeh, diurutkan berdasarkan tanggal.
4
4
 
5
+ ## [2025-12-29] - Monday, December 29, 2025 - Upgrade CLI Improvements & MongoDB Support (v2.6.6)
6
+
7
+ ### 🚀 Features & Improvements
8
+
9
+ - **Enhanced CLI `upgrade` Command**:
10
+
11
+ - The `upgrade` command now intelligently detects and preserves local `file:` dependencies in `package.json`. This is critical for framework contributors and local testing, ensuring that upgrading doesn't overwrite local links with npm versions.
12
+ - Standard users will still receive the latest npm version updates automatically.
13
+
14
+ - **MongoDB & Prisma Compatibility**:
15
+
16
+ - **BigInt Fixes**: Resolved serialization issues where `BigInt` IDs (common in SQL) caused crashes in MongoDB environments. All IDs in `auth` and `rbac` controllers now safely convert to `String` before response.
17
+ - **RBAC Schema**: Added missing RBAC models (`roles`, `permissions`, `user_roles`, `role_permissions`) to the core `prisma/schema.prisma` generation pipeline. This ensures `npx prisma generate` works flawlessly without manual schema adjustments.
18
+
19
+ - **CLI Initialization Flags**:
20
+ - Added new flags to `npx lapeh init` for faster setup:
21
+ - `--full`: Sets up a complete project with dummy data (users/roles).
22
+ - `--default` (or `--y`): Skips interactive prompts and uses default settings (PostgreSQL).
23
+
5
24
  ## [2025-12-28] - Sunday, December 28, 2025 - Multi-Database & Cleanup (v2.4.10)
6
25
 
7
26
  ### 🚀 Features & Improvements
8
27
 
9
28
  - **Multi-Database Support (CLI)**:
29
+
10
30
  - Added full support for project initialization with **MongoDB** and **MySQL**, alongside **PostgreSQL**.
11
31
  - Fixed database provider replacement logic in `schema.prisma` templates for better accuracy.
12
32
  - Added `--db-type=mongo|pgsql|mysql` CLI argument for zero-interaction automated installation.
13
33
  - Handled MongoDB migration differences by conditionally using `prisma db push`.
14
34
 
15
35
  - **Package Cleanup**:
36
+
16
37
  - Removed unnecessary development files/folders (`test-local-run`, `init`, `framework.md`, etc.) from the public NPM package.
17
38
  - Explicitly added the `LICENSE` (MIT) file to the package.
18
39
  - Ensured `dist` folder is cleanly regenerated during publication.
package/doc/en/CLI.md CHANGED
@@ -10,7 +10,42 @@ All commands are executed using `npm run <command>`.
10
10
 
11
11
  Main commands to run the application:
12
12
 
13
- ### 1. Development Server (`dev`)
13
+ ### 1. Initialize Project (`init`)
14
+ Creates a new project from scratch.
15
+
16
+ ```bash
17
+ npx lapeh@latest init <project-name> [flags]
18
+ ```
19
+
20
+ **Available Flags:**
21
+ - `--full`: Initialize with full setup (includes dummy users, roles, permissions).
22
+ - `--default`: Initialize with default configuration (PostgreSQL) skipping interactive prompts.
23
+ - `--y`: Alias for `--default`.
24
+
25
+ **Examples:**
26
+ ```bash
27
+ # Interactive Mode
28
+ npx lapeh init my-app
29
+
30
+ # Full Setup (Recommended for learning)
31
+ npx lapeh init my-app --full
32
+
33
+ # Fast Setup (Default Postgres)
34
+ npx lapeh init my-app --y
35
+ ```
36
+
37
+ ### 2. Upgrade Framework (`upgrade`)
38
+ Upgrades the Lapeh framework to the latest version in your existing project.
39
+
40
+ ```bash
41
+ npx lapeh upgrade
42
+ ```
43
+ **Features:**
44
+ - Automatically updates `package.json` dependencies.
45
+ - Syncs core framework files while preserving your custom code.
46
+ - **Smart Dependency Handling**: Preserves local `file:` dependencies if you are developing the framework locally, otherwise updates to the latest npm version.
47
+
48
+ ### 3. Development Server (`dev`)
14
49
  Runs the server in development mode with hot-reload feature.
15
50
 
16
51
  ```bash
@@ -19,14 +19,21 @@ The easiest way to start is by using the `npx` CLI generator.
19
19
  Run the following command in your terminal:
20
20
 
21
21
  ```bash
22
- npx lapeh@latest your-project-name
22
+ # Standard Interactive Setup
23
+ npx lapeh@latest init your-project-name
23
24
  ```
24
25
 
25
- Or for a full setup (with dummy user & role data):
26
+ **Alternative Quick Setup Flags:**
26
27
 
27
- ```bash
28
- npx lapeh@latest your-project-name --full
29
- ```
28
+ - **Full Setup** (Includes dummy data, recommended for learning):
29
+ ```bash
30
+ npx lapeh@latest init your-project-name --full
31
+ ```
32
+
33
+ - **Default Setup** (Skips questions, uses PostgreSQL):
34
+ ```bash
35
+ npx lapeh@latest init your-project-name --y
36
+ ```
30
37
 
31
38
  ### 2. Initial Setup
32
39
 
@@ -2,17 +2,38 @@
2
2
 
3
3
  File ini mencatat semua perubahan, pembaruan, dan perbaikan yang dilakukan pada framework Lapeh, diurutkan berdasarkan tanggal.
4
4
 
5
+ ## [2025-12-29] - Senin, 29 Desember 2025 - Perbaikan CLI Upgrade & Dukungan MongoDB (v2.6.6)
6
+
7
+ ### 🚀 Fitur & Perbaikan
8
+
9
+ - **Peningkatan Perintah CLI `upgrade`**:
10
+
11
+ - Perintah `upgrade` sekarang secara cerdas mendeteksi dan mempertahankan dependensi lokal (`file:`) di `package.json`. Ini sangat penting bagi kontributor framework dan pengujian lokal, memastikan proses upgrade tidak menimpa link lokal dengan versi npm.
12
+ - Pengguna standar tetap akan mendapatkan pembaruan versi npm terbaru secara otomatis.
13
+
14
+ - **Kompatibilitas MongoDB & Prisma**:
15
+
16
+ - **Perbaikan BigInt**: Mengatasi masalah serialisasi di mana ID bertipe `BigInt` (umum di SQL) menyebabkan crash di lingkungan MongoDB. Semua ID di controller `auth` dan `rbac` kini dikonversi menjadi `String` sebelum dikirim sebagai respons.
17
+ - **Schema RBAC**: Menambahkan model RBAC yang hilang (`roles`, `permissions`, `user_roles`, `role_permissions`) ke dalam pipeline generasi `prisma/schema.prisma`. Ini memastikan `npx prisma generate` berjalan lancar tanpa perlu penyesuaian schema manual.
18
+
19
+ - **Flag Inisialisasi CLI**:
20
+ - Menambahkan flag baru pada `npx lapeh init` untuk setup yang lebih cepat:
21
+ - `--full`: Menyiapkan proyek lengkap dengan data dummy (user/role).
22
+ - `--default` (atau `--y`): Melewati pertanyaan interaktif dan menggunakan pengaturan default (PostgreSQL).
23
+
5
24
  ## [2025-12-28] - Minggu, 28 Desember 2025 - Multi-Database & Cleanup (v2.4.10)
6
25
 
7
26
  ### 🚀 Fitur & Perbaikan
8
27
 
9
28
  - **Dukungan Multi-Database (CLI)**:
29
+
10
30
  - Menambahkan dukungan penuh untuk inisialisasi proyek dengan **MongoDB** dan **MySQL** selain **PostgreSQL**.
11
31
  - Memperbaiki logika penggantian provider database pada template `schema.prisma` agar lebih akurat.
12
32
  - Menambahkan argumen CLI `--db-type=mongo|pgsql|mysql` untuk otomatisasi instalasi tanpa interaksi.
13
33
  - Mengatasi masalah migrasi pada MongoDB dengan menggunakan `prisma db push` secara kondisional.
14
34
 
15
35
  - **Pembersihan Paket (Cleanup)**:
36
+
16
37
  - Menghapus file dan folder development yang tidak diperlukan (`test-local-run`, `init`, `framework.md`, dll) dari paket publik NPM.
17
38
  - Menambahkan file `LICENSE` (MIT) secara eksplisit ke dalam paket.
18
39
  - Memastikan folder `dist` di-generate ulang dengan bersih saat publikasi.
package/doc/id/CLI.md CHANGED
@@ -10,7 +10,42 @@ Semua perintah dijalankan menggunakan `npm run <command>`.
10
10
 
11
11
  Perintah utama untuk menjalankan aplikasi:
12
12
 
13
- ### 1. Development Server (`dev`)
13
+ ### 1. Inisialisasi Project (`init`)
14
+ Membuat project baru dari awal.
15
+
16
+ ```bash
17
+ npx lapeh@latest init <nama-project> [flags]
18
+ ```
19
+
20
+ **Flag Tersedia:**
21
+ - `--full`: Inisialisasi dengan setup lengkap (termasuk dummy user, role, permission).
22
+ - `--default`: Inisialisasi dengan konfigurasi default (PostgreSQL) melewati prompt interaktif.
23
+ - `--y`: Alias untuk `--default`.
24
+
25
+ **Contoh:**
26
+ ```bash
27
+ # Mode Interaktif
28
+ npx lapeh init my-app
29
+
30
+ # Setup Lengkap (Disarankan untuk belajar)
31
+ npx lapeh init my-app --full
32
+
33
+ # Setup Cepat (Default Postgres)
34
+ npx lapeh init my-app --y
35
+ ```
36
+
37
+ ### 2. Upgrade Framework (`upgrade`)
38
+ Memperbarui framework Lapeh ke versi terbaru di project yang sudah ada.
39
+
40
+ ```bash
41
+ npx lapeh upgrade
42
+ ```
43
+ **Fitur:**
44
+ - Secara otomatis memperbarui dependensi `package.json`.
45
+ - Menyinkronkan file inti framework sambil menjaga kode kustom Anda.
46
+ - **Smart Dependency Handling**: Mempertahankan dependensi `file:` lokal jika Anda mengembangkan framework secara lokal, jika tidak akan mengupdate ke versi npm terbaru.
47
+
48
+ ### 3. Development Server (`dev`)
14
49
  Menjalankan server dalam mode development dengan fitur hot-reload.
15
50
 
16
51
  ```bash
@@ -19,14 +19,21 @@ Cara termudah untuk memulai adalah menggunakan CLI generator `npx`.
19
19
  Jalankan perintah berikut di terminal Anda:
20
20
 
21
21
  ```bash
22
- npx lapeh@latest nama-project-anda
22
+ # Setup Interaktif Standar
23
+ npx lapeh@latest init nama-project-anda
23
24
  ```
24
25
 
25
- Atau untuk setup lengkap (dengan data dummy user & role):
26
+ **Opsi Setup Cepat (Flags):**
26
27
 
27
- ```bash
28
- npx lapeh@latest nama-project-anda --full
29
- ```
28
+ - **Setup Lengkap** (Termasuk data dummy, disarankan untuk belajar):
29
+ ```bash
30
+ npx lapeh@latest init nama-project-anda --full
31
+ ```
32
+
33
+ - **Setup Default** (Melewati pertanyaan, menggunakan PostgreSQL):
34
+ ```bash
35
+ npx lapeh@latest init nama-project-anda --y
36
+ ```
30
37
 
31
38
  ### 2. Setup Awal
32
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapeh",
3
- "version": "2.6.6",
3
+ "version": "2.6.7",
4
4
  "description": "Framework API Express yang siap pakai (Standardized)",
5
5
  "engines": {
6
6
  "node": ">=18.0.0",