This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
174 lines (166 loc) · 6.87 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
name := "scalajs-react-datepicker"
Global / onChangedBuildSource := ReloadOnSourceChanges
val reactJS = "17.0.2"
val reactDatePicker = "4.3.0"
val reactDatePickerTypes = "4.1.7"
val scalaJsReact = "2.0.1"
addCommandAlias(
"restartWDS",
"; demo/fastOptJS/stopWebpackDevServer; demo/fastOptJS/startWebpackDevServer"
)
inThisBuild(
List(
scalaVersion := "2.13.8",
ThisBuild / Test / parallelExecution := false,
organization := "com.rpiaggio",
sonatypeProfileName := "com.rpiaggio",
homepage := Some(
url("https://github.com/rpiaggio/scalajs-react-datepicker")
),
licenses := Seq(
"BSD 3-Clause License" -> url(
"https://opensource.org/licenses/BSD-3-Clause"
)
),
developers := List(
Developer(
"rpiaggio",
"Raúl Piaggio",
url("https://github.com/rpiaggio")
),
Developer(
"cquiroz",
"Carlos Quiroz",
url("https://github.com/cquiroz")
)
),
scmInfo := Some(
ScmInfo(
url("https://github.com/rpiaggio/scalajs-react-datepicker"),
"scm:git:[email protected]:rpiaggio/scalajs-react-datepicker.git"
)
)
)
)
val root =
project
.in(file("."))
.aggregate(facade, demo)
.settings(
name := "scalajs-react-datepicker",
// 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.44.1",
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",
"sass" -> "1.26.10",
"sass-loader" -> "9.0.2",
"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"
),
Compile / npmDependencies ++= Seq(
"react" -> reactJS,
"react-dom" -> reactJS,
"react-datepicker" -> reactDatePicker
),
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.4.0"
),
// don't publish the demo
publish := {},
publishLocal := {},
publishArtifact := false,
Keys.`package` := file("")
)
.dependsOn(facade)
lazy val facade =
project
.in(file("facade"))
.enablePlugins(ScalaJSBundlerPlugin, ScalablyTypedConverterGenSourcePlugin)
.settings(
name := "facade",
moduleName := "scalajs-react-datepicker",
// Requires the DOM for tests
Test / requireJsDomEnv := true,
// Use yarn as it is faster than npm
useYarn := true,
yarnExtraArgs := {
if (insideCI.value) List("--pure-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,
Compile / npmDependencies ++= Seq(
"react" -> reactJS,
"react-dom" -> reactJS,
"react-datepicker" -> reactDatePicker,
"@types/react-datepicker" -> reactDatePickerTypes
),
stUseScalaJsDom := true,
stOutputPackage := "lucuma",
stFlavour := Flavour.ScalajsReact,
stIgnore ++= List("react-dom"),
(Compile / stMinimize).withRank(KeyRanks.Invisible) :=
Selection.AllExcept("@types/react-datepicker"),
// stEnableScalaJsDefined := Selection.All,
scalacOptions ~= (_.filterNot(
Set(
// Types are declared for ReactDatepicker and ReactDatePicker, which are the same.
// Scalac issues a warning about them differing only in case, which I can find no way to single out and turn off.
"-Xfatal-warnings",
"-Wdead-code",
// By necessity facades will have unused params
"-Wunused:params",
"-Wunused:explicits",
"-Wunused:imports",
"-Wvalue-discard"
)
)),
// Some Scalablytyped generated Scaladocs are malformed.
// Workaround: https://github.com/xerial/sbt-sonatype/issues/30#issuecomment-342532067
Compile / doc / sources := Seq()
)