Skip to content

Commit

Permalink
Add source maps mapping to Github on Scala.js (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab authored Oct 26, 2023
1 parent f560f57 commit 9c65c36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ object scalatags extends Module {
extends ScalaJSModule with ScalatagsPublishModule {
def scalaJSVersion = "1.10.1"
def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.scala-js::scalajs-dom::2.3.0")
private def sourceMapOptions = T.task {
val vcsState = VcsVersion.vcsState()
vcsState.lastTag.collect {
case tag if vcsState.commitsSinceLastTag == 0 =>
val baseUrl =
pomSettings().url.replace("github.com", "raw.githubusercontent.com")
val sourcesOptionName =
if (isScala3(crossScalaVersion))
"-scalajs-mapSourceURI"
else "-P:scalajs:mapSourceURI"
s"$sourcesOptionName:${T.workspace.toIO.toURI}->$baseUrl/$tag/"
}
}
override def scalacOptions = super.scalacOptions() ++ sourceMapOptions()

object test extends ScalaJSTests with CommonTestModule{
def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.scala-js::scalajs-env-jsdom-nodejs:1.1.0").map(_.withDottyCompat(crossScalaVersion))
Expand Down

0 comments on commit 9c65c36

Please sign in to comment.