Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript command line compilation without NodeJS

I was looking over Typescript and was a bit confused about how you could build your js files from the ts files via the command line.

It implies in the documentation that you can do it easily through nodeJS, which would be great if I wanted a dependency on nodeJS... So is there any way to compile it via the command line without having nodeJS or visual studio?

This may seem crazy to some, but I would just put a build script step to output the javascript at the end if possible then package it into my release, as I tend to do most of my javascript development with RubyMine and don't want a dependency on nodeJS or Visual Studio for my build server.

like image 547
Grofit Avatar asked Mar 20 '13 14:03

Grofit


People also ask

Can I use TypeScript without node JS?

TypeScript is available as a package on the npm registry available as "typescript" . You will need a copy of Node. js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.

Can you run TypeScript without compiling?

Since the release of deno, you can now execute deno run path/to/file. ts and it will run typescript files in a single command without compiling it to a separate JS file.


1 Answers

If you install the TypeScript Tools without Visual Studio installed on the machine, tsc.exe and its dependencies will still get installed.

You can also just xcopy deploy tsc.exe (I don't have a definitive list of its dependencies, but it's pretty straightforward to figure out, or just copy everything that gets installed to the SDK folder) to a build server. The only thing unexpected you would need is msvcr110.dll, which you may or may not need to copy to tsc.exe's path.

like image 50
Ryan Cavanaugh Avatar answered Sep 22 '22 20:09

Ryan Cavanaugh