-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
140 lines (115 loc) · 4.67 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import scala.sys.process.stringToProcess
import _root_.io.github.nafg.mergify.dsl._
import _root_.io.github.nafg.scalacoptions._
def myScalacOptions(version: String) =
ScalacOptions.all(version)(
(opts: options.Common) => opts.feature ++ opts.deprecation,
)
inThisBuild(
List(
organization := "io.github.nafg.css-dsl",
scalaVersion := "3.3.4",
crossScalaVersions := Seq("2.13.15", scalaVersion.value),
scalacOptions ++= myScalacOptions(scalaVersion.value),
versionScheme := Some("early-semver")
)
)
name := "css-dsl"
publish / skip := true
mergifyExtraConditions := Seq(
(Attr.Author :== "scala-steward") ||
(Attr.Author :== "nafg-scala-steward[bot]")
)
def npmView(pkg: String, field: String)(parse: Stream[String] => String) =
parse(s"npm view $pkg $field".lineStream)
def latestTag(pkg: String) = npmView(pkg, "dist-tags.latest")(_.head)
val npmViewVersionRegex = ".*'(.*)'".r
def latestIn(pkg: String, versionMajor: Int) =
npmView(s"$pkg@$versionMajor", "version")(_.last match { case npmViewVersionRegex(v) => v })
def scalaJsReactSettings(config: CssDslConfig) = Seq(
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "2.1.2",
cssVariant := TargetImpl.ScalaJsReact,
cssDslConfig := config
)
def scalatagsSettings(config: CssDslConfig) = Seq(
libraryDependencies += "com.lihaoyi" %%% "scalatags" % "0.13.1",
cssVariant := TargetImpl.Scalatags,
cssDslConfig := config
)
val bootstrap3Config =
CssDslConfig(
"Bootstrap 3",
Set(None, Some("bs"), Some("bs3")),
latestIn("bootstrap", 3),
"https://stackpath.bootstrapcdn.com/bootstrap/" + _ + "/css/bootstrap.min.css"
)
val bootstrap4Config =
CssDslConfig(
"Bootstrap 4",
Set(None, Some("bs"), Some("bs4")),
latestIn("bootstrap", 4),
"https://cdn.jsdelivr.net/npm/bootstrap@" + _ + "/dist/css/bootstrap.min.css"
)
val bootstrap5Config =
CssDslConfig(
"Bootstrap 5",
Set(None, Some("bs"), Some("bs5")),
latestIn("bootstrap", 5),
"https://cdn.jsdelivr.net/npm/bootstrap@" + _ + "/dist/css/bootstrap.min.css"
)
val bulmaConfig =
CssDslConfig(
"Bulma",
Set(None, Some("b")),
latestTag("bulma"),
"https://cdn.jsdelivr.net/npm/bulma@" + _ + "/css/bulma.min.css"
)
val semanticUiConfig =
CssDslConfig(
"Semantic UI",
Set(Some("s")),
latestTag("semantic-ui"),
"https://cdn.jsdelivr.net/npm/semantic-ui@" + _ + "/dist/semantic.min.css"
)
val fomanticUiConfig =
CssDslConfig(
"Fomantic UI",
Set(Some("f")),
"2.9.0" /*latestTag("fomantic-ui")*/, // pin at 2.9.0 until https://github.com/phax/ph-css/issues/90 is fixed
"https://cdn.jsdelivr.net/npm/fomantic-ui@" + _ + "/dist/semantic.min.css"
)
val fontawesomeUiConfig =
CssDslConfig(
"Font Awesome",
Set(None, Some("fa")),
latestTag("@fortawesome/fontawesome-free"),
"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@" + _ + "/css/all.min.css"
)
lazy val bootstrap3_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(bootstrap3Config))
lazy val bootstrap3_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(bootstrap3Config))
lazy val bootstrap4_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(bootstrap4Config))
lazy val bootstrap4_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(bootstrap4Config))
lazy val bootstrap5_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(bootstrap5Config))
lazy val bootstrap5_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(bootstrap5Config))
lazy val bulma_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(bulmaConfig))
lazy val bulma_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(bulmaConfig))
lazy val semanticui_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(semanticUiConfig))
lazy val semanticui_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(semanticUiConfig))
lazy val fomanticui_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(fomanticUiConfig))
lazy val fomanticui_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(fomanticUiConfig))
lazy val fontawesome_scalajsreact =
project.enablePlugins(ScalaJSPlugin, GeneratorPlugin).settings(scalaJsReactSettings(fontawesomeUiConfig))
lazy val fontawesome_scalatags =
project.enablePlugins(GeneratorPlugin).settings(scalatagsSettings(fontawesomeUiConfig))