How to create a TypeScript compiler (tsc.js) from a source?

How to create a TypeScript compiler ( typescript.codeplex.com ) from a 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 cannot find clear documentation, and the Readme file in the source does not help.

+4
source share
3 answers

To use the make file with mingw32 or cygwin make, you need to go through the file and fix the indent.

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

To compile it, you can run this command:

 make TYPESCRIPT_HOST="cscript //Nologo" compiler 

This also works with nmake .

+3
source

The Makefile in the TypeScript source is in NMAKE format and has dependencies on Windows commands. NMAKE ships with Visual Studio and is on the way when running the Visual Studio command line.

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. Created .js files will be placed in built\local

Edit: Added missing arg parameter TYPESCRIPT_HOST

+3
source

There, apparently, it is even easier to answer. Just referring to tsc.ts in / src / compiler does the trick:

 tsc tsc.ts --out tsc.js 

All other files are automatically extracted through the /// syntax.

+1
source

Source: https://habr.com/ru/post/1444423/


All Articles