Relay Modern Tools for Scala.js Folks

There are three parts to this.

  • Node compiler - scala-relay-compiler details
  • Sbt plugin - addSbtPlugin("com.dispalt.relay" % "sbt-relay-compiler" % "<version>") which handles code generation sbt hooks
  • Scala.js runtime - "com.dispalt.relay" %%% "relay-macro" % "<version>" which handles the runtime, which is very small.



  • Upgrade relay to 1.6.2, most of the changes seem import related
  • Generate a def newInput(args...): MutationInputType = ... for all mutaitons, making it a little easier.


  • Add ability to mix in traits with scalarFields so if value was a string { value @scalajs(extends:"Foo") } The trait would have a member val value: String with Foo


  • Added support for @scalajs(useNulls: boolean) that gives you finer grained access to using A | Null


  • Added support to support .gql files in any directory from baseDirectory.value so while it looks over more files it can support alternate locations now.


  • Relay 1.5.0 compiler support, nothing extra came of that minus some code changes.
  • Add option for --useNulls that specifies using a union with Null type for optional fields.
  • Add option for --verbose to increase verbosity
  • Make @scalajs(extends: string) work for more cases (inline frags, linked fields, and frag defs)


  • Actually works against 1.4.1 with everything I can test.


  • Mutations and Queries now are fully typed input and output
  • Published for npm as well. I haven't run across a query that can't compile. however I don't use some of the advanced features.


  • published for sbt 1


  • Manually publish for bintray as follow publishSigned from sbt-relay-compiler then bintrayRelease
  • Sonatype releasing seems to not be automatic anymore. you should be able to use sonatypeReleaseAll after publishSigned