Skip to content

Latest commit

 

History

History
135 lines (100 loc) · 5.06 KB

README.md

File metadata and controls

135 lines (100 loc) · 5.06 KB

Fluxo-BCV-TS

Binary Compatibility Validator for Kotlin/TypeScript definitions (JS, WASM targets)

Gradle Plugin Portal JitPack Build Common Changelog

KotlinX BCV Compatibility Kotlin Compatibility Gradle Compatibility

A tiny Gradle plugin that adds TypeScript (JS) API support to the KotlinX Binary Compatibility Validator (BCV).

Can be used with any Gradle module with Kotlin/JS or Kotlin/WASM target. Either Kotlin Multiplatform or Kotlin/JS.

Doesn't conflict with the KLIB API dumps.

Integrates with the default BCV pipeline, providing more features for the 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 or WASM 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.

Compatibility

Kotlin has supported generation of TypeScript declarations since 1.6.20. Compatibility tested with:

Version BCV Kotlin Gradle
1.0.0 0.8 - 0.15 1.7.22+ 7.6+
0.3.0 0.8 - 0.14 1.6.20+ 7.6+
0.2.0 0.8 - 0.13 1.6.20+ 7.4+

How to use

Gradle Plugin Portal

// in the `build.gradle.kts` of the target module.
plugins {
  kotlin("multiplatform") version "2.0.0" // <-- versions from 1.7 to 2.0
  id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.14.0" // <-- 0.8 .. 0.15
  id("io.github.fluxo-kt.binary-compatibility-validator-js") version "1.0.0" // <-- add here
}
kotlin {
  js(IR) {
    binaries.executable() // required to generate TS definitions
    nodejs() // or browser()
  }
}
How to use snapshots from JitPack repository

JitPack

// in the `build.gradle.kts` of the target module.
plugins {
  kotlin("multiplatform") version "2.0.0" // <-- versions from 1.7 to 2.0
  id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.14.0" // <-- 0.8 .. 0.15
  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:dee48ac65c") // <-- specify a version, or a commit.
  }
}

Module examples for:

Versioning

Uses SemVer for versioning.

License

License

This project is licensed under the Apache License, Version 2.0 — see the license file for details.