Skip to content

Commit 138f079

Browse files
committed
Update dependencies and related refactoring
1 parent 9cc5356 commit 138f079

40 files changed

+322
-253
lines changed

build.sbt

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
1-
import chrome.Impl._
2-
import chrome.permissions.APIPermission._
1+
import Dependencies.{addLibraries, addJsLibraries}
2+
import chrome.permissions.Permission
3+
import chrome.permissions.Permission.API
4+
import chrome.{App, AppManifest, Background}
35
import net.lullabyte.{Chrome, ChromeSbtPlugin}
46

5-
lazy val root = project.in(file("."))
6-
.enablePlugins(ChromeSbtPlugin)
7-
.settings(
8-
name := "System Monitor",
9-
version := "0.1.0",
10-
scalaVersion := "2.11.8",
11-
scalacOptions ++= Seq(
12-
"-language:implicitConversions",
13-
"-language:existentials",
14-
"-Xlint",
15-
"-deprecation",
16-
"-Xfatal-warnings",
17-
"-feature"
18-
),
19-
persistLauncher := true,
20-
persistLauncher in Test := false,
21-
relativeSourceMaps := true,
22-
libraryDependencies ++= Seq(
23-
"org.scala-js" %%% "scalajs-dom" % "0.9.0" withSources() withJavadoc(),
24-
"com.github.japgolly.scalajs-react" %%% "core" % "0.9.1" withSources() withJavadoc(),
25-
"com.github.japgolly.scalajs-react" %%% "extra" % "0.9.1" withSources() withJavadoc(),
26-
"com.github.japgolly.scalacss" %%% "core" % "0.3.0" withSources() withJavadoc(),
27-
"com.github.japgolly.scalacss" %%% "ext-react" % "0.3.0" withSources() withJavadoc(),
28-
"net.lullabyte" %%% "scala-js-chrome" % "0.2.0" withSources() withJavadoc()
29-
),
30-
jsDependencies += "org.webjars" % "react" % "0.13.3" / "react-with-addons.min.js" commonJSName "React",
31-
skip in packageJSDependencies := false,
32-
chromeManifest := AppManifest(
33-
name = name.value,
34-
version = version.value,
35-
app = App(
36-
background = Background(
37-
scripts = List("deps.js", "main.js", "launcher.js")
38-
)
39-
),
40-
defaultLocale = Some("en"),
41-
icons = Chrome.icons(
42-
"assets/icons",
43-
"app.png",
44-
Set(16, 32, 48, 64, 96, 128, 256, 512)
45-
),
46-
permissions = Set(
47-
System.CPU,
48-
System.Display,
49-
System.Memory,
50-
System.Network,
51-
Storage
52-
)
7+
enablePlugins(ChromeSbtPlugin)
8+
9+
name := "System Monitor"
10+
version := "0.2.0"
11+
scalaVersion := "2.12.2"
12+
13+
14+
addLibraries()
15+
addJsLibraries()
16+
17+
18+
scalaJSUseMainModuleInitializer := true
19+
scalaJSUseMainModuleInitializer in Test := false
20+
relativeSourceMaps := true
21+
skip in packageJSDependencies := false
22+
23+
24+
scalacOptions ++= MyBuildConfig.scalacOptions
25+
26+
27+
chromeManifest := new AppManifest {
28+
val name = Keys.name.value
29+
val version = Keys.version.value
30+
val app = App(
31+
background = Background(
32+
scripts = List("dependencies.js", "main.js")
5333
)
5434
)
5535

36+
override val defaultLocale = Some("en")
37+
38+
override val icons = Chrome.icons(
39+
"assets/icons",
40+
"app.png",
41+
Set(16, 32, 48, 64, 96, 128, 256, 512)
42+
)
43+
44+
override val permissions: Set[Permission] = Set(
45+
API.System.CPU,
46+
API.System.Display,
47+
API.System.Memory,
48+
API.System.Network,
49+
API.Storage
50+
)
51+
}
52+
53+
5654

project/Dependencies.scala

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
2+
import sbt.Keys.libraryDependencies
3+
import sbt._
4+
5+
object Dependencies {
6+
7+
object versions {
8+
val scalacss = "0.5.3"
9+
val scalaReact = "1.0.0"
10+
val scalaChrome = "0.5.0"
11+
12+
val react = "15.3.2"
13+
}
14+
15+
def addLibraries() = {
16+
libraryDependencies ++= Seq(
17+
"org.scala-js" %%% "scalajs-dom" % "0.9.2" withSources() withJavadoc(),
18+
"com.github.japgolly.scalajs-react" %%% "core" % versions.scalaReact withSources() withJavadoc(),
19+
"com.github.japgolly.scalajs-react" %%% "extra" % versions.scalaReact withSources() withJavadoc(),
20+
"com.github.japgolly.scalacss" %%% "core" % versions.scalacss withSources() withJavadoc(),
21+
"com.github.japgolly.scalacss" %%% "ext-react" % versions.scalacss withSources() withJavadoc(),
22+
"net.lullabyte" %%% "scala-js-chrome" % versions.scalaChrome withSources() withJavadoc()
23+
)
24+
}
25+
26+
def addJsLibraries() = {
27+
jsDependencies ++= Seq(
28+
"org.webjars" % "react" % versions.react / "react-with-addons.js" commonJSName "React",
29+
"org.webjars" % "react" % versions.react / "react-dom.js" commonJSName "ReactDOM"
30+
dependsOn "react-with-addons.js"
31+
minified "react-dom.min.js"
32+
)
33+
}
34+
}
35+
36+
object MyBuildConfig {
37+
38+
val scalacOptions = Seq(
39+
"-language:implicitConversions",
40+
"-language:existentials",
41+
"-Xlint",
42+
"-deprecation",
43+
"-Xfatal-warnings",
44+
"-feature"
45+
)
46+
47+
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 0.13.8
1+
sbt.version = 0.13.15

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("net.lullabyte" % "sbt-chrome-plugin" % "0.2.1")
2-
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.6.0")
1+
addSbtPlugin("net.lullabyte" % "sbt-chrome-plugin" % "0.5.0")
2+
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)