Skip to content

Commit

Permalink
switching over to the multiplatform plugin for all js
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfmurdock committed Jul 9, 2023
1 parent a501792 commit 963212d
Show file tree
Hide file tree
Showing 460 changed files with 339 additions and 1,375 deletions.
157 changes: 79 additions & 78 deletions client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import com.fasterxml.jackson.databind.ObjectMapper
import com.zegreatrob.coupling.plugins.NodeExec
import com.zegreatrob.coupling.plugins.setup
Expand Down Expand Up @@ -28,85 +29,85 @@ kotlin {
}
}
sourceSets {
getByName("main") {
resources.srcDir("src/main/javascript")
getByName("jsMain") {
resources.srcDir("src/jsMain/javascript")
}
}
}

val runtimeClasspath: Configuration by configurations.getting
val jsRuntimeClasspath: Configuration by configurations.getting
val clientConfiguration: Configuration by configurations.creating
val cdnLookupConfiguration: Configuration by configurations.creating

dependencies {
cdnLookupConfiguration(
project(mapOf("path" to ":scripts:cdn-lookup", "configuration" to "cdnLookupConfiguration"))
)
implementation(kotlin("stdlib-js"))
implementation(project("components"))
implementation(project(":sdk"))
implementation(project(":libraries:model"))
implementation(project(":libraries:json"))
implementation(project(":libraries:action"))
implementation(project(":libraries:logging"))
implementation(project(":libraries:repository:core"))
implementation(project(":libraries:repository:memory"))
implementation("com.benasher44:uuid")
implementation("com.soywiz.korlibs.klock:klock")
implementation("com.zegreatrob.jsmints:minreact")
implementation("com.zegreatrob.jsmints:react-data-loader")
implementation("com.zegreatrob.testmints:action")
implementation("com.zegreatrob.testmints:action-async")
implementation("org.jetbrains.kotlin-wrappers:kotlin-css")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
implementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-popper")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-styled-next")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
implementation("io.ktor:ktor-client-core")
implementation("io.ktor:ktor-client-content-negotiation")
implementation("io.ktor:ktor-serialization-kotlinx-json")
implementation(npmConstrained("@auth0/auth0-react"))
implementation(npmConstrained("blueimp-md5"))
implementation(npmConstrained("core-js"))
implementation(npmConstrained("css-loader"))
implementation(npmConstrained("d3"))
implementation(npmConstrained("d3-color"))
implementation(npmConstrained("d3-selection"))
implementation(npmConstrained("date-fns"))
implementation(npmConstrained("drag-drop-webkit-mobile"))
implementation(npmConstrained("favicons"))
implementation(npmConstrained("file-loader"))
implementation(npmConstrained("fitty"))
implementation(npmConstrained("html-webpack-harddisk-plugin"))
implementation(npmConstrained("html-webpack-plugin"))
implementation(npmConstrained("karma"))
implementation(npmConstrained("mini-css-extract-plugin"))
implementation(npmConstrained("raw-loader"))
implementation(npmConstrained("react-dnd"))
implementation(npmConstrained("react-dnd-html5-backend"))
implementation(npmConstrained("react-flip-toolkit"))
implementation(npmConstrained("react-use-websocket"))
implementation(npmConstrained("reactjs-popup"))
implementation(npmConstrained("style-loader"))
implementation(npmConstrained("styled-components"))
implementation(npmConstrained("text-loader"))
implementation(npmConstrained("url-loader"))
implementation(npmConstrained("webpack"))
implementation(npmConstrained("webpack-cli"))
implementation(npmConstrained("webpack-favicons"))

testImplementation(project(":libraries:stub-model"))
testImplementation(project(":libraries:test-logging"))
testImplementation("com.zegreatrob.testmints:async")
testImplementation("com.zegreatrob.testmints:minassert")
testImplementation("com.zegreatrob.testmints:minspy")
testImplementation("com.zegreatrob.testmints:standard")
testImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common")
testImplementation("org.jetbrains.kotlin:kotlin-test-common")
testImplementation("org.jetbrains.kotlin:kotlin-test-js")
jsMainImplementation(kotlin("stdlib-js"))
jsMainImplementation(project("components"))
jsMainImplementation(project(":sdk"))
jsMainImplementation(project(":libraries:model"))
jsMainImplementation(project(":libraries:json"))
jsMainImplementation(project(":libraries:action"))
jsMainImplementation(project(":libraries:logging"))
jsMainImplementation(project(":libraries:repository:core"))
jsMainImplementation(project(":libraries:repository:memory"))
jsMainImplementation("com.benasher44:uuid")
jsMainImplementation("com.soywiz.korlibs.klock:klock")
jsMainImplementation("com.zegreatrob.jsmints:minreact")
jsMainImplementation("com.zegreatrob.jsmints:react-data-loader")
jsMainImplementation("com.zegreatrob.testmints:action")
jsMainImplementation("com.zegreatrob.testmints:action-async")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-css")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-react-popper")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-styled-next")
jsMainImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
jsMainImplementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
jsMainImplementation("io.ktor:ktor-client-core")
jsMainImplementation("io.ktor:ktor-client-content-negotiation")
jsMainImplementation("io.ktor:ktor-serialization-kotlinx-json")
jsMainImplementation(npmConstrained("@auth0/auth0-react"))
jsMainImplementation(npmConstrained("blueimp-md5"))
jsMainImplementation(npmConstrained("core-js"))
jsMainImplementation(npmConstrained("css-loader"))
jsMainImplementation(npmConstrained("d3"))
jsMainImplementation(npmConstrained("d3-color"))
jsMainImplementation(npmConstrained("d3-selection"))
jsMainImplementation(npmConstrained("date-fns"))
jsMainImplementation(npmConstrained("drag-drop-webkit-mobile"))
jsMainImplementation(npmConstrained("favicons"))
jsMainImplementation(npmConstrained("file-loader"))
jsMainImplementation(npmConstrained("fitty"))
jsMainImplementation(npmConstrained("html-webpack-harddisk-plugin"))
jsMainImplementation(npmConstrained("html-webpack-plugin"))
jsMainImplementation(npmConstrained("karma"))
jsMainImplementation(npmConstrained("mini-css-extract-plugin"))
jsMainImplementation(npmConstrained("raw-loader"))
jsMainImplementation(npmConstrained("react-dnd"))
jsMainImplementation(npmConstrained("react-dnd-html5-backend"))
jsMainImplementation(npmConstrained("react-flip-toolkit"))
jsMainImplementation(npmConstrained("react-use-websocket"))
jsMainImplementation(npmConstrained("reactjs-popup"))
jsMainImplementation(npmConstrained("style-loader"))
jsMainImplementation(npmConstrained("styled-components"))
jsMainImplementation(npmConstrained("text-loader"))
jsMainImplementation(npmConstrained("url-loader"))
jsMainImplementation(npmConstrained("webpack"))
jsMainImplementation(npmConstrained("webpack-cli"))
jsMainImplementation(npmConstrained("webpack-favicons"))

jsTestImplementation(project(":libraries:stub-model"))
jsTestImplementation(project(":libraries:test-logging"))
jsTestImplementation("com.zegreatrob.testmints:async")
jsTestImplementation("com.zegreatrob.testmints:minassert")
jsTestImplementation("com.zegreatrob.testmints:minspy")
jsTestImplementation("com.zegreatrob.testmints:standard")
jsTestImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common")
jsTestImplementation("org.jetbrains.kotlin:kotlin-test-common")
jsTestImplementation("org.jetbrains.kotlin:kotlin-test-js")
}

val taggerExtension = TaggerExtension.apply(rootProject)
Expand All @@ -119,9 +120,9 @@ tasks {
val cdnBuildOutput = "${project.buildDir.absolutePath}/cdn.json"
val lookupCdnUrls by registering(NodeExec::class) {
setup(project)
dependsOn(cdnLookupConfiguration, "publicPackageJson", ":kotlinNpmInstall")
dependsOn(cdnLookupConfiguration, "jsPublicPackageJson", ":kotlinNpmInstall")
inputs.files(cdnLookupConfiguration)
inputs.files(runtimeClasspath)
inputs.files(jsRuntimeClasspath)
val settingsFile = File(project.projectDir, "cdn.settings.json")
inputs.file(settingsFile)
val settings = ObjectMapper().readTree(settingsFile)
Expand All @@ -148,8 +149,8 @@ tasks {
}
compileProductionExecutableKotlinJs {}

val browserProductionWebpack = named("browserProductionWebpack", KotlinWebpack::class) {
dependsOn(lookupCdnUrls, "processResources")
val browserProductionWebpack = named("jsBrowserProductionWebpack", KotlinWebpack::class) {
dependsOn(lookupCdnUrls, jsProcessResources)
inputs.file(cdnBuildOutput)
inputs.file(File(project.projectDir, "cdn.settings.json"))
outputs.dir(outputDirectory.dir("html"))
Expand Down Expand Up @@ -179,20 +180,20 @@ tasks {
into("${project.buildDir.absolutePath}/additionalResources")
from(provider { (findByPath(":sdk:jsProcessResources") as ProcessResources).destinationDir })
}
named("processResources") {
jsProcessResources {
dependsOn(additionalResources)
}

named("browserTest") {
named("jsBrowserTest") {
outputs.cacheIf { true }
}
}

tasks {
formatKotlinMain {
formatKotlinJsMain {
dependsOn("kspKotlinJs")
}
lintKotlinMain {
lintKotlinJsMain {
dependsOn("kspKotlinJs")
}
withType(FormatTask::class) {
Expand All @@ -207,8 +208,8 @@ artifacts {
add(clientConfiguration.name, tasks.compileProductionExecutableKotlinJs.map { it.destinationDirectory }) {
builtBy(tasks.compileProductionExecutableKotlinJs)
}
val browserProductionWebpack = tasks.named("browserProductionWebpack", KotlinWebpack::class)
val browserDistribution = tasks.named("browserDistribution")
val browserProductionWebpack = tasks.named("jsBrowserProductionWebpack", KotlinWebpack::class)
val browserDistribution = tasks.named("jsBrowserDistribution")
add(clientConfiguration.name, browserProductionWebpack.map { it.outputDirectory }) {
builtBy(browserProductionWebpack, browserDistribution)
}
Expand Down
22 changes: 11 additions & 11 deletions client/components/action/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ kotlin {
}

dependencies {
implementation(project(":libraries:action"))
implementation(project(":libraries:json"))
implementation(project(":libraries:model"))
implementation(project(":libraries:repository:core"))
implementation("com.zegreatrob.testmints:action")
implementation("com.zegreatrob.testmints:action-async")
implementation("com.zegreatrob.testmints:minspy")
implementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
jsMainImplementation(project(":libraries:action"))
jsMainImplementation(project(":libraries:json"))
jsMainImplementation(project(":libraries:model"))
jsMainImplementation(project(":libraries:repository:core"))
jsMainImplementation("com.zegreatrob.testmints:action")
jsMainImplementation("com.zegreatrob.testmints:action-async")
jsMainImplementation("com.zegreatrob.testmints:minspy")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")

testImplementation(project(":libraries:stub-model"))
testImplementation(project(":libraries:test-logging"))
testImplementation("com.zegreatrob.testmints:async")
jsTestImplementation(project(":libraries:stub-model"))
jsTestImplementation(project(":libraries:test-logging"))
jsTestImplementation("com.zegreatrob.testmints:async")
}
64 changes: 32 additions & 32 deletions client/components/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ kotlin {
}

kotlin {
sourceSets.main {
sourceSets.jsMain {
kotlin.srcDir("build/generated/ksp/js/main/kotlin")
}
sourceSets.test {
sourceSets.jsTest {
kotlin.srcDir("build/generated/ksp/js/test/kotlin")
}
}

tasks {
formatKotlinMain {
formatKotlinJsMain {
dependsOn("kspKotlinJs")
}
lintKotlinMain {
lintKotlinJsMain {
dependsOn("kspKotlinJs")
}
withType(FormatTask::class) {
Expand All @@ -42,33 +42,33 @@ tasks {
}

dependencies {
implementation(project("action"))
implementation(project(":libraries:action"))
implementation(project(":libraries:json"))
implementation(project(":libraries:model"))
implementation(project(":libraries:repository:core"))
implementation("com.zegreatrob.jsmints:minreact")
implementation("com.zegreatrob.jsmints:react-data-loader")
implementation("com.zegreatrob.testmints:action")
implementation("com.zegreatrob.testmints:action-async")
implementation("com.zegreatrob.testmints:minspy")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
implementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation(npmConstrained("react-use-websocket"))
implementation(npmConstrained("fitty"))
implementation(npmConstrained("blueimp-md5"))
implementation(npmConstrained("date-fns"))
implementation(npmConstrained("react-dnd"))
implementation(npmConstrained("react-dnd-html5-backend"))
implementation(npmConstrained("html2canvas"))
jsMainImplementation(project("action"))
jsMainImplementation(project(":libraries:action"))
jsMainImplementation(project(":libraries:json"))
jsMainImplementation(project(":libraries:model"))
jsMainImplementation(project(":libraries:repository:core"))
jsMainImplementation("com.zegreatrob.jsmints:minreact")
jsMainImplementation("com.zegreatrob.jsmints:react-data-loader")
jsMainImplementation("com.zegreatrob.testmints:action")
jsMainImplementation("com.zegreatrob.testmints:action-async")
jsMainImplementation("com.zegreatrob.testmints:minspy")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-react")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
jsMainImplementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
jsMainImplementation(npmConstrained("react-use-websocket"))
jsMainImplementation(npmConstrained("fitty"))
jsMainImplementation(npmConstrained("blueimp-md5"))
jsMainImplementation(npmConstrained("date-fns"))
jsMainImplementation(npmConstrained("react-dnd"))
jsMainImplementation(npmConstrained("react-dnd-html5-backend"))
jsMainImplementation(npmConstrained("html2canvas"))

testImplementation(project(":libraries:test-react"))
testImplementation(project(":libraries:stub-model"))
testImplementation(project(":libraries:test-logging"))
testImplementation("com.zegreatrob.testmints:async")
testImplementation(npmConstrained("jsdom"))
testImplementation(npmConstrained("global-jsdom"))
jsTestImplementation(project(":libraries:test-react"))
jsTestImplementation(project(":libraries:stub-model"))
jsTestImplementation(project(":libraries:test-logging"))
jsTestImplementation("com.zegreatrob.testmints:async")
jsTestImplementation(npmConstrained("jsdom"))
jsTestImplementation(npmConstrained("global-jsdom"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.zegreatrob.coupling.client.external.react

import web.cssom.ClassName

external interface SimpleStyle {
val className: ClassName
}

operator fun SimpleStyle.get(propertyName: String): ClassName = let {
@Suppress("UNUSED_VARIABLE")
val prop = propertyName
ClassName(js("it[prop]").unsafeCast<String>())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@file:JsModule("react-hotkeys-hook")
@file:Suppress("unused")

package com.zegreatrob.coupling.client.external.reacthotkeyshook

import kotlin.js.Json

external fun useHotkeys(
key: String,
onPress: (keyboardEvent: dynamic, handler: dynamic) -> Unit,
options: Json = definedExternally,
)

external fun useIsHotkeyPressed(): (key: String) -> Boolean
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion coupling-plugins/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org-jlleitschuh-gradle-ktlint = "11.0.0"
com-fasterxml-jackson-core-jackson-databind = "com.fasterxml.jackson.core:jackson-databind:2.15.2"
com-github-ben-manes-gradle-versions-plugin = "com.github.ben-manes:gradle-versions-plugin:0.47.0"
com-soywiz-korlibs-klock = "com.soywiz.korlibs.klock:klock:4.0.8"
com-zegreatrob-jsmints-jsmints-bom = "com.zegreatrob.jsmints:jsmints-bom:4.0.3"
com-zegreatrob-jsmints-jsmints-bom = "com.zegreatrob.jsmints:jsmints-bom:4.2.0"
com-zegreatrob-testmints-testmints-bom = "com.zegreatrob.testmints:testmints-bom:10.0.0"
com-zegreatrob-tools-tools-bom = "com.zegreatrob.tools:tools-bom:0.3.2"
org-ajoberstar-grgit-gradle-plugin = "org.ajoberstar.grgit:org.ajoberstar.grgit.gradle.plugin:5.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.zegreatrob.coupling.plugins
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest

plugins {
kotlin("js")
kotlin("multiplatform")
id("com.zegreatrob.jsmints.plugins.jspackage")
id("com.zegreatrob.jsmints.plugins.ncu")
id("com.zegreatrob.coupling.plugins.versioning")
Expand Down Expand Up @@ -43,7 +43,7 @@ configure<JsConstraintExtension> {
}

dependencies {
implementation(enforcedPlatform(project(":libraries:dependency-bom")))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
jsMainImplementation(enforcedPlatform(project(":libraries:dependency-bom")))
jsMainImplementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
jsMainImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
}
Loading

0 comments on commit 963212d

Please sign in to comment.