Skip to content

Commit d4fc899

Browse files
authored
Merge pull request #615 from contentstack/feature/win-merge
Feature/win merge
2 parents bf808d6 + 1d087d7 commit d4fc899

File tree

4 files changed

+78
-2
lines changed

4 files changed

+78
-2
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"description": "",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
7-
"postinstall": "(cd ./api && npm install) ; (cd ./ui && npm install) ; (cd ./upload-api && npm install)",
87
"env": "npm start",
98
"api": "cd ./api && npm run dev",
109
"upload": "cd ./upload-api && npm run dev",
@@ -44,4 +43,4 @@
4443
"dependencies": {
4544
"@contentstack/cli-utilities": "^1.8.4"
4645
}
47-
}
46+
}

setup-continue.bat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo off
2+
SET SCRIPT_DIR=%~dp0
3+
CD /D "%SCRIPT_DIR%"
4+
5+
echo Using Node version:
6+
node -v
7+
8+
call npm run setup:file
9+
call npm run create:env
10+
11+
start "API" cmd /k "cd /d %SCRIPT_DIR%\api && npm install && npm run windev"
12+
start "Upload API" cmd /k "cd /d %SCRIPT_DIR%\upload-api && npm install && npm run start"
13+
start "UI" cmd /k "cd /d %SCRIPT_DIR%\ui && npm install && npm run start"
14+
15+
echo All services started!

setup-nvm.bat

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@echo off
2+
SETLOCAL
3+
4+
echo Checking if NVM is already installed...
5+
6+
where nvm >nul 2>nul
7+
IF %ERRORLEVEL% EQU 0 (
8+
echo NVM is already installed. Skipping installation.
9+
goto run_setup
10+
)
11+
12+
echo NVM not found. Checking for winget...
13+
14+
where winget >nul 2>nul
15+
IF %ERRORLEVEL% EQU 0 (
16+
echo Installing NVM using winget...
17+
winget install -e --id CoreyButler.NVMforWindows
18+
goto check_nvm
19+
)
20+
21+
echo winget not found. Installing NVM manually...
22+
SET NVM_URL=https://github.com/coreybutler/nvm-windows/releases/latest/download/nvm-setup.exe
23+
SET NVM_INSTALLER=%TEMP%\nvm-setup.exe
24+
25+
IF EXIST "%NVM_INSTALLER%" DEL /F /Q "%NVM_INSTALLER%"
26+
27+
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%NVM_URL%' -OutFile '%NVM_INSTALLER%'"
28+
29+
IF EXIST "%NVM_INSTALLER%" (
30+
echo Running NVM installer...
31+
start /wait "" "%NVM_INSTALLER%"
32+
) ELSE (
33+
echo Failed to download NVM installer.
34+
pause
35+
exit /b 1
36+
)
37+
38+
:check_nvm
39+
echo Verifying NVM installation...
40+
41+
where nvm >nul 2>nul
42+
IF %ERRORLEVEL% NEQ 0 (
43+
echo NVM installation failed or not detected in PATH.
44+
echo Please restart your terminal and try again, or install manually:
45+
echo https://github.com/coreybutler/nvm-windows
46+
pause
47+
exit /b 1
48+
)
49+
50+
:run_setup
51+
echo NVM is ready. Running setup.bat...
52+
call setup.bat

setup.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SETLOCAL ENABLEDELAYEDEXPANSION
2+
3+
SET SCRIPT_DIR=%~dp0
4+
CD /D "%SCRIPT_DIR%"
5+
6+
call nvm install 21
7+
call nvm use 21
8+
9+
REM Call second script in a new process to reload env
10+
start "" cmd /k "%SCRIPT_DIR%setup-continue.bat"

0 commit comments

Comments
 (0)