mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-07-29 11:04:53 +00:00
Add scalafmt.conf and elm compile options
This commit is contained in:
15
.scalafmt.conf
Normal file
15
.scalafmt.conf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
version = "2.3.0"
|
||||||
|
|
||||||
|
align = most
|
||||||
|
#align.arrowEnumeratorGenerator = true
|
||||||
|
|
||||||
|
maxColumn = 100
|
||||||
|
|
||||||
|
rewrite.rules = [
|
||||||
|
AvoidInfix
|
||||||
|
RedundantBraces
|
||||||
|
RedundantParens
|
||||||
|
AsciiSortImports
|
||||||
|
PreferCurlyFors
|
||||||
|
SortModifiers
|
||||||
|
]
|
11
build.sbt
11
build.sbt
@ -3,6 +3,8 @@ import scala.sys.process._
|
|||||||
import com.typesafe.sbt.SbtGit.GitKeys._
|
import com.typesafe.sbt.SbtGit.GitKeys._
|
||||||
import docspell.build._
|
import docspell.build._
|
||||||
|
|
||||||
|
val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources")
|
||||||
|
|
||||||
val sharedSettings = Seq(
|
val sharedSettings = Seq(
|
||||||
organization := "com.github.eikek",
|
organization := "com.github.eikek",
|
||||||
scalaVersion := "2.13.1",
|
scalaVersion := "2.13.1",
|
||||||
@ -31,12 +33,14 @@ val testSettings = Seq(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val elmSettings = Seq(
|
val elmSettings = Seq(
|
||||||
|
elmCompileMode := ElmCompileMode.Debug,
|
||||||
Compile/resourceGenerators += Def.task {
|
Compile/resourceGenerators += Def.task {
|
||||||
compileElm(streams.value.log
|
compileElm(streams.value.log
|
||||||
, (Compile/baseDirectory).value
|
, (Compile/baseDirectory).value
|
||||||
, (Compile/resourceManaged).value
|
, (Compile/resourceManaged).value
|
||||||
, name.value
|
, name.value
|
||||||
, version.value)
|
, version.value
|
||||||
|
, elmCompileMode.value)
|
||||||
}.taskValue,
|
}.taskValue,
|
||||||
watchSources += Watched.WatchSource(
|
watchSources += Watched.WatchSource(
|
||||||
(Compile/sourceDirectory).value/"elm"
|
(Compile/sourceDirectory).value/"elm"
|
||||||
@ -381,10 +385,11 @@ def copyWebjarResources(src: Seq[File], base: File, artifact: String, version: S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def compileElm(logger: Logger, wd: File, outBase: File, artifact: String, version: String): Seq[File] = {
|
def compileElm(logger: Logger, wd: File, outBase: File, artifact: String, version: String, mode: ElmCompileMode): Seq[File] = {
|
||||||
logger.info("Compile elm files ...")
|
logger.info("Compile elm files ...")
|
||||||
val target = outBase/"META-INF"/"resources"/"webjars"/artifact/version/"docspell-app.js"
|
val target = outBase/"META-INF"/"resources"/"webjars"/artifact/version/"docspell-app.js"
|
||||||
val proc = Process(Seq("elm", "make", "--output", target.toString) ++ Seq(wd/"src"/"main"/"elm"/"Main.elm").map(_.toString), Some(wd))
|
val cmd = Seq("elm", "make") ++ mode.flags ++ Seq("--output", target.toString)
|
||||||
|
val proc = Process(cmd ++ Seq(wd/"src"/"main"/"elm"/"Main.elm").map(_.toString), Some(wd))
|
||||||
val out = proc.!!
|
val out = proc.!!
|
||||||
logger.info(out)
|
logger.info(out)
|
||||||
Seq(target)
|
Seq(target)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"excludedPaths": [
|
"excludedPaths": [
|
||||||
"modules/webapp/target/elm-src"
|
"modules/webapp/target/elm-src/"
|
||||||
]
|
],
|
||||||
|
"checks" : {
|
||||||
|
"ImportAll": false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
elm-package.json
Symbolic link
1
elm-package.json
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
elm.json
|
14
project/ElmCompileMode.scala
Normal file
14
project/ElmCompileMode.scala
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
trait ElmCompileMode {
|
||||||
|
def flags: Seq[String]
|
||||||
|
}
|
||||||
|
object ElmCompileMode {
|
||||||
|
case object Production extends ElmCompileMode {
|
||||||
|
val flags = Seq("--optimize")
|
||||||
|
}
|
||||||
|
case object Debug extends ElmCompileMode {
|
||||||
|
val flags = Seq("--debug")
|
||||||
|
}
|
||||||
|
case object Dev extends ElmCompileMode {
|
||||||
|
val flags = Seq.empty
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,11 @@
|
|||||||
addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.5.0")
|
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
|
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
|
|
||||||
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
|
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.5.2")
|
|
||||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
|
|
||||||
addSbtPlugin("com.47deg" % "sbt-microsites" % "0.9.2")
|
addSbtPlugin("com.47deg" % "sbt-microsites" % "0.9.2")
|
||||||
|
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
|
||||||
|
addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.5.0")
|
||||||
|
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
|
||||||
|
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
|
||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
|
||||||
|
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.5.2")
|
||||||
|
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
|
||||||
|
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.0.3")
|
||||||
|
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.0")
|
||||||
|
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")
|
||||||
|
Reference in New Issue
Block a user