Skip to content

Instantly share code, notes, and snippets.

@Richard-West
Created May 6, 2014 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Richard-West/2fa5a8728ee4a52da674 to your computer and use it in GitHub Desktop.
Save Richard-West/2fa5a8728ee4a52da674 to your computer and use it in GitHub Desktop.
Deployment section from a customer Azure deploy.cmd
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
:Deployment
echo Handling node.js deployment.
:: 2. Select node version
call :SelectNodeVersion
:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd !NPM_CMD! install --production
IF !ERRORLEVEL! NEQ 0 goto error
popd
)
:: 4. Build DocPad Site
echo Building the DocPad site
pushd %DEPLOYMENT_TARGET%
call %DEPLOYMENT_TARGET%\node_modules\.bin\docpad.cmd generate
IF !ERRORLEVEL! NEQ 0 goto error
:: 1. KuduSync
echo KuduSync executing
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
)
@amitapl
Copy link

amitapl commented May 6, 2014

The problem here is that you still do the npm installl on the target path, to make this work you need to run npm on the source (or possibly a third intermediate directory) and then kudu sync it to the target.

psuedo code:

copy %source%  to %some_temp%
cd %some_temp%
npm install
docpad generate
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%some_temp%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment