Сергей Гуков
01/11/2025, 8:02 PMСергей Гуков
01/12/2025, 1:03 PMplugins {
kotlin("js")
}
val kotlinxHtmlVersion: String by project
val kotlinxSerializationVersion: String by project
val kotlinWrappersSuffix: String by project
val kotlinxCoroutinesVersion: String by project
val d3Version: String by project
val d3SelectionMultiVersion: String by project
val leafletVersion: String by project
val leafletMarkerClusterVersion: String by project
val visTimelineVersion: String by project
val visDataVersion: String by project
val momentVersion: String by project
val enzymeVersion: String by project
val enzymeAdapterVersion: String by project
val reactFlowVersion: String by project
val ktorVersion: String by project
fun kotlinWrappers(target: String): String = "org.jetbrains.kotlin-wrappers:kotlin-$target"
repositories {
mavenCentral()
}
kotlin {
js(LEGACY) {
useCommonJs()
browser {
commonWebpackConfig {
showProgress = true // включение в логах прогресса загрузки клиента
sourceMaps = false // отключение двойной перезагрузки клиента
}
distribution {
directory = project.file("../www/static")
}
runTask {
devServer?.run {
proxy = mutableMapOf("/" to "<https://localhost:8443>")
port = 3000
static = mutableListOf("$buildDir/processedResources/frontend/main")
open = true
}
}
testTask {
testLogging {
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showCauses = true
showStackTraces = true
}
}
}
binaries.executable()
nodejs {
testTask {
testLogging {
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showCauses = true
showStackTraces = true
}
}
}
}
}
dependencies {
implementation(project(":libs:loggerLib"))
implementation(project(":common:connection"))
implementation(project(":common:data"))
implementation(kotlin("reflect"))
implementation(project(":libs:!microservice:microserviceModel"))
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-js:$kotlinxSerializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-html:$kotlinxHtmlVersion")
implementation(enforcedPlatform(kotlinWrappers("wrappers-bom:1.0.0-${kotlinWrappersSuffix}")))
implementation(kotlinWrappers("react"))
implementation(kotlinWrappers("react-dom"))
implementation(kotlinWrappers("react-router-dom"))
implementation(kotlinWrappers("redux"))
implementation(kotlinWrappers("react-redux"))
implementation(kotlinWrappers("extensions"))
implementation(kotlinWrappers("emotion"))
implementation(npm("d3", d3Version))
implementation(npm("d3-selection-multi", d3SelectionMultiVersion))
implementation(npm("leaflet.markercluster", leafletMarkerClusterVersion))
implementation(npm("leaflet", leafletVersion))
implementation(npm("vis-timeline", visTimelineVersion))
implementation(npm("vis-data", visDataVersion))
implementation(npm("moment", momentVersion))
implementation(npm("reactflow", reactFlowVersion))
// testImplementation("org.jetbrains.kotlin:kotlin-test-js")
// testImplementation(npm("enzyme", enzymeVersion))
// testImplementation(npm("enzyme-adapter-react-16", enzymeAdapterVersion))
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.time.ExperimentalTime"
}
Artem Kobzar
01/13/2025, 12:08 PMСергей Гуков
01/13/2025, 1:54 PMArtem Kobzar
01/13/2025, 1:56 PMIlya Goncharov [JB]
01/14/2025, 10:27 AMsecure
property in Gradle DSL yet, you can configure webpack manually with <project>/webpack.config.d/index.js
config.devServer = config.devServer || {};
config.devServer.proxy [
{
context: ['/'],
target: '<https://localhost:8443>',
secure: false,
},
];