Home > Software design >  How can I add my own version of dukat in intellij idea
How can I add my own version of dukat in intellij idea

Time:01-17

I am trying to generate external Declaration for a NPM package but it is giving errors But when I tried the same with dukat@next version it worked Tell me either how can I include my generated declarations to my kotlinJs project or how can I update to dukat@next in IDE to automatically generate declarations and use it

I am expecting for dukat to generate my Declarations and i can work with my npm module

CodePudding user response:

The Kotlin/JS Gradle plugin configures the version of Dukat via an extension on the root Gradle project (even if the root project does not have the Kotlin/JS plugin applied).

The latest version of Dukat can be found on npmjs.com. Right now, the latest version is 0.5.8-rc.4-dev.20221020

// build.gradle.kts

import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin

rootProject.plugins.withType<NodeJsRootPlugin> {
  configure<NodeJsRootExtension> {
    versions.apply {
      dukat.version = "0.5.8-rc.4-dev.20221020"
    }
  }
}

There are actually a lot of versions that can be configured. The full list (for Kotlin v1.8.0) can be viewed in NpmVersions.kt

I wouldn't rely on Dukat too much though. It's still highly experimental, and is updated rarely. Further development has been postponed a number of times. It rarely generates correct code, but it can be used as a good starting point (read more).

  • Related