forked from mouseless/baked
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.cmd
More file actions
136 lines (118 loc) · 2.5 KB
/
make.cmd
File metadata and controls
136 lines (118 loc) · 2.5 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@REM Generated By GPT
@echo off
setlocal enabledelayedexpansion
title Project Runner
if "%1"=="" (
echo Usage: %0 ^<command^>
echo.
echo Available commands: run, format, build, test, coverage, install
echo Test options: %0 test, %0 test backend, %0 test frontend
exit /b 1
)
set CMD=%1
set SUBCMD=%2
if /i "%CMD%"=="format" goto format
if /i "%CMD%"=="install" goto install
if /i "%CMD%"=="build" goto build
if /i "%CMD%"=="test" goto test
if /i "%CMD%"=="coverage" goto coverage
if /i "%CMD%"=="run" goto run
echo Invalid command: %CMD%
exit /b 1
:format
echo Formatting code...
cd core
dotnet format --verbosity normal
cd ..
cd ui
npm run lint -- --fix
cd ..
cd docs\.theme
npm run lint -- --fix
cd ..\..
goto end
:install
echo Installing dependencies...
cd docs\.theme
call npm i
cd ..\..
cd ui
call npm i
cd ..
cd core\test\Baked.Test.Load
call npm i
cd ..\..\..
goto end
:build
echo Building projects...
cd core
dotnet build -v d /p:GenerateArgs="--warn-for-missing-component"
cd ..
cd ui
npm run build
cd ..
goto end
:test
echo Running tests...
if /i "%SUBCMD%"=="backend" goto test_backend
if /i "%SUBCMD%"=="frontend" goto test_frontend
call :test_backend
if errorlevel 1 goto end
call :test_frontend
goto end
:test_backend
echo Running backend tests...
cd core
dotnet test --output Detailed
set TEST_EXIT=%ERRORLEVEL%
cd ..
exit /b %TEST_EXIT%
:test_frontend
echo Running frontend tests...
cd ui
set BUILD_SILENT=1
call npm test
set TEST_EXIT=%ERRORLEVEL%
cd ..
exit /b %TEST_EXIT%
:coverage
echo Generating coverage report...
cd core
if exist .coverage rmdir /s /q .coverage
dotnet test -c Release --coverage --coverage-output-format cobertura --coverage-settings .\test\runsettings.xml --report-trx --results-directory .coverage
dotnet reportgenerator -reports:.coverage\*.cobertura.xml -targetdir:.coverage\html
start .coverage\html\index.html
cd ..
goto end
:run
echo (1) API (Development)
echo (2) UI (Development)
echo (3) Docker (Production)
echo (4) Docs
set /p choice="Please select 1-4: "
if "%choice%"=="1" goto api
if "%choice%"=="2" goto ui
if "%choice%"=="3" goto docker
if "%choice%"=="4" goto docs
:api
echo Running API (Development)...
dotnet run --project core\playground\Baked.Playground.Application /p:GenerateArgs="--warn-for-missing-component"
goto end
:ui
echo Starting Playground (Development)...
cd ui
npm run dev
cd ..
goto end
:docker
echo Running Docker (Production)...
docker compose up --build
goto end
:docs
echo Running Docs...
cd docs
make run
cd ..
goto end
:end
echo Done.