mirror of
https://github.com/phfroidmont/scalive.git
synced 2025-12-24 21:26:58 +01:00
97 lines
2.8 KiB
Text
97 lines
2.8 KiB
Text
//| mvnDeps:
|
|
//| - com.raquo::domtypes:18.1.0
|
|
//| - com.goyeau::mill-scalafix::0.6.0
|
|
|
|
package build
|
|
|
|
import mill.*, scalalib.*, javascriptlib.TypeScriptModule, publish.*
|
|
import mill.scalalib.scalafmt.ScalafmtModule
|
|
import mill.api.Task.Simple
|
|
import java.net.URI
|
|
import java.nio.file.*
|
|
import java.nio.file.attribute.BasicFileAttributes
|
|
import java.util
|
|
import com.goyeau.mill.scalafix.ScalafixModule
|
|
|
|
trait ScalaCommon extends ScalaModule with ScalafmtModule with ScalafixModule:
|
|
def scalaVersion = "3.7.3"
|
|
def scalacOptions = Seq(
|
|
"-Wunused:all",
|
|
"-preview",
|
|
"-feature",
|
|
"-language:implicitConversions",
|
|
"-Wvalue-discard",
|
|
"-Wnonunit-statement",
|
|
"-deprecation"
|
|
)
|
|
|
|
trait PublishCommon extends PublishModule:
|
|
def publishVersion = "0.0.1"
|
|
def pomSettings = PomSettings(
|
|
description = artifactName(),
|
|
organization = "phfroidmont",
|
|
url = "https://github.com/phfroidmont/scalive",
|
|
licenses = Seq(License.MIT),
|
|
versionControl = VersionControl.github("phfroidmont", "scalive"),
|
|
developers =
|
|
Seq(Developer("phfroidmont", "Paul-Henri Froidmont", "https://github.com/phfroidmont"))
|
|
)
|
|
|
|
object scalive extends Module:
|
|
object core extends ScalaCommon with PublishCommon:
|
|
def mvnDeps = Seq(mvn"dev.zio::zio-json:0.7.44")
|
|
|
|
def generatedSources = Task {
|
|
new DomDefsGenerator((Task.dest / "core/src/scalive").toString).generate()
|
|
super.generatedSources() ++ Seq(PathRef(Task.dest))
|
|
}
|
|
|
|
object test extends ScalaTests with scalalib.TestModule.Utest:
|
|
def utestVersion = "0.9.0"
|
|
|
|
object zio extends ScalaCommon with PublishCommon:
|
|
def mvnDeps = Seq(mvn"dev.zio::zio-http:3.4.0")
|
|
def moduleDeps = Seq(core)
|
|
|
|
object test extends ScalaTests with scalalib.TestModule.ZioTest:
|
|
def zioTestVersion = "2.1.23"
|
|
|
|
object example extends ScalaCommon:
|
|
def moduleDeps = Seq(scalive.zio)
|
|
def mvnDeps = Seq(mvn"dev.optics::monocle-core:3.1.0", mvn"dev.zio::zio-logging:2.5.1")
|
|
|
|
def tailwindConfig = Task.Source(moduleDir / "tailwind.css")
|
|
|
|
def generateCss = Task {
|
|
sources()
|
|
os.proc(
|
|
"tailwindcss",
|
|
"--minify",
|
|
"--input",
|
|
tailwindConfig().path
|
|
).call().out.text()
|
|
}
|
|
|
|
def customResources = Task {
|
|
os.write(
|
|
target = Task.dest / "public" / "app.css",
|
|
data = generateCss(),
|
|
createFolders = true
|
|
)
|
|
os.copy(
|
|
from = example.js.bundle().path,
|
|
to = Task.dest / "public" / "app.js",
|
|
createFolders = true
|
|
)
|
|
PathRef(Task.dest)
|
|
}
|
|
|
|
def resources = Task {
|
|
super.resources() :+ customResources()
|
|
}
|
|
|
|
object js extends TypeScriptModule:
|
|
def mainFileName = "app.js"
|
|
def npmDeps = Seq("phoenix@1.7.21", "phoenix_live_view@1.1.8", "topbar@3.0.0", "daisyui@5.1.12")
|
|
def bundleFlags = super.bundleFlags() ++ Map("minify" -> ujson.Bool(false))
|
|
end example
|