Hi everyone! I have a question about `kotlin.js` v...
# javascript
m
Hi everyone! I have a question about
kotlin.js
vs
kotlin.multiplatform
The recommended way to use Kotlin/JS is via the
kotlin.multiplatform
Gradle plugin. This is said by the doc Kotlin for JavaScript. A year ago it was:
The recommended way to use Kotlin/JS is via the ``kotlin.js`` and ``kotlin.multiplatform`` Gradle plugins.
Bot, and not just
kotlin.multiplatform
. Does it mean that
kotlin.js
will be deprecated and the main approach will be only
kotlin.multiplatform
? If I want just JS target should I prefer still use
kotlin.multiplatform
? If I want only JS target, for example write a GitHub Action in Kotlin.
👌 4
c
Yes, always use
kotlin.multiplatform
.
m
Recently, I’ve tried to build a GitHub Action using KotlinJS, but I found it a bit tricky even with kotlin.js. Now, I should use Kotlin Multiplatform and source sets, which adds a little bit more headaches :)
c
Apart from the different directory names (
src/main
→
src/jsMain
) and some gradle tasks having
js
at the start, you shouldn't see any differences
m
I guess you’re right.
c
There is actually only one Kotlin plugin. If you notice, all
kotlin.*
plugins point to the same JAR. The only difference between them is some initialization logic (task names, folder names…) but they all behave exactly the same
m
all
kotlin.*
plugins point to the same JAR
I didn’t know that. Cool then.
h
BTW there are already some existing kotlin frameworks for GitHub Actions, eg the one from Ryan https://github.com/rnett/kotlin-js-action or https://github.com/hfhbd/kotlin-actions created by me.
m
Hey @hfhbd! Thanks a lot! I’m looking into your repo. You don’t use ncc or Webpack? Everything works fine without packing in one file?
h
No, you do need to package it in one file (unless you want to check in the node modules folder) and I use webpack. But it is managed by the Kotlin gradle plugin.
m
I see, thanks
> BTW there are already some existing kotlin frameworks for GitHub Actions I just want to create one KotlinJS GHA from scratch to figure everything out how it works.