@@ -13,10 +13,18 @@ import scala.sys.process._
1313object NextApp extends AutoPlugin {
1414 override def requires = ScalaJSPlugin
1515 override def trigger = noTrigger
16- private val scalaJsReactVersion = " 2.0.0-RC3"
1716
1817 object autoImport {
1918 val npm = SettingKey [String ](" npm" , " The path to the npm executable" )
19+ val scalaJsReactVersion =
20+ SettingKey [String ](
21+ " scalaJsReactVersion" ,
22+ " The version of scalaJsReact to use"
23+ )
24+ val scalaJsReactUseGeneric = SettingKey [Boolean ](
25+ " scalaJsReactUseGeneric" ,
26+ " Whether to use the 'core-generic' module scalajs-react, that provides effect agnositicism"
27+ )
2028 val nextServerProcess = AttributeKey [Option [Process ]](
2129 " nextServerProcess" ,
2230 " A handle to the currently-running next dev server"
@@ -51,10 +59,20 @@ object NextApp extends AutoPlugin {
5159 (Compile / fastLinkJS / scalaJSLinkerConfig) ~= {
5260 _.withModuleSplitStyle(ModuleSplitStyle .SmallestModules )
5361 },
54- libraryDependencies ++= Seq (
55- " com.github.japgolly.scalajs-react" %%% " core" % scalaJsReactVersion
56- ),
57- npm := " /Users/gbogard/.nix-profile/bin/npm" ,
62+ scalaJsReactVersion := " 2.0.0-RC4" ,
63+ scalaJsReactUseGeneric := false ,
64+ libraryDependencies ++=
65+ (if (scalaJsReactUseGeneric.value) {
66+ Seq (
67+ " com.github.japgolly.scalajs-react" %%% " core-generic" % scalaJsReactVersion.value,
68+ " com.github.japgolly.scalajs-react" %%% " util-dummy-defaults" % scalaJsReactVersion.value
69+ )
70+ } else {
71+ Seq (
72+ " com.github.japgolly.scalajs-react" %%% " core" % scalaJsReactVersion.value
73+ )
74+ }),
75+ npm := " npm" ,
5876 startNextServer := {
5977 if (! nextServerIsRunning.value) {
6078 val log = streams.value.log
@@ -84,6 +102,6 @@ object NextApp extends AutoPlugin {
84102 },
85103 npmInstall := Process (Seq (npm.value, " install" ), baseDirectory.value).! ,
86104 nextBuild := Process (Seq (npm.value, " run" , " build" ), baseDirectory.value).! ,
87- nextBuild := nextBuild.dependsOn(Compile / fullLinkJS).value,
105+ nextBuild := nextBuild.dependsOn(Compile / fullLinkJS).value
88106 )
89107}
0 commit comments