Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build the TypeScript compiler (tsc.js) from source?

Tags:

typescript

tsc

How do I build the TypeScript compiler (at typescript.codeplex.com) from source? When I clone it from git I see a Makefile, but make in cygwin fails with *** missing separator (did you mean TAB instead of 8 spaces?)

I can't find any clear documentation, and the Readme file in the source doesn't help.

like image 489
dcstraw Avatar asked Nov 06 '12 18:11

dcstraw


2 Answers

To use the makefile with mingw32 or cygwin make, you need to go trough the file and fix the indentation.

sed -i.bak -e "s/^[[:space:]]\+/    /" Makefile

To get it to compile, you can issue this command:

make TYPESCRIPT_HOST="cscript //Nologo" compiler

This also works with nmake.

like image 167
Markus Jarderot Avatar answered Dec 11 '22 07:12

Markus Jarderot


The Makefile in the TypeScript source is in NMAKE format and has dependencies on Windows commands. NMAKE comes with Visual Studio and is in the path when you run a Visual Studio Command Prompt.

In order to build you need both nmake and nodejs in your path. Then just run:

nmake TYPESCRIPT_HOST=node world

from the directory containing your TypeScript source. The built .js files will be placed in built\local

Edit: Added the missing arg setting TYPESCRIPT_HOST

like image 30
dcstraw Avatar answered Dec 11 '22 05:12

dcstraw