Skip to content

Commit 843a252

Browse files
authored
Small modules for and coursier cache (#66)
* . * . * . * .
1 parent cd62f17 commit 843a252

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
runs-on: ${{ matrix.os }}
2828
timeout-minutes: 60
2929
steps:
30+
- uses: taiki-e/install-action@just
31+
- uses: coursier/cache-action@v8
3032
- uses: coursier/setup-action@main
3133
with:
3234
jvm: temurin@21
@@ -97,6 +99,7 @@ jobs:
9799
fetch-depth: 0
98100
fetch-tags: true
99101

102+
- uses: coursier/cache-action@v8
100103
- uses: coursier/setup-action@main
101104
with:
102105
jvm: temurin@21
@@ -130,6 +133,7 @@ jobs:
130133
needs: build
131134
runs-on: ubuntu-latest
132135
steps:
136+
- uses: coursier/cache-action@v8
133137
- uses: coursier/setup-action@main
134138
with:
135139
jvm: temurin@21

plugin/integration/src/js.test.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ object SiteJsTests extends TestSuite:
7979
}
8080
}
8181

82-
test("Import map populated from sub task") {
82+
/** YAML friendly overrides
83+
*/
84+
test("Import map and smallModulesFor populated from sub task") {
8385
object build extends TestRootModule with ScalaJsRefreshModule:
8486
override def scalaVersion: Simple[String] = "3.8.2"
85-
override def moduleSplitStyle: Simple[ModuleSplitStyle] =
86-
ModuleSplitStyle.SmallModulesFor("webapp")
8787

88+
override def smallModulesFor = Seq("webapp")
8889
override def mvnDeps = Seq(
8990
mvn"com.raquo::laminar::17.0.0"
9091
)
@@ -106,6 +107,10 @@ object SiteJsTests extends TestSuite:
106107
prefix == "@foo" && target == "https://cdn.skypack.dev/foo/"
107108
case _ => throw new java.lang.AssertionError(s"Unexpected import mapping type: $report")
108109
})
110+
111+
val Right(smallModulesResult) = eval(build.smallModulesFor).runtimeChecked
112+
val smallModules = smallModulesResult.value
113+
assert(smallModules.contains("webapp"))
109114
}
110115

111116
}

plugin/src/refresh_plugin.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import mill.scalajslib.api.ModuleKind
1717
import mill.scalajslib.api.Report
1818
import mill.scalajslib.config.ScalaJSConfigModule
1919
import mill.scalajslib.api.ESModuleImportMapping
20+
import mill.scalajslib.api.ModuleSplitStyle
2021
implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global
2122

2223
/** Base Mill plugin trait for Scala.js applications served by sjsls during development.
@@ -74,6 +75,12 @@ trait ScalaJsRefreshModule extends ScalaJSConfigModule:
7475
.toSeq
7576
end scalaJSImportMap
7677

78+
def smallModulesFor = Task(Seq.empty[String])
79+
80+
override def moduleSplitStyle: Simple[ModuleSplitStyle] = Task {
81+
ModuleSplitStyle.SmallModulesFor(smallModulesFor()*)
82+
}
83+
7784
/** DOM id of the root node your application will mount into. */
7885
def appRoot: String = "app"
7986

0 commit comments

Comments
 (0)