wmono / jtsc

JVM Wrapper for the TypeScript Compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JVM Wrapper for the TypeScript Compiler

This project is

  • a wrapper to allow tsc to run on the JVM, plus
  • a Maven plugin to compile TypeScript as part of a build

Warning

This project is currently in a proof-of-concept stage and is not suitable for use by end users.

In particular, readDirectory is not implemented yet, so tsc.js will only be able to locate explicitly named files.

Why?

There are a variety of reasons that a development team can't require Node.js and NPM for their build process, including company policy, regulatory and audit compliance, and inertia. While individual developers may be able to work around these roadblocks, a requirement to install new software on the build server is more likely to remain a problem.

How to use

First, build and install the plugin into your local repository:

	$ mvn -am -pl jtsc-maven-plugin install

See the demo-project project for a minimal but complete project.

Using jtsc-maven-plugin in your project

  • Configure the plugin in your project:
	<plugin>
		<groupId>ca.eqv.jtsc</groupId>
		<artifactId>jtsc-maven-plugin</artifactId>
		<version>0.1.0.BUILD-SNAPSHOT</version>
		<executions>
			<execution>
				<goals>
					<goal>compile</goal>
				</goals>
			</execution>
		</executions>
	</plugin>
  • Place a tsconfig.json in your project root (next to pom.xml)
  • Compile your project.

Using the self-contained tsc equivalent executable

  • Build the executable:
	$ mvn -am -pl jtsc-executable package
  • Run it:
	$ java -jar jtsc-executable/target/jtsc-executable-*-jar-with-dependencies.jar --help

See also

If installing/executing Node.js is a possibility, consider other plugins such as frontend-maven-plugin and grunt-maven-plugin.

This project is intended to replace tsc-maven-plugin which is only capable of running tsc versions older than 1.5.

Credits

Based on work and discussion in TypeScript #8565

About

JVM Wrapper for the TypeScript Compiler


Languages

Language:Java 69.4%Language:JavaScript 29.8%Language:TypeScript 0.8%