项目文件夹

文件
wehub-resource-sync 680cc63b3d
Relay Deploy Dev / Deploy Relay Dev (push) Failing after 1s
Remote Deploy Dev / Deploy Remote Dev (push) Failing after 2s
Test / frontend-checks (push) Blocked by required conditions
Test / changes (push) Waiting to run
Test / backend-schema-checks (push) Blocked by required conditions
Test / backend-remote-checks (push) Blocked by required conditions
Test / backend-clippy (push) Blocked by required conditions
Test / backend-test (push) Blocked by required conditions
Test / tauri-checks (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:12:58 +08:00

48 行
1.9 KiB
Rust

use std::{fs, path::Path};
fn main() {
// Load .env from the workspace root
let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
let env_file = workspace_root.join(".env");
dotenv::from_path(&env_file).ok();
// Re-run build script when these env vars or .env file change
println!("cargo:rerun-if-env-changed=POSTHOG_API_KEY");
println!("cargo:rerun-if-env-changed=POSTHOG_API_ENDPOINT");
println!("cargo:rerun-if-env-changed=VK_SHARED_API_BASE");
println!("cargo:rerun-if-env-changed=SENTRY_DSN");
if env_file.exists() {
println!("cargo:rerun-if-changed={}", env_file.display());
}
if let Ok(api_key) = std::env::var("POSTHOG_API_KEY") {
println!("cargo:rustc-env=POSTHOG_API_KEY={}", api_key);
}
if let Ok(api_endpoint) = std::env::var("POSTHOG_API_ENDPOINT") {
println!("cargo:rustc-env=POSTHOG_API_ENDPOINT={}", api_endpoint);
}
if let Ok(vk_shared_api_base) = std::env::var("VK_SHARED_API_BASE") {
println!("cargo:rustc-env=VK_SHARED_API_BASE={}", vk_shared_api_base);
}
if let Ok(vk_shared_relay_api_base) = std::env::var("VK_SHARED_RELAY_API_BASE") {
println!(
"cargo:rustc-env=VK_SHARED_RELAY_API_BASE={}",
vk_shared_relay_api_base
);
}
// Create packages/local-web/dist directory if it doesn't exist
let dist_path = Path::new("../../packages/local-web/dist");
if !dist_path.exists() {
println!("cargo:warning=Creating dummy packages/local-web/dist directory for compilation");
fs::create_dir_all(dist_path).unwrap();
// Create a dummy index.html
let dummy_html = r#"<!DOCTYPE html>
<html><head><title>Build web app first</title></head>
<body><h1>Please build @vibe/local-web first</h1></body></html>"#;
fs::write(dist_path.join("index.html"), dummy_html).unwrap();
}
}