Nexa CLI struktur
Nexa CLI adalah command line interface yang powerful untuk mengelola
proyek Nexa Framework. Tool ini menyediakan berbagai perintah untuk
instalasi package, manajemen profil, dan utilitas pengembangan. Dengan
dukungan cross-platform dan integrasi yang mulus dengan NPM dan Git, Nexa
CLI memudahkan developer dalam membangun dan mengelola aplikasi Nexa.
Prasyarat
- PowerShell 5.1 atau PowerShell Core 7.x
- Git (untuk package git)
- Node.js dan NPM (untuk package npm)
File .env dengan konfigurasi:
APP_ENV=development
APP_DEBUG=true
Memulai dengan Nexa CLI
-
Install profil Nexa:
nexa install-profile
-
Restart PowerShell atau reload profil:
. $PROFILE
-
Verifikasi instalasi:
nexa
Perintah Dasar
# Install package
nexa i git@owner/repo # Install git package ke package/repository
nexa i pckg@owner/repo # Install git package langsung ke package folder
nexa i public@owner/repo # Install git package ke public folder
nexa i npm@package-name@1.0.0 # Install npm package
# Update package
nexa u git@owner/repo # Update git package
nexa u public@owner/repo # Update public package
nexa u npm@package-name # Update npm package
# Hapus package
nexa d git@owner/repo # Hapus git package
nexa d public@owner/repo # Hapus public package
nexa d npm@package-name # Hapus npm package
# Manajemen Profil
nexa install-profile # Install profil PowerShell
nexa remove-profile # Hapus profil Nexa
# Utilitas
nexa protect # Amankan script Nexa
Struktur Folder
vendor/
├─ repository/ # Lokasi git repositories
├─ node_modules/ # Lokasi npm packages
├─ package.json # NPM konfigurasi
└─ .npmrc # NPM konfigurasi tambahan
app/
├─ logs/ # Log files
└─ system/ # Script sistem
└─ nexa.ps1 # Script utama
.env # Konfigurasi environment
nexa.lock.json # Lock file untuk tracking packages
Contoh Penggunaan
Install Git Package
nexa i git@username/repo-name
Install NPM Package
nexa i npm@express@4.18.2
nexa i npm@lodash # Versi terbaru
Catatan: Semua package akan diinstal di folder vendor
untuk isolasi yang lebih baik.
Keamanan
- Mode Development: Nexa hanya berjalan dalam mode development
- Machine ID: Setiap instalasi terikat dengan mesin spesifik
- Logging: Semua operasi dicatat dalam file log
-
Script Protection: Opsi untuk mengenkripsi script dengan:
nexa protect
Manajemen Profil
Install Profil
nexa install-profile
Menginstal atau memperbarui profil PowerShell untuk Nexa CLI.
Hapus Profil
nexa remove-profile
Menghapus konfigurasi Nexa dari profil PowerShell. Setelah menghapus:
- Tutup semua jendela PowerShell
- Buka PowerShell baru
-
Untuk menginstal ulang, gunakan
nexa install-profile
Catatan: Perintah remove-profile hanya menghapus
konfigurasi Nexa dan mempertahankan konfigurasi PowerShell lainnya.
Dukungan NPM Package
Fitur NPM:
- Instalasi package dengan versi spesifik
- Manajemen dependensi otomatis
- Lock file untuk konsistensi versi
- Isolasi package di folder vendor
Peringatan:
-
Pastikan selalu menggunakan mode development saat menggunakan Nexa
CLI.
-
Setelah menghapus atau menginstal profil, restart PowerShell untuk
menerapkan perubahan.