-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.bat
More file actions
75 lines (64 loc) · 1.72 KB
/
Copy pathdev.bat
File metadata and controls
75 lines (64 loc) · 1.72 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
@echo off
setlocal
cd /d "%~dp0"
set "CHECK_ONLY=0"
set "WAILS_ARGS="
:parse_args
if "%~1"=="" goto args_done
if /I "%~1"=="-CheckOnly" (
set "CHECK_ONLY=1"
) else (
set "WAILS_ARGS=%WAILS_ARGS% %~1"
)
shift
goto parse_args
:args_done
call go version >nul 2>&1 || (
echo [ERROR] Missing go. Install Go 1.26+ and ensure it is on PATH.
exit /b 1
)
where fnm >nul 2>&1 && (
echo [STEP] fnm use --install-if-missing
FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z
call fnm use --install-if-missing || exit /b 1
)
call node -v >nul 2>&1 || (
echo [ERROR] Missing node. Install Node.js 22 and ensure it is on PATH.
exit /b 1
)
for /f "usebackq delims=" %%v in (`node -v`) do set "NODE_VERSION=%%v"
for /f "tokens=1 delims=." %%m in ("%NODE_VERSION:v=%") do set "NODE_MAJOR=%%m"
if not "%NODE_MAJOR%"=="22" (
echo [ERROR] Node.js 22 is required for this project. Current version: %NODE_VERSION%
echo Hint: install fnm and keep the repo-level .node-version file.
exit /b 1
)
call npm -v >nul 2>&1 || (
echo [ERROR] Missing npm. Install Node.js 22+ and ensure it is on PATH.
exit /b 1
)
if not exist "frontend\node_modules" (
echo [STEP] npm install
pushd "frontend"
call npm install || (
popd
exit /b 1
)
popd
) else (
echo [STEP] frontend dependencies already present
)
if "%CHECK_ONLY%"=="1" (
echo [STEP] dev checks complete
exit /b 0
)
call wails version >nul 2>&1 || (
echo [ERROR] Missing wails. Install with:
echo go install github.com/wailsapp/wails/v2/cmd/wails@latest
exit /b 1
)
echo [STEP] wails dev -s%WAILS_ARGS%
echo [STEP] frontend changes: Vite HMR
echo [STEP] backend Go changes: Wails rebuild and relaunch
call wails dev -s%WAILS_ARGS%
exit /b %ERRORLEVEL%