Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aSemy opened this issue Mar 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@aSemy
Copy link
Contributor

aSemy commented Mar 3, 2022

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?

@aSemy aSemy changed the title Create a plugin, so TypeScript files are generated during compilation Create a Gradle plugin, so TypeScript files are generated during compilation Mar 3, 2022
@aSemy aSemy added the enhancement New feature or request label Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant