Skip to content

Create a Gradle plugin, so TypeScript files are generated during compilation #5

Open
@aSemy

Description

@aSemy

The plugin will scan for all classes with @Serializable. It will convert each to a TypeScript definition.

Nice extras

  1. kxs-ts-gen is configurable

  2. Add a @TsExport annotation so only specific types are generated

  3. Allow @TsExport to be added to const strings, and the raw value will be exported (inspired by Sharing constants ntrrgc/ts-generator#24)

    @TsExport
    const val customConfig: String = """
    object ApiConstants {
        const SOME_VAL_1 = 1234
        const SOME_VAL_2 = "hello world"
    }
    """

    kxs-ts-gen will produce

    object ApiConstants {
        const SOME_VAL_1 = 1234
        const SOME_VAL_2 = "hello world"
    }

    Or maybe directly convert a const

    object ApiConstants {
      @TsExport
      const val SOME_VAL_1 = 1234
      @TsExport
      const val SOME_VAL_2 = "hello world"
    }

    kxs-ts-gen will produce

    object ApiConstants {
        const SOME_VAL_1 = 1234
        const SOME_VAL_2 = "hello world"
    }
  4. Grab KDoc, and convert it to JSDoc

  5. Grab annotations and convert them Feature Request: ability to annotate integer fields ntrrgc/ts-generator#23

  6. Add example for NPM upload (with mpetuska/npm-publish?) context

Use KSP to create a plugin. KSP is unsuitable, it can only view and can't run code, use https://github.com/ronmamo/reflections or https://github.com/classgraph/classgraph instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions