Hi. Do you know an example open source project whe...
# javascript
r
Hi. Do you know an example open source project where some Kotlin code targeting K/JS is used by the plain JS or better TS subproject? I know I can publish an NPM library using npm-publish gradle plugin. But what if Kotlin code is more dynamic (e.g. generated by KSP)? Can it be used directly without NPM repository? How to structure such project? How to connect Kotlin/Gradle buildchain with JS/TS buildchain (npm, package.json, etc.).
t
Do you want to have hot reload for all files at one time?
r
I have no idea what is possible.
A user is asking for a TS client for my RPC framework. But I have no experience with Kotlin/TS interop and need some working example to learn and understand.
t
In simple case you can use path to local zip file (NPM package) instead of version in
package.json
Publish to NPM registry isn't required for local changes testing
r
So both projects (Kotlin and TS) don't need to know anything about each other? I can just use some task to create NPM package in some build directory. And then add this location to
package.json
of the TS project and use npm or any other TS build tool to work with TS as usual?
t
It's fine scheme for rare checks
thank you color 1
e
> Do you know an example open source project where some Kotlin code targeting K/JS is used by the plain JS or better TS subproject When @Artem Kobzar finishes setting up https://github.com/Kotlin/kotlin-js-examples, I plan to open a PR to add an example of a production-ready monorepository. Tho I'm not sure if that repo will actually contain the sources, or if it's there just to link to other repos.
a
@Edoardo Luppi the repo is containing links to other repos, so you are welcome to make such a PR 🙂
e
Ahhh ok! I'll publish the example on my own repository then, and I'll open a PR to add the link. Thanks.
kodee loving 1
b
r
@Big Chungus This is what I was searching for! Thanks!
e
As far as I can see that relies on installing and linking the built package locally.
b
Correct, curious if anyone has found a better way of setting up local kt + js sourced project