This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
190 lines (182 loc) · 7.46 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name := "scalajs-react-table"
Global / onChangedBuildSource := ReloadOnSourceChanges
val reactTable = "7.7.0"
val reactTableTypes = "7.7.0"
val reactJS = "17.0.2"
val reactTypes = "17.0.14"
val reactDomTypes = "17.0.9"
val scalaJsReact = "2.1.1"
val scalajsReactVirtuoso = "0.2.2"
val munit = "0.7.29"
addCommandAlias(
"restartWDS",
"; demo / Compile / fastOptJS / stopWebpackDevServer; demo / Compile /fastOptJS / startWebpackDevServer"
)
inThisBuild(
List(
organization := "io.github.toddburnside",
sonatypeProfileName := "io.github.toddburnside",
homepage := Some(
url("https://github.com/toddburnside/scalajs-react-table")
),
licenses := Seq(
"BSD 3-Clause License" -> url(
"https://opensource.org/licenses/BSD-3-Clause"
)
),
developers := List(
Developer(
"toddburnside",
"Todd Burnside",
"toddjburnside@gmail.com",
url("https://github.com/toddburnside")
),
Developer(
"rpiaggio",
"Raúl Piaggio",
"rpiaggio@gmail.com",
url("https://github.com/rpiaggio")
),
Developer(
"cquiroz",
"Carlos Quiroz",
"carlos.m.quiroz@gmail.com",
url("https://github.com/cquiroz")
)
),
scmInfo := Some(
ScmInfo(
url("https://github.com/toddburnside/scalajs-react-table"),
"scm:git:git@github.com:toddburnside/scalajs-react-table.git"
)
)
)
)
val root =
project
.in(file("."))
.aggregate(facade, demo)
.settings(
name := "scalajs-react-table",
// No, SBT, we don't want any artifacts for root.
// No, not even an empty jar.
publish := {},
publishLocal := {},
publishArtifact := false,
Keys.`package` := file("")
)
lazy val demo =
project
.in(file("demo"))
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
webpack / version := "4.32.0",
startWebpackDevServer / version := "3.3.1",
fastOptJS / webpackConfigFile := Some(
baseDirectory.value / "webpack" / "dev.webpack.config.js"
),
fullOptJS / webpackConfigFile := Some(
baseDirectory.value / "webpack" / "prod.webpack.config.js"
),
webpackMonitoredDirectories += (Compile / resourceDirectory).value,
webpackResources := baseDirectory.value / "webpack" * "*.js",
webpackMonitoredFiles / includeFilter := "*",
useYarn := true,
fastOptJS / webpackBundlingMode := BundlingMode.LibraryOnly(),
fullOptJS / webpackBundlingMode := BundlingMode.Application,
test := {},
Compile / fastOptJS / scalaJSLinkerConfig ~= { _.withSourceMap(false) },
Compile / fullOptJS / scalaJSLinkerConfig ~= { _.withSourceMap(false) },
// NPM libs for development, mostly to let webpack do its magic
Compile / npmDevDependencies ++= Seq(
"postcss-loader" -> "3.0.0",
"autoprefixer" -> "9.4.4",
"url-loader" -> "1.1.1",
"file-loader" -> "3.0.1",
"css-loader" -> "2.1.0",
"style-loader" -> "0.23.1",
"less" -> "3.9.0",
"less-loader" -> "4.1.0",
"webpack-merge" -> "4.2.1",
"mini-css-extract-plugin" -> "0.5.0",
"webpack-dev-server-status-bar" -> "1.1.0",
"cssnano" -> "4.1.8",
"uglifyjs-webpack-plugin" -> "2.1.1",
"html-webpack-plugin" -> "3.2.0",
"optimize-css-assets-webpack-plugin" -> "5.0.1",
"favicons-webpack-plugin" -> "0.0.9",
"why-did-you-update" -> "1.0.6"
),
Compile / npmDependencies ++= Seq(
"react" -> reactJS,
"react-dom" -> reactJS,
"react-table" -> reactTable
),
// don't publish the demo
publish := {},
publishLocal := {},
publishArtifact := false,
Keys.`package` := file(""),
scalacOptions ~= (_.filterNot(Set("-Vtype-diffs")))
)
.dependsOn(facade)
lazy val facade =
project
.in(file("facade"))
.enablePlugins(ScalaJSBundlerPlugin, ScalablyTypedConverterGenSourcePlugin)
.settings(
name := "facade",
moduleName := "scalajs-react-table",
// Requires the DOM for tests
Test / requireJsDomEnv := true,
// Use yarn as it is faster than npm
useYarn := true,
yarnExtraArgs := {
if (insideCI.value) List("--frozen-lockfile") else List.empty
},
webpack / version := "4.44.1",
installJsdom / version := "16.4.0",
scalaJSUseMainModuleInitializer := false,
// Compile tests to JS using fast-optimisation
Test / scalaJSStage := FastOptStage,
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % scalaJsReact,
"com.github.japgolly.scalajs-react" %%% "util" % scalaJsReact,
"io.github.toddburnside" %%% "scalajs-react-virtuoso" % scalajsReactVirtuoso,
"com.github.japgolly.scalajs-react" %%% "test" % scalaJsReact % Test,
"org.scalameta" %%% "munit" % munit % Test
),
Compile / npmDependencies ++= Seq(
"react" -> reactJS,
"react-dom" -> reactJS,
"@types/react" -> reactTypes,
"@types/react-dom" -> reactDomTypes,
"react-table" -> reactTable,
"@types/react-table" -> reactTableTypes
),
stUseScalaJsDom := true,
stOutputPackage := "reactST",
stFlavour := Flavour.ScalajsReact,
stReactEnableTreeShaking := Selection.All,
stTypescriptVersion := "4.2.4",
(Compile / stMinimize).withRank(KeyRanks.Invisible) := Selection.AllExcept("react-table"),
scalacOptions ~= (_.filterNot(
Set(
// By necessity facades will have unused params
"-Wunused:params",
"-Wunused:explicits",
"-Wunused:imports",
"-Wdead-code",
"-Wvalue-discard",
"-Xlint:missing-interpolator",
"-Xlint:nullary-unit"
)
)),
// Some Scalablytyped generated Scaladocs are malformed.
// Workaround: https://github.com/xerial/sbt-sonatype/issues/30#issuecomment-342532067
Compile / doc / sources := Seq(),
Test / webpackConfigFile := Some(
baseDirectory.value / "test.webpack.config.js"
),
testFrameworks += new TestFramework("munitFramework")
)