Is there a way to run the TypeScript compiler as part of the Azure Git Deploy Is there a way to run the TypeScript compiler as part of the Azure Git Deploy typescript typescript

Is there a way to run the TypeScript compiler as part of the Azure Git Deploy


Yes, you can run arbitrary logic using a custom deployment script. You'll need to either include the tools you need in your repo, or preferably download them as needed (to avoid commiting binaries).


For now you can generate a custom deployment script custom deployment script

Then edit the npm command to use the newer node.exe version (0.8.2) with the following command:

call "D:\Program Files (x86)\nodejs\0.8.2\node.exe" "D:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" install --production


Just in case somebody else is looking, this is what I needed to do to get this working.

First, I make sure that TypeScript is installed where the Kudu build server can reach it, by adding these lines somewhere towards the top of my deploy.cmd file:

call npm install typescriptIF %ERRORLEVEL% NEQ 0 (  echo Unable to install TypeScript  goto error)

This places the Node-callable version of TypeScript in .\node_modules\.bin\tsc.cmd.

The batch file that actually performs the build (callable in various ways, but primarily as a post-build event) looks like this:

@echo offif (%1%=="") goto settsccd %1%:settscif exist ".\node_modules\.bin\tsc.cmd" (    set tsc=call ".\node_modules\.bin\tsc.cmd"    goto build)if exist "%ProgramFiles(x86)%\Microsoft Sdks\Typescript\0.9\tsc.exe" (    set tsc="%ProgramFiles(x86)%\Microsoft Sdks\Typescript\0.9\tsc.exe"    goto build)if exist "%ProgramFiles%\Microsoft Sdks\Typescript\0.9\tsc.exe" (    set tsc="%ProgramFiles%\Microsoft Sdks\Typescript\0.9\tsc.exe"      goto build)echo TypeScript compiler not foundexit 999:buildecho Building TypeScript: Payboard.Site.js (using %tsc%)%tsc% --sourcemap --out Scripts\Payboard\Payboard.Site.js @tsbuild_Site.txtecho Building TypeScript: Payboard Widget (using %tsc%)%tsc% --sourcemap --out Widget\v1.0\Payboard.js @tsbuild_Widget_v10.txtecho Building TypeScript: App\Payboard.App.js (using %tsc%)%tsc% --sourcemap --out App\Payboard.App.js @tsbuild_App.txt

Hope this helps someone else out.