Skip to content

Commit

Permalink
add sbt task for building the JS file
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvgt committed Dec 8, 2023
1 parent 62c266c commit f064690
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ lazy val deploy = taskKey[Unit]("Builds the jar and moves it to the bin folder")
lazy val generateLicenses = taskKey[Unit]("Analyses dependencies and downloads all licenses")
lazy val updateVersions = taskKey[Unit]("Update version in package.json and pom.xml")
lazy val install = taskKey[Unit]("Installs the current version locally")
lazy val assembleJS = taskKey[Unit]("Assemble the JS file in out/effekt.js")
lazy val assembleBinary = taskKey[Unit]("Assembles the effekt binary in bin/effekt")
lazy val generateDocumentation = taskKey[Unit]("Generates some documentation.")

Expand Down Expand Up @@ -167,6 +168,15 @@ lazy val effekt: CrossProject = crossProject(JSPlatform, JVMPlatform).in(file("e
)
.jsSettings(

assembleJS := {
(Compile / clean).value
(Compile / compile).value
val resultDir = (Compile / fastLinkJSOutput).value
val jsFile = IO.listFiles(resultDir, "main.js")(0)
val outputFile = (ThisBuild / baseDirectory).value / "out" / "effekt.js"
IO.copyFile(jsFile, outputFile)
},

scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },

libraryDependencies += "com.lihaoyi" %%% "utest" % "0.8.2" % "test",
Expand Down

0 comments on commit f064690

Please sign in to comment.