-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-preview.bat
More file actions
100 lines (86 loc) · 1.85 KB
/
Copy pathstart-preview.bat
File metadata and controls
100 lines (86 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@echo off
setlocal
chcp 65001 >nul
echo === Personal Navigation Preview Script ===
echo.
REM Check PHP
php --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] PHP not found.
pause
exit /b 1
)
REM Check PHP Extensions
php -m | findstr /i "pdo_mysql" >nul
if errorlevel 1 (
echo [ERROR] PHP extension 'pdo_mysql' not found. Please enable it in php.ini.
pause
exit /b 1
)
REM Check Node.js
node --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Node.js not found.
pause
exit /b 1
)
REM Check Composer
call composer --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Composer not found.
pause
exit /b 1
)
echo [INFO] Environment check passed.
echo.
REM Check dependencies
if not exist "vendor" (
echo [INFO] Installing PHP dependencies...
call composer install
if errorlevel 1 (
echo [ERROR] Composer install failed.
pause
exit /b 1
)
)
if not exist "node_modules" (
echo [INFO] Installing frontend dependencies...
call npm install
if errorlevel 1 (
echo [ERROR] npm install failed.
pause
exit /b 1
)
)
REM Check .env
if not exist ".env" (
echo [INFO] Creating environment configuration...
copy .env.example .env
echo [INFO] Please configure database in .env file.
)
REM Build frontend
echo [INFO] Building frontend assets...
call npm run build
if errorlevel 1 (
echo [ERROR] Build failed.
pause
exit /b 1
)
REM Start server
echo.
echo [INFO] Starting preview server...
echo URL: http://127.0.0.1:8100
echo Admin: http://127.0.0.1:8100/admin
echo Credentials: See .env file (Default: admin / admin123)
echo.
echo First run? Make sure to run: php scripts/setup_db.php
echo.
echo Press Ctrl+C to stop server.
echo.
php -S 127.0.0.1:8100 -t public
if errorlevel 1 (
echo [ERROR] Server exited unexpectedly.
pause
)
pause
endlocal