[object Object]

← back to Logo Variants App

port to Tauri v2 — 698MB Electron → 3.8MB native

18b51cd02509b34fee7010bba502a506297cb2ba · 2026-05-12 10:03:40 -0700 · SteveStudio2

Drop-in replacement for the Electron wrapper using Tauri v2 + macOS
WKWebView. Bundle size 184× smaller (3.8 MB vs 698 MB) at the cost of
adding a Rust toolchain dependency (`brew install rust` + `cargo install
tauri-cli`).

Structure:
  src-tauri/Cargo.toml        Rust crate manifest, release profile is
                              size-optimized (panic=abort, lto, opt='s',
                              codegen-units=1, strip).
  src-tauri/tauri.conf.json   Window config — 1440×900, decorations on,
                              Overlay titlebar with hiddenTitle, URL =
                              http://127.0.0.1:9716/logo-variants.html.
  src-tauri/src/main.rs       Tiny entry point — Tauri builds the window
                              from config and runs the WKWebView. ~15 LOC.
  src-tauri/icons/            32×32, 128×128, 128×128@2x, 512×512 icons
                              rasterized from build/source.svg via
                              macOS `sips` (no rsvg/imagemagick needed).
  web/index.html              frontendDist placeholder. The actual page
                              loads from :9716 — this is just satisfying
                              tauri-build's pre-flight check.

The Electron files (main.js, package.json's electron deps) remain in
place as a fallback — `_electron-start-legacy` and `_electron-pack-legacy`
npm scripts can still build the 698 MB Electron bundle if Tauri's
WKWebView ever diverges from Chrome on this specific page.

Shipped: killed old Electron process, replaced ~/Desktop/Logo Showdown.app,
launched (PID 23727), verified the WKWebView loads :9716/logo-variants.html
cleanly.

First-time setup cost: ~3 min for `brew install rust` + `cargo install
tauri-cli` + initial Rust compilation of ~280 dependency crates. Future
builds: 27s for the release binary.

Files touched

Diff

commit 18b51cd02509b34fee7010bba502a506297cb2ba
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Tue May 12 10:03:40 2026 -0700

    port to Tauri v2 — 698MB Electron → 3.8MB native
    
    Drop-in replacement for the Electron wrapper using Tauri v2 + macOS
    WKWebView. Bundle size 184× smaller (3.8 MB vs 698 MB) at the cost of
    adding a Rust toolchain dependency (`brew install rust` + `cargo install
    tauri-cli`).
    
    Structure:
      src-tauri/Cargo.toml        Rust crate manifest, release profile is
                                  size-optimized (panic=abort, lto, opt='s',
                                  codegen-units=1, strip).
      src-tauri/tauri.conf.json   Window config — 1440×900, decorations on,
                                  Overlay titlebar with hiddenTitle, URL =
                                  http://127.0.0.1:9716/logo-variants.html.
      src-tauri/src/main.rs       Tiny entry point — Tauri builds the window
                                  from config and runs the WKWebView. ~15 LOC.
      src-tauri/icons/            32×32, 128×128, 128×128@2x, 512×512 icons
                                  rasterized from build/source.svg via
                                  macOS `sips` (no rsvg/imagemagick needed).
      web/index.html              frontendDist placeholder. The actual page
                                  loads from :9716 — this is just satisfying
                                  tauri-build's pre-flight check.
    
    The Electron files (main.js, package.json's electron deps) remain in
    place as a fallback — `_electron-start-legacy` and `_electron-pack-legacy`
    npm scripts can still build the 698 MB Electron bundle if Tauri's
    WKWebView ever diverges from Chrome on this specific page.
    
    Shipped: killed old Electron process, replaced ~/Desktop/Logo Showdown.app,
    launched (PID 23727), verified the WKWebView loads :9716/logo-variants.html
    cleanly.
    
    First-time setup cost: ~3 min for `brew install rust` + `cargo install
    tauri-cli` + initial Rust compilation of ~280 dependency crates. Future
    builds: 27s for the release binary.
---
 .gitignore                     |   3 +++
 README.md                      |  23 ++++++++++++++-------
 package.json                   |   8 +++++---
 src-tauri/Cargo.toml           |  22 +++++++++++++++++++++
 src-tauri/build.rs             |   3 +++
 src-tauri/icons/128x128.png    | Bin 0 -> 7058 bytes
 src-tauri/icons/128x128@2x.png | Bin 0 -> 15418 bytes
 src-tauri/icons/32x32.png      | Bin 0 -> 1653 bytes
 src-tauri/icons/icon.png       | Bin 0 -> 34578 bytes
 src-tauri/src/main.rs          |  21 ++++++++++++++++++++
 src-tauri/tauri.conf.json      |  44 +++++++++++++++++++++++++++++++++++++++++
 web/index.html                 |   7 +++++++
 12 files changed, 121 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index c4f5cc7..ac65121 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@ dist/
 *.log
 .DS_Store
 build/icon.iconset/
+src-tauri/target/
+src-tauri/Cargo.lock
+src-tauri/gen/
diff --git a/README.md b/README.md
index bf9fadf..57f72b7 100644
--- a/README.md
+++ b/README.md
@@ -12,25 +12,34 @@ chrome (tabs, URL bar, bookmarks) competing with the marks themselves. A
 borderless app window puts the variants front-and-center, and you can keep it
 pinned to a Space without losing it to a Cmd-Tab through Chrome.
 
-## Run
+## Run (Tauri — primary)
 
 ```bash
 cd ~/Projects/logo-variants-app
 npm install
-npm start
+npm start              # → cargo tauri dev — hot-reload window
 ```
 
-The first launch downloads Electron (~150 MB). Subsequent launches are local.
+Requires Rust + cargo-tauri. Install once: `brew install rust && cargo install
+tauri-cli --version "^2.0" --locked`.
 
 ## Build the `.app`
 
 ```bash
-npm run pack         # builds dist/Logo Showdown-darwin-arm64/Logo Showdown.app
-npm run ship         # builds + copies to ~/Desktop/Logo Showdown.app
+npm run pack          # → src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Logo Showdown.app
+npm run ship          # build + copy to ~/Desktop/Logo Showdown.app
 ```
 
-The first build also downloads Electron's prebuilt binary; subsequent builds
-are cached and fast.
+Bundle size: **3.8 MB** (vs 698 MB for the legacy Electron build below).
+
+## Stack history
+
+- **v0.1.0 (Tauri, current)** — Rust + macOS WKWebView. 3.8 MB.
+- v0.1.0-electron (kept for fallback) — Electron + bundled Chromium, 698 MB.
+  Legacy scripts under `_electron-*-legacy` in package.json. The Electron
+  files (`main.js`, electron deps) remain in the repo as a safety net in
+  case Tauri's WKWebView ever proves too different from Chrome for the TSD
+  Logo Showdown page.
 
 ## What it talks to
 
diff --git a/package.json b/package.json
index 60a24a9..b2c5aba 100644
--- a/package.json
+++ b/package.json
@@ -4,9 +4,11 @@
   "description": "Native macOS desktop wrapper around the TSD Logo Showdown viewer at http://127.0.0.1:9716/logo-variants.html — for picking the final brand mark out of generated variants without needing a browser tab.",
   "main": "main.js",
   "scripts": {
-    "start": "electron .",
-    "pack": "electron-packager . 'Logo Showdown' --platform=darwin --arch=arm64 --overwrite --out=dist --app-bundle-id=com.designerwallcoverings.logoshowdown --app-version=0.1.0",
-    "ship": "npm run pack && rm -rf '/Users/stevestudio2/Desktop/Logo Showdown.app' && cp -r 'dist/Logo Showdown-darwin-arm64/Logo Showdown.app' /Users/stevestudio2/Desktop/ && echo 'shipped → ~/Desktop/Logo Showdown.app'"
+    "start": "cargo tauri dev",
+    "pack": "cargo tauri build --target aarch64-apple-darwin",
+    "ship": "npm run pack && killall 'Logo Showdown' 2>/dev/null ; rm -rf '/Users/stevestudio2/Desktop/Logo Showdown.app' && cp -r 'src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Logo Showdown.app' /Users/stevestudio2/Desktop/ && echo 'shipped → ~/Desktop/Logo Showdown.app'",
+    "_electron-start-legacy": "electron .",
+    "_electron-pack-legacy": "electron-packager . 'Logo Showdown' --platform=darwin --arch=arm64 --overwrite --out=dist --app-bundle-id=com.designerwallcoverings.logoshowdown --app-version=0.1.0"
   },
   "author": "Designer Wallcoverings",
   "license": "UNLICENSED",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
new file mode 100644
index 0000000..e0f0e3b
--- /dev/null
+++ b/src-tauri/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "logo-showdown"
+version = "0.1.0"
+edition = "2021"
+description = "Focused desktop wrapper for the TSD Logo Showdown viewer."
+authors = ["Designer Wallcoverings"]
+license = "UNLICENSED"
+
+[build-dependencies]
+tauri-build = { version = "2", features = [] }
+
+[dependencies]
+tauri = { version = "2", features = ["macos-private-api"] }
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+
+[profile.release]
+panic = "abort"
+codegen-units = 1
+lto = true
+opt-level = "s"
+strip = true
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
new file mode 100644
index 0000000..d860e1e
--- /dev/null
+++ b/src-tauri/build.rs
@@ -0,0 +1,3 @@
+fn main() {
+    tauri_build::build()
+}
diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png
new file mode 100644
index 0000000..ee1c00a
Binary files /dev/null and b/src-tauri/icons/128x128.png differ
diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png
new file mode 100644
index 0000000..2295031
Binary files /dev/null and b/src-tauri/icons/128x128@2x.png differ
diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png
new file mode 100644
index 0000000..7a6a1ff
Binary files /dev/null and b/src-tauri/icons/32x32.png differ
diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png
new file mode 100644
index 0000000..ec6222f
Binary files /dev/null and b/src-tauri/icons/icon.png differ
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
new file mode 100644
index 0000000..181ca91
--- /dev/null
+++ b/src-tauri/src/main.rs
@@ -0,0 +1,21 @@
+// Logo Showdown — Tauri v2 wrapper around http://127.0.0.1:9716/logo-variants.html.
+//
+// The window's URL is set declaratively in tauri.conf.json (app.windows[0].url),
+// so this binary is intentionally tiny — Tauri handles the window, WKWebView
+// handles the rendering. No frontend bundling needed since the page is served
+// by the TSD Express server.
+
+#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+
+fn main() {
+    tauri::Builder::default()
+        .plugin(tauri_plugin_opener())
+        .run(tauri::generate_context!())
+        .expect("error while running Logo Showdown");
+}
+
+fn tauri_plugin_opener() -> tauri::plugin::TauriPlugin<tauri::Wry> {
+    // Minimal noop plugin so we have a build dependency hook for future
+    // upgrades (system menu, external-link opening, etc.).
+    tauri::plugin::Builder::new("opener").build()
+}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
new file mode 100644
index 0000000..b021e3e
--- /dev/null
+++ b/src-tauri/tauri.conf.json
@@ -0,0 +1,44 @@
+{
+  "$schema": "https://schema.tauri.app/config/2",
+  "productName": "Logo Showdown",
+  "version": "0.1.0",
+  "identifier": "com.designerwallcoverings.logoshowdown",
+  "build": {
+    "frontendDist": "../web",
+    "devUrl": "http://127.0.0.1:9716/logo-variants.html"
+  },
+  "app": {
+    "macOSPrivateApi": true,
+    "windows": [
+      {
+        "label": "main",
+        "title": "Logo Showdown",
+        "width": 1440,
+        "height": 900,
+        "minWidth": 900,
+        "minHeight": 600,
+        "resizable": true,
+        "fullscreen": false,
+        "decorations": true,
+        "titleBarStyle": "Overlay",
+        "hiddenTitle": true,
+        "transparent": false,
+        "backgroundColor": "#0b0b0d",
+        "url": "http://127.0.0.1:9716/logo-variants.html"
+      }
+    ],
+    "security": {
+      "csp": null,
+      "dangerousDisableAssetCspModification": true
+    }
+  },
+  "bundle": {
+    "active": true,
+    "category": "DeveloperTool",
+    "copyright": "© Designer Wallcoverings",
+    "targets": ["app"],
+    "macOS": {
+      "minimumSystemVersion": "11.0"
+    }
+  }
+}
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 0000000..6b62c73
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<html><head>
+<meta charset="utf-8"><title>Logo Showdown</title>
+<style>html,body{margin:0;background:#0b0b0d;color:#f0ebe3;font:14px/1.5 -apple-system,sans-serif;}body{display:flex;align-items:center;justify-content:center;height:100vh;}p{opacity:.7}</style>
+</head><body><p>Loading TSD Logo Showdown…</p>
+<script>location.replace('http://127.0.0.1:9716/logo-variants.html');</script>
+</body></html>

← 3df8a30 initial scaffold — Electron wrapper for TSD Logo Showdown vi  ·  back to Logo Variants App  ·  chore: macstudio3 migration — reconcile from mac2 + repoint 2f6c529 →