-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.bat
More file actions
65 lines (56 loc) · 1.89 KB
/
Copy pathdebug.bat
File metadata and controls
65 lines (56 loc) · 1.89 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
@echo off
setlocal
echo =========================================
echo Cococopi Site - Debug Runner
echo =========================================
echo.
:: Kill any lingering local servers that might be locking the dist/ folder
echo [0/3] Cleaning up lingering local servers...
powershell -Command "Stop-Process -Name 'python', 'node' -Force -ErrorAction SilentlyContinue"
echo.
:: Add Git's bin and usr\bin to PATH so that Unix utilities like 'bash' and 'mkdir' (used by Corros) are available.
if exist "C:\Program Files\Git\bin" (
set "PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin"
)
echo [1/3] Building the Corros site...
corros site.cro
if %errorlevel% neq 0 (
echo.
echo [ERROR] Build failed!
echo If 'corros' is installed globally, the build might be failing because Unix commands like 'mkdir' are not found.
echo Ensure Git Bash is installed in the default location.
pause
exit /b %errorlevel%
)
echo.
echo [2/3] Running tests...
bash tests/run.sh
if %errorlevel% neq 0 (
echo.
echo [ERROR] Tests failed! Ensure you have bash like Git Bash installed on Windows.
pause
exit /b %errorlevel%
)
echo.
echo [3/3] Starting local server at http://localhost:8000...
:: Open the default web browser to the local server
start http://localhost:8000
:: Attempt to use Python to serve the site
python --version >nul 2>&1
if %errorlevel% equ 0 (
echo Using Python http.server - with clean URL support...
python tests/server.py
exit /b 0
)
:: Attempt to use npx (Node.js) if Python isn't available
npx --version >nul 2>&1
if %errorlevel% equ 0 (
echo Using Node.js via npx serve...
npx serve dist -p 8000
exit /b 0
)
echo.
echo [WARNING] Neither Python nor Node.js was found.
echo The site is built in the 'dist' folder, but no local server could be started automatically.
echo Please manually serve the 'dist' folder to view the site.
pause