diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a9ef54d..8bb25eb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,15 @@ jobs: if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' run: sbt +update + - name: Setup Node + if: matrix.project == 'rootJS' + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - run: npm ci + - name: Check that workflows are up to date run: sbt githubWorkflowCheck diff --git a/.gitignore b/.gitignore index 82512572..bb115f94 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,6 @@ yarn.lock .tags* .java-version -package.json -package-lock.json metals.sbt .bloop/ @@ -70,7 +68,6 @@ smartgcal .jvmopts # Node modules node_modules/ -package-lock.json # Nix .direnv/ \ No newline at end of file diff --git a/build.sbt b/build.sbt index ff984554..69fe28c4 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,3 @@ -import org.scalajs.linker.interface.OutputPatterns - Global / onChangedBuildSource := ReloadOnSourceChanges ThisBuild / crossScalaVersions := List("3.6.2") @@ -7,6 +5,16 @@ ThisBuild / tlBaseVersion := "0.47" ThisBuild / tlCiReleaseBranches := Seq("master") +ThisBuild / githubWorkflowBuildPreamble ++= Seq( + WorkflowStep.Use( + UseRef.Public("actions", "setup-node", "v4"), + name = Some("Setup Node"), + params = Map("node-version" -> "22", "cache" -> "npm"), + cond = Some("matrix.project == 'rootJS'") + ), + WorkflowStep.Run(List("npm ci")) +) + lazy val root = tlCrossRootProject.aggregate(core, testkit, tests) lazy val core = crossProject(JVMPlatform, JSPlatform) @@ -55,26 +63,8 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform) libraryDependencies ++= { Settings.Libraries.ScalaJSReactTest.value.map(_ % Test) }, - // libraryDependencies ++= Seq( - // ("org.webjars.npm" % "react" % "18.3.1" % Test).intransitive(), - // ("org.webjars.npm" % "react-dom" % "18.3.1" % Test).intransitive() - // ), - // jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv() - jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv( - org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv - .Config() - .withEnv( - Map( - "NODE_PATH" -> (baseDirectory.value / "node_modules").absolutePath - ) - ) - ), - Test / scalaJSLinkerConfig ~= { - // Enable ECMAScript module output. - _.withModuleKind(ModuleKind.ESModule) - // Use .mjs extension. - .withOutputPatterns(OutputPatterns.fromJSFile("%s.mjs")) - } + jsEnv := new lucuma.LucumaJSDOMNodeJSEnv(), + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) } ) // .jsSettings( // Defaults.itSettings: _* diff --git a/project/plugins.sbt b/project/plugins.sbt index 4cbf87da..442f9127 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.12.4") -libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0" +libraryDependencies += "edu.gemini" %% "lucuma-jsdom" % "0.12.4"