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.
jtsc-maven-plugin
in your project
Using - 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 topom.xml
) - Compile your project.
tsc
equivalent executable
Using the self-contained - 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