blackboardsh / electrobun

Build ultra fast, tiny, and cross-platform desktop apps with Typescript.
https://www.electrobun.dev
MIT License
254 stars 4 forks source link

Updating apps #3

Closed YoavCodes closed 5 months ago

YoavCodes commented 6 months ago

Goal

Two paths:

  1. bun and webview runtimes are stored in a global location
  2. bun and webview runtimes are bundled with your app bundle

Open questions:

  1. when supporting multiple OSes later, with either of these paths be easier or not feasible. lean toward cross-platform consistency where possible.
  2. what manages the update logic (launcher binary, the bun api)? Most likely in bun so we can leverage native ui and notifications
  3. when does auto-downloading and auto-applying of updates happen? app shutdown, app startup, etc.

Build flow

Option 1: Global runtime cache

dev

distribution

Option 2: Bundled runtimes

dev

distribution

Update flow

Files

// version.json -- in the app bundle
{
    "version": "1.0.0",
    "channel": "stable",
    "url": "http://example.com/update.json"
}

// update.json -- hosted somewhere
{
  "baseUrl": "http://example.com/updates/",
  "channels": {
    "stable": {
      "1.0.0": {
        "notes": "This is a stable release",
        "targets": {
          "windows-x64": {
            "bundle": {
              "checksum": "1234567890abcdef",
              "filesize": 102900
            },
            "app": {
              "checksum": "1234567890abcdef",
              "filesize": 102400
            },
            "bun": {
              "checksum": "abcdef1234567890",
              "filesize": 20480
            },
            "webview": {
              "checksum": "fedcba0987654321",
              "filesize": 30720
            }
          },
          "linux-arm64": {
            "bundle": {
              "checksum": "1234567890abcdef",
              "filesize": 102900
            },
            "app": {
              "checksum": "0987654321fedcba",
              "filesize": 51200
            },
            "bun": {
              "checksum": "abcdef1234567890",
              "filesize": 15360
            },
            "webview": {
              "checksum": "1234567890abcdef",
              "filesize": 20480
            }
          }
        }
      }
    },
    "canary": {
      "1.1.0": {
        "notes": "This is a beta release",
        "targets": {
          // Similar structure for canary builds
        }
      }
    },
    "dev": {
      "1.2.0": {
        "notes": "This is a dev release",
        "targets": {
          // Similar structure for dev builds
        }
      }
    }
  }
}

Tasks:

YoavCodes commented 5 months ago

the flow is a bit different but wrapped up the first implementation of updates last week. will write up proper docs soon.