Skip to content

ptrdom/scalajs-electron-quick-start

Repository files navigation

scalajs-electron-quick-start

electron-quick-start conversion to Scala.js

How to run

Requires npm to be installed in the system.

Run sbt app/electronStart.

Design

The application is split into five sbt modules to fit a project structure that works well with Scala.js and the security guidelines outlined in Electron documentation:

  • app
    • Combines Scala.js output of other modules with additional resources into an Electron application.
    • Implements a simple Electron sbt plugin with following tasks:
      • app/electronInstall - copies over resources (index.html, package.json, package-lock.json, styles.css) to target directory and runs npm install.
      • app/electronCompile - compiles Scala.js modules, copies output to target directory.
      • app/electronStart - runs npm start on target directory.
  • main
  • preload
    • Contains preload script.
    • Can use a polyfilled subset of Node.js APIs, so it does use CommonJS modules, but can only require a subset of them.
  • node-shared
    • Contains Scala.js facades that can be shared between main and preload modules.
  • renderer
    • Contains renderer process of the Electron Process Model.
    • Because it used for producing web content and browsers do not have built-in support CommonJS modules, it is built separately as a single bundle.

scalaJSStage setting in main, preload and renderer modules can be used to toggle between FastLinkJS and FullLinkJS output.

License

This software is licensed under the MIT license

Releases

No releases published

Packages

No packages published