aboutsummaryrefslogtreecommitdiff
path: root/build.sc
diff options
context:
space:
mode:
Diffstat (limited to 'build.sc')
-rw-r--r--build.sc25
1 files changed, 24 insertions, 1 deletions
diff --git a/build.sc b/build.sc
index 2a544bc..10354e9 100644
--- a/build.sc
+++ b/build.sc
@@ -1,4 +1,4 @@
-import mill._, scalalib._
+import mill._, scalalib._, scalajslib._
object server extends ScalaModule {
def scalaVersion = "2.13.1"
@@ -10,4 +10,27 @@ object server extends ScalaModule {
ivy"org.xerial:sqlite-jdbc:3.28.0" // actual database driver, note the single ':'
)
+ // This includes the resulting javascript file so that it can be served
+ // as a classpath resource and is packaged in the final jar.
+ def localClasspath = T {
+ super.localClasspath() ++ List(webapp.asAsset())
+ }
+
+}
+
+object webapp extends ScalaJSModule {
+ def scalaVersion = "2.13.1"
+ def scalaJSVersion = "0.6.31" // https://www.scala-js.org/
+
+ def ivyDeps = Agg(
+ ivy"org.scala-js::scalajs-dom::0.9.7" // http://scala-js.github.io/scala-js-dom/
+ )
+
+ // friendlier name than the default 'out.js'
+ def asAsset = T {
+ val out = T.ctx().dest / "assets" / "app.js"
+ os.copy(fastOpt().path, out, createFolders = true)
+ PathRef(T.ctx().dest)
+ }
+
}