All Projects → jensim → kt2ts-gradle-plugin

jensim / kt2ts-gradle-plugin

Licence: Apache-2.0 license
Generate TypeScript from Kotlin (or any jvm language) by annotations

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to kt2ts-gradle-plugin

secrets-gradle-plugin
A Gradle plugin for providing your secrets to your Android project.
Stars: ✭ 475 (+3066.67%)
Mutual labels:  gradle-plugin
angular-code-input
Code (number/chars/otp/password) input component for angular 7, 8, 9, 10, 11, 12+ projects including Ionic 4, 5 +
Stars: ✭ 112 (+646.67%)
Mutual labels:  angular7
fabric-loom
Gradle build system plugin used to automate the setup of a minecraft mod development environment.
Stars: ✭ 150 (+900%)
Mutual labels:  gradle-plugin
kfc-plugins
Kotlin/JS Fast Configuration
Stars: ✭ 37 (+146.67%)
Mutual labels:  gradle-plugin
extra-java-module-info
A Gradle 6.4+ plugin to use legacy Java libraries as Java Modules in a modular Java project
Stars: ✭ 39 (+160%)
Mutual labels:  gradle-plugin
parcl
Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux
Stars: ✭ 52 (+246.67%)
Mutual labels:  gradle-plugin
ng-pdf-highlighter
PDF annotation with angular7
Stars: ✭ 15 (+0%)
Mutual labels:  angular7
groocss
GrooCSS - code CSS in Groovy
Stars: ✭ 24 (+60%)
Mutual labels:  gradle-plugin
SPM-DashBoard-Angular-7
Practice Application SPM DashBoard
Stars: ✭ 16 (+6.67%)
Mutual labels:  angular7
kosogor
Defaults and simplified Kotlins-DSL interfaces for Gradle
Stars: ✭ 18 (+20%)
Mutual labels:  gradle-plugin
laboratory
Feature flags for multi-module Kotlin Android projects
Stars: ✭ 71 (+373.33%)
Mutual labels:  gradle-plugin
sentry-android-gradle-plugin
Gradle plugin for Sentry Android. Upload proguard, debug files, and more.
Stars: ✭ 67 (+346.67%)
Mutual labels:  gradle-plugin
android-shortcut-gradle-plugin
Android Gradle plugin generates App Shortcuts shortcuts.xml for different flavors with different applicationId.
Stars: ✭ 20 (+33.33%)
Mutual labels:  gradle-plugin
gradle-git-versioning-plugin
This extension will set project version, based on current Git branch or tag.
Stars: ✭ 44 (+193.33%)
Mutual labels:  gradle-plugin
babel-loader-lerna-cra
Transpile Create-React-App imports in Lerna projects.
Stars: ✭ 30 (+100%)
Mutual labels:  transpile
android-buddy
Transform Android project classes with Byte Buddy at compile time
Stars: ✭ 42 (+180%)
Mutual labels:  gradle-plugin
native-build-tools
Native-image plugins for various build tools
Stars: ✭ 168 (+1020%)
Mutual labels:  gradle-plugin
gradle-jnlp-plugin
Gradle plugin to generate jnlp files, sign jars etc. for being able to start an application with Java Webstart
Stars: ✭ 19 (+26.67%)
Mutual labels:  gradle-plugin
kotlin-plugin-generated
A Kotlin compiler plugin that annotates Kotlin-generated methods for improved coverage reports
Stars: ✭ 33 (+120%)
Mutual labels:  gradle-plugin
FirebaseTestLab-Android
No description or website provided.
Stars: ✭ 50 (+233.33%)
Mutual labels:  gradle-plugin

Kotlin to TypeScript gradle-plugin

Have your backend declare the data types (DTOs) for its API, and use em in the front end. Great when working with Angular or other TypeScript frameworks.

This project is a wrapper around the ts-generator project

Project Status: Active – The project has reached a stable, usable state and is being actively developed. License Gradle Plugin Portal Build Status Quality Gate Status Coverage Lines of Code Maintainability Rating

Usage

build.kotlin.kts

plugins {
    id("se.jensim.kt2ts") version "$pluginVersion"
}

kt2ts {
    // Repeatable block for linking outputfile to a set of annotations
    output {
        outputFile = file("$buildDir/ts/kt2ts.d.ts")
        annotations = listOf("com.example.ToTypescript")
    }
    classFilesSources {
        // Two ways of setting classes dir, if both are set, both are jointly used
        // One has to be provided (for task input resolution to work properly, I made it mandatory)
        compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
        classesDirs = files("$buildDir/classes/kotlin/main")
    }
}
// Shorthand versions - with default values
kt2ts {
    annotation = "com.example.ToTypescript"
    classFilesSources.compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
}
kt2ts {
    annotations = listOf("com.example.ToTypescript")
    classFilesSources.compileTasks = listOf(tasks.compileKotlin, tasks.compileJava)
}

Your custom annotation and API data classes

package com.example

annotation class ToTypescript

@ToTypescript
data class OneDataType(val types: List<ThreeDataType>, val e: FouthEnum)

data class TwoDataType(val name: String)

data class ThreeDataType(val name: String)

enum class FouthEnum {
    FOUR
}

Dependencies and license stuff

Dependency License
kt2ts (this) License
ts-generator License
reflections WTFPL
javassist (transitive) License: MPL 2.0
guava (transitive) License

Why?

Because we need something like kt2js https://youtrack.jetbrains.com/issue/KT-16604

Tests & CI

We use jacoco for testcoverage of the plugin project, on top of that we build and test the example project that uses the plugin when building master and tagging releases in TravisCI. All plugin publishings to gradle plugin protal are made in trvisCI after a full build & test has been successful in both the plugin and the example project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].