Skip to content

Commit

Permalink
Display badge for targetType appropriate to release
Browse files Browse the repository at this point in the history
So if we're looking at:

https://index.scala-lang.org/typelevel/cats/cats-core/2.6.1?target=_sjs1.x_3.x

...we want to see the badge with `targetType=js`, rather than the default
badge that displays JVM-based artifacts.
  • Loading branch information
rtyley committed Jun 1, 2021
1 parent 4ae6d0e commit 1656f4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion model/src/main/scala/ch.epfl.scala.index.model/Release.scala
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ object Release {

def artifactHttpPath = s"/$organization/$repository/$artifact"
def artifactFullHttpUrl = s"https://index.scala-lang.org$artifactHttpPath"
def badgeUrl: String = s"$artifactFullHttpUrl/latest-by-scala-version.svg"
def nonDefaultTargetType: Option[ScalaTargetType] = target.map(_.targetType).filter(_ != Jvm)
def badgeUrl: String = s"$artifactFullHttpUrl/latest-by-scala-version.svg" + nonDefaultTargetType.map(tt => s"?targetType=$tt").mkString
def httpUrl = {
val targetQuery = target.map(t => s"?target=${t.encode}").getOrElse("")

Expand Down

0 comments on commit 1656f4d

Please sign in to comment.