Skip to content

upgrades: sbt 1.1.1, sjs 0.6.22, and more #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ lazy val client: Project = (project in file("client"))
scalacOptions ++= elideOptions.value,
jsDependencies ++= Settings.jsDependencies.value,
// RuntimeDOM is needed for tests
jsDependencies += RuntimeDOM % "test",
jsEnv in Test := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv,
// yes, we want to package JS dependencies
skip in packageJSDependencies := false,
// use Scala.js provided launcher code to start the client app
Expand Down Expand Up @@ -60,6 +60,7 @@ lazy val server = (project in file("server"))
scalaJSProjects := clients,
pipelineStages in Assets := Seq(scalaJSPipeline),
pipelineStages := Seq(digest, gzip),
libraryDependencies += guice,
// compress CSS
LessKeys.compress in Assets := true
)
Expand All @@ -83,4 +84,4 @@ lazy val ReleaseCmd = Command.command("release") {
// lazy val root = (project in file(".")).aggregate(client, server)

// loads the Play server project at sbt startup
onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value
onLoad in Global := ("project server" :: (_: State)) compose (onLoad in Global).value
10 changes: 5 additions & 5 deletions client/src/main/scala/spatutorial/client/SPAMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import spatutorial.client.modules._
import spatutorial.client.services.SPACircuit

import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import scala.scalajs.js.annotation.{ JSExport, JSExportTopLevel }
import CssSettings._

import scalacss.ScalaCssReact._

@JSExportTopLevel("SPAMain")
object SPAMain extends js.JSApp {
object SPAMain {

// Define the locations (pages) used in this application
sealed trait Loc
Expand Down Expand Up @@ -53,8 +53,8 @@ object SPAMain extends js.JSApp {
)
}

@JSExport
def main(): Unit = {
@JSExportTopLevel("SPAMain.main")
def main(args: Array[String]): Unit = {
log.warn("Application starting")
// send log messages also to the server
log.enableServerLogging("/logging")
Expand Down
2 changes: 1 addition & 1 deletion project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object Settings {
val bootstrap = "3.3.6"
val chartjs = "2.1.3"

val scalajsScripts = "1.0.0"
val scalajsScripts = "1.1.1"
}

/**
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=1.1.1
14 changes: 7 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// repository for Typesafe plugins
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.3")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.15")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.12")

addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.0.5")
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.0.6")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")
10 changes: 10 additions & 0 deletions server/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ application.cdn=${?APPLICATION_CDN}

spatutorial {
}

# as seen in https://github.com/playframework/play-scala-streaming-example/pull/38/files:
# https://www.playframework.com/documentation/latest/SecurityHeaders
# Allow URLs from the same origin to be loaded by frames and scripts
play.filters.headers {
frameOptions = "SAMEORIGIN"
contentSecurityPolicy = "connect-src 'self'"
}

play.filters.disabled+=play.filters.csrf.CSRFFilter
6 changes: 3 additions & 3 deletions server/src/main/scala/controllers/Application.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package controllers

import java.nio.ByteBuffer
import javax.inject.Inject

import boopickle.Default._
import com.google.inject.Inject
import play.api.{Configuration, Environment}
import play.api.{ Configuration, Environment }
import play.api.mvc._
import services.ApiService
import spatutorial.shared.Api
Expand All @@ -16,7 +16,7 @@ object Router extends autowire.Server[ByteBuffer, Pickler, Pickler] {
override def write[R: Pickler](r: R) = Pickle.intoBytes(r)
}

class Application @Inject() (implicit val config: Configuration, env: Environment) extends Controller {
class Application @Inject() (implicit val config: Configuration, env: Environment) extends InjectedController {
val apiService = new ApiService()

def index = Action {
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/twirl/views/tags/_asset.scala.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@(path: String)(implicit config: play.api.Configuration)@{config.getString("application.cdn").getOrElse("") + routes.Assets.versioned(path)}
@(path: String)(implicit config: play.api.Configuration)@{config.getOptional[String]("application.cdn").getOrElse("") + routes.Assets.versioned(path)}