Skip to content

Commit b14efeb

Browse files
committed
[WEB] Init web project
1 parent b51a3fd commit b14efeb

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ rootProject.name = "kmp-showcase"
1919
include(":androidApp")
2020
include(":shared")
2121
include(":server")
22+
include(":web")
2223

2324
enableFeaturePreview("GRADLE_METADATA")
2425

shared/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ kotlin {
2424
}
2525
}
2626
}
27+
js {
28+
browser {
29+
}
30+
}
31+
2732
sourceSets {
2833
all {
2934
languageSettings.apply {
@@ -83,6 +88,13 @@ kotlin {
8388
}
8489
}
8590
val iosTest by getting
91+
92+
val jsMain by getting {
93+
dependencies {
94+
api(Dependencies.Koin.core)
95+
api(Dependencies.Coroutines.common)
96+
}
97+
}
8698
}
8799
}
88100
android {

web/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
kotlin("js")
3+
}
4+
5+
dependencies {
6+
implementation(kotlin("stdlib-js"))
7+
implementation(project(":shared"))
8+
}
9+
10+
11+
kotlin {
12+
js {
13+
useCommonJs()
14+
browser {
15+
runTask {
16+
outputFileName = "app.js"
17+
}
18+
}
19+
binaries.executable()
20+
}
21+
}

web/src/main/kotlin/main.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import kotlinx.browser.document
2+
3+
fun main() {
4+
document.body?.textContent = "Welcome"
5+
}

web/src/main/resources/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Kotlin Multiplatform Showcase</title>
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script src="app.js"></script>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)