Binary Compatibility Validator for Kotlin/JS by Fluxo
A tiny Gradle plugin that adds JS/TS API support to the KotlinX Binary Compatibility Validator (BCV).
Can be used with any Gradle module with Kotlin/JS target. Either Kotlin Multiplatform or Kotlin/JS.
Integrates well with the default BCV pipeline, providing more features with same Gradle tasks.
As mentioned in the Kotlin/binary-compatibility-validator#42, the Kotlin team is not yet ready to accept a contribution for JS/TS support, or even to do due diligence and see if this is a reasonable addition for the future.
The tool allows dumping TypeScript definitions of a JS part of a Kotlin multiplatform library that's public in the sense of npm package visibility, and ensures that the public definitions haven't been changed in a way that makes this change binary incompatible.
This plugin will be supported until the official Kotlin/JS support is added to BCV.
Initially was made for the Fluxo state management framework, but then published for general use.
Kotlin supports generation of TypeScript declarations since 1.6.20 Compatibility tested with:
Version | BCV | Kotlin | Gradle |
---|---|---|---|
0.2.0 | 0.8 - 0.13 | 1.6.20+ | 7.4+ |
// in the `build.gradle.kts` of the target module
plugins {
kotlin("multiplatform") version "1.9.10" // <-- multiplatform or js, versions from 1.6.20 to 1.9
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" // <-- 0.8 .. 0.13
id("io.github.fluxo-kt.binary-compatibility-validator-js") version "0.2.0" // <-- add here
}
kotlin {
js(IR) {
binaries.executable() // required to generate TS definitions
nodejs() // or browser()
}
}
How to use snapshots from JitPack repository
// in the `build.gradle.kts` of the target module
plugins {
kotlin("multiplatform") version "1.9.10" // <-- multiplatform or js, versions from 1.6.20 to 1.9
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" // <-- 0.8 .. 0.13
id("io.github.fluxo-kt.binary-compatibility-validator-js") // <-- add here, no version needed for jitpack usage
}
kotlin {
js(IR) {
binaries.executable() // required to generate TS definitions
nodejs() // or browser()
}
}
// in the `settings.gradle.kts` of the project
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://jitpack.io") // <-- add jitpack repo
}
resolutionStrategy.eachPlugin {
if (requested.id.toString() == "io.github.fluxo-kt.binary-compatibility-validator-js")
useModule("com.github.fluxo-kt.fluxo-bcv-js:fluxo-bcv-js:e072120070") // <-- specify version or commit
}
}
Module examples for:
Uses SemVer for versioning.
This project is licensed under the Apache License, Version 2.0 — see the license file for details.