lyngweb: add Maven publishing configuration, range iterability tests, and minor editor refinements

This commit is contained in:
Sergey Chernov 2025-11-22 01:22:39 +01:00
parent faead76688
commit f4375ad627
4 changed files with 41 additions and 7 deletions

View File

@ -3536,4 +3536,12 @@ class ScriptTest {
}
}
@Test
fun testRangeIsIterable() = runTest {
eval("""
val r = 1..10
assert( r is Iterable )
""".trimIndent())
}
}

View File

@ -23,8 +23,13 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
id("org.jetbrains.kotlin.plugin.compose") version "2.2.21"
id("org.jetbrains.compose") version "1.9.3"
`maven-publish`
}
group = "net.sergeych"
version = "0.0.1-SNAPSHOT"
kotlin {
js(IR) {
browser {
@ -49,3 +54,21 @@ kotlin {
}
}
}
publishing {
val mavenToken by lazy {
File("${System.getProperty("user.home")}/.gitea_token").readText()
}
repositories {
maven {
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = mavenToken
}
url = uri("https://gitea.sergeych.net/api/packages/SergeychWorks/maven")
authentication {
create("Authorization", HttpHeaderAuthentication::class)
}
}
}
}

View File

@ -74,9 +74,11 @@ fun HomePage() {
// Code sample
val code = """
// Create, transform, and verify — the Lyng way
val data = 1..5
val evens = data.filter { it % 2 == 0 }.map { it * it }
assertEquals([4, 16], evens)
import lyng.stdlib
val data = 1..5 // or [1,2,3,4,5]
val evens2 = data.filter { it % 2 == 0 }.map { it * it }
assertEquals([4, 16], evens2)
>>> void
""".trimIndent()

View File

@ -30,10 +30,10 @@ fun TryLyngPage() {
"""
// Welcome to Lyng! Edit and run.
// Try changing the data and press Ctrl+Enter or click Run.
import lyng.stdlib
val data = 1..5
val evens = data.filter { it % 2 == 0 }.map { it * it }
evens
val data = 1..5 // or [1, 2, 3, 4, 5]
data.filter { it % 2 == 0 }.map { it * it }
""".trimIndent()
)
}
@ -47,6 +47,7 @@ fun TryLyngPage() {
running = true
output = null
error = null
extendedError = null
scope.launch {
// keep this outside try so we can show partial prints if evaluation fails
val printed = StringBuilder()