-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsetup.bat
More file actions
66 lines (59 loc) · 1.81 KB
/
setup.bat
File metadata and controls
66 lines (59 loc) · 1.81 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
@echo off
echo Setting up React E-Commerce Application...
echo.
echo [1/5] Installing backend dependencies...
call npm install
if %ERRORLEVEL% NEQ 0 (
echo Error installing backend dependencies!
pause
exit /b 1
)
echo [2/5] Installing frontend dependencies...
call npm install --prefix frontend
if %ERRORLEVEL% NEQ 0 (
echo Error installing frontend dependencies!
pause
exit /b 1
)
echo [3/5] Creating environment files...
if not exist ".env" (
echo Creating root .env file...
echo NODE_ENV=development > .env
echo PORT=8000 >> .env
echo MONGO_URI=mongodb://localhost:27017/react-ecommerce >> .env
echo JWT_SECRET=abc123 >> .env
echo PAYPAL_CLIENT_ID=your_paypal_client_id_here >> .env
)
if not exist "backend\.env" (
echo Creating backend .env file...
echo NODE_ENV=development > backend\.env
echo PORT=8000 >> backend\.env
echo MONGO_URI=mongodb://localhost:27017/react-ecommerce >> backend\.env
echo JWT_SECRET=abc123 >> backend\.env
echo PAYPAL_CLIENT_ID=your_paypal_client_id_here >> backend\.env
)
if not exist "frontend\.env" (
echo Creating frontend .env file...
echo SKIP_PREFLIGHT_CHECK=true > frontend\.env
echo NODE_OPTIONS=--openssl-legacy-provider >> frontend\.env
echo GENERATE_SOURCEMAP=false >> frontend\.env
)
echo [4/5] Setting up database with sample data...
call npm run data:import
if %ERRORLEVEL% NEQ 0 (
echo Error importing sample data!
pause
exit /b 1
)
echo [5/5] Setup complete!
echo.
echo ========================================
echo Setup Complete!
echo ========================================
echo You can now run from any directory:
echo - Root: npm run dev
echo - Backend: cd backend && nodemon server.js
echo - Frontend: cd frontend && npm start
echo ========================================
echo.
pause