def commonSettings = Seq( scalaVersion := "2.13.3", version := "0.1.0", ) lazy val server: Project = (project in file("server")) .settings(commonSettings) .settings( scalaJSProjects := Seq(client), pipelineStages in Assets := Seq(scalaJSPipeline), compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value, javaOptions in Test += "-Dconfig.file=conf/testing.conf", libraryDependencies ++= Seq( guice, "codes.reactive" %% "scala-time" % "0.4.2", // OAuth "com.nulab-inc" %% "scala-oauth2-core" % "1.5.0", "com.nulab-inc" %% "play2-oauth2-provider" % "1.5.0", "com.github.t3hnar" %% "scala-bcrypt" % "4.3.0", // Client Libraries "com.vmunier" %% "scalajs-scripts" % "1.1.4", "org.webjars" %% "webjars-play" % "2.8.0", "org.webjars" % "jquery" % "3.4.1", "org.webjars" % "bootstrap" % "4.4.1-1", // Mogno + ORM "org.mongodb.scala" %% "mongo-scala-driver" % "4.1.0", // Testing specs2 % Test, "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test ) ) .enablePlugins(PlayScala) .dependsOn(sharedJvm) .dependsOn(fdcJvm) import com.tflucke.webroutes.endpoints.PlayEndpointFile lazy val client = (project in file("client")) .settings(commonSettings) .settings( scalaJSUseMainModuleInitializer := true, Compile / apiDefinitions += PlayEndpointFile(server), libraryDependencies += "org.querki" %%% "jquery-facade" % "2.0", libraryDependencies += "in.nvilla" %%% "monadic-html" % "0.4.1", libraryDependencies += "in.nvilla" %%% "monadic-rx-cats" % "0.4.1", // libraryDependencies += "com.thoughtworks.binding" %%% "binding" % "12.0.1+8-8f3c7f31", // libraryDependencies += "org.lrng.binding" %%% "html" % "1.0.3", // libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % "2.0.0-M2", scalacOptions ++= { import Ordering.Implicits._ if (VersionNumber(scalaVersion.value).numbers >= Seq(2L, 13L)) Seq("-Ymacro-annotations") else Nil } ) .enablePlugins(ScalaJSPlugin, RestRPC, ScalaJSWeb) .dependsOn(sharedJs) .dependsOn(fdcJs) lazy val shared = crossProject(JSPlatform, JVMPlatform) .in(file("shared")) .settings(commonSettings) .settings( libraryDependencies += "com.typesafe.play" %%% "play-json" % "2.9.2", // Temporary workaround due to mongodb limitations libraryDependencies += "org.julienrf" %%% "play-json-derived-codecs" % "8.0.0" ) .jsConfigure(_ enablePlugins ScalaJSWeb) lazy val sharedJvm = shared.jvm.dependsOn(fdcJvm).settings( libraryDependencies += "org.mongodb.scala" %% "mongo-scala-bson" % "4.1.0" ) lazy val sharedJs = shared.js.dependsOn(fdcJs) lazy val fdc = crossProject(JSPlatform, JVMPlatform) .in(file("fdc")) .settings(commonSettings) .settings( libraryDependencies += "com.typesafe.play" %% "play-json" % "2.9.2", libraryDependencies += "com.tflucke" %%% "rest-rpc" % "0.3.1" ) lazy val fdcJs = fdc.js lazy val fdcJvm = fdc.jvm // loads the server project at sbt startup onLoad in Global := (onLoad in Global).value.andThen( state => "project server" :: state )