chahuadev-framework-en / build-desktop.bat
chahuadev
Update README
857cdcf
Raw
History Blame Contribute Delete
5.11 kB
@echo off
chcp 65001 > nul
title Chahuadev Framework -- Desktop Builder
setlocal enabledelayedexpansion
set "PROJECT_DIR=%~dp0"
cd /d "%PROJECT_DIR%"
echo.
echo ================================================================
echo Chahuadev Framework -- Desktop Builder v1.0.0
echo ================================================================
echo.
echo Project : %PROJECT_DIR%
echo.
:menu
echo Build options:
echo.
echo [1] Windows NSIS + Portable (build-win)
echo [2] Windows NSIS Installer only
echo [3] Windows Portable only
echo [4] Windows MSI Installer only
echo [5] Linux AppImage via WSL
echo [6] Build exe + AppImage
echo [7] Clean Delete dist folder
echo [8] Status View build output
echo [9] Exit
echo.
set /p "choice= > "
if "%choice%"=="1" goto build_win
if "%choice%"=="2" goto build_nsis
if "%choice%"=="3" goto build_portable
if "%choice%"=="4" goto build_msi
if "%choice%"=="5" goto build_linux
if "%choice%"=="6" goto build_all
if "%choice%"=="7" goto clean_dist
if "%choice%"=="8" goto show_status
if "%choice%"=="9" goto done
echo.
echo [ERROR] Invalid choice. Try again.
timeout /t 1 >nul
goto menu
REM ----------------------------------------------------------------
:build_win
echo.
echo [BUILD] Windows -- NSIS + Portable...
echo.
call npm run build-win
if %errorlevel% neq 0 (
echo.
echo [FAILED] Windows build failed.
pause
goto menu
)
echo.
echo [OK] Windows build complete.
goto show_results
REM ----------------------------------------------------------------
:build_nsis
echo.
echo [BUILD] Windows -- NSIS Installer...
echo.
call npm run build-nsis
if %errorlevel% neq 0 (
echo.
echo [FAILED] NSIS build failed.
pause
goto menu
)
echo.
echo [OK] NSIS build complete.
goto show_results
REM ----------------------------------------------------------------
:build_portable
echo.
echo [BUILD] Windows -- Portable...
echo.
call npm run build-exe
if %errorlevel% neq 0 (
echo.
echo [FAILED] Portable build failed.
pause
goto menu
)
echo.
echo [OK] Portable build complete.
goto show_results
REM ----------------------------------------------------------------
:build_msi
echo.
echo [BUILD] Windows -- MSI Installer...
echo.
call npm run build-msi
if %errorlevel% neq 0 (
echo.
echo [FAILED] MSI build failed.
pause
goto menu
)
echo.
echo [OK] MSI build complete.
goto show_results
REM ----------------------------------------------------------------
:build_linux
echo.
echo [BUILD] Linux -- AppImage via WSL...
echo.
call npm run build:linux:wsl
if %errorlevel% neq 0 (
echo.
echo [FAILED] Linux build failed.
echo Make sure WSL and Node.js are installed inside WSL.
pause
goto menu
)
echo.
echo [OK] Linux build complete.
goto show_results
REM ----------------------------------------------------------------
:build_all
echo.
echo [!] Make sure Chahuadev Framework app is fully closed before building.
echo (app.asar will be locked if the app is running)
echo.
set /p "confirm= Continue? (y/n): "
if /i not "%confirm%"=="y" goto menu
echo.
echo [BUILD] exe + AppImage...
echo.
echo [1/2] Windows Portable (.exe)...
call npm run build-exe
if %errorlevel% neq 0 (
echo [FAILED] exe build failed.
pause
goto menu
)
echo [OK] exe done.
echo.
echo [2/2] Linux AppImage via WSL...
call npm run build:linux:wsl
if %errorlevel% neq 0 (
echo [FAILED] AppImage build failed.
echo Make sure WSL and Node.js are installed inside WSL.
pause
goto menu
)
echo [OK] AppImage done.
echo.
echo [OK] exe + AppImage builds complete.
goto show_results
REM ----------------------------------------------------------------
:clean_dist
echo.
if exist "dist" (
echo [INFO] Deleting dist\...
rmdir /s /q "dist"
echo [OK] Done.
) else (
echo [INFO] No dist folder found.
)
echo.
pause
goto menu
REM ----------------------------------------------------------------
:show_status
echo.
echo [STATUS] Files in dist\:
echo.
if exist "dist" (
for %%f in ("dist\*.exe" "dist\*.msi" "dist\*.AppImage") do echo %%~nxf
for /d %%d in ("dist\*") do (
for %%f in ("%%d\*.exe" "%%d\*.msi" "%%d\*.AppImage") do echo %%~nxf
)
) else (
echo [INFO] No dist folder. Run a build first.
)
echo.
pause
goto menu
REM ----------------------------------------------------------------
:show_results
echo.
echo ================================================================
echo Build Results
echo ================================================================
echo.
if exist "dist" (
for %%f in ("dist\*.exe" "dist\*.msi" "dist\*.AppImage") do echo %%~nxf
for /d %%d in ("dist\*") do (
for %%f in ("%%d\*.exe" "%%d\*.msi" "%%d\*.AppImage") do echo %%~nxf
)
echo.
set /p "open_dist= Open dist folder? (y/n): "
if /i "!open_dist!"=="y" start "" "%PROJECT_DIR%dist"
) else (
echo [INFO] No dist folder found.
)
echo.
pause
goto menu
REM ----------------------------------------------------------------
:done
echo.
echo Goodbye.
echo.
endlocal
exit /b 0