Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 2.02 KB

README.md

File metadata and controls

68 lines (50 loc) · 2.02 KB

typescript4s

Scala library to compile TypeScript

Build Status

Usage

Compile

scala> import com.zaneli.typescript4s.TypeScriptCompiler
import com.zaneli.typescript4s.TypeScriptCompiler

scala> val dest = TypeScriptCompiler(new java.io.File("example.ts")).compile()
dest: Seq[java.io.File] = List(example.js)

scala> val dest = TypeScriptCompiler(new java.io.File("example.ts")).out(new java.io.File("dest.js")).compile()
dest: Seq[java.io.File] = List(dest.js)

scala> val dest = TypeScriptCompiler(new java.io.File("example.ts")).declaration(true).sourcemap(true).compile()
dest: Seq[java.io.File] = List(example.js.map, example.js, example.d.ts)

Watch

equivalent of tsc --watch option

scala> import com.zaneli.typescript4s.TypeScriptCompiler
import com.zaneli.typescript4s.TypeScriptCompiler

scala> val watcher = TypeScriptCompiler(new java.io.File("example.ts")).watch()
// compile example.ts and start watching file.

scala> watcher.cancel
// stop watching file.

Credit

##Maven Repository

for Scala 2.10.x and Scala 2.11.x

###pom.xml com.zaneli Zaneli Repository http://www.zaneli.com/repositories

<dependencies>
  <dependency>
    <groupId>com.zaneli</groupId>
    <artifactId>typescript4s_2.11</artifactId>
    <version>0.0.2</version>
  </dependency>
</dependencies>

###build.sbt resolvers += "Zaneli Repository" at "http://www.zaneli.com/repositories"

libraryDependencies ++= {
  Seq("com.zaneli" %% "typescript4s" % "0.0.2")
}