Anyone know if there is a gradle plugin to use wit...
# javascript
h
Anyone know if there is a gradle plugin to use with something like this: https://github.com/adamko-dev/kotlinx-serialization-typescript-generator. Was thinking about using it to generate my response models from my ktor backend and possible functions to wrap the rest api
t
@Adam Semenenko ^^
a
hey, I thought about creating a Gradle plugin but since KxsTsGen needs the output of the compilation it's a bit tricky. I wanted to avoid creating a KSP plugin because I think they're a hassle to maintain. Personally I'd splitting up the responsibility into specific subprojects. 1. Define the serializable models in
:my-models
2. Create another subproject for generating TS. This will depend on
:my-models
and KxsTsGen and have a
fun main()
for running the generation. You could also search on GitHub to see how other projects do it: I see the icpc project just created a specific task, maybe it'd help: https://github.com/icpc/live-v3/blob/2835fc0d503267a724dd1d721cc788a94db6b1d0/build-logic/src/main/kotlin/org/icpclive/gradle/tasks/TsInterfaceGeneratorTask.kt
👍 1