chore: SDA-1623: switch NodeJs dynamically during build (#830)

* SDA-1623: support building using dynamic node versions

* SDA-1623: remove sourcing profile files

* SDA-1623: updated windows batch files for dynamic node version switching

* SDA-1623: add gulp installation on demand

* SDA-1623: fix formatting in package.json
This commit is contained in:
Vishwas Shashidhar
2019-12-12 17:33:37 +05:30
committed by GitHub
parent 0ccf690ba6
commit 13ca322a66
4 changed files with 82 additions and 13 deletions
+15 -2
View File
@@ -5,6 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd
echo %PATH%
set DISABLE_REBUILD=true
set NODE_REQUIRED_VERSION=12.13.1
set PATH=%PATH%;C:\Program Files\nodejs\;C:\Program Files\Git\cmd
echo %PATH%
@@ -18,6 +19,15 @@ if %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)
WHERE nvm
if %ERRORLEVEL% NEQ 0 (
echo "NVM does not exist. Please set it up before running this script."
EXIT /B 1
)
nvm install %NODE_REQUIRED_VERSION%
nvm use %NODE_REQUIRED_VERSION%
WHERE node
if %ERRORLEVEL% NEQ 0 (
echo "NODE does not exist. Please set it up before running this script."
@@ -30,12 +40,17 @@ if %ERRORLEVEL% NEQ 0 (
EXIT /B 1
)
call npm i -g gulp-cli
WHERE gulp
if %ERRORLEVEL% NEQ 0 (
echo "GULP does not exist. Please set it up before running this script."
EXIT /B 1
)
echo "Node version is: "
call node --version
:: Below command replaces buildVersion with the appropriate build number from jenkins
sed -i -e "s/\"buildNumber\"[[:space:]]*\:[[:space:]]*\".*\"/\"buildNumber\":\"%PARENT_BUILD_VERSION%\"/g" package.json
@@ -46,8 +61,6 @@ echo D | xcopy /y "C:\jenkins\workspace\tronlibraries\library" "library"
echo "Running npm install..."
call npm install
call npm i -g gulp-cli
:: Set expiry if required
IF "%EXPIRY_PERIOD%"=="" (
echo "Not setting expiry for the build!"