-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
76 lines (67 loc) · 3.26 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name := "Scala.js miniprogram"
scalaVersion := "3.4.0"
scalacOptions += "-deprecation"
scalacOptions += "-feature"
scalacOptions += "-unchecked"
scalacOptions += "-language:postfixOps"
import com.typesafe.sbt.web._
import Import.WebKeys._
lazy val root = (project in file(".")).aggregate(common, app, images, index)
lazy val facade = (project in file("facade")).enablePlugins(ScalaJSPlugin)
lazy val common = (project in file("common")).enablePlugins(ScalaJSPlugin)
.dependsOn(facade)
.settings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.10.0",
"org.typelevel" %%% "cats-effect-kernel" % "3.5.4",
"org.typelevel" %%% "cats-effect-std" % "3.5.4",
"org.typelevel" %%% "cats-effect" % "3.5.4",
),
webTarget := target.value / ".." / ".." / "target",
Compile / fullOptJS / artifactPath := webTarget.value / (name.value + ".js")
)
lazy val commonSettings = Seq(
Assets / sourceDirectory := baseDirectory.value,
Assets / public := webTarget.value,
Assets / LessKeys.less / resourceManaged := webTarget.value,
Assets / mappings := (Assets / sources / mappings).value,
Assets / includeFilter := new SimpleFileFilter(_.getParent == baseDirectory.value + "/lib") || "*.wxml" || "*.json" ,
Assets / LessKeys.less / includeFilter := "*.less",
Assets / LessKeys.less / excludeFilter := new SimpleFileFilter(_.getAbsolutePath.contains("style")) || "*.wxss",
Assets / LessKeys.less / managedSources := (Assets / sourceDirectory).value.descendantsExcept((Assets / LessKeys.less / includeFilter).value, excludeFilter.value).get,
Assets / LessKeys.sourceMap := true,
Assets / LessKeys.compress := true,
scalaJSUseMainModuleInitializer := true,
webTarget := target.value / ".." / ".." / ".." / "target" / "pages" / name.value,
Compile / fullOptJS / artifactPath := webTarget.value / (name.value + ".js")
)
lazy val componentSettings = Seq(
Assets / sourceDirectory := baseDirectory.value,
Assets / public := webTarget.value,
Assets / includeFilter := "*.js" | "*.json" | "*.wxss" | "*.svg" | "*.wxml" | "*.jpg" | "*.png",
webTarget := target.value / ".." / ".." / ".." / "target" / "components" / name.value
)
lazy val app = (project in file("app"))
.enablePlugins(SbtWeb,ScalaJSPlugin,BuildInfoPlugin,GitVersioning)
.dependsOn(facade)
.settings(
commonSettings,
webTarget := target.value / ".." / ".." / "target",
version := "1.0.0",
buildInfoKeys ++= Seq[BuildInfoKey](
git.gitHeadCommit,
"wxrequest" -> sys.env.get("WX_REQUEST").getOrElse("weapp.darkanchor.com"),
"wxdownload" -> sys.env.get("WX_DOWNLOAD").getOrElse("cdn.darkanchor.com")
),
buildInfoPackage := "build"
)
lazy val images = (project in file("images"))
.enablePlugins(SbtWeb)
.settings(
Assets / sourceDirectory := baseDirectory.value,
Assets / public := webTarget.value,
Assets / includeFilter := "*.png" | "*.jpg",
webTarget := target.value / ".." / ".." / "target" / name.value
)
lazy val index = (project in file("pages/index")).enablePlugins(SbtWeb,ScalaJSPlugin).dependsOn(facade).settings(commonSettings)