Files
OurUmbraco/build/BuildClientFiles.bat
T

54 lines
1.8 KiB
Batchfile
Raw Normal View History

@ECHO OFF
SETLOCAL
:: SETLOCAL is on, so changes to the path not persist to the actual user's path
SET release=%1
2016-09-18 12:12:52 +02:00
SET toolsFolder=%CD%\tools\
ECHO Current folder: %CD%
2016-09-18 12:12:52 +02:00
SET nodeFileName=node-v4.5.0-win-x86.7z
SET nodeExtractFolder=%toolsFolder%node.js.450
IF NOT EXIST %nodeExtractFolder% (
ECHO Downloading node.js
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://nodejs.org/dist/v4.5.0/%nodeFileName%', '%toolsFolder%\%nodeFileName%')"
ECHO Extracting node.js
%toolsFolder%\7za.exe x %toolsFolder%\%nodeFileName% -o%nodeExtractFolder% -aos > nul
)
FOR /f "delims=" %%A in ('dir %nodeExtractFolder%\node* /b') DO SET "nodePath=%nodeExtractFolder%\%%A"
2016-09-18 12:12:52 +02:00
SET nuGetFolder=%CD%\..\packages\
FOR /f "delims=" %%A in ('dir %nuGetFolder%npm.js.* /b') DO SET "npmPath=%nuGetFolder%%%A\tools\"
2016-09-18 12:44:10 +02:00
IF [%npmPath%] == [] GOTO :installnpm
IF NOT [%npmPath%] == [] GOTO :build
:installnpm
2016-09-18 12:12:52 +02:00
ECHO Downloading npm
ECHO Configured packages folder: %nuGetFolder%
ECHO Installing Npm NuGet Package
%CD%\..\.nuget\NuGet.exe install Npm.js -OutputDirectory %nuGetFolder% -Verbosity quiet
2016-09-18 12:44:10 +02:00
REM Ensures that we look for the just downloaded NPM, not whatever the user has installed on their machine
2016-09-18 12:12:52 +02:00
FOR /f "delims=" %%A in ('dir %nuGetFolder%npm.js.* /b') DO SET "npmPath=%nuGetFolder%%%A\tools\"
2016-09-18 12:44:10 +02:00
GOTO :build
2016-09-18 12:44:10 +02:00
:build
PATH=%npmPath%;%nodePath%
SET buildFolder=%CD%
2016-09-18 12:44:10 +02:00
ECHO Change directory to %CD%\..\OurUmbraco.Client\
CD %CD%\..\OurUmbraco.Client\
ECHO.
ECHO Setting node_modules folder to hidden to prevent VS13 from crashing on it while loading the websites project
attrib +h node_modules
2016-09-18 12:44:10 +02:00
ECHO Do npm install and the gulp build
SET npm="%nodePath%\node.exe" "%npmPath%node_modules\npm\bin\npm-cli.js" %*
%npm% cache clean
%npm% install
%npm% install -g install gulp -g
gulp build
2016-09-18 12:44:10 +02:00
ECHO Move back to the build folder
CD %buildFolder%
GOTO :EOF