You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

4 years ago
  1. lazy val server = (project in file("server"))
  2. .settings(commonSettings)
  3. .settings(
  4. scalaJSProjects := Seq(client),
  5. pipelineStages in Assets := Seq(scalaJSPipeline),
  6. pipelineStages := Seq(digest, gzip),
  7. // triggers scalaJSPipeline when using compile or continuous compilation
  8. compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value,
  9. libraryDependencies ++= Seq(
  10. "com.vmunier" %% "scalajs-scripts" % "1.1.4",
  11. guice,
  12. specs2 % Test
  13. ),
  14. // Compile the project before generating Eclipse files, so that generated .scala or .class files for views and routes are present
  15. EclipseKeys.preTasks := Seq(compile in Compile)
  16. )
  17. .enablePlugins(PlayScala)
  18. // .enablePlugins(SbtWeb)
  19. .enablePlugins(WebScalaJSBundlerPlugin)
  20. .dependsOn(sharedJvm)
  21. lazy val client = (project in file("client"))
  22. .settings(commonSettings)
  23. .settings(
  24. scalaJSUseMainModuleInitializer := true,
  25. libraryDependencies ++= Seq(
  26. "org.scala-js" %%% "scalajs-dom" % "1.0.0",
  27. "com.github.japgolly.scalajs-react" %%% "core" % "1.7.0",
  28. "com.github.japgolly.scalajs-react" %%% "extra" % "1.7.0",
  29. // "com.github.japgolly.scalajs-react" %%% "test" % "1.7.0",
  30. ),
  31. scalacOptions ++= Seq("-Ymacro-annotations","-deprecation"),
  32. useYarn := true,
  33. stFlavour := Flavour.Japgolly,
  34. Compile / npmDependencies ++= Seq(
  35. "react" -> "16.13.1",
  36. "react-dom" -> "16.13.1",
  37. "@types/react" -> "16.9.34",
  38. "@types/react-dom" -> "16.9.6"
  39. )
  40. )
  41. .enablePlugins(ScalaJSPlugin)
  42. .enablePlugins(ScalaJSBundlerPlugin)
  43. .enablePlugins(ScalablyTypedConverterPlugin)
  44. .dependsOn(sharedJs)
  45. lazy val shared = crossProject(JSPlatform, JVMPlatform)
  46. .crossType(CrossType.Pure)
  47. .in(file("shared"))
  48. .settings(commonSettings)
  49. .jsConfigure(_.enablePlugins(ScalaJSWeb))
  50. lazy val sharedJvm = shared.jvm
  51. lazy val sharedJs = shared.js
  52. lazy val commonSettings = Seq(
  53. scalaVersion := "2.13.2",
  54. organization := "com.example"
  55. )