org.wisdom-framework:wisdom-typescript-maven-plugin

Wisdom is a web framework and integration platform for Java, enabling modularity and dynamism.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

org.wisdom-framework
ArtifactId

ArtifactId

wisdom-typescript-maven-plugin
Last Version

Last Version

0.6
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Wisdom is a web framework and integration platform for Java, enabling modularity and dynamism.
Project Organization

Project Organization

Wisdom Framework
Source Code Management

Source Code Management

https://github.com/wisdom-framework/wisdom-typescript/

Download wisdom-typescript-maven-plugin

How to add to project

<plugin>
    <groupId>org.wisdom-framework</groupId>
    <artifactId>wisdom-typescript-maven-plugin</artifactId>
    <version>0.6</version>
</plugin>

Dependencies

compile (1)

Group / Artifact Type Version
org.wisdom-framework : wisdom-maven-plugin jar 0.6

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

test (2)

Group / Artifact Type Version
org.assertj : assertj-core jar 1.6.0
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Wisdom-TypeScript

TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.

Wisdom-TypeScript integrates TypeScript compilation into Wisdom. So, TypeScript files (.ts files) automatically compiled to JavaScript at build time.

It supports the Wisdom Watch Mode, so any change to a .ts file immediately triggers the compilation and updates the output file.

Usage

Add the following plugin to you pom.xml file:

<plugin>
    <groupId>org.wisdom-framework</groupId>
    <artifactId>wisdom-typescript-maven-plugin</artifactId>
    <version>0.6</version> <!-- set the version here -->
    <executions>
        <execution>
            <id>compile-typescript-files</id>
            <phase>compile</phase>
            <goals>
                <goal>compile-typescript</goal>
            </goals>
        </execution>
    </executions>
</plugin>

By default, TypeScript 1.0.1 is used, but you can set the version to use as follows:

<plugin>
    <groupId>org.wisdom-framework</groupId>
    <artifactId>wisdom-typescript-maven-plugin</artifactId>
    <version>${project.version}</version>
    <executions>
            <execution>
                <id>compile-typescript-files</id>
                <phase>compile</phase>
                <goals>
                    <goal>compile-typescript</goal>
                </goals>
            </execution>
        </executions>
    <configuration>
        <version>1.0.1</version>
    </configuration>
</plugin>

Examples

The TypeScript files can be either in src/main/resources/assets (internal resources, packaged within the application), or in src/main/assets (external resources, only packaged within the distribution).

For example, the file src/main/resources/assets/Animal.ts with the following content:

class Animal {
    constructor(public name: string) { }
    move(meters: number) {
        alert(this.name + " moved " + meters + "m.");
    }
}

class Snake extends Animal {
    constructor(name: string) { super(name); }
    move() {
        alert("Slithering...");
        super.move(5);
    }
}

class Horse extends Animal {
    constructor(name: string) { super(name); }
    move() {
        alert("Galloping...");
        super.move(45);
    }
}

var sam = new Snake("Sammy the Python");
var tom: Animal = new Horse("Tommy the Palomino");

sam.move();
tom.move(34);

generates the target/classes/assets/Animal.js, as well as the associated source map and declaration.

Parameters

In addition to the version parameter seen above, the plugin supports:

  • removeComments : When enabled, removes the comments from the generated JavaScript files. (Default: false)
  • declaration : When enabled, generates corresponding +.d.ts+ files. (Default: false)
  • module : Set the type of module generated among "commonjs" and "amd". (Default: commonsjs)
  • noImplicitAny : When enabled, fail the compilation on expressions and declaration with an implied 'any' type. (Default: false)
  • sourcemap : When enabled, generates the source map files (Default: true)
org.wisdom-framework

Wisdom Framework

Versions

Version
0.6