From 7f70345a489b568e5e2cf30a5c6b18326836eedb Mon Sep 17 00:00:00 2001 From: johannes karoff Date: Mon, 13 Nov 2023 00:30:01 +0100 Subject: [PATCH] scala 3 prep (#253) --- build.sbt | 16 ++++++++-------- .../src/main/scala/helper/EventSubscriber.scala | 2 +- clientWeb/src/main/scala/Auth.scala | 2 +- .../src/main/scala/Handler.scala | 2 +- project/Deps.scala | 8 ++++---- project/plugins.sbt | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index e6cfa49..c50a8bc 100644 --- a/build.sbt +++ b/build.sbt @@ -26,23 +26,23 @@ inThisBuild( ), ) +val isDotty = Def.setting(CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)) + lazy val commonSettings = Seq( - addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full), libraryDependencies ++= Deps.scalatest.value % Test :: Nil, scalacOptions --= Seq("-Wconf:any&src=src_managed/.*"), + + libraryDependencies ++= (if (isDotty.value) Nil + else + Seq( + compilerPlugin(("org.typelevel" %% "kind-projector" % "0.13.2").cross(CrossVersion.full)), + )), ) lazy val jsSettings = Seq( useYarn := true, - scalacOptions += { - val githubRepo = "fun-stack/fun-stack-scala" - val local = baseDirectory.value.toURI - val subProjectDir = baseDirectory.value.getName - val remote = s"https://raw.githubusercontent.com/${githubRepo}/${git.gitHeadCommit.value.get}" - s"-P:scalajs:mapSourceURI:$local->$remote/${subProjectDir}/" - }, ) lazy val core = project diff --git a/clientCore/src/main/scala/helper/EventSubscriber.scala b/clientCore/src/main/scala/helper/EventSubscriber.scala index 04b1902..84b8866 100644 --- a/clientCore/src/main/scala/helper/EventSubscriber.scala +++ b/clientCore/src/main/scala/helper/EventSubscriber.scala @@ -18,7 +18,7 @@ final class EventSubscriber(send: String => Unit) extends IncidentHandler[Subscr send(subscribePayload(subscriptionKey)) private def doUnsubscribe(subscriptionKey: String): Unit = { - subscriptionByKey.remove(subscriptionKey): Unit + val _ = subscriptionByKey.remove(subscriptionKey) send(unsubscribePayload(subscriptionKey)) } diff --git a/clientWeb/src/main/scala/Auth.scala b/clientWeb/src/main/scala/Auth.scala index 28984f9..391ebec 100644 --- a/clientWeb/src/main/scala/Auth.scala +++ b/clientWeb/src/main/scala/Auth.scala @@ -54,7 +54,7 @@ class Auth(val auth: AuthAppConfig, website: WebsiteAppConfig) extends funstack. if (shouldRedirect && check) { sessionStorage.setItem(StorageKey.redirectFlag, "") // needs to be in a timeout, otherwise messes with the history stack - dom.window.setTimeout(() => dom.window.location.href = authRequests.loginUrl, 0): Unit + val _ = dom.window.setTimeout(() => dom.window.location.href = authRequests.loginUrl, 0) true } else false diff --git a/lambdaWsEventAuthorizer/src/main/scala/Handler.scala b/lambdaWsEventAuthorizer/src/main/scala/Handler.scala index f47ac2c..2db1759 100644 --- a/lambdaWsEventAuthorizer/src/main/scala/Handler.scala +++ b/lambdaWsEventAuthorizer/src/main/scala/Handler.scala @@ -111,7 +111,7 @@ object Handler { val router = routerf(request) val result: Future[Boolean] = ServerMessageSerdes.deserialize(record.Sns.Message) match { - case Right(n: Notification[SubscriptionEvent]) => + case Right(n: Notification[SubscriptionEvent@unchecked]) => val (a, b, arg) = n.event.subscriptionKey.split("/") match { case Array(a, b) => (a, b, "") case Array(a, b, arg) => (a, b, arg) diff --git a/project/Deps.scala b/project/Deps.scala index 5da7343..1e795dd 100644 --- a/project/Deps.scala +++ b/project/Deps.scala @@ -25,7 +25,7 @@ object Deps { // websocket connecitivity val mycelium = new { - val version = "0.3.1" + val version = "0.4.0" val core = s("com.github.cornerman" %%% "mycelium-core" % version) val clientJs = s("com.github.cornerman" %%% "mycelium-client-js" % version) } @@ -40,7 +40,7 @@ object Deps { } val tapir = new { - val version = "1.8.0" + val version = "1.9.0" val core = s("com.softwaremill.sttp.tapir" %%% "tapir-core" % version) val lambda = s("com.softwaremill.sttp.tapir" %%% "tapir-aws-lambda" % version) val circe = s("com.softwaremill.sttp.tapir" %%% "tapir-json-circe" % version) @@ -51,7 +51,7 @@ object Deps { // aws-sdk-js val awsSdkJS = new { - val version = s"0.32.0-v${NpmDeps.awsSdkVersion}" + val version = s"0.33.0-v${NpmDeps.awsSdkVersion}" val lambda = s("net.exoego" %%% "aws-sdk-scalajs-facade-lambda" % version) val dynamodb = s("net.exoego" %%% "aws-sdk-scalajs-facade-dynamodb" % version) val apigatewaymanagementapi = s("net.exoego" %%% "aws-sdk-scalajs-facade-apigatewaymanagementapi" % version) @@ -62,7 +62,7 @@ object Deps { } object NpmDeps { - val awsSdkVersion = "2.798.0" + val awsSdkVersion = "2.892.0" val awsSdk = "aws-sdk" -> awsSdkVersion val jwtDecode = "jwt-decode" -> "3.1.2" val nodeFetch = "node-fetch" -> "2.6.7" diff --git a/project/plugins.sbt b/project/plugins.sbt index f62ba9b..6fa0e06 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,6 +7,6 @@ addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0 // sane scalac options addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.0") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") - addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") + +addSbtPlugin("com.thoughtworks.sbt-scala-js-map" % "sbt-scala-js-map" % "4.1.1")