All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zegreatrob.jsmints.plugins.jspackage.gradle.kts Maven / Gradle / Ivy

There is a newer version: 6.1.90
Show newest version
package com.zegreatrob.jsmints.plugins

import com.zegreatrob.jsmints.plugins.jspackage.JsPackageExtension
import com.zegreatrob.jsmints.plugins.jspackage.loadPackageJson
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin

plugins {
    kotlin("multiplatform")
}

kotlin(fun KotlinMultiplatformExtension.() {
    js(fun KotlinJsTargetDsl.() {
    })
})

val jspackage = project.extensions.create("jspackage", JsPackageExtension::class, loadPackageJson())

dependencies {
    jspackage.dependencies()?.forEach {
        "jsMainImplementation"(npm(it.first, it.second.asText()))
    }
    jspackage.devDependencies()?.forEach {
        "jsTestImplementation"(npm(it.first, it.second.asText()))
    }
}

NodeJsRootPlugin.apply(rootProject).apply {
    val libs = jspackage.dependencies()?.toMap()
    if (libs != null) {
        libs["webpack"]?.asText()?.let { versions.webpack.version = it }
        libs["webpack-cli"]?.asText()?.let { versions.webpackCli.version = it }
        libs["karma"]?.asText()?.let { versions.karma.version = it }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy