Gradle plugin enabling NPM publishing (essentially maven-publish for NPM packages). Integrates seamlessly with
Kotlin/KMP plugin if applied, providing auto configurations.
Check the latest release for verified JVM, Kotlin and Gradle tooling versions
Here's a bare minimum setup when using together with one of the kotlin plugins. This setup would produce the following tasks:
assembleJsPackagepackJsPackagepublishJsPackageToNpmjsRegistry
plugins {
kotlin("npm-publish") version "<VERSION>"
kotlin("multiplatform") version "<VERSION>>" // Optional, also supports "js"
}
kotlin {
js(IR) {
binaries.library()
browser() // or nodejs()
}
}
npmPublish {
registries {
// For registries expecting an authentiation token, use authToken
register("npmjs") {
uri.set("https://registry.npmjs.org")
authToken.set("obfuscated")
}
// For registries expecting a username and password, use auth or username + password
register("nexus") {
uri.set("https://nexus.example.com/repository/npm-internal")
username.set("obfuscated")
password.set("obfuscated")
// Or:
// auth.set("base64-encoded-string")
}
}
}Full documentation can be found on npm-publish.petuska.dev
Support for the org.jetbrains.kotlin.js plugin has been removed in version 3.7.0. Use prior versions if you are using the legacy Kotlin/JS plugin or migrate to the Kotlin/Multiplatform plugin.
The project was developed by Martynas Petuška (mpetuska) for a long time, and after Martynas no longer had the capacity to maintain this plugin We (JetBrains), by mutual agreement with Martynas, took over the repository to further develop the plugin, ensuring our awesome community would not be left without the essential feature of publishing KMP libraries to NPM.
We would like to extend a huge thank-you to Martynas and all the contributors for developing such a great plugin!
The plugin originally was under Unlincense license, but after the migration to Kotlin org, there was a decision to migrate to the Apache License 2.0 license.
The last version of code under Unlincense license is placed in this repo in the licensed-with-unlicense branch. The last version of the plugin published under Unlincense is v3.5.3.
All the versions after v3.5.3 are under Apache License 2.0.
See CONTRIBUTING
Thanks to all the people who contributed to npm-publish!