Closed zetashift closed 1 year ago
Do we track the current scala-js-dom version in the build file? I want to inject it in the docs using mdoc, but I can't seem to find the value.
We use the sbt dynver plugin, you can use the previousStableVersion
setting key to access it.
https://github.com/sbt/sbt-dynver/blob/125101baaff68978727f58994ecb9fd781501796/sbtdynver/src/main/scala/sbtdynver/DynVerPlugin.scala#L25
Make sure that the git tags are up to date in your local clone :)
Next error, I am trying to get interactive scala JS to work, I made a mdoc.properties
in the root folder but I get the following error:
bad option: '--intransitive'
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.ServiceLoader$2.next(ServiceLoader.java:1318)
at java.base/java.util.ServiceLoader$2.next(ServiceLoader.java:1306)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
at mdoc.modifiers.JsModifier.onLoad(JsModifier.scala:102)
at mdoc.internal.cli.Settings.$anonfun$onLoad$1(Settings.scala:222)
at mdoc.internal.cli.Settings.$anonfun$onLoad$1$adapted(Settings.scala:222)
at scala.collection.immutable.List.foreach(List.scala:431)
at mdoc.internal.cli.Settings.onLoad(Settings.scala:222)
at mdoc.internal.cli.Context$.fromSettings(Context.scala:50)
at mdoc.internal.cli.MainOps$.$anonfun$process$1(MainOps.scala:272)
at metaconfig.Configured.andThen(Configured.scala:45)
at mdoc.internal.cli.MainOps$.process(MainOps.scala:272)
at mdoc.MainProcess.process(Main.scala:41)
at mdoc.MainProcess.process$(Main.scala:38)
at mdoc.Main$.process(Main.scala:13)
at mdoc.MainProcess.process(Main.scala:36)
at mdoc.MainProcess.process$(Main.scala:35)
at mdoc.Main$.process(Main.scala:13)
at mdoc.Main$.main(Main.scala:15)
at mdoc.Main.main(Main.scala)
Hum, why did you add mdoc.properties
? I haven't needed that in any of my projects using mdoc.js
Oh oops, I read the instructions for mdoc:js modifiers wrong, thank you :P
Alright I got console logging working from the docs/mdoc --watch
command and then loading the readme.md.
I need to improve the examples I think. Btw how are we deploying the mdoc.js site? Docusaurus seems like overkill
🎉
I need to improve the examples I think.
Do you mean the ones in the existing documentation? Maybe, haven't looked at them recently 😂 even if we just start by porting them
Btw how are we deploying the mdoc.js site? Docusaurus seems like overkill
Agree about docusaurus. I have to think about this, open to ideas too. Maybe we can steal the html/theme from the scala-js.org website which uses jekyll.
Do you mean the ones in the existing documentation? Maybe, haven't looked at them recently joy even if we just start by porting them
I'll try to port them over!
Agree about docusaurus. I have to think about this, open to ideas too. Maybe we can steal the html/theme from the scala-js.org website which uses jekyll.
Yea I think we can just create a stylesheet based off of the main website. At the very least to get us started.
I am converting the examples and I see this piece of code:
def main(pre: html.Pre) = {
import scala.concurrent
.ExecutionContext
.Implicits
.global
import js.Thenable.Implicits._
val url =
"https://www.boredapi.com/api/activity"
val responseText = for {
response <- dom.fetch(url)
text <- response.text()
} yield {
text
}
for (text <- responseText)
pre.textContent = text
}
Is an ExecutionContext
really necessary for using fetch?
Strictly speaking, no. It's only necessary if you convert the Promise
s to Future
s.
Is it correct that Promise
can't be flatmapped?
Running into this error:
value flatMap is not a member of scala.scalajs.js.Promise[org.scalaj
s.dom.Response]
response <- fetch(url)
^^^^^^^^^^
The code:
def fetchBoredApi(element: html.Pre) = {
val url =
"https://www.boredapi.com/api/activity"
val responseText = for {
response <- fetch(url)
text <- response.text()
} yield {
text
}
for (text <- responseText)
pre.textContent = text
}
Yes, you need a .toFuture
Closing this to hide my shameful Git skills! New PR will be up soon(TM)
Currently running against: