without it app starts in same jvm and we're told that Ctrl+C will not always kill the Ember server: https://typelevel.org/cats-effect/docs/2.x/datatypes/ioapp WARNING: If you run your IOApp program from sbt, you may observe cancellation and resource releasing is not happening. This is due to sbt, by default, running programs in the same JVM as sbt, so when your program is canceled sbt avoids stopping its own JVM. To properly allow cancellation, ensure your progam is forked into its own JVM via a setting like fork := true in your sbt configuration.
82 lines
2.7 KiB
Scala
82 lines
2.7 KiB
Scala
import org.scalajs.linker.interface.ModuleSplitStyle
|
|
|
|
lazy val commonSettings = Seq(
|
|
scalaVersion := "3.2.0"
|
|
)
|
|
|
|
lazy val frontend = project
|
|
.in(file("frontend"))
|
|
.enablePlugins(ScalaJSPlugin) // Enable the Scala.js plugin in this project
|
|
.settings(
|
|
commonSettings,
|
|
|
|
// Tell Scala.js that this is an application with a main method
|
|
scalaJSUseMainModuleInitializer := true,
|
|
|
|
/* Configure Scala.js to emit modules in the optimal way to
|
|
* connect to Vite's incremental reload.
|
|
* - emit ECMAScript modules
|
|
* - emit as many small modules as possible for classes in the "livechart" package
|
|
* - emit as few (large) modules as possible for all other classes
|
|
* (in particular, for the standard library)
|
|
*/
|
|
scalaJSLinkerConfig ~= {
|
|
_.withModuleKind(ModuleKind.ESModule)
|
|
.withModuleSplitStyle(
|
|
ModuleSplitStyle.SmallModulesFor(List("industries.sunshine.planningpoker"))
|
|
)
|
|
},
|
|
|
|
/* Depend on the scalajs-dom library.
|
|
* It provides static types for the browser DOM APIs.
|
|
*/
|
|
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
|
|
libraryDependencies += "com.raquo" %%% "laminar" % "15.0.1",
|
|
libraryDependencies += "io.laminext" %%% "websocket-circe" % "0.15.0",
|
|
libraryDependencies += "io.laminext" %%% "fetch" % "0.15.0"
|
|
)
|
|
.dependsOn(common.js)
|
|
|
|
val circeVersion = "0.14.5"
|
|
val http4sVersion = "1.0.0-M39"
|
|
|
|
lazy val backend = project
|
|
.in(file("backend"))
|
|
.settings(
|
|
commonSettings,
|
|
fork := true,
|
|
libraryDependencies ++= Seq(
|
|
"org.http4s" %% "http4s-ember-client" % http4sVersion,
|
|
"org.http4s" %% "http4s-ember-server" % http4sVersion,
|
|
"org.http4s" %% "http4s-dsl" % http4sVersion,
|
|
"org.http4s" %% "http4s-circe" % http4sVersion
|
|
),
|
|
// available for 2.12, 2.13, 3.2
|
|
libraryDependencies += "co.fs2" %% "fs2-core" % "3.6.1",
|
|
libraryDependencies += "org.typelevel" %% "cats-core" % "2.9.0",
|
|
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.4.9",
|
|
assembly / mainClass := Some("industries.sunshine.planningpoker.BackendApp"),
|
|
)
|
|
.dependsOn(common.jvm)
|
|
|
|
lazy val common = crossProject(JSPlatform, JVMPlatform)
|
|
.crossType(CrossType.Pure)
|
|
.in(file("common"))
|
|
.settings(
|
|
commonSettings,
|
|
libraryDependencies ++= Seq(
|
|
"io.circe" %%% "circe-core",
|
|
"io.circe" %%% "circe-generic",
|
|
"io.circe" %%% "circe-parser"
|
|
).map(_ % circeVersion)
|
|
)
|
|
|
|
lazy val commonJVM = common.jvm
|
|
lazy val commonJS = common.js.settings(
|
|
// scalaJS specific settings
|
|
scalaJSLinkerConfig ~= {
|
|
_.withModuleKind(ModuleKind.ESModule)
|
|
.withModuleSplitStyle(ModuleSplitStyle.SmallModulesFor(List("industries.sunshine.planningpoker")))
|
|
}
|
|
)
|