I'm writing a gradle plugin to handle kjs publishi...
# javascript
b
I'm writing a gradle plugin to handle kjs publishing to npm repositories. I'd like to know what configuration options would be useful for such plugin? Could you drop your suggestions in the thread?
v
It would probably make sense to integrate with the other Gradle publishing infrastructure, so similar to maven-publish plugin
b
That's the plan. I'm just curious as to which npm specific configs would be useful
👌 1
o
Hi, great initiative. Would it be possible to have an option to let the user send in any argument?
r
I'm not using kotlinjs since it doesn't support the stuff I need as a library author, but the best publishing experience I've had on JS is with pika pack (https://www.pika.dev/blog/introducing-pika-pack), in which you can define different build profiles which hook the entrypoints into the appropriate package.json field (
main
,
module
,
browser
,
types
, etc). The profiles can then be further configured if needed. That package in turn uses
np
which lays out a publishing pipeline (https://www.npmjs.com/package/np) A nice-to-have would probably be 2FA support
a
I have several inter-dependent Kotlin/JS modules in the same project. My current publishing flow might not be the standard route, but I'm curious if it could be supported. I currently have a jank gradle setup that: • has an umbrella JS project that depends on all other JS modules, kotlin/js stdlib and kotlinx.serialiation • sets the umbrella project's dce output directory to
$buildDir/distributions
• runs
browserDistribution
on the umbrella project to compile and run DCE, getting a unique DCE'd subfolder in
$buildDir/distributions
for each dependency of the umbrella project • Add a
package.json
to each subfolder, populating transitive dependencies to point to one another • publish all subfolders (including our own DCE'd version of kotlin.js and serialization) This lets us keep our web bundle sizes lean, as we only load each specific kotlin/js module on the page where it's needed, and avoid pulling in extra artifacts (esp serialization, which isn't used in every module). Maybe ES6 support will make the need for DCE obsolete since it would let us use webpack's tree shaking instead 🤷‍♂️
b
@ankushg Just released v0.0.4. This should allow for you to setup your use-case. Not sure how much extra config that'd need as you're now managing task dependencies and publication files yourself.
Apologies guys, but I've decided to rename the plugin from kpm-publish to npm-publish while noone is using it yet since the mission now has changed to support generic npm packages (not just kotlin). Here's v0.0.5