acadex-cli 1.0.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/LICENSE +21 -0
- package/README.md +71 -0
- package/acadex +497 -0
- package/acadex.ps1 +594 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Learn From Xavi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# acadex-cli
|
|
2
|
+
|
|
3
|
+
A global CLI tool for managing Acadex projects with easy setup and automation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Via npm (Global)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g acadex-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After installation, you can use the `acadex` command from anywhere:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
acadex --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Manual Installation
|
|
20
|
+
|
|
21
|
+
Clone the repository and link it globally:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone <repository-url>
|
|
25
|
+
cd acadex-cli-global
|
|
26
|
+
npm link
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Run the CLI tool using:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
acadex <command> [arguments]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Available Commands
|
|
38
|
+
|
|
39
|
+
#### Setup & Installation
|
|
40
|
+
- `acadex setup` - First-time full installation
|
|
41
|
+
- `acadex install:2fa` - Install 2FA packages
|
|
42
|
+
- `acadex install:notif` - Install notification feature packages
|
|
43
|
+
- `acadex check` - Check system requirements
|
|
44
|
+
|
|
45
|
+
#### Development
|
|
46
|
+
- `acadex serve` - Start production servers (Laravel + Queue + Scheduler + Reverb)
|
|
47
|
+
- `acadex services` - Start background services only (for Herd)
|
|
48
|
+
- `acadex dev` - Start dev servers (Laravel + Queue + Logs + Vite + Reverb)
|
|
49
|
+
- `acadex build` - Build assets for production
|
|
50
|
+
- `acadex ui` - Rebuild UI assets and clear caches
|
|
51
|
+
- `acadex start` - Start Laravel server only
|
|
52
|
+
|
|
53
|
+
#### Testing
|
|
54
|
+
- `acadex test` - Run PHPUnit tests
|
|
55
|
+
- `acadex test:coverage` - Run tests with coverage
|
|
56
|
+
|
|
57
|
+
#### Database
|
|
58
|
+
- `acadex migrate` - Run database migrations
|
|
59
|
+
- `acadex migrate:fresh` - Fresh migration with seeders
|
|
60
|
+
- `acadex seed` - Run database seeders
|
|
61
|
+
- `acadex tinker` - Start Laravel Tinker
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
- Node.js >= 14.0.0
|
|
66
|
+
- Bash shell (Linux/macOS) or PowerShell (Windows)
|
|
67
|
+
- PHP and Composer (for Laravel projects)
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
package/acadex
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ACADEX - Custom command wrapper for AcadexV3
|
|
4
|
+
# Usage: ./acadex <command> [arguments]
|
|
5
|
+
|
|
6
|
+
# Colors for output
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
YELLOW='\033[1;33m'
|
|
10
|
+
BLUE='\033[0;34m'
|
|
11
|
+
NC='\033[0m' # No Color
|
|
12
|
+
|
|
13
|
+
# Project root directory
|
|
14
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
15
|
+
cd "$SCRIPT_DIR"
|
|
16
|
+
|
|
17
|
+
# Display help
|
|
18
|
+
show_help() {
|
|
19
|
+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
|
|
20
|
+
echo -e "${BLUE}║${NC} ${GREEN}ACADEX${NC} - AcadexV3 Commands ${BLUE}║${NC}"
|
|
21
|
+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════╝${NC}"
|
|
22
|
+
echo ""
|
|
23
|
+
echo -e "${YELLOW}Usage:${NC} acadex <command> [arguments]"
|
|
24
|
+
echo ""
|
|
25
|
+
echo -e "${YELLOW}Available Commands:${NC}"
|
|
26
|
+
echo ""
|
|
27
|
+
echo -e " ${BLUE}Setup & Installation:${NC}"
|
|
28
|
+
echo -e " ${GREEN}setup${NC} First-time full installation"
|
|
29
|
+
echo -e " ${GREEN}install:2fa${NC} Install 2FA packages (existing install)"
|
|
30
|
+
echo -e " ${GREEN}install:notif${NC} Install notification feature packages"
|
|
31
|
+
echo -e " ${GREEN}check${NC} Check system requirements"
|
|
32
|
+
echo ""
|
|
33
|
+
echo -e " ${BLUE}Development:${NC}"
|
|
34
|
+
echo -e " ${GREEN}serve${NC} Start production servers (Laravel + Queue + Scheduler + Reverb)"
|
|
35
|
+
echo -e " ${GREEN}services${NC} Start background services only (for Herd)"
|
|
36
|
+
echo -e " ${GREEN}dev${NC} Start dev servers (Laravel + Queue + Logs + Vite + Reverb)"
|
|
37
|
+
echo -e " ${GREEN}build${NC} Build assets for production (npm run build)"
|
|
38
|
+
echo -e " ${GREEN}ui${NC} Rebuild UI assets and clear caches"
|
|
39
|
+
echo -e " ${GREEN}start${NC} Start Laravel server only"
|
|
40
|
+
echo ""
|
|
41
|
+
echo -e " ${BLUE}Testing:${NC}"
|
|
42
|
+
echo -e " ${GREEN}test${NC} Run PHPUnit tests"
|
|
43
|
+
echo -e " ${GREEN}test:coverage${NC} Run tests with coverage"
|
|
44
|
+
echo ""
|
|
45
|
+
echo -e " ${BLUE}Database:${NC}"
|
|
46
|
+
echo -e " ${GREEN}migrate${NC} Run database migrations"
|
|
47
|
+
echo -e " ${GREEN}migrate:fresh${NC} Fresh migration with seeders"
|
|
48
|
+
echo -e " ${GREEN}seed${NC} Run database seeders"
|
|
49
|
+
echo -e " ${GREEN}tinker${NC} Start Laravel Tinker"
|
|
50
|
+
echo ""
|
|
51
|
+
echo -e " ${BLUE}Maintenance:${NC}"
|
|
52
|
+
echo -e " ${GREEN}cache:clear${NC} Clear all caches"
|
|
53
|
+
echo -e " ${GREEN}optimize${NC} Optimize the application"
|
|
54
|
+
echo -e " ${GREEN}logs${NC} Tail Laravel logs"
|
|
55
|
+
echo ""
|
|
56
|
+
echo -e " ${BLUE}Code Quality:${NC}"
|
|
57
|
+
echo -e " ${GREEN}analyze${NC} Run PHPStan static analysis"
|
|
58
|
+
echo -e " ${GREEN}format${NC} Format code with Pint"
|
|
59
|
+
echo ""
|
|
60
|
+
echo -e " ${BLUE}Dependencies:${NC}"
|
|
61
|
+
echo -e " ${GREEN}install${NC} Install all dependencies"
|
|
62
|
+
echo -e " ${GREEN}update${NC} Update all dependencies"
|
|
63
|
+
echo ""
|
|
64
|
+
echo -e " ${BLUE}Other:${NC}"
|
|
65
|
+
echo -e " ${GREEN}routes${NC} List all routes"
|
|
66
|
+
echo -e " ${GREEN}queue${NC} Start queue worker"
|
|
67
|
+
echo -e " ${GREEN}schedule${NC} Run scheduled tasks"
|
|
68
|
+
echo -e " ${GREEN}share${NC} Share site publicly via Expose"
|
|
69
|
+
echo -e " ${GREEN}phpmyadmin${NC} Start Apache & open phpMyAdmin (port 8080)"
|
|
70
|
+
echo -e " ${GREEN}phpmyadmin:stop${NC} Stop Apache"
|
|
71
|
+
echo -e " ${GREEN}docs${NC} Open ACADEX documentation"
|
|
72
|
+
echo ""
|
|
73
|
+
echo -e "${YELLOW}Examples:${NC}"
|
|
74
|
+
echo -e " acadex setup # First-time installation"
|
|
75
|
+
echo -e " acadex services # Start services for Herd (recommended)"
|
|
76
|
+
echo -e " acadex serve # Start full stack (without Herd)"
|
|
77
|
+
echo -e " acadex dev # Start development"
|
|
78
|
+
echo -e " acadex test # Run tests"
|
|
79
|
+
echo -e " acadex migrate:fresh # Reset database"
|
|
80
|
+
echo ""
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Command handlers
|
|
84
|
+
case "$1" in
|
|
85
|
+
setup)
|
|
86
|
+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
|
|
87
|
+
echo -e "${BLUE}║${NC} ${GREEN}ACADEX${NC} - First Time Installation ${BLUE}║${NC}"
|
|
88
|
+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════╝${NC}"
|
|
89
|
+
echo ""
|
|
90
|
+
|
|
91
|
+
# Step 1: Check requirements
|
|
92
|
+
echo -e "${YELLOW}[1/9]${NC} Checking requirements..."
|
|
93
|
+
|
|
94
|
+
# Check PHP
|
|
95
|
+
if command -v php &> /dev/null; then
|
|
96
|
+
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
|
|
97
|
+
echo -e " ${GREEN}✓${NC} PHP $PHP_VERSION found"
|
|
98
|
+
else
|
|
99
|
+
echo -e " ${RED}✗${NC} PHP not found. Please install PHP 8.2+"
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# Check Composer
|
|
104
|
+
if command -v composer &> /dev/null; then
|
|
105
|
+
echo -e " ${GREEN}✓${NC} Composer found"
|
|
106
|
+
else
|
|
107
|
+
echo -e " ${RED}✗${NC} Composer not found. Please install Composer"
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
# Check Node
|
|
112
|
+
if command -v node &> /dev/null; then
|
|
113
|
+
NODE_VERSION=$(node -v)
|
|
114
|
+
echo -e " ${GREEN}✓${NC} Node.js $NODE_VERSION found"
|
|
115
|
+
else
|
|
116
|
+
echo -e " ${RED}✗${NC} Node.js not found. Please install Node.js"
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Check npm
|
|
121
|
+
if command -v npm &> /dev/null; then
|
|
122
|
+
echo -e " ${GREEN}✓${NC} npm found"
|
|
123
|
+
else
|
|
124
|
+
echo -e " ${RED}✗${NC} npm not found. Please install npm"
|
|
125
|
+
exit 1
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
echo ""
|
|
129
|
+
|
|
130
|
+
# Step 2: Copy .env
|
|
131
|
+
echo -e "${YELLOW}[2/9]${NC} Setting up environment file..."
|
|
132
|
+
if [ ! -f .env ]; then
|
|
133
|
+
if [ -f .env.example ]; then
|
|
134
|
+
cp .env.example .env
|
|
135
|
+
echo -e " ${GREEN}✓${NC} Created .env from .env.example"
|
|
136
|
+
else
|
|
137
|
+
echo -e " ${RED}✗${NC} .env.example not found!"
|
|
138
|
+
exit 1
|
|
139
|
+
fi
|
|
140
|
+
else
|
|
141
|
+
echo -e " ${GREEN}✓${NC} .env already exists"
|
|
142
|
+
fi
|
|
143
|
+
echo ""
|
|
144
|
+
|
|
145
|
+
# Step 3: Install Composer dependencies
|
|
146
|
+
echo -e "${YELLOW}[3/9]${NC} Installing Composer dependencies..."
|
|
147
|
+
echo -e " ${BLUE}→${NC} This includes: Laravel, Excel, 2FA, Socialite, notifications, etc."
|
|
148
|
+
composer install --no-interaction
|
|
149
|
+
if [ $? -eq 0 ]; then
|
|
150
|
+
echo -e " ${GREEN}✓${NC} Composer dependencies installed"
|
|
151
|
+
else
|
|
152
|
+
echo -e " ${RED}✗${NC} Composer install failed!"
|
|
153
|
+
exit 1
|
|
154
|
+
fi
|
|
155
|
+
echo ""
|
|
156
|
+
|
|
157
|
+
# Step 4: Install npm dependencies
|
|
158
|
+
echo -e "${YELLOW}[4/9]${NC} Installing npm dependencies..."
|
|
159
|
+
npm install
|
|
160
|
+
if [ $? -eq 0 ]; then
|
|
161
|
+
echo -e " ${GREEN}✓${NC} npm dependencies installed"
|
|
162
|
+
else
|
|
163
|
+
echo -e " ${RED}✗${NC} npm install failed!"
|
|
164
|
+
exit 1
|
|
165
|
+
fi
|
|
166
|
+
echo -e " ${BLUE}→${NC} Installing notification features..."
|
|
167
|
+
npm install @alpinejs/intersect --save
|
|
168
|
+
if [ $? -eq 0 ]; then
|
|
169
|
+
echo -e " ${GREEN}✓${NC} Notification packages installed"
|
|
170
|
+
fi
|
|
171
|
+
echo ""
|
|
172
|
+
|
|
173
|
+
# Step 5: Generate app key
|
|
174
|
+
echo -e "${YELLOW}[5/9]${NC} Generating application key..."
|
|
175
|
+
if grep -q "APP_KEY=base64:" .env; then
|
|
176
|
+
echo -e " ${GREEN}✓${NC} APP_KEY already set"
|
|
177
|
+
else
|
|
178
|
+
php artisan key:generate --ansi
|
|
179
|
+
echo -e " ${GREEN}✓${NC} APP_KEY generated"
|
|
180
|
+
fi
|
|
181
|
+
echo ""
|
|
182
|
+
|
|
183
|
+
# Step 6: Database setup prompt
|
|
184
|
+
echo -e "${YELLOW}[6/9]${NC} Database configuration..."
|
|
185
|
+
echo -e " ${BLUE}→${NC} Please configure your database in .env file"
|
|
186
|
+
echo -e " ${BLUE}→${NC} DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD"
|
|
187
|
+
echo ""
|
|
188
|
+
read -p " Have you configured the database? (y/n): " db_configured
|
|
189
|
+
if [ "$db_configured" != "y" ] && [ "$db_configured" != "Y" ]; then
|
|
190
|
+
echo -e " ${YELLOW}!${NC} Please configure the database in .env and run: acadex migrate"
|
|
191
|
+
echo ""
|
|
192
|
+
else
|
|
193
|
+
# Step 7: Run migrations
|
|
194
|
+
echo ""
|
|
195
|
+
echo -e "${YELLOW}[7/9]${NC} Running database migrations..."
|
|
196
|
+
php artisan migrate --force
|
|
197
|
+
if [ $? -eq 0 ]; then
|
|
198
|
+
echo -e " ${GREEN}✓${NC} Migrations completed"
|
|
199
|
+
else
|
|
200
|
+
echo -e " ${RED}✗${NC} Migration failed! Check your database configuration."
|
|
201
|
+
fi
|
|
202
|
+
echo ""
|
|
203
|
+
|
|
204
|
+
# Seeding prompt
|
|
205
|
+
read -p " Run database seeders? (y/n): " run_seeders
|
|
206
|
+
if [ "$run_seeders" = "y" ] || [ "$run_seeders" = "Y" ]; then
|
|
207
|
+
php artisan db:seed --force
|
|
208
|
+
echo -e " ${GREEN}✓${NC} Database seeded"
|
|
209
|
+
fi
|
|
210
|
+
fi
|
|
211
|
+
echo ""
|
|
212
|
+
|
|
213
|
+
# Step 8: Build assets
|
|
214
|
+
echo -e "${YELLOW}[8/9]${NC} Building frontend assets..."
|
|
215
|
+
npm run build
|
|
216
|
+
if [ $? -eq 0 ]; then
|
|
217
|
+
echo -e " ${GREEN}✓${NC} Assets built"
|
|
218
|
+
else
|
|
219
|
+
echo -e " ${RED}✗${NC} Build failed!"
|
|
220
|
+
fi
|
|
221
|
+
echo ""
|
|
222
|
+
|
|
223
|
+
# Step 9: Optimize
|
|
224
|
+
echo -e "${YELLOW}[9/9]${NC} Optimizing application..."
|
|
225
|
+
php artisan config:cache
|
|
226
|
+
php artisan route:cache
|
|
227
|
+
php artisan view:cache
|
|
228
|
+
echo -e " ${GREEN}✓${NC} Application optimized"
|
|
229
|
+
echo ""
|
|
230
|
+
|
|
231
|
+
# Done!
|
|
232
|
+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
|
|
233
|
+
echo -e "${BLUE}║${NC} ${GREEN}✓ Installation Complete!${NC} ${BLUE}║${NC}"
|
|
234
|
+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════╝${NC}"
|
|
235
|
+
echo ""
|
|
236
|
+
echo -e "${YELLOW}Next steps:${NC}"
|
|
237
|
+
echo -e " 1. Configure your .env file (database, mail, etc.)"
|
|
238
|
+
echo -e " 2. Run ${GREEN}acadex dev${NC} to start development servers"
|
|
239
|
+
echo -e " 3. Visit ${BLUE}http://localhost:8000${NC}"
|
|
240
|
+
echo ""
|
|
241
|
+
;;
|
|
242
|
+
|
|
243
|
+
install:2fa)
|
|
244
|
+
echo -e "${GREEN}Installing 2FA packages...${NC}"
|
|
245
|
+
echo ""
|
|
246
|
+
composer require pragmarx/google2fa-laravel bacon/bacon-qr-code
|
|
247
|
+
if [ $? -eq 0 ]; then
|
|
248
|
+
echo ""
|
|
249
|
+
echo -e "${GREEN}✓ 2FA packages installed successfully!${NC}"
|
|
250
|
+
echo -e " - pragmarx/google2fa-laravel"
|
|
251
|
+
echo -e " - bacon/bacon-qr-code"
|
|
252
|
+
else
|
|
253
|
+
echo -e "${RED}✗ Installation failed!${NC}"
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
;;
|
|
257
|
+
|
|
258
|
+
install:notif)
|
|
259
|
+
echo -e "${GREEN}Installing notification feature packages...${NC}"
|
|
260
|
+
echo ""
|
|
261
|
+
npm install @alpinejs/intersect --save
|
|
262
|
+
if [ $? -eq 0 ]; then
|
|
263
|
+
echo ""
|
|
264
|
+
echo -e "${GREEN}✓ Notification packages installed successfully!${NC}"
|
|
265
|
+
echo -e " - @alpinejs/intersect"
|
|
266
|
+
else
|
|
267
|
+
echo -e "${RED}✗ Installation failed!${NC}"
|
|
268
|
+
exit 1
|
|
269
|
+
fi
|
|
270
|
+
;;
|
|
271
|
+
|
|
272
|
+
check)
|
|
273
|
+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
|
|
274
|
+
echo -e "${BLUE}║${NC} ${GREEN}ACADEX${NC} - System Requirements ${BLUE}║${NC}"
|
|
275
|
+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════╝${NC}"
|
|
276
|
+
echo ""
|
|
277
|
+
|
|
278
|
+
# PHP
|
|
279
|
+
echo -e "${YELLOW}PHP:${NC}"
|
|
280
|
+
if command -v php &> /dev/null; then
|
|
281
|
+
PHP_VERSION=$(php -v | head -n 1)
|
|
282
|
+
echo -e " ${GREEN}✓${NC} $PHP_VERSION"
|
|
283
|
+
else
|
|
284
|
+
echo -e " ${RED}✗${NC} PHP not found (required: 8.2+)"
|
|
285
|
+
fi
|
|
286
|
+
|
|
287
|
+
# Composer
|
|
288
|
+
echo -e "${YELLOW}Composer:${NC}"
|
|
289
|
+
if command -v composer &> /dev/null; then
|
|
290
|
+
COMPOSER_VERSION=$(composer --version)
|
|
291
|
+
echo -e " ${GREEN}✓${NC} $COMPOSER_VERSION"
|
|
292
|
+
else
|
|
293
|
+
echo -e " ${RED}✗${NC} Composer not found"
|
|
294
|
+
fi
|
|
295
|
+
|
|
296
|
+
# Node.js
|
|
297
|
+
echo -e "${YELLOW}Node.js:${NC}"
|
|
298
|
+
if command -v node &> /dev/null; then
|
|
299
|
+
NODE_VERSION=$(node -v)
|
|
300
|
+
echo -e " ${GREEN}✓${NC} Node.js $NODE_VERSION"
|
|
301
|
+
else
|
|
302
|
+
echo -e " ${RED}✗${NC} Node.js not found"
|
|
303
|
+
fi
|
|
304
|
+
|
|
305
|
+
# npm
|
|
306
|
+
echo -e "${YELLOW}npm:${NC}"
|
|
307
|
+
if command -v npm &> /dev/null; then
|
|
308
|
+
NPM_VERSION=$(npm -v)
|
|
309
|
+
echo -e " ${GREEN}✓${NC} npm $NPM_VERSION"
|
|
310
|
+
else
|
|
311
|
+
echo -e " ${RED}✗${NC} npm not found"
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
# Git
|
|
315
|
+
echo -e "${YELLOW}Git:${NC}"
|
|
316
|
+
if command -v git &> /dev/null; then
|
|
317
|
+
GIT_VERSION=$(git --version)
|
|
318
|
+
echo -e " ${GREEN}✓${NC} $GIT_VERSION"
|
|
319
|
+
else
|
|
320
|
+
echo -e " ${RED}✗${NC} Git not found"
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
echo ""
|
|
324
|
+
|
|
325
|
+
# Project status
|
|
326
|
+
echo -e "${YELLOW}Project Status:${NC}"
|
|
327
|
+
|
|
328
|
+
if [ -f .env ]; then
|
|
329
|
+
echo -e " ${GREEN}✓${NC} .env file exists"
|
|
330
|
+
else
|
|
331
|
+
echo -e " ${RED}✗${NC} .env file missing"
|
|
332
|
+
fi
|
|
333
|
+
|
|
334
|
+
if [ -d vendor ]; then
|
|
335
|
+
echo -e " ${GREEN}✓${NC} Composer dependencies installed"
|
|
336
|
+
else
|
|
337
|
+
echo -e " ${RED}✗${NC} Composer dependencies not installed"
|
|
338
|
+
fi
|
|
339
|
+
|
|
340
|
+
if [ -d node_modules ]; then
|
|
341
|
+
echo -e " ${GREEN}✓${NC} npm dependencies installed"
|
|
342
|
+
else
|
|
343
|
+
echo -e " ${RED}✗${NC} npm dependencies not installed"
|
|
344
|
+
fi
|
|
345
|
+
|
|
346
|
+
if [ -d public/build ]; then
|
|
347
|
+
echo -e " ${GREEN}✓${NC} Assets built"
|
|
348
|
+
else
|
|
349
|
+
echo -e " ${RED}✗${NC} Assets not built (run: acadex build)"
|
|
350
|
+
fi
|
|
351
|
+
|
|
352
|
+
echo ""
|
|
353
|
+
;;
|
|
354
|
+
|
|
355
|
+
serve)
|
|
356
|
+
echo -e "${GREEN}Starting production servers (Laravel + Queue + Scheduler + Reverb)...${NC}"
|
|
357
|
+
npx concurrently -c "#93c5fd,#c4b5fd,#4ade80,#fbbf24" \
|
|
358
|
+
"php artisan serve" \
|
|
359
|
+
"php artisan queue:work --tries=3 --timeout=90" \
|
|
360
|
+
"php artisan schedule:work" \
|
|
361
|
+
--names=server,queue,scheduler
|
|
362
|
+
;;
|
|
363
|
+
dev)
|
|
364
|
+
echo -e "${GREEN}Starting development servers (Laravel + Queue + Logs + Vite + Reverb)...${NC}"
|
|
365
|
+
npx concurrently -c "#93c5fd,#c4b5fd,#fb7185,#fdba74,#fbbf24" \
|
|
366
|
+
"php artisan serve" \
|
|
367
|
+
"php artisan queue:work --tries=3 --timeout=90" \
|
|
368
|
+
"php artisan pail --timeout=0" \
|
|
369
|
+
"npm run dev" \
|
|
370
|
+
"php artisan reverb:start" \
|
|
371
|
+
--names=server,queue,logs,vite,reverb
|
|
372
|
+
;;
|
|
373
|
+
build)
|
|
374
|
+
echo -e "${GREEN}Building assets for production...${NC}"
|
|
375
|
+
npm run build
|
|
376
|
+
;;
|
|
377
|
+
ui)
|
|
378
|
+
echo -e "${GREEN}Rebuilding UI and clearing caches...${NC}"
|
|
379
|
+
echo -e " ${BLUE}→${NC} Building frontend assets..."
|
|
380
|
+
npm run build
|
|
381
|
+
echo -e " ${BLUE}→${NC} Clearing all caches..."
|
|
382
|
+
php artisan optimize:clear
|
|
383
|
+
echo -e "${GREEN}✓ UI refreshed! Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)${NC}"
|
|
384
|
+
;;
|
|
385
|
+
start)
|
|
386
|
+
echo -e "${GREEN}Starting Laravel server only...${NC}"
|
|
387
|
+
php artisan serve
|
|
388
|
+
;;
|
|
389
|
+
test)
|
|
390
|
+
echo -e "${GREEN}Running tests...${NC}"
|
|
391
|
+
php artisan test "${@:2}"
|
|
392
|
+
;;
|
|
393
|
+
test:coverage)
|
|
394
|
+
echo -e "${GREEN}Running tests with coverage...${NC}"
|
|
395
|
+
php artisan test --coverage "${@:2}"
|
|
396
|
+
;;
|
|
397
|
+
migrate)
|
|
398
|
+
echo -e "${GREEN}Running migrations...${NC}"
|
|
399
|
+
php artisan migrate "${@:2}"
|
|
400
|
+
;;
|
|
401
|
+
migrate:fresh)
|
|
402
|
+
echo -e "${YELLOW}Running fresh migration with seeders...${NC}"
|
|
403
|
+
php artisan migrate:fresh --seed "${@:2}"
|
|
404
|
+
;;
|
|
405
|
+
seed)
|
|
406
|
+
echo -e "${GREEN}Running seeders...${NC}"
|
|
407
|
+
php artisan db:seed "${@:2}"
|
|
408
|
+
;;
|
|
409
|
+
tinker)
|
|
410
|
+
echo -e "${GREEN}Starting Tinker...${NC}"
|
|
411
|
+
php artisan tinker
|
|
412
|
+
;;
|
|
413
|
+
cache:clear)
|
|
414
|
+
echo -e "${GREEN}Clearing all caches...${NC}"
|
|
415
|
+
php artisan config:clear
|
|
416
|
+
php artisan cache:clear
|
|
417
|
+
php artisan route:clear
|
|
418
|
+
php artisan view:clear
|
|
419
|
+
echo -e "${GREEN}All caches cleared!${NC}"
|
|
420
|
+
;;
|
|
421
|
+
optimize)
|
|
422
|
+
echo -e "${GREEN}Optimizing application...${NC}"
|
|
423
|
+
php artisan optimize
|
|
424
|
+
;;
|
|
425
|
+
logs)
|
|
426
|
+
echo -e "${GREEN}Tailing Laravel logs...${NC}"
|
|
427
|
+
tail -f storage/logs/laravel.log
|
|
428
|
+
;;
|
|
429
|
+
analyze)
|
|
430
|
+
echo -e "${GREEN}Running PHPStan analysis...${NC}"
|
|
431
|
+
./vendor/bin/phpstan analyse "${@:2}"
|
|
432
|
+
;;
|
|
433
|
+
format)
|
|
434
|
+
echo -e "${GREEN}Formatting code with Pint...${NC}"
|
|
435
|
+
./vendor/bin/pint "${@:2}"
|
|
436
|
+
;;
|
|
437
|
+
install)
|
|
438
|
+
echo -e "${GREEN}Installing dependencies...${NC}"
|
|
439
|
+
composer install
|
|
440
|
+
npm install
|
|
441
|
+
echo -e "${BLUE}→${NC} Installing notification features..."
|
|
442
|
+
npm install @alpinejs/intersect --save
|
|
443
|
+
echo -e "${GREEN}Dependencies installed!${NC}"
|
|
444
|
+
;;
|
|
445
|
+
update)
|
|
446
|
+
echo -e "${GREEN}Updating dependencies...${NC}"
|
|
447
|
+
composer update
|
|
448
|
+
npm update
|
|
449
|
+
echo -e "${GREEN}Dependencies updated!${NC}"
|
|
450
|
+
;;
|
|
451
|
+
routes)
|
|
452
|
+
echo -e "${GREEN}Listing routes...${NC}"
|
|
453
|
+
php artisan route:list "${@:2}"
|
|
454
|
+
;;
|
|
455
|
+
queue)
|
|
456
|
+
echo -e "${GREEN}Starting queue worker...${NC}"
|
|
457
|
+
php artisan queue:work "${@:2}"
|
|
458
|
+
;;
|
|
459
|
+
schedule)
|
|
460
|
+
echo -e "${GREEN}Running scheduled tasks...${NC}"
|
|
461
|
+
php artisan schedule:run
|
|
462
|
+
;;
|
|
463
|
+
share)
|
|
464
|
+
echo -e "${GREEN}Sharing site via Expose...${NC}"
|
|
465
|
+
echo -e "${YELLOW}Public URL will be displayed below${NC}"
|
|
466
|
+
echo -e "${YELLOW}Press Ctrl+C to stop sharing${NC}"
|
|
467
|
+
echo ""
|
|
468
|
+
expose share https://acadexv3.test
|
|
469
|
+
;;
|
|
470
|
+
phpmyadmin)
|
|
471
|
+
echo -e "${GREEN}Starting Apache & opening phpMyAdmin...${NC}"
|
|
472
|
+
sudo /Applications/XAMPP/xamppfiles/bin/apachectl start
|
|
473
|
+
echo -e "${GREEN}✓ Apache started on port 8080${NC}"
|
|
474
|
+
echo -e "${YELLOW}Opening http://localhost:8080/phpmyadmin/${NC}"
|
|
475
|
+
open http://localhost:8080/phpmyadmin/
|
|
476
|
+
echo ""
|
|
477
|
+
echo -e "${YELLOW}To stop Apache: acadex phpmyadmin:stop${NC}"
|
|
478
|
+
;;
|
|
479
|
+
phpmyadmin:stop)
|
|
480
|
+
echo -e "${GREEN}Stopping Apache...${NC}"
|
|
481
|
+
sudo /Applications/XAMPP/xamppfiles/bin/apachectl stop
|
|
482
|
+
echo -e "${GREEN}✓ Apache stopped${NC}"
|
|
483
|
+
;;
|
|
484
|
+
docs)
|
|
485
|
+
echo -e "${GREEN}Opening ACADEX documentation...${NC}"
|
|
486
|
+
open "https://xaviworks.github.io/AcadexV3/"
|
|
487
|
+
;;
|
|
488
|
+
help|--help|-h|"")
|
|
489
|
+
show_help
|
|
490
|
+
;;
|
|
491
|
+
*)
|
|
492
|
+
echo -e "${RED}Unknown command: $1${NC}"
|
|
493
|
+
echo ""
|
|
494
|
+
show_help
|
|
495
|
+
exit 1
|
|
496
|
+
;;
|
|
497
|
+
esac
|
package/acadex.ps1
ADDED
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
ACADEX - Custom command wrapper for AcadexV3 (Windows PowerShell)
|
|
4
|
+
.DESCRIPTION
|
|
5
|
+
Usage: acadex <command> [arguments]
|
|
6
|
+
#>
|
|
7
|
+
|
|
8
|
+
param(
|
|
9
|
+
[Parameter(Position=0)]
|
|
10
|
+
[string]$Command,
|
|
11
|
+
|
|
12
|
+
[Parameter(Position=1, ValueFromRemainingArguments=$true)]
|
|
13
|
+
[string[]]$Arguments
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Project root directory
|
|
17
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
18
|
+
Set-Location $ScriptDir
|
|
19
|
+
|
|
20
|
+
# Display help
|
|
21
|
+
function Show-Help {
|
|
22
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
23
|
+
Write-Host " ACADEX - AcadexV3 Commands " -ForegroundColor Green
|
|
24
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
25
|
+
Write-Host ""
|
|
26
|
+
Write-Host "Usage: acadex <command> [arguments]" -ForegroundColor Yellow
|
|
27
|
+
Write-Host ""
|
|
28
|
+
Write-Host "Available Commands:" -ForegroundColor Yellow
|
|
29
|
+
Write-Host ""
|
|
30
|
+
Write-Host " Setup and Installation:" -ForegroundColor Cyan
|
|
31
|
+
Write-Host " setup " -ForegroundColor Green -NoNewline
|
|
32
|
+
Write-Host "First-time full installation"
|
|
33
|
+
Write-Host " install:2fa " -ForegroundColor Green -NoNewline
|
|
34
|
+
Write-Host "Install 2FA packages (existing install)"
|
|
35
|
+
Write-Host " install:notif " -ForegroundColor Green -NoNewline
|
|
36
|
+
Write-Host "Install notification feature packages"
|
|
37
|
+
Write-Host " check " -ForegroundColor Green -NoNewline
|
|
38
|
+
Write-Host "Check system requirements"
|
|
39
|
+
Write-Host ""
|
|
40
|
+
Write-Host " Development:" -ForegroundColor Cyan
|
|
41
|
+
Write-Host " serve " -ForegroundColor Green -NoNewline
|
|
42
|
+
Write-Host "Start production servers (Laravel + Queue + Scheduler + Reverb)"
|
|
43
|
+
Write-Host " services " -ForegroundColor Green -NoNewline
|
|
44
|
+
Write-Host "Start background services only (for Herd/Laragon)"
|
|
45
|
+
Write-Host " dev " -ForegroundColor Green -NoNewline
|
|
46
|
+
Write-Host "Start dev servers (Laravel + Queue + Logs + Vite + Reverb)"
|
|
47
|
+
Write-Host " build " -ForegroundColor Green -NoNewline
|
|
48
|
+
Write-Host "Build assets for production (npm run build)"
|
|
49
|
+
Write-Host " ui " -ForegroundColor Green -NoNewline
|
|
50
|
+
Write-Host "Rebuild UI assets and clear caches"
|
|
51
|
+
Write-Host " start " -ForegroundColor Green -NoNewline
|
|
52
|
+
Write-Host "Start Laravel server only"
|
|
53
|
+
Write-Host ""
|
|
54
|
+
Write-Host " Testing:" -ForegroundColor Cyan
|
|
55
|
+
Write-Host " test " -ForegroundColor Green -NoNewline
|
|
56
|
+
Write-Host "Run PHPUnit tests"
|
|
57
|
+
Write-Host " test:coverage " -ForegroundColor Green -NoNewline
|
|
58
|
+
Write-Host "Run tests with coverage"
|
|
59
|
+
Write-Host ""
|
|
60
|
+
Write-Host " Database:" -ForegroundColor Cyan
|
|
61
|
+
Write-Host " migrate " -ForegroundColor Green -NoNewline
|
|
62
|
+
Write-Host "Run database migrations"
|
|
63
|
+
Write-Host " migrate:fresh " -ForegroundColor Green -NoNewline
|
|
64
|
+
Write-Host "Fresh migration with seeders"
|
|
65
|
+
Write-Host " seed " -ForegroundColor Green -NoNewline
|
|
66
|
+
Write-Host "Run database seeders"
|
|
67
|
+
Write-Host " tinker " -ForegroundColor Green -NoNewline
|
|
68
|
+
Write-Host "Start Laravel Tinker"
|
|
69
|
+
Write-Host ""
|
|
70
|
+
Write-Host " Maintenance:" -ForegroundColor Cyan
|
|
71
|
+
Write-Host " cache:clear " -ForegroundColor Green -NoNewline
|
|
72
|
+
Write-Host "Clear all caches"
|
|
73
|
+
Write-Host " optimize " -ForegroundColor Green -NoNewline
|
|
74
|
+
Write-Host "Optimize the application"
|
|
75
|
+
Write-Host " logs " -ForegroundColor Green -NoNewline
|
|
76
|
+
Write-Host "Tail Laravel logs"
|
|
77
|
+
Write-Host ""
|
|
78
|
+
Write-Host " Code Quality:" -ForegroundColor Cyan
|
|
79
|
+
Write-Host " analyze " -ForegroundColor Green -NoNewline
|
|
80
|
+
Write-Host "Run PHPStan static analysis"
|
|
81
|
+
Write-Host " format " -ForegroundColor Green -NoNewline
|
|
82
|
+
Write-Host "Format code with Pint"
|
|
83
|
+
Write-Host ""
|
|
84
|
+
Write-Host " Dependencies:" -ForegroundColor Cyan
|
|
85
|
+
Write-Host " install " -ForegroundColor Green -NoNewline
|
|
86
|
+
Write-Host "Install all dependencies"
|
|
87
|
+
Write-Host " update " -ForegroundColor Green -NoNewline
|
|
88
|
+
Write-Host "Update all dependencies"
|
|
89
|
+
Write-Host ""
|
|
90
|
+
Write-Host " Other:" -ForegroundColor Cyan
|
|
91
|
+
Write-Host " routes " -ForegroundColor Green -NoNewline
|
|
92
|
+
Write-Host "List all routes"
|
|
93
|
+
Write-Host " queue " -ForegroundColor Green -NoNewline
|
|
94
|
+
Write-Host "Start queue worker"
|
|
95
|
+
Write-Host " schedule " -ForegroundColor Green -NoNewline
|
|
96
|
+
Write-Host "Run scheduled tasks" Write-Host " share " -ForegroundColor Green -NoNewline
|
|
97
|
+
Write-Host "Share site publicly via Expose" Write-Host " phpmyadmin " -ForegroundColor Green -NoNewline
|
|
98
|
+
Write-Host "Start Apache & open phpMyAdmin (Windows)"
|
|
99
|
+
Write-Host " phpmyadmin:stop " -ForegroundColor Green -NoNewline
|
|
100
|
+
Write-Host "Stop Apache (Windows)"
|
|
101
|
+
Write-Host " docs " -ForegroundColor Green -NoNewline
|
|
102
|
+
Write-Host "Open ACADEX documentation"
|
|
103
|
+
Write-Host ""
|
|
104
|
+
Write-Host "Examples:" -ForegroundColor Yellow
|
|
105
|
+
Write-Host " acadex setup # First-time installation"
|
|
106
|
+
Write-Host " acadex services # Start services for Herd/Laragon (recommended)"
|
|
107
|
+
Write-Host " acadex serve # Start full stack (without Herd/Laragon)"
|
|
108
|
+
Write-Host " acadex dev # Start development"
|
|
109
|
+
Write-Host " acadex test # Run tests"
|
|
110
|
+
Write-Host " acadex migrate:fresh # Reset database"
|
|
111
|
+
Write-Host ""
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Check if a command exists
|
|
115
|
+
function Test-CommandExists {
|
|
116
|
+
param([string]$Cmd)
|
|
117
|
+
$null -ne (Get-Command $Cmd -ErrorAction SilentlyContinue)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# Command handlers
|
|
121
|
+
switch ($Command) {
|
|
122
|
+
"setup" {
|
|
123
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
124
|
+
Write-Host " ACADEX - First Time Installation " -ForegroundColor Green
|
|
125
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
126
|
+
Write-Host ""
|
|
127
|
+
|
|
128
|
+
# Step 1: Check requirements
|
|
129
|
+
Write-Host "[1/9] Checking requirements..." -ForegroundColor Yellow
|
|
130
|
+
|
|
131
|
+
# Check PHP
|
|
132
|
+
if (Test-CommandExists "php") {
|
|
133
|
+
$phpVersion = php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;"
|
|
134
|
+
Write-Host " [OK] PHP $phpVersion found" -ForegroundColor Green
|
|
135
|
+
} else {
|
|
136
|
+
Write-Host " [X] PHP not found. Please install PHP 8.2+" -ForegroundColor Red
|
|
137
|
+
exit 1
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# Check Composer
|
|
141
|
+
if (Test-CommandExists "composer") {
|
|
142
|
+
Write-Host " [OK] Composer found" -ForegroundColor Green
|
|
143
|
+
} else {
|
|
144
|
+
Write-Host " [X] Composer not found. Please install Composer" -ForegroundColor Red
|
|
145
|
+
exit 1
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# Check Node
|
|
149
|
+
if (Test-CommandExists "node") {
|
|
150
|
+
$nodeVersion = node -v
|
|
151
|
+
Write-Host " [OK] Node.js $nodeVersion found" -ForegroundColor Green
|
|
152
|
+
} else {
|
|
153
|
+
Write-Host " [X] Node.js not found. Please install Node.js" -ForegroundColor Red
|
|
154
|
+
exit 1
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
# Check npm
|
|
158
|
+
if (Test-CommandExists "npm") {
|
|
159
|
+
Write-Host " [OK] npm found" -ForegroundColor Green
|
|
160
|
+
} else {
|
|
161
|
+
Write-Host " [X] npm not found. Please install npm" -ForegroundColor Red
|
|
162
|
+
exit 1
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
Write-Host ""
|
|
166
|
+
|
|
167
|
+
# Step 2: Copy .env
|
|
168
|
+
Write-Host "[2/9] Setting up environment file..." -ForegroundColor Yellow
|
|
169
|
+
if (!(Test-Path ".env")) {
|
|
170
|
+
if (Test-Path ".env.example") {
|
|
171
|
+
Copy-Item ".env.example" ".env"
|
|
172
|
+
Write-Host " [OK] Created .env from .env.example" -ForegroundColor Green
|
|
173
|
+
} else {
|
|
174
|
+
Write-Host " [X] .env.example not found!" -ForegroundColor Red
|
|
175
|
+
exit 1
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
Write-Host " [OK] .env already exists" -ForegroundColor Green
|
|
179
|
+
}
|
|
180
|
+
Write-Host ""
|
|
181
|
+
|
|
182
|
+
# Step 3: Install Composer dependencies
|
|
183
|
+
Write-Host "[3/9] Installing Composer dependencies..." -ForegroundColor Yellow
|
|
184
|
+
Write-Host " -> This includes: Laravel, Excel, 2FA, Socialite, notifications, etc." -ForegroundColor Cyan
|
|
185
|
+
composer install --no-interaction
|
|
186
|
+
if ($LASTEXITCODE -eq 0) {
|
|
187
|
+
Write-Host " [OK] Composer dependencies installed" -ForegroundColor Green
|
|
188
|
+
} else {
|
|
189
|
+
Write-Host " [X] Composer install failed!" -ForegroundColor Red
|
|
190
|
+
exit 1
|
|
191
|
+
}
|
|
192
|
+
Write-Host ""
|
|
193
|
+
|
|
194
|
+
# Step 4: Install npm dependencies
|
|
195
|
+
Write-Host "[4/9] Installing npm dependencies..." -ForegroundColor Yellow
|
|
196
|
+
npm install
|
|
197
|
+
if ($LASTEXITCODE -eq 0) {
|
|
198
|
+
Write-Host " [OK] npm dependencies installed" -ForegroundColor Green
|
|
199
|
+
} else {
|
|
200
|
+
Write-Host " [X] npm install failed!" -ForegroundColor Red
|
|
201
|
+
exit 1
|
|
202
|
+
}
|
|
203
|
+
Write-Host " -> Installing notification features..." -ForegroundColor Cyan
|
|
204
|
+
npm install @alpinejs/intersect --save
|
|
205
|
+
if ($LASTEXITCODE -eq 0) {
|
|
206
|
+
Write-Host " [OK] Notification packages installed" -ForegroundColor Green
|
|
207
|
+
}
|
|
208
|
+
Write-Host ""
|
|
209
|
+
|
|
210
|
+
# Step 5: Generate app key
|
|
211
|
+
Write-Host "[5/9] Generating application key..." -ForegroundColor Yellow
|
|
212
|
+
$envContent = Get-Content ".env" -Raw
|
|
213
|
+
if ($envContent -match "APP_KEY=base64:") {
|
|
214
|
+
Write-Host " [OK] APP_KEY already set" -ForegroundColor Green
|
|
215
|
+
} else {
|
|
216
|
+
php artisan key:generate --ansi
|
|
217
|
+
Write-Host " [OK] APP_KEY generated" -ForegroundColor Green
|
|
218
|
+
}
|
|
219
|
+
Write-Host ""
|
|
220
|
+
|
|
221
|
+
# Step 6: Database setup prompt
|
|
222
|
+
Write-Host "[6/9] Database configuration..." -ForegroundColor Yellow
|
|
223
|
+
Write-Host " -> Please configure your database in .env file" -ForegroundColor Cyan
|
|
224
|
+
Write-Host " -> DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD" -ForegroundColor Cyan
|
|
225
|
+
Write-Host ""
|
|
226
|
+
$dbConfigured = Read-Host " Have you configured the database? (y/n)"
|
|
227
|
+
if ($dbConfigured -ne "y" -and $dbConfigured -ne "Y") {
|
|
228
|
+
Write-Host " [!] Please configure the database in .env and run: acadex migrate" -ForegroundColor Yellow
|
|
229
|
+
Write-Host ""
|
|
230
|
+
} else {
|
|
231
|
+
# Step 7: Run migrations
|
|
232
|
+
Write-Host ""
|
|
233
|
+
Write-Host "[7/9] Running database migrations..." -ForegroundColor Yellow
|
|
234
|
+
php artisan migrate --force
|
|
235
|
+
if ($LASTEXITCODE -eq 0) {
|
|
236
|
+
Write-Host " [OK] Migrations completed" -ForegroundColor Green
|
|
237
|
+
} else {
|
|
238
|
+
Write-Host " [X] Migration failed! Check your database configuration." -ForegroundColor Red
|
|
239
|
+
}
|
|
240
|
+
Write-Host ""
|
|
241
|
+
|
|
242
|
+
# Seeding prompt
|
|
243
|
+
$runSeeders = Read-Host " Run database seeders? (y/n)"
|
|
244
|
+
if ($runSeeders -eq "y" -or $runSeeders -eq "Y") {
|
|
245
|
+
php artisan db:seed --force
|
|
246
|
+
Write-Host " [OK] Database seeded" -ForegroundColor Green
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
Write-Host ""
|
|
250
|
+
|
|
251
|
+
# Step 8: Build assets
|
|
252
|
+
Write-Host "[8/9] Building frontend assets..." -ForegroundColor Yellow
|
|
253
|
+
npm run build
|
|
254
|
+
if ($LASTEXITCODE -eq 0) {
|
|
255
|
+
Write-Host " [OK] Assets built" -ForegroundColor Green
|
|
256
|
+
} else {
|
|
257
|
+
Write-Host " [X] Build failed!" -ForegroundColor Red
|
|
258
|
+
}
|
|
259
|
+
Write-Host ""
|
|
260
|
+
|
|
261
|
+
# Step 9: Optimize
|
|
262
|
+
Write-Host "[9/9] Optimizing application..." -ForegroundColor Yellow
|
|
263
|
+
php artisan config:cache
|
|
264
|
+
php artisan route:cache
|
|
265
|
+
php artisan view:cache
|
|
266
|
+
Write-Host " [OK] Application optimized" -ForegroundColor Green
|
|
267
|
+
Write-Host ""
|
|
268
|
+
|
|
269
|
+
# Done!
|
|
270
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
271
|
+
Write-Host " Installation Complete! " -ForegroundColor Green
|
|
272
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
273
|
+
Write-Host ""
|
|
274
|
+
Write-Host "Next steps:" -ForegroundColor Yellow
|
|
275
|
+
Write-Host " 1. Configure your .env file (database, mail, etc.)"
|
|
276
|
+
Write-Host " 2. Run 'acadex dev' to start development servers" -ForegroundColor Green
|
|
277
|
+
Write-Host " 3. Visit http://localhost:8000" -ForegroundColor Cyan
|
|
278
|
+
Write-Host ""
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
"install:2fa" {
|
|
282
|
+
Write-Host "Installing 2FA packages..." -ForegroundColor Green
|
|
283
|
+
Write-Host ""
|
|
284
|
+
composer require pragmarx/google2fa-laravel bacon/bacon-qr-code
|
|
285
|
+
if ($LASTEXITCODE -eq 0) {
|
|
286
|
+
Write-Host ""
|
|
287
|
+
Write-Host "[OK] 2FA packages installed successfully!" -ForegroundColor Green
|
|
288
|
+
Write-Host " - pragmarx/google2fa-laravel"
|
|
289
|
+
Write-Host " - bacon/bacon-qr-code"
|
|
290
|
+
} else {
|
|
291
|
+
Write-Host "[X] Installation failed!" -ForegroundColor Red
|
|
292
|
+
exit 1
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
"install:notif" {
|
|
297
|
+
Write-Host "Installing notification feature packages..." -ForegroundColor Green
|
|
298
|
+
Write-Host ""
|
|
299
|
+
npm install @alpinejs/intersect --save
|
|
300
|
+
if ($LASTEXITCODE -eq 0) {
|
|
301
|
+
Write-Host ""
|
|
302
|
+
Write-Host "[OK] Notification packages installed successfully!" -ForegroundColor Green
|
|
303
|
+
Write-Host " - @alpinejs/intersect"
|
|
304
|
+
} else {
|
|
305
|
+
Write-Host "[X] Installation failed!" -ForegroundColor Red
|
|
306
|
+
exit 1
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
"check" {
|
|
311
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
312
|
+
Write-Host " ACADEX - System Requirements " -ForegroundColor Green
|
|
313
|
+
Write-Host "===========================================================" -ForegroundColor Cyan
|
|
314
|
+
Write-Host ""
|
|
315
|
+
|
|
316
|
+
# PHP
|
|
317
|
+
Write-Host "PHP:" -ForegroundColor Yellow
|
|
318
|
+
if (Test-CommandExists "php") {
|
|
319
|
+
$phpVersion = php -v | Select-Object -First 1
|
|
320
|
+
Write-Host " [OK] $phpVersion" -ForegroundColor Green
|
|
321
|
+
} else {
|
|
322
|
+
Write-Host " [X] PHP not found (required: 8.2+)" -ForegroundColor Red
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
# Composer
|
|
326
|
+
Write-Host "Composer:" -ForegroundColor Yellow
|
|
327
|
+
if (Test-CommandExists "composer") {
|
|
328
|
+
$composerVersion = composer --version
|
|
329
|
+
Write-Host " [OK] $composerVersion" -ForegroundColor Green
|
|
330
|
+
} else {
|
|
331
|
+
Write-Host " [X] Composer not found" -ForegroundColor Red
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
# Node.js
|
|
335
|
+
Write-Host "Node.js:" -ForegroundColor Yellow
|
|
336
|
+
if (Test-CommandExists "node") {
|
|
337
|
+
$nodeVersion = node -v
|
|
338
|
+
Write-Host " [OK] Node.js $nodeVersion" -ForegroundColor Green
|
|
339
|
+
} else {
|
|
340
|
+
Write-Host " [X] Node.js not found" -ForegroundColor Red
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
# npm
|
|
344
|
+
Write-Host "npm:" -ForegroundColor Yellow
|
|
345
|
+
if (Test-CommandExists "npm") {
|
|
346
|
+
$npmVersion = npm -v
|
|
347
|
+
Write-Host " [OK] npm $npmVersion" -ForegroundColor Green
|
|
348
|
+
} else {
|
|
349
|
+
Write-Host " [X] npm not found" -ForegroundColor Red
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
# Git
|
|
353
|
+
Write-Host "Git:" -ForegroundColor Yellow
|
|
354
|
+
if (Test-CommandExists "git") {
|
|
355
|
+
$gitVersion = git --version
|
|
356
|
+
Write-Host " [OK] $gitVersion" -ForegroundColor Green
|
|
357
|
+
} else {
|
|
358
|
+
Write-Host " [X] Git not found" -ForegroundColor Red
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
Write-Host ""
|
|
362
|
+
|
|
363
|
+
# Project status
|
|
364
|
+
Write-Host "Project Status:" -ForegroundColor Yellow
|
|
365
|
+
|
|
366
|
+
if (Test-Path ".env") {
|
|
367
|
+
Write-Host " [OK] .env file exists" -ForegroundColor Green
|
|
368
|
+
} else {
|
|
369
|
+
Write-Host " [X] .env file missing" -ForegroundColor Red
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (Test-Path "vendor") {
|
|
373
|
+
Write-Host " [OK] Composer dependencies installed" -ForegroundColor Green
|
|
374
|
+
} else {
|
|
375
|
+
Write-Host " [X] Composer dependencies not installed" -ForegroundColor Red
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (Test-Path "node_modules") {
|
|
379
|
+
Write-Host " [OK] npm dependencies installed" -ForegroundColor Green
|
|
380
|
+
} else {
|
|
381
|
+
Write-Host " [X] npm dependencies not installed" -ForegroundColor Red
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (Test-Path "public/build") {
|
|
385
|
+
Write-Host " [OK] Assets built" -ForegroundColor Green
|
|
386
|
+
} else {
|
|
387
|
+
Write-Host " [X] Assets not built (run: acadex build)" -ForegroundColor Red
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
Write-Host ""
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
"serve" {
|
|
394
|
+
Write-Host "Starting production servers (Laravel + Queue + Scheduler)..." -ForegroundColor Green
|
|
395
|
+
npx concurrently -c "#93c5fd,#c4b5fd,#4ade80" "php artisan serve" "php artisan queue:work --tries=3 --timeout=90" "php artisan schedule:work" --names=server,queue,scheduler
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
"dev" {
|
|
399
|
+
Write-Host "Starting development servers (Laravel + Queue + Logs + Vite + Reverb)..." -ForegroundColor Green
|
|
400
|
+
npx concurrently -c "#93c5fd,#c4b5fd,#fb7185,#fdba74,#fbbf24" "php artisan serve" "php artisan queue:work --tries=3 --timeout=90" "php artisan pail --timeout=0" "npm run dev" "php artisan reverb:start" --names=server,queue,logs,vite,reverb
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
"build" {
|
|
404
|
+
Write-Host "Building assets for production..." -ForegroundColor Green
|
|
405
|
+
npm run build
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
"ui" {
|
|
409
|
+
Write-Host "Rebuilding UI and clearing caches..." -ForegroundColor Green
|
|
410
|
+
Write-Host " -> Building frontend assets..." -ForegroundColor Cyan
|
|
411
|
+
npm run build
|
|
412
|
+
Write-Host " -> Clearing all caches..." -ForegroundColor Cyan
|
|
413
|
+
php artisan optimize:clear
|
|
414
|
+
Write-Host "[OK] UI refreshed! Hard refresh your browser (Ctrl+Shift+R or Cmd+Shift+R)" -ForegroundColor Green
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
"start" {
|
|
418
|
+
Write-Host "Starting Laravel server only..." -ForegroundColor Green
|
|
419
|
+
php artisan serve
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
"test" {
|
|
423
|
+
Write-Host "Running tests..." -ForegroundColor Green
|
|
424
|
+
if ($Arguments) {
|
|
425
|
+
php artisan test @Arguments
|
|
426
|
+
} else {
|
|
427
|
+
php artisan test
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
"test:coverage" {
|
|
432
|
+
Write-Host "Running tests with coverage..." -ForegroundColor Green
|
|
433
|
+
if ($Arguments) {
|
|
434
|
+
php artisan test --coverage @Arguments
|
|
435
|
+
} else {
|
|
436
|
+
php artisan test --coverage
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
"migrate" {
|
|
441
|
+
Write-Host "Running migrations..." -ForegroundColor Green
|
|
442
|
+
if ($Arguments) {
|
|
443
|
+
php artisan migrate @Arguments
|
|
444
|
+
} else {
|
|
445
|
+
php artisan migrate
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
"migrate:fresh" {
|
|
450
|
+
Write-Host "Running fresh migration with seeders..." -ForegroundColor Yellow
|
|
451
|
+
if ($Arguments) {
|
|
452
|
+
php artisan migrate:fresh --seed @Arguments
|
|
453
|
+
} else {
|
|
454
|
+
php artisan migrate:fresh --seed
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
"seed" {
|
|
459
|
+
Write-Host "Running seeders..." -ForegroundColor Green
|
|
460
|
+
if ($Arguments) {
|
|
461
|
+
php artisan db:seed @Arguments
|
|
462
|
+
} else {
|
|
463
|
+
php artisan db:seed
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
"tinker" {
|
|
468
|
+
Write-Host "Starting Tinker..." -ForegroundColor Green
|
|
469
|
+
php artisan tinker
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
"cache:clear" {
|
|
473
|
+
Write-Host "Clearing all caches..." -ForegroundColor Green
|
|
474
|
+
php artisan config:clear
|
|
475
|
+
php artisan cache:clear
|
|
476
|
+
php artisan route:clear
|
|
477
|
+
php artisan view:clear
|
|
478
|
+
Write-Host "All caches cleared!" -ForegroundColor Green
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
"optimize" {
|
|
482
|
+
Write-Host "Optimizing application..." -ForegroundColor Green
|
|
483
|
+
php artisan optimize
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
"logs" {
|
|
487
|
+
Write-Host "Tailing Laravel logs..." -ForegroundColor Green
|
|
488
|
+
Get-Content "storage/logs/laravel.log" -Wait -Tail 50
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
"analyze" {
|
|
492
|
+
Write-Host "Running PHPStan analysis..." -ForegroundColor Green
|
|
493
|
+
if ($Arguments) {
|
|
494
|
+
& ./vendor/bin/phpstan analyse @Arguments
|
|
495
|
+
} else {
|
|
496
|
+
& ./vendor/bin/phpstan analyse
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
"format" {
|
|
501
|
+
Write-Host "Formatting code with Pint..." -ForegroundColor Green
|
|
502
|
+
if ($Arguments) {
|
|
503
|
+
& ./vendor/bin/pint @Arguments
|
|
504
|
+
} else {
|
|
505
|
+
& ./vendor/bin/pint
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
"install" {
|
|
510
|
+
Write-Host "Installing dependencies..." -ForegroundColor Green
|
|
511
|
+
composer install
|
|
512
|
+
npm install
|
|
513
|
+
Write-Host " -> Installing notification features..." -ForegroundColor Cyan
|
|
514
|
+
npm install @alpinejs/intersect --save
|
|
515
|
+
Write-Host "Dependencies installed!" -ForegroundColor Green
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
"update" {
|
|
519
|
+
Write-Host "Updating dependencies..." -ForegroundColor Green
|
|
520
|
+
composer update
|
|
521
|
+
npm update
|
|
522
|
+
Write-Host "Dependencies updated!" -ForegroundColor Green
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
"routes" {
|
|
526
|
+
Write-Host "Listing routes..." -ForegroundColor Green
|
|
527
|
+
if ($Arguments) {
|
|
528
|
+
php artisan route:list @Arguments
|
|
529
|
+
} else {
|
|
530
|
+
php artisan route:list
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
"queue" {
|
|
535
|
+
Write-Host "Starting queue worker..." -ForegroundColor Green
|
|
536
|
+
if ($Arguments) {
|
|
537
|
+
php artisan queue:work @Arguments
|
|
538
|
+
} else {
|
|
539
|
+
php artisan queue:work
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
"schedule" {
|
|
544
|
+
Write-Host "Running scheduled tasks..." -ForegroundColor Green
|
|
545
|
+
php artisan schedule:run
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
"share" {
|
|
549
|
+
Write-Host "Sharing site via Expose..." -ForegroundColor Green
|
|
550
|
+
Write-Host "Public URL will be displayed below" -ForegroundColor Yellow
|
|
551
|
+
Write-Host "Press Ctrl+C to stop sharing" -ForegroundColor Yellow
|
|
552
|
+
Write-Host ""
|
|
553
|
+
expose share http://localhost:8000
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
"phpmyadmin" {
|
|
557
|
+
Write-Host "Starting Apache & opening phpMyAdmin..." -ForegroundColor Green
|
|
558
|
+
# Adjust path for your XAMPP/Laragon installation
|
|
559
|
+
$apachePath = "C:\xampp\apache\bin\httpd.exe"
|
|
560
|
+
if (Test-Path $apachePath) {
|
|
561
|
+
Start-Process $apachePath -WindowStyle Hidden
|
|
562
|
+
Write-Host "[OK] Apache started" -ForegroundColor Green
|
|
563
|
+
Write-Host "Opening http://localhost/phpmyadmin/" -ForegroundColor Yellow
|
|
564
|
+
Start-Process "http://localhost/phpmyadmin/"
|
|
565
|
+
Write-Host ""
|
|
566
|
+
Write-Host "To stop Apache: acadex phpmyadmin:stop" -ForegroundColor Yellow
|
|
567
|
+
} else {
|
|
568
|
+
Write-Host "[X] Apache not found at $apachePath" -ForegroundColor Red
|
|
569
|
+
Write-Host "Please adjust the path in acadex.ps1" -ForegroundColor Yellow
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
"phpmyadmin:stop" {
|
|
574
|
+
Write-Host "Stopping Apache..." -ForegroundColor Green
|
|
575
|
+
Stop-Process -Name "httpd" -Force -ErrorAction SilentlyContinue
|
|
576
|
+
Write-Host "[OK] Apache stopped" -ForegroundColor Green
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
"docs" {
|
|
580
|
+
Write-Host "Opening ACADEX documentation..." -ForegroundColor Green
|
|
581
|
+
Start-Process "https://xaviworks.github.io/AcadexV3/"
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
{ $_ -in @("help", "--help", "-h", "", $null) } {
|
|
585
|
+
Show-Help
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
default {
|
|
589
|
+
Write-Host "Unknown command: $Command" -ForegroundColor Red
|
|
590
|
+
Write-Host ""
|
|
591
|
+
Show-Help
|
|
592
|
+
exit 1
|
|
593
|
+
}
|
|
594
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acadex-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A global CLI tool for managing Acadex projects with easy setup and automation",
|
|
5
|
+
"main": "acadex",
|
|
6
|
+
"bin": {
|
|
7
|
+
"acadex": "./acadex"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"acadex",
|
|
14
|
+
"cli",
|
|
15
|
+
"laravel",
|
|
16
|
+
"automation",
|
|
17
|
+
"development"
|
|
18
|
+
],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": ""
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=14.0.0"
|
|
27
|
+
},
|
|
28
|
+
"preferGlobal": true,
|
|
29
|
+
"os": [
|
|
30
|
+
"darwin",
|
|
31
|
+
"linux",
|
|
32
|
+
"win32"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
|