Skip to content

Instantly share code, notes, and snippets.

@shadaj
Last active August 8, 2017 18:28
Show Gist options
  • Save shadaj/e6a1f66f24b0769144824db051b583aa to your computer and use it in GitHub Desktop.
Save shadaj/e6a1f66f24b0769144824db051b583aa to your computer and use it in GitHub Desktop.
enablePlugins(ScalaJSBundlerPlugin)
resolvers += "Apollo Bintray" at "https://dl.bintray.com/apollographql/maven/"
libraryDependencies += "com.apollographql" %%% "react-apollo-scalajs" % "0.1.0"
libraryDependencies += "me.shadaj" %%% "slinky-web" % "0.1.0"
npmDependencies in Compile += "react" -> "15.6.1"
npmDependencies in Compile += "react-dom" -> "15.6.1"
npmDependencies in Compile += "react-apollo" -> "1.4.8"
scalaJSUseMainModuleInitializer := true
val namespace = "com.apollographql.scalajs"
(sourceGenerators in Compile) += Def.task {
import scala.sys.process._
val out = (sourceManaged in Compile).value
out.mkdirs()
Seq(
"apollo-codegen", "generate", ((sourceDirectory in Compile).value / "graphql").getAbsolutePath + "/*.graphql",
"--schema", (baseDirectory.value / "schema.json").getAbsolutePath,
"--target", "scala",
"--namespace", namespace,
"--output", (out / "graphql.scala").getAbsolutePath
).!
Seq(out / "graphql.scala")
}
watchSources ++= ((sourceDirectory in Compile).value / "graphql" ** "*.graphql").get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment