How to vend KotlinJS libraries?


#1

Question: how does one actually vend KotlinJS libraries? Through Maven, npm, or…both?

Suppose you have a KotlinJS library and a KotlinJS application that uses rollup and consumes that library. Right now, it looks like I have to vend through Maven (for types and externals and such when compiling Kotlin) and through npm, so that the generated KotlinJS application code (which requires the library code) can actually get merged together into a proper IIFE-type JS file.

This seems kinda Bad though as now the user (and the maintainer) has two versions to keep in sync – Maven and npm. I’m thinking about writing a plugin similar to the iconic rollup-plugin-node-resolve that does the same thing, except using JARs/classpaths instead of node_modules. Then I could vend solely through Maven, and rollup would just pull from the JAR for modules.

Thoughts?


#2

If your library is used with Kotlin applications, there is no need to vend any JavaScript files through npm. It’s enough to publish jars through maven/gradle repository (e.g. on bintray) and use kotlin-frontend-plugin to build the application. You can look how my KVision library is published.

However if you want to use your library directly from html+javascript pages, then it’s probably necessary to publish generated JS files as well.


#3

Thanks, I’ll keep that in mind…but I really don’t want to use kotlin-frontend-plugin. Webpack confuses the hell out of me, and I don’t want to use Karma.