Remove react from sample, force version 4 of webpack
This commit is contained in:
parent
d6945979a9
commit
3a7e16e7e7
@ -83,21 +83,11 @@ object Deps {
|
|||||||
val ktorClientSerialization = "io.ktor:ktor-client-serialization-js:${Versions.ktor}"
|
val ktorClientSerialization = "io.ktor:ktor-client-serialization-js:${Versions.ktor}"
|
||||||
val ktorClientWebSockets = "io.ktor:ktor-client-websockets-js:${Versions.ktor}"
|
val ktorClientWebSockets = "io.ktor:ktor-client-websockets-js:${Versions.ktor}"
|
||||||
|
|
||||||
object React {
|
|
||||||
val react = "org.jetbrains.kotlin-wrappers:kotlin-react:${JsVersions.react}"
|
|
||||||
val reactDom = "org.jetbrains.kotlin-wrappers:kotlin-react-dom:${JsVersions.react}"
|
|
||||||
val styled = "org.jetbrains.kotlin-wrappers:kotlin-styled:${JsVersions.styled}"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
object Npm {
|
object Npm {
|
||||||
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.8")
|
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.9")
|
||||||
//val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz")
|
//val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz")
|
||||||
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.8")
|
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.9")
|
||||||
val reactPair = Pair("react", JsVersions.reactNpm)
|
|
||||||
val reactDomPair = Pair("react-dom", JsVersions.reactNpm)
|
|
||||||
val styledComponentsPair = Pair("styled-components", JsVersions.styledNpm)
|
|
||||||
val inlineStylePrefixesPair = Pair("inline-style-prefixer", "6.0.0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,3 +24,5 @@ kotlin.native.disableCompilerDaemon=true
|
|||||||
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=4096m
|
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=4096m
|
||||||
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
|
kotlin.js.webpack.major.version=4
|
||||||
|
@ -60,28 +60,28 @@ kotlin {
|
|||||||
android()
|
android()
|
||||||
runningOnLinuxx86_64 {
|
runningOnLinuxx86_64 {
|
||||||
jvm()
|
jvm()
|
||||||
// js(IR) {
|
js(IR) {
|
||||||
// browser {
|
browser {
|
||||||
// webpackTask {
|
webpackTask {
|
||||||
//
|
|
||||||
// }
|
|
||||||
// testTask {
|
|
||||||
// useKarma {
|
|
||||||
// useChrome()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// nodejs {
|
|
||||||
// testTask {
|
|
||||||
// useMocha() {
|
|
||||||
// timeout = "10s"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// binaries.executable()
|
}
|
||||||
|
testTask {
|
||||||
|
useKarma {
|
||||||
|
useChrome()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodejs {
|
||||||
|
testTask {
|
||||||
|
useMocha() {
|
||||||
|
timeout = "10s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// }
|
binaries.executable()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
linuxX64("linux") {
|
linuxX64("linux") {
|
||||||
@ -284,30 +284,18 @@ kotlin {
|
|||||||
implementation(kotlin(Deps.Jvm.reflection))
|
implementation(kotlin(Deps.Jvm.reflection))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// val jsMain by getting {
|
val jsMain by getting {
|
||||||
// dependencies {
|
dependencies {
|
||||||
// implementation(kotlin(Deps.Js.stdLib))
|
implementation(kotlin(Deps.Js.stdLib))
|
||||||
// implementation(Deps.Js.coroutines)
|
implementation(Deps.Js.coroutines)
|
||||||
//
|
|
||||||
//
|
}
|
||||||
// // React
|
}
|
||||||
// implementation(Deps.Js.React.react)
|
val jsTest by getting {
|
||||||
// implementation(Deps.Js.React.reactDom)
|
dependencies {
|
||||||
//// implementation(npm(Deps.Js.Npm.reactPair.first, Deps.Js.Npm.reactPair.second))
|
implementation(kotlin(Deps.Js.test))
|
||||||
//// implementation(npm(Deps.Js.Npm.reactDomPair.first, Deps.Js.Npm.reactDomPair.second))
|
}
|
||||||
//
|
}
|
||||||
// // Styled
|
|
||||||
// implementation(Deps.Js.React.styled)
|
|
||||||
//// implementation(npm(Deps.Js.Npm.styledComponentsPair.first, Deps.Js.Npm.styledComponentsPair.second))
|
|
||||||
//// implementation(npm(Deps.Js.Npm.inlineStylePrefixesPair.first, Deps.Js.Npm.inlineStylePrefixesPair.second))
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// val jsTest by getting {
|
|
||||||
// dependencies {
|
|
||||||
// implementation(kotlin(Deps.Js.test))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
val linuxMain by getting {
|
val linuxMain by getting {
|
||||||
dependsOn(nativeMain)
|
dependsOn(nativeMain)
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
import com.ionspin.kotlin.crypto.hash.Hash
|
|
||||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
|
||||||
import com.ionspin.kotlin.crypto.util.toHexString
|
|
||||||
import react.RBuilder
|
|
||||||
import react.RComponent
|
|
||||||
import react.RProps
|
|
||||||
import react.RState
|
|
||||||
import react.ReactElement
|
|
||||||
import react.dom.h1
|
|
||||||
|
|
||||||
external interface RAppState : RState {
|
|
||||||
var currentState: String
|
|
||||||
}
|
|
||||||
|
|
||||||
external interface RAppProps : RProps {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class App(props: RAppProps) : RComponent<RAppProps, RAppState>(props) {
|
|
||||||
override fun RBuilder.render() {
|
|
||||||
val hash = Hash.sha512("123".encodeToUByteArray())
|
|
||||||
h1 {
|
|
||||||
+"Hash (SHA512) of 123: ${hash.toHexString()}"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun RBuilder.app(handler: RAppProps.() -> Unit): ReactElement {
|
|
||||||
return child(App::class) {
|
|
||||||
this.attrs(handler)
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,28 +2,13 @@
|
|||||||
|
|
||||||
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
||||||
import com.ionspin.kotlin.crypto.hash.Hash
|
import com.ionspin.kotlin.crypto.hash.Hash
|
||||||
import com.ionspin.kotlin.crypto.util.LibsodiumRandom
|
|
||||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||||
import com.ionspin.kotlin.crypto.util.toHexString
|
import com.ionspin.kotlin.crypto.util.toHexString
|
||||||
import react.dom.render
|
|
||||||
import kotlinx.browser.document
|
|
||||||
import kotlinx.browser.window
|
|
||||||
|
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
val runningOnNode = jsTypeOf(window) == "undefined"
|
|
||||||
// if (!runningOnNode) = runTest {
|
|
||||||
LibsodiumInitializer.initializeWithCallback {
|
LibsodiumInitializer.initializeWithCallback {
|
||||||
render(document.getElementById("root")) {
|
val hash = Hash.sha512("123".encodeToUByteArray())
|
||||||
app {
|
println("Hash (SHA512) of 123: ${hash.toHexString()}")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// } else = runTest {
|
|
||||||
// LibsodiumInitializer.initializeWithCallback {
|
|
||||||
// val hash = Hash.sha512("123".encodeToUByteArray())
|
|
||||||
// println("Hash (SHA512) of 123: ${hash.toHexString()}")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user