11name := " jquery-demo"
22
33inThisBuild(Seq (
4- version := " 3.0.2 " ,
4+ version := " 3.0.0-SNAPSHOT " ,
55 organization := " io.udash" ,
66))
77
88val commonSettings = Seq (
9- scalaVersion := " 2.12.10 " ,
10- crossScalaVersions := Seq (" 2.12.10 " ), // todo 2.13 & SJS 1.0 with Udash 0.9
9+ scalaVersion := " 2.12.11 " ,
10+ crossScalaVersions := Seq (" 2.13.1 " ),
1111 scalacOptions ++= Seq (
1212 " -feature" ,
1313 " -deprecation" ,
@@ -28,15 +28,54 @@ val commonSettings = Seq(
2828)
2929
3030val generatedGlobalDir = file(" generated/global" )
31+ val compileStatics = taskKey[Unit ](" Compiles all static files." )
3132val copyAssets = taskKey[Unit ](" Copies all assets to the target directory." )
32- val root = project.in(file(" ." ))
33+
34+ lazy val root = project.in(file(" ." ))
3335 .enablePlugins(ScalaJSPlugin )
3436 .settings(commonSettings)
37+ .aggregate(`jquery-bundler-demo`, `jquery-global-demo`)
3538
36- val generatedBundlerDir = file(" generated" )
37- val compileStatics = taskKey[Unit ](" Compiles all static files." )
39+ lazy val `jquery-global-demo` = project.in(file(" global-demo" ))
40+ .enablePlugins(ScalaJSPlugin , JSDependenciesPlugin )
41+ .settings(
42+ commonSettings,
43+
44+ sourceDirsSettings(_.getParentFile),
45+
46+ cleanFiles += generatedGlobalDir,
47+
48+ Compile / fullOptJS / crossTarget := generatedGlobalDir,
49+ Compile / fastOptJS / crossTarget := generatedGlobalDir,
50+ Compile / packageJSDependencies / crossTarget := generatedGlobalDir,
51+ Compile / packageMinifiedJSDependencies / crossTarget := generatedGlobalDir,
52+
53+ Compile / fastOptJS := (Compile / fastOptJS).dependsOn(copyAssets).value,
54+ Compile / fullOptJS := (Compile / fullOptJS).dependsOn(copyAssets).value,
55+
56+ scalaJSUseMainModuleInitializer := true ,
3857
39- val example = project.in(file(" ." ))
58+ copyAssets := {
59+ IO .copyFile(
60+ sourceDirectory.value / " main/assets/index.html" ,
61+ generatedGlobalDir / " index.html"
62+ )
63+ },
64+
65+ compileStatics := (Compile / fastOptJS).value,
66+
67+ Compile / fastOptJS / artifactPath :=
68+ (Compile / fastOptJS / crossTarget).value / " scripts" / " frontend-impl.js" ,
69+ Compile / fullOptJS / artifactPath :=
70+ (Compile / fullOptJS / crossTarget).value / " scripts" / " frontend-impl.js" ,
71+ Compile / packageJSDependencies / artifactPath :=
72+ (Compile / packageJSDependencies / crossTarget).value / " scripts" / " frontend-deps.js" ,
73+ Compile / packageMinifiedJSDependencies / artifactPath :=
74+ (Compile / packageMinifiedJSDependencies / crossTarget).value / " scripts" / " frontend-deps.js"
75+ )
76+
77+ val generatedBundlerDir = file(" generated/bundler" )
78+ lazy val `jquery-bundler-demo` = project.in(file(" bundler-demo" ))
4079 .enablePlugins(ScalaJSBundlerPlugin )
4180 .settings(
4281 commonSettings,
@@ -52,6 +91,8 @@ val example = project.in(file("."))
5291 )
5392 },
5493
94+ cleanFiles += generatedBundlerDir,
95+
5596 compileStatics := {
5697 val sjsFileName = (Compile / fastOptJS).value.data.name.stripSuffix(" .js" )
5798 IO .copyFile(
0 commit comments