From 640b52ef9e5e2b4bf2a3722a8860b1d583046c91 Mon Sep 17 00:00:00 2001 From: CRT Date: Wed, 30 Sep 2026 15:32:38 +0000 Subject: [PATCH] README: Dev loop section --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index cbac421..e9c83dc 100644 --- a/README.md +++ b/README.md @@ -510,6 +510,29 @@ wayBetter for X adds this repository as a git submodule at `waybetter/` and cons type stripping refuses `.ts` files under `node_modules`, while sources outside it work with Bun's isolated linker on Windows. +## Dev loop + +`waybetter dev [--stable] --watch ""...` starts the app's watchers, waits for their +first build and runs `tauri dev` (`--stable` adds `--no-watch`: a Rust file saved by someone else +does not restart the app; restart it yourself after Rust changes). Debug builds only: + +- The app names its page scripts with `waybetter_host::page_script!(include_str!("../x.js"), "x.js")` + in `SiteHooks::init_scripts`. A debug build reads the file from disk (path relative to the app + crate, falling back to the embedded copy) each time a tab's init scripts are built and watches it + (`devloop`, using `devmode`'s debounced signature watcher). When it changes, every tab webview is + rebuilt on its current URL through `tabs_sync`, because a webview's document-start scripts are + fixed at creation. Route is kept, scroll is not. About 1 s from save to visible. +- `buildRuntime({ watch: watchRequested(), ... })` (`waybetter/build`) keeps esbuild rebuilding the + file; a failed build leaves the last good one. +- The shell reloads through the frontend dev server (`beforeDevCommand`), instantly. +- Restart needed: Rust, `tauri.conf.json`, capabilities, bundled plugin sources (`include_str!` in the + plugin table; installed plugin files reload with developer mode as before). +- Release builds contain none of it: `devloop` is `cfg(debug_assertions)`, the macro's release arm is + `$embedded.to_owned()` and the path literal is never expanded. `release_guard` (lib.rs) checks that + every mention is gated; `cargo test --release` also runs `release_page_script_is_the_embedded_copy`. +- `.taurignore` the watched output files (`observer.js`, `x-runtime.js`), or plain `tauri dev` restarts + on every rebuild. `create-waybetter` apps get `npm run dev` and `npm run dev:stable`. + ## Scripts (no CI) ```sh