-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
119 lines (105 loc) · 2.39 KB
/
install.bat
File metadata and controls
119 lines (105 loc) · 2.39 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
@echo off
REM Standards Tracker Installation Script
REM For Windows
echo ==========================================
echo Standards Tracker Installer
echo ==========================================
echo.
REM Get the directory where this script is located
set INSTALL_DIR=%~dp0
cd /d "%INSTALL_DIR%"
echo Installation directory: %INSTALL_DIR%
echo.
REM Check for Node.js
where node >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo ERROR: Node.js is not installed.
echo Please install Node.js 18 or later from https://nodejs.org/
pause
exit /b 1
)
for /f "tokens=1,2,3 delims=." %%a in ('node -v') do (
set NODE_MAJOR=%%a
)
set NODE_MAJOR=%NODE_MAJOR:v=%
if %NODE_MAJOR% LSS 18 (
echo ERROR: Node.js version 18 or later is required.
node -v
pause
exit /b 1
)
echo Node.js version:
node -v
echo.
REM Install dependencies
echo Installing server dependencies...
call npm install
if %ERRORLEVEL% neq 0 (
echo ERROR: Failed to install server dependencies
pause
exit /b 1
)
echo.
echo Installing client dependencies...
cd client
call npm install
cd ..
if %ERRORLEVEL% neq 0 (
echo ERROR: Failed to install client dependencies
pause
exit /b 1
)
REM Create .env file if it doesn't exist
if not exist .env (
echo.
echo Creating .env file from template...
copy .env.example .env
echo.
echo IMPORTANT: Please edit .env and set a secure JWT_SECRET!
echo The default value must be changed before running in production.
echo.
)
REM Initialize database
echo.
echo Setting up database...
call npm run setup:db
if %ERRORLEVEL% neq 0 (
echo ERROR: Failed to set up database
pause
exit /b 1
)
REM Ask about demo data
echo.
set /p DEMO_DATA="Would you like to add demo data? (y/N): "
if /i "%DEMO_DATA%"=="y" (
echo Seeding demo data...
call npm run seed:demo
)
REM Build client
echo.
echo Building client...
call npm run build:client
if %ERRORLEVEL% neq 0 (
echo ERROR: Failed to build client
pause
exit /b 1
)
echo.
echo ==========================================
echo Installation Complete!
echo ==========================================
echo.
echo To start the server:
echo npm start
echo.
echo To run in development mode:
echo npm run dev
echo.
echo To run as Electron app:
echo npm run electron:dev
echo.
echo Access the application at: http://localhost:3000
echo.
echo REMINDER: Edit .env and set a secure JWT_SECRET!
echo.
pause