sapling/addons/isl-standalone
Evan Krause eb2a1c384f Standalone Tauri app
Summary:
See this document for more information:
https://docs.google.com/document/d/1kSdc86XNyPMt_rTB8uggYOZQ0hf4k7Fq4NhK1N3taZE/edit#

The idea here is to make a standalone application to access ISL, rather than using `sl web` to open ISL in a browser. This makes ISL feel more native and lets it use OS windowing features.

Since ISL is a web application, we need a browser-like technology like electron. Electron is quite bloated, so Tauri is a good alternative for our use case.

We only need to run `sl web` and embed that into a webview with Tauri. We don't need to produce entirely new javascript bundles for Tauri. This means the Tauri application shell can be updated independently of the actual ISL client/server code.

I don't intend to pursue this much futher right now, since the next steps involve figuring out distribution mechanisms and build pipelines. But I figured it was worth publishing and even landing this so it's easily accessible in the near future.

Reviewed By: quark-zju

Differential Revision: D40149722

fbshipit-source-id: 8225ffd54d77141254166676af65b991d4a1a3c1
2023-03-16 11:34:35 -07:00
..
dist Standalone Tauri app 2023-03-16 11:34:35 -07:00
src-tauri Standalone Tauri app 2023-03-16 11:34:35 -07:00
.gitignore Standalone Tauri app 2023-03-16 11:34:35 -07:00
dev.sh Standalone Tauri app 2023-03-16 11:34:35 -07:00
package.json Standalone Tauri app 2023-03-16 11:34:35 -07:00
README.md Standalone Tauri app 2023-03-16 11:34:35 -07:00

Standalone ISL

This is a standalone Tauri application that shows the Interactive Smartlog (ISL) UI for Sapling. This is similar to the browser-based sl web, but as an OS application.

Development

First run yarn to install dependencies. Compile the ISL client & server code and leave these watching processes running:

  • cd ../isl && yarn start
  • cd ../isl-server && yarn watch

Start the tauri app (from isl-standalone/):

  • ./dev.sh

Note: this can't be a yarn sub-command because tauri isn't happy about our configured node binary. Manually invoking this script works around this.

The tauri dev script will recompile the rust code whenever it detects changes.

Building for production

yarn --no-default-rc tauri build or ./node_modules/.bin/tauri build will create a production build of the app, which will end up in ./src-tauri/target/release.

How the Tauri ISL platform works

When you start the Tauri app, it runs sl web --json --platform standalone, to start an ISL server with the given platform. It will then launch and connect to the same server URL given by the sl web output.

The Tauri application bundle itself does not contain the ISL client or server code, since it just uses sl web.

The standalone platform defines how the client & server JS use Standalone-specific implementations of features. This is largely the same as the browser platform implementation.