Just released <v0.1.1> of npm-publish plugin. Have...
# gradle
b
Just released v0.1.1 of npm-publish plugin. Have a look! 🎉
m
Hey @Big Chungus I'm wondering if you've encountered issues with Kotlin multiplatform transitive dependencies not being in NPM. Specifically, I wanted to use Ktor in a JS/JVM multiplatform library that I'd use from pure JS. This was because Ktor is not actually published to NPM. Theoretically, it should be possible to do
npm install <url>
and target the JAR in Maven which unpacks more or less exactly like an NPM
.tgz
. Still, it's a blocker for ease-of-use and was wondering if you had thoughts.
b
Hmm, that sounds like bundled dependencies. Are you sure, though, that the unpacked structure would be acceptable to node?
m
Yeah I've tried using them (albeit, after downloding them and changing the extension)
b
My suggestion would be to just publish own kotlin/js lib container that wraps all kotlinJs dependencies
m
If those have transitives not in NPM, that creates another problem.
@Big Chungus do you have any examples or code suggestions for creating a "fat NPM module" (similar to a fat JAR)? That is what you're talking about, right? I was looking for documentation along those lines, or even some example code, but couldn't find it.
👍 1
It would be a really cool addition to your plugin, the ability to create and publish such an artifact.
b
Essentially duplicating ktor compiled files into your own lib that's published as pure npm lib with no kotlin/jar dependencies (since they're now part of this lib)
I'll give it a go and let you know
m
That would be so great. It's the one thing stopping us from using this in our TypeScript react app.
I'd help out, but I'm an extreme JS/NPM novice and right now I'm barely coping with multiplatform. So much to learn!
If you need to tap someone for Gradle advice/suggestions I'd be happy to contribute in that way. That's one thing I'm better than most with.
b
Managed to get it working (not sure how sufficient it'll be for you). Here's a sample gradle setup and published artifact. After installing that artifact, ktor-client-core will be resolved as well (even though it's not on the registry). Give it a go and let me know how it works out for you. Note that it's on develop branch still so you,ll need to build 0.1.2 plugin locally (checkout repo and run
./gradlew publishToMavenLocal
)
m
This is really cool. I like the
bundledDependencies
DSL. I'm booked for the next couple of days but will happily give you some feedback (hopefully early) next week.
b
That's npm specific construct, actually :) looking forward for your feedback, then and if all is ok, will release 0.1.2 afterwards
@mike.holler, just pushed an update to develop branch that automagically bundles all your kotlin-only dependencies (including their transitive kotlin deps) by default. The minimal required setup is now the same as if you wouldn't have any kotlin deps: https://gitlab.com/lt.petuska/npm-publish/-/blob/develop/sandbox/js/build.gradle.kts#L32
@mike.holler did you manage to give it a go yet?
m
Not yet, sorry. I've had a bit of an unexpected week. It hasn't left my memory though. I'm extremely excited to give it a go.
b
No worries. I'm quite excited myself 😀
m
@Big Chungus is your new features for publishing transitive deps from the link above and, apparently, this commit in a published tag? Or is still a publishToMavenLocal and consume kind of thing? https://gitlab.com/lt.petuska/npm-publish/-/commit/6c4c2d1750811549436692113ad5c7a04ef71954
b
Latest version is not published yet, so publishToMavenLocal please
I'm waiting for you to be my test mice 😄
Make sure to checkout develop branch
m
Gotcha, good to know for when I look at it.
b
v1.0.0 is out!