diff --git a/docs/antora/modules/ROOT/pages/Common_Project_Layouts.adoc b/docs/antora/modules/ROOT/pages/Common_Project_Layouts.adoc index 782ee8952db..7c621ba9d68 100644 --- a/docs/antora/modules/ROOT/pages/Common_Project_Layouts.adoc +++ b/docs/antora/modules/ROOT/pages/Common_Project_Layouts.adoc @@ -90,10 +90,16 @@ version lives in `src-x.y`. ---- import mill._ import mill.scalajslib._ +import mill.scalajslib.api._ object foo extends ScalaJSModule { - def scalaVersion = "2.12.4" - def scalaJSVersion = "0.6.22" + def scalaVersion = "2.13.8" + def scalaJSVersion = "1.10.1" + def ivyDeps = Agg(ivy"org.scala-js::scalajs-dom::2.2.0") + + object test extends Tests with TestModule.Utest { + def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.0") + } } ---- @@ -103,6 +109,11 @@ latter of which runs your code on Node.js, which must be pre-installed) `ScalaJSModule` also exposes the `foo.fastOpt` and `foo.fullOpt` tasks for generating the optimized Javascript file. +ScalaJSModule requires declaring it's dependencies as third party +libraries (don't forget to use double-colons `::` between the library name and the version for Scala.js dependencies). + +If you are following the https://www.scala-js.org/doc/tutorial/basic/[Scala.js Tutorial], in the section where you test the code, it's mentioned that you need to make the DOM available to Node.js. Install the `jsdom` node library as instructed then add `def jsEnvConfig = T(JsEnvConfig.JsDom())` to your `build.sc` object. In Scala 3, the "scalajs-env-jsdom-nodejs" mentioned in the tutorial is no longer required. + == Scala Native Modules .`build.sc` @@ -402,4 +413,4 @@ A relatively complex build with numerous submodules, some cross-built across Scala major versions while others are cross-built against Scala minor versions. Also demonstrates how to pass one module's compiled artifacts to the -`run`/`test` commands of another, via their `forkEnv`. \ No newline at end of file +`run`/`test` commands of another, via their `forkEnv`.