embed dashboard (#1169)

* embed dashboard

* docs

* fmt
This commit is contained in:
Chris Tate
2026-04-06 10:45:08 -05:00
committed by GitHub
parent 3896ed0d9d
commit 1f8757b215
15 changed files with 116 additions and 272 deletions
+17
View File
@@ -3,7 +3,24 @@ use std::env;
use std::fs;
use std::path::Path;
/// Ensure `packages/dashboard/out/` exists so `rust-embed` doesn't fail during
/// Rust-only dev builds where the dashboard hasn't been built. The placeholder
/// `index.html` is only written when the directory is completely absent.
fn ensure_dashboard_dir() {
let dashboard_out = Path::new("../packages/dashboard/out");
println!("cargo:rerun-if-changed=../packages/dashboard/out");
if !dashboard_out.join("index.html").exists() {
let _ = fs::create_dir_all(dashboard_out);
let _ = fs::write(
dashboard_out.join("index.html"),
"<!DOCTYPE html><html><body><p>Dashboard not built. Run: cd packages/dashboard &amp;&amp; pnpm build</p></body></html>\n",
);
}
}
fn main() {
ensure_dashboard_dir();
let protocol_dir = Path::new("cdp-protocol");
let out_dir = env::var("OUT_DIR").unwrap();
let out_path = Path::new(&out_dir).join("cdp_generated.rs");