* wip: posthog analytics * wip: remove posthog-rs crate; call endpoint directly * make analytics non-blocking * session start event * configure analytics for release builds * remove dev_server_stopped event * address review comments * simplify analytics enabled logic * analytics on by default; send start_session when user enables analytics; new task_attempt_start event * lower visibility of analytics logs * chore: bump version to 0.0.37-0 * set analytics to true if previously unset --------- Co-authored-by: GitHub Action <action@github.com>
27 lines
901 B
Rust
27 lines
901 B
Rust
use std::{fs, path::Path};
|
|
|
|
fn main() {
|
|
dotenv::dotenv().ok();
|
|
|
|
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);
|
|
}
|
|
|
|
// Create frontend/dist directory if it doesn't exist
|
|
let dist_path = Path::new("../frontend/dist");
|
|
if !dist_path.exists() {
|
|
println!("cargo:warning=Creating dummy frontend/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 frontend first</title></head>
|
|
<body><h1>Please build the frontend</h1></body></html>"#;
|
|
|
|
fs::write(dist_path.join("index.html"), dummy_html).unwrap();
|
|
}
|
|
}
|