-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
47 lines (40 loc) · 1.49 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.3.3"
val todo = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.settings(libraryDependencies += "com.lihaoyi" %%% "upickle" % "3.3.1")
val AkkaVersion = "2.8.5"
val AkkaHttpVersion = "10.5.3"
val copyMainJs = taskKey[Unit]("Copy frontend-fastopt main.js to backend resources")
lazy val backend = project
.dependsOn(todo.jvm)
.settings(
libraryDependencies ++= Seq(
("com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion),
("com.typesafe.akka" %% "akka-stream" % AkkaVersion),
("com.typesafe.akka" %% "akka-http" % AkkaHttpVersion),
"com.lihaoyi" %% "requests" % "0.8.0"
),
copyMainJs := {
val log = streams.value.log
val source = (frontend / Compile / fastOptJS).value.data
val targetDir = (Compile / classDirectory).value
val target = targetDir / "main.js"
IO.copyFile(source, target)
log.info(s"Copied $source to $target")
},
copyMainJs := copyMainJs.dependsOn(frontend / Compile / fastOptJS).value,
(Compile / compile) := (Compile / compile).dependsOn(copyMainJs).value
)
lazy val frontend = project
.dependsOn(todo.js)
.enablePlugins(ScalaJSPlugin)
.settings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client3" %%% "core" % "3.6.2",
"org.scala-js" %%% "scalajs-dom" % "2.2.0"
)
)
lazy val root = project.in(file("."))
.aggregate(backend, frontend)