From 15afabf83e3dc339a6da0d3d3a4e64429a7d88d9 Mon Sep 17 00:00:00 2001 From: Sebastian Aigner Date: Thu, 2 Apr 2020 20:16:09 +0800 Subject: [PATCH] Update kotlin and reactjs. Update code to 1.4 Update Gradle to 6.6 Update dependency versions to 1.4-compatible libraries Add explicit versions to NPM dependencies Use new Gradle DSL for configuring Kotlin/JS Move kotlin.browser to kotlinx.browser Update build file --- build.gradle.kts | 38 ++++++++++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/kotlin/Main.kt | 2 +- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 384f5d5..b82a6c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.jetbrains.kotlin.js") version "1.3.70-eap-184" + id("org.jetbrains.kotlin.js") version "1.4.31" } group = "org.example" @@ -12,28 +12,40 @@ repositories { jcenter() } +kotlin { + js { + browser { + commonWebpackConfig { + cssSupport.enabled = true + } + } + binaries.executable() + } +} + dependencies { - implementation(kotlin("stdlib-js")) //React, React DOM + Wrappers (chapter 3) - implementation("org.jetbrains:kotlin-react:16.9.0-pre.89-kotlin-1.3.60") - implementation("org.jetbrains:kotlin-react-dom:16.9.0-pre.89-kotlin-1.3.60") - implementation(npm("react", "16.12.0")) - implementation(npm("react-dom", "16.12.0")) + implementation("org.jetbrains:kotlin-react:17.0.1-pre.148-kotlin-1.4.21") + implementation("org.jetbrains:kotlin-react-dom:17.0.1-pre.148-kotlin-1.4.21") + implementation(npm("react", "17.0.1")) + implementation(npm("react-dom", "17.0.1")) //Kotlin Styled (chapter 3) - implementation("org.jetbrains:kotlin-styled:1.0.0-pre.90-kotlin-1.3.61") - implementation(npm("styled-components")) - implementation(npm("inline-style-prefixer")) + implementation("org.jetbrains:kotlin-styled:5.2.1-pre.148-kotlin-1.4.21") + implementation(npm("styled-components", "~5.2.1")) //Video Player (chapter 7) - implementation(npm("react-player")) + implementation(npm("react-youtube-lite", "1.0.1")) //Share Buttons (chapter 7) - implementation(npm("react-share")) + implementation(npm("react-share", "~4.2.1")) //Coroutines (chapter 8) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.3") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3") } -kotlin.target.browser { } \ No newline at end of file +// Heroku Deployment (chapter 9) +tasks.register("stage") { + dependsOn("build") +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ba94df8..6c9a224 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index efa3a07..15f7cf0 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,4 +1,4 @@ -import kotlin.browser.document +import kotlinx.browser.document fun main() { document.bgColor = "blue"