scalajs-multiclient-example

About

Quick-and-dirty multi-client (web, mobile, desktop) Scala.js application using scalajs-bundler, Slinky, React, React Native, Expo and Electron.

Pre-requisites:

Tools

  • Oracle Java JDK 7/8/9
  • sbt >= 0.13
  • Node.js >= 6 (install via nvm to avoid issues with native packaged versions)
  • yarn (optional)

npm packages

  • npm install -g create-react-native-app
  • npm install -g react-native-cli
  • npm install -g electron
  • npm install -g react-devtools

Usage

Web client, from sbt:

webClient/fastOptJS::startWebpackServer

Desktop client, from sbt:

desktopClient/electron

Mobile client, from sbt:

mobileClient/expo

NB: Until a React Native facade exists for Slinky expect a big red warning about missing components when you run the mobile client.

Notes

In all 3 clients we're using (or misusing) scalajs-bundler to set up a Node.js project and deliver compiled Scala.js at target/scala-2.12/scalajs-bundler/main. If you're curious or want to run npm/node/yarn directly you can look here after running the client-specific commands to build the project.

TODO

  • web client
  • desktop client with Electron
    • node project config managed in sbt
    • launch Electron from sbt
    • app setup in Scala.js
    • use Slinky/React to render the client
  • mobile client with React Native and Expo
    • node project config managed in sbt
    • launch Expo server from sbt
    • facade for React Native Components
    • use Slinky/React Native to render the client
  • embed mscharley's Electron facade until PR is accepted and a compatible version published
  • shared code & components across clients
  • experiment with react-native-web
  • experiment with reactxp
  • production builds