Skip to content

Commit 32cb801

Browse files
Upgraded to react v17
1 parent 82fde5a commit 32cb801

File tree

5 files changed

+14
-53
lines changed

5 files changed

+14
-53
lines changed

project/plugins.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ val scalaJSVersion =
55
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.31")
66

77
if (scalaJSVersion.startsWith("0.6")) {
8-
//addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin-sjs06" % "0.6.0-SNAPSHOT").changing())
9-
addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin-sjs06" % "0.6.0")
8+
addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin-sjs06" % "0.7.0-SNAPSHOT").changing())
9+
//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin-sjs06" % "0.7.0")
1010
}
1111
else {
12-
//addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.6.0-SNAPSHOT").changing())
13-
addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.6.0")
12+
addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.7.0-SNAPSHOT").changing())
13+
//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.7.0")
1414
}
1515

1616
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")

project/src/main/scala/common/Libs.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import scommons.sbtplugin.project.CommonLibs
66

77
object Libs extends CommonLibs {
88

9-
val scommonsNodejsVersion = "0.6.0"
10-
private val sjsReactJsVer = "0.16.0"
9+
val scommonsNodejsVersion = "0.6.3"
10+
private val sjsReactJsVer = "0.17.0-SNAPSHOT"
1111

1212
lazy val sjsReactJsCore = Def.setting("org.scommons.shogowada" %%% "scalajs-reactjs-core" % sjsReactJsVer)
1313
lazy val sjsReactJsDom = Def.setting("org.scommons.shogowada" %%% "scalajs-reactjs-dom" % sjsReactJsVer)
1414
lazy val sjsReactJsRedux = Def.setting("org.scommons.shogowada" %%% "scalajs-reactjs-redux" % sjsReactJsVer)
15-
//lazy val sjsReactJsReduxDevTools = Def.setting("org.scommons.shogowada" %%% "scalajs-reactjs-redux-devtools" % sjsReactJsVer)
1615
}

project/src/main/scala/definitions/ReactTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object ReactTest extends ScalaJsModule {
1919
coverageExcludedPackages := "scommons.react.test.raw",
2020

2121
npmDependencies in Compile ++= Seq(
22-
"react-test-renderer" -> "^16.8.0"
22+
"react-test-renderer" -> "^17.0.1"
2323
)
2424
)
2525

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package definitions
22

3-
import org.scalajs.jsenv.nodejs.NodeJSEnv
43
import org.scalajs.sbtplugin.ScalaJSPlugin
54
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
65
import sbt.Keys._
76
import sbt._
87
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin
9-
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.autoImport._
10-
import scommons.sbtplugin.project.CommonModule.ideExcludedDirectories
8+
import scommons.sbtplugin.project.CommonNodeJsModule
119
import scoverage.ScoverageKeys.{coverageEnabled, coverageScalacPluginVersion}
1210
import scoverage.ScoverageSbtPlugin._
1311

@@ -16,7 +14,7 @@ trait ScalaJsModule extends ReactModule {
1614
override def definition: Project = {
1715
super.definition
1816
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
19-
.settings(ScalaJsModule.settings: _*)
17+
.settings(CommonNodeJsModule.settings: _*)
2018
.settings(
2119
//TODO: remove these temporal fixes for Scala.js 1.1+ and scoverage
2220
coverageScalacPluginVersion := {
@@ -41,38 +39,3 @@ trait ScalaJsModule extends ReactModule {
4139
)
4240
}
4341
}
44-
45-
object ScalaJsModule {
46-
47-
val settings: Seq[Setting[_]] = Seq(
48-
scalaJSLinkerConfig ~= {
49-
_.withModuleKind(ModuleKind.CommonJSModule)
50-
.withSourceMap(false)
51-
.withESFeatures(_.withUseECMAScript2015(false))
52-
},
53-
//Opt-in @ScalaJSDefined by default
54-
scalacOptions += {
55-
if (scalaJSVersion.startsWith("0.6")) "-P:scalajs:sjsDefinedByDefault"
56-
else ""
57-
},
58-
requireJsDomEnv in Test := false,
59-
version in webpack := "4.29.0",
60-
webpackEmitSourceMaps := false,
61-
62-
// required for node.js >= v12.12.0
63-
// see:
64-
// https://github.com/nodejs/node/pull/29919
65-
scalaJSLinkerConfig in Test ~= {
66-
_.withSourceMap(true)
67-
},
68-
jsEnv in Test := new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--enable-source-maps"))),
69-
70-
ideExcludedDirectories ++= {
71-
val base = baseDirectory.value
72-
List(
73-
base / "build",
74-
base / "node_modules"
75-
)
76-
}
77-
)
78-
}

showcase/src/test/scala/scommons/react/showcase/ErrorBoundaryDemoSpec.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ class ErrorBoundaryDemoSpec extends TestSpec with TestRendererUtils {
2929
//then
3030
js.Dynamic.global.console.error = savedConsoleError
3131

32-
assertNativeComponent(result,
33-
<.div()(
34-
s"Error: java.lang.Exception: test exception",
32+
assertNativeComponent(result, <.div()(), inside(_) { case List(error, info) =>
33+
error shouldBe s"Error: java.lang.Exception: test exception"
34+
info.toString should startWith (
3535
"""Info:
36-
| in ErrorBoundaryDemoSpec$$anon$1
37-
| in ErrorBoundaryDemo""".stripMargin
36+
| at ErrorBoundaryDemoSpec$$anon$1""".stripMargin
3837
)
39-
)
38+
})
4039
}
4140

4241
it should "render children" in {

0 commit comments

Comments
 (0)