Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include TypeScript files in azure git deploy

I'm trying to include TypeScript files in my automatic git deploy so I can showcase code for a framework I'm building. However, whenever I deploy to azurewebsites the deployments do not include the TypeScript files.

Site in question: http://endgate-samples.azurewebsites.net/Samples/AnimatedSprites/

What I've tried:

  1. Copy all TypeScript files to output folder by setting TypeScript properties to "Copy Always". Issue with this is that I need to change the references to all the files (do not want to do this).

  2. MSBuild pipeline. This works for file system deploy but not web deploy... https://github.com/NTaylorMullen/EndGate/blob/master/EndGate/samples/EndGate.Core.JS.Samples/EndGate.Core.JS.Samples.csproj#L896-L909.

  3. Manual publish to FTP endpoint (works like a charm), but not automatic. Also requires the msbuild pipeline (#2)

What am I doing wrong or what can I do (that I haven't tried) to get my TypeScript files deploying automagically?

like image 271
N. Taylor Mullen Avatar asked May 17 '13 04:05

N. Taylor Mullen


1 Answers

So after a lot of work it turns out that with the msbuild pipeline piece (#2) it will actually deploy the typescript files. One thing that I was missing was adding the appropriate mime type to handle typescript files.

It turns out by default IIS won't serve the TypeScript files correctly.

To add the Custom mime type I did:

<system.webServer>
    <staticContent>
      <remove fileExtension=".ts"/>
      <mimeMap fileExtension=".ts" mimeType="text/plain" />
    </staticContent>
</system.webServer>

It's important that we remove the existing .ts mime type (if there is one) prior to adding the mime type. If you deploy onto a machine that has the .ts mime type already and you do not remove prior to adding, it will pretty much destroy your existing mappings and will fail to serve any css, js files etc.

This has been a battle but I finally got it working, hope this helps somebody else in the future!

like image 93
N. Taylor Mullen Avatar answered Oct 20 '22 19:10

N. Taylor Mullen