Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//> using dep org.typelevel::laika-preview::1.3.2
//> using dep com.monovore::decline-effect::2.6.2
//> using dep org.graalvm.js:js:25.0.2
//> using dep org.webjars.npm:katex:0.16.28
//> using dep org.webjars.npm:katex:0.16.44
//> using dep org.webjars.npm:fortawesome__fontawesome-free:7.2.0
//> using dep pink.cozydev::protosearch-laika:0.0-7f79720-SNAPSHOT
//> using repository https://central.sonatype.com/repository/maven-snapshots
Expand Down Expand Up @@ -440,7 +440,7 @@ object KaTeX {
import scala.jdk.CollectionConverters.*

private def loadKaTeX(): String = {
val resourcePath = "/META-INF/resources/webjars/katex/0.16.28/dist/katex.js"
val resourcePath = "/META-INF/resources/webjars/katex/0.16.44/dist/katex.js"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to update this line as well is annoying.
I wonder if we can get this programmatically without too much difficulty?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armanbilge how bad would it be to read the pom.properties at build time? Something like this:

def webjarVersion(artifactId: String): String = {
  val propsPath = s"/META-INF/maven/org.webjars.npm/$artifactId/pom.properties"
  val props = java.util.Properties()
  props.load(classOf[Main.type].getResourceAsStream(propsPath))
  props.getProperty("version")
}

I get that Scala Steward is smart enough to bump both versions, but I never am when manually doing/testing things.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, more so than just versioning, we could have a little helper class for loading resources from webjars

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea, I think I didn't know about the pom.properties. I issued it :)

val inputStream = getClass.getResourceAsStream(resourcePath)
String(inputStream.readAllBytes())
}
Expand Down
Loading