-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall_packages.bat
More file actions
122 lines (108 loc) · 2.99 KB
/
install_packages.bat
File metadata and controls
122 lines (108 loc) · 2.99 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
@echo off
setlocal enabledelayedexpansion
title ATLAS Backend Setup
color 0A
echo ========================================
echo ATLAS Backend - First Time Setup
echo ========================================
echo.
REM Check if Bun is installed
echo [1/3] Checking for Bun installation...
where bun >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] Bun is already installed!
for /f "tokens=*" %%i in ('bun --version 2^>nul') do set BUN_VERSION=%%i
echo [OK] Bun version: !BUN_VERSION!
goto :install_deps
)
echo [!] Bun is not installed.
echo.
echo Bun is required to run ATLAS Backend. Would you like to install it now?
echo.
echo Options:
echo 1. Install Bun automatically (Recommended)
echo 2. Open Bun website to install manually
echo 3. Exit setup
echo.
set /p choice="Enter your choice (1-3): "
if "%choice%"=="1" goto :auto_install
if "%choice%"=="2" goto :manual_install
if "%choice%"=="3" goto :exit
echo Invalid choice. Exiting...
goto :exit
:auto_install
echo.
echo [*] Downloading and installing Bun...
echo [*] This may take a moment...
powershell -Command "& {irm bun.sh/install.ps1 | iex}"
if %errorlevel% neq 0 (
echo [ERROR] Failed to install Bun automatically.
echo [*] Please visit https://bun.sh to install manually.
pause
goto :exit
)
REM Refresh environment variables
echo [*] Refreshing environment...
for /f "tokens=2*" %%a in ('reg query "HKCU\Environment" /v Path 2^>nul') do set "USER_PATH=%%b"
set "PATH=%USER_PATH%;%PATH%"
REM Check if Bun is now available
where bun >nul 2>&1
if %errorlevel% neq 0 (
echo [!] Bun was installed but not found in PATH.
echo [*] Please restart your terminal and run this script again.
pause
goto :exit
)
echo [OK] Bun installed successfully!
for /f "tokens=*" %%i in ('bun --version 2^>nul') do set BUN_VERSION=%%i
echo [OK] Bun version: !BUN_VERSION!
goto :install_deps
:manual_install
echo.
echo [*] Opening Bun installation page...
start https://bun.sh/docs/installation
echo.
echo Please install Bun and run this setup script again.
pause
goto :exit
:install_deps
echo.
echo [2/3] Installing project dependencies...
bun install
if %errorlevel% neq 0 (
echo [ERROR] Failed to install dependencies.
echo [*] Please check your internet connection and try again.
pause
goto :exit
)
echo [OK] Dependencies installed successfully!
:verify
echo.
echo [3/3] Verifying installation...
if not exist "node_modules\" (
echo [ERROR] node_modules folder not found.
echo [*] Dependencies may not have been installed correctly.
pause
goto :exit
)
if not exist "src\index.ts" (
echo [ERROR] Main application file not found.
echo [*] Project structure may be incomplete.
pause
goto :exit
)
echo [OK] Installation verified!
echo.
echo ========================================
echo Setup Complete!
echo ========================================
echo.
echo To start ATLAS Backend, run: start.bat
echo.
echo For support, join the Discord:
echo https://discord.gg/GqgakxU6bm
echo.
pause
goto :exit
:exit
endlocal