import org.scalajs.linker.interface.ModuleSplitStyle lazy val commonSettings = Seq( version := "0.1.1", 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-circe" % "0.15.0", libraryDependencies += "io.laminext" %%% "validation-cats" % "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")) ) } )