forked from tealios/errata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-dev.bat
More file actions
57 lines (48 loc) · 1.42 KB
/
Copy pathsetup-dev.bat
File metadata and controls
57 lines (48 loc) · 1.42 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
@echo off
setlocal enabledelayedexpansion
echo [1/4] Checking for Bun...
where bun >nul 2>nul
if %errorlevel% neq 0 (
echo Bun was not found on PATH.
echo [2/4] Installing Bun with winget...
where winget >nul 2>nul
if %errorlevel% neq 0 (
echo ERROR: winget is not available on this machine.
echo Please install Bun manually from https://bun.sh and run this script again.
exit /b 1
)
winget install --id Oven-sh.Bun -e --source winget --accept-package-agreements --accept-source-agreements
if %errorlevel% neq 0 (
echo ERROR: Bun installation failed.
exit /b 1
)
rem Try common Bun install locations in case PATH is not refreshed yet.
if exist "%USERPROFILE%\.bun\bin\bun.exe" set "PATH=%USERPROFILE%\.bun\bin;%PATH%"
if exist "%ProgramFiles%\Bun\bin\bun.exe" set "PATH=%ProgramFiles%\Bun\bin;%PATH%"
where bun >nul 2>nul
if %errorlevel% neq 0 (
echo ERROR: Bun installed, but this shell cannot find it yet.
echo Open a new terminal and run setup-dev.bat again.
exit /b 1
)
) else (
echo Bun is already installed.
)
where git >nul 2>nul
if %errorlevel% equ 0 (
if exist ".git" (
set /p PULL="Pull latest changes from git? [Y/n] "
if /i "!PULL!" neq "n" (
git pull --ff-only
)
)
)
echo [3/4] Installing dependencies...
bun install
if %errorlevel% neq 0 (
echo ERROR: bun install failed.
exit /b 1
)
echo [4/4] Starting dev server...
bun run dev
endlocal