Skip to content

Commit 7a05bd5

Browse files
committed
fix: make cargo publish work by pre-building frontend
1 parent 23bf940 commit 7a05bd5

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

tracing-web-console/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ readme = "../README.md"
99
description = "A real-time web-based console for viewing and filtering tracing logs"
1010
keywords = ["tracing", "logging", "console", "dashboard", "web"]
1111
categories = ["development-tools::debugging", "development-tools::profiling", "web-programming"]
12+
include = [
13+
"src/**/*",
14+
"frontend/dist/**/*",
15+
"build.rs",
16+
"Cargo.toml",
17+
]
1218

1319
[dependencies]
1420
# Workspace dependencies

tracing-web-console/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ fn main() {
1818
// Recursively track all files in src directory
1919
track_directory("frontend/src");
2020

21+
// If dist already exists (e.g., during cargo publish), skip building
22+
// This is necessary because cargo publish verifies the package in a temp directory
23+
// and build scripts cannot modify the source directory
24+
if dist_dir.exists() && dist_dir.join("index.html").exists() {
25+
println!("cargo:warning=Frontend dist already exists, skipping build");
26+
println!("cargo:rerun-if-changed=frontend/dist");
27+
return;
28+
}
29+
2130
// Check if we should build the frontend
2231
if frontend_dir.exists() {
2332
println!("cargo:warning=Building frontend...");

0 commit comments

Comments
 (0)