@@ -21,23 +21,20 @@ lazy val commonSettings = Seq(
21
21
)
22
22
23
23
lazy val jsSettings = Seq (
24
- webpack / version := " 4.46.0" ,
25
- useYarn := true ,
26
24
scalaJSLinkerConfig ~= { _.withOptimizer(false ) },
27
25
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind .CommonJSModule ) },
28
26
libraryDependencies += " org.portable-scala" %%% " portable-scala-reflect" % " 1.1.2" ,
29
- )
30
27
31
- def readJsDependencies (baseDirectory : File , field : String ): Seq [(String , String )] = {
32
- val packageJson = ujson.read(IO .read(new File (s " $baseDirectory/package.json " )))
33
- packageJson(field).obj.mapValues(_.str.toString).toSeq
34
- }
28
+ externalNpm := {
29
+ sys.process.Process (" yarn" , baseDirectory.value).!
30
+ baseDirectory.value
31
+ },
32
+ )
35
33
36
34
lazy val webapp = project
37
35
.enablePlugins(
38
36
ScalaJSPlugin ,
39
- ScalaJSBundlerPlugin ,
40
- ScalablyTypedConverterPlugin ,
37
+ ScalablyTypedConverterExternalNpmPlugin ,
41
38
)
42
39
.dependsOn(api)
43
40
.settings(commonSettings, jsSettings)
@@ -49,26 +46,12 @@ lazy val webapp = project
49
46
" com.github.cornerman" %%% " colibri-router" % versions.colibri,
50
47
" io.suzaku" %%% " boopickle" % versions.boopickle,
51
48
),
52
- Compile / npmDependencies ++= readJsDependencies(baseDirectory.value, " dependencies" ) ++ Seq (
53
- " snabbdom" -> " github:outwatch/snabbdom.git#semver:0.7.5" , // for outwatch, workaround for: https://github.com/ScalablyTyped/Converter/issues/293
54
- " reconnecting-websocket" -> " 4.1.10" , // for fun-stack websockets, workaround for https://github.com/ScalablyTyped/Converter/issues/293 https://github.com/cornerman/mycelium/blob/6f40aa7018276a3281ce11f7047a6a3b9014bff6/build.sbt#74
55
- " jwt-decode" -> " 3.1.2" , // for fun-stack auth, workaround for https://github.com/ScalablyTyped/Converter/issues/293 https://github.com/cornerman/mycelium/blob/6f40aa7018276a3281ce11f7047a6a3b9014bff6/build.sbt#74
56
- ),
57
49
stIgnore ++= List (
58
50
" reconnecting-websocket" ,
59
51
" snabbdom" ,
60
52
" jwt-decode" ,
61
53
),
62
- Compile / npmDevDependencies ++= readJsDependencies(baseDirectory.value, " devDependencies" ),
63
54
scalaJSUseMainModuleInitializer := true ,
64
- webpackDevServerPort := 12345 ,
65
- webpackDevServerExtraArgs := Seq (" --color" ),
66
- startWebpackDevServer / version := " 3.11.3" ,
67
- fullOptJS / webpackEmitSourceMaps := true ,
68
- fastOptJS / webpackEmitSourceMaps := true ,
69
- fastOptJS / webpackBundlingMode := BundlingMode .LibraryOnly (),
70
- fastOptJS / webpackConfigFile := Some (baseDirectory.value / " webpack.config.dev.js" ),
71
- fullOptJS / webpackConfigFile := Some (baseDirectory.value / " webpack.config.prod.js" ),
72
55
)
73
56
74
57
// shared project which contains api definitions.
@@ -87,8 +70,7 @@ lazy val api = project
87
70
lazy val lambda = project
88
71
.enablePlugins(
89
72
ScalaJSPlugin ,
90
- ScalaJSBundlerPlugin ,
91
- ScalablyTypedConverterPlugin ,
73
+ ScalablyTypedConverterExternalNpmPlugin ,
92
74
)
93
75
.dependsOn(api)
94
76
.settings(commonSettings, jsSettings)
@@ -102,27 +84,14 @@ lazy val lambda = project
102
84
" io.suzaku" %%% " boopickle" % versions.boopickle,
103
85
" com.lihaoyi" %%% " pprint" % versions.pprint,
104
86
),
105
- Compile / npmDependencies ++= readJsDependencies(baseDirectory.value, " dependencies" ),
106
87
stIgnore ++= List (
107
88
" aws-sdk" ,
108
89
),
109
- Compile / npmDevDependencies ++= readJsDependencies(baseDirectory.value, " devDependencies" ),
110
- fullOptJS / webpackEmitSourceMaps := true ,
111
- fastOptJS / webpackEmitSourceMaps := true ,
112
- fastOptJS / webpackConfigFile := Some (baseDirectory.value / " webpack.config.dev.js" ),
113
- fullOptJS / webpackConfigFile := Some (baseDirectory.value / " webpack.config.prod.js" ),
114
90
)
115
91
116
- addCommandAlias(" prod" , " fullOptJS/webpack" )
117
- addCommandAlias(" prodf" , " webapp/fullOptJS/webpack" )
118
- addCommandAlias(" prodb" , " lambda/fullOptJS/webpack" )
119
- addCommandAlias(" dev" , " devInitAll; devWatchAll; devDestroyFrontend" )
120
- addCommandAlias(" devf" , " devInitFrontend; devWatchFrontend; devDestroyFrontend" ) // compile only frontend
121
- addCommandAlias(" devb" , " devInitBackend; devWatchBackend" ) // compile only backend
122
- addCommandAlias(" devInitBackend" , " lambda/fastOptJS/webpack" )
123
- addCommandAlias(" devInitFrontend" , " webapp/fastOptJS/startWebpackDevServer; webapp/fastOptJS/webpack" )
124
- addCommandAlias(" devInitAll" , " devInitFrontend; devInitBackend" )
125
- addCommandAlias(" devWatchFrontend" , " ~; webapp/fastOptJS" )
126
- addCommandAlias(" devWatchBackend" , " ~; lambda/fastOptJS" )
127
- addCommandAlias(" devWatchAll" , " ~; lambda/fastOptJS; webapp/fastOptJS" )
128
- addCommandAlias(" devDestroyFrontend" , " webapp/fastOptJS/stopWebpackDevServer" )
92
+ addCommandAlias(" prod" , " fullOptJS" )
93
+ addCommandAlias(" prodf" , " webapp/fullOptJS" )
94
+ addCommandAlias(" prodb" , " lambda/fullOptJS" )
95
+ addCommandAlias(" dev" , " ~; lambda/fastOptJS; webapp/fastOptJS" )
96
+ addCommandAlias(" devf" , " ~; webapp/fastOptJS" )
97
+ addCommandAlias(" devb" , " ~; lambda/fastOptJS" )
0 commit comments