-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
85 lines (72 loc) · 2.35 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
76
77
78
79
80
81
82
83
84
85
import org.scalajs.linker.interface.ModuleSplitStyle
import Settings.Libraries._
import scala.sys.process._
val reactJS = "17.0.2"
ThisBuild / Test / bspEnabled := false
ThisBuild / ScalafixConfig / bspEnabled.withRank(KeyRanks.Invisible) := false
addCommandAlias(
"fixImports",
"; scalafix OrganizeImports; Test/scalafix OrganizeImports"
)
addCommandAlias(
"fix",
"; headerCreateAll; fixImports; scalafmtAll; fixCSS"
)
ThisBuild / description := "Lucuma-Seed"
Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / resolvers += Resolver.sonatypeRepo("snapshots")
ThisBuild / scalaVersion := "3.2.0"
ThisBuild / crossScalaVersions := Seq("3.2.0")
ThisBuild / scalacOptions ++= Seq(
"-language:implicitConversions"
)
// Libs common to JVM and JS projects.
lazy val commonLibSettings = Seq(
libraryDependencies ++=
Cats.value ++
CatsEffect.value ++
FS2.value ++
Monocle.value
)
lazy val commonSettings =
lucumaGlobalSettings ++
commonLibSettings ++
Seq(scalacOptions ~= (_.filterNot(Set("-Vtype-diffs"))))
lazy val esModule = Seq(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) },
Compile / fastLinkJS / scalaJSLinkerConfig ~= { _.withSourceMap(false) },
Compile / fullLinkJS / scalaJSLinkerConfig ~= { _.withSourceMap(false) },
Compile / fastLinkJS / scalaJSLinkerConfig ~= (_.withModuleSplitStyle(
// If the browser is too slow for the SmallModulesFor switch to ModuleSplitStyle.FewestModules
ModuleSplitStyle.SmallModulesFor(List("explore"))
)),
Compile / fullLinkJS / scalaJSLinkerConfig ~= (_.withModuleSplitStyle(
ModuleSplitStyle.FewestModules
))
)
val lintCSS = TaskKey[Unit]("lintCSS", "Lint CSS files")
lintCSS := {
if (("npm run lint" !) != 0)
throw new Exception("Error in CSS format")
}
val fixCSS = TaskKey[Unit]("fixCSS", "Fix CSS files")
fixCSS := {
if (("npm run fix" !) != 0)
throw new Exception("Error in CSS fix")
}
lazy val root = tlCrossRootProject
.aggregate(web)
lazy val web: Project = project
.in(file("web"))
.settings(commonSettings: _*)
.settings(esModule: _*)
.enablePlugins(ScalaJSPlugin)
.settings(
Test / test := {},
coverageEnabled := false,
libraryDependencies ++=
Crystal.value ++
Log4Cats.value ++
ReactCommon.value ++
ScalaJSReact.value
)