@@ -13,10 +13,18 @@ import scala.sys.process._
13
13
object NextApp extends AutoPlugin {
14
14
override def requires = ScalaJSPlugin
15
15
override def trigger = noTrigger
16
- private val scalaJsReactVersion = " 2.0.0-RC3"
17
16
18
17
object autoImport {
19
18
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
+ )
20
28
val nextServerProcess = AttributeKey [Option [Process ]](
21
29
" nextServerProcess" ,
22
30
" A handle to the currently-running next dev server"
@@ -51,10 +59,20 @@ object NextApp extends AutoPlugin {
51
59
(Compile / fastLinkJS / scalaJSLinkerConfig) ~= {
52
60
_.withModuleSplitStyle(ModuleSplitStyle .SmallestModules )
53
61
},
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" ,
58
76
startNextServer := {
59
77
if (! nextServerIsRunning.value) {
60
78
val log = streams.value.log
@@ -84,6 +102,6 @@ object NextApp extends AutoPlugin {
84
102
},
85
103
npmInstall := Process (Seq (npm.value, " install" ), baseDirectory.value).! ,
86
104
nextBuild := Process (Seq (npm.value, " run" , " build" ), baseDirectory.value).! ,
87
- nextBuild := nextBuild.dependsOn(Compile / fullLinkJS).value,
105
+ nextBuild := nextBuild.dependsOn(Compile / fullLinkJS).value
88
106
)
89
107
}
0 commit comments