1use std::{path::Path, process::Command};
2
3use dap_adapters::{JsDebugAdapter, PythonDebugAdapter, UpdateSchemasDapDelegate};
4use tempfile::TempDir;
5
6fn main() -> anyhow::Result<()> {
7 let temp_dir = TempDir::new()?;
8 let output_dir = Path::new("crates/dap_adapters/schemas");
9 let delegate = UpdateSchemasDapDelegate::new();
10
11 let schema = JsDebugAdapter::get_schema(&temp_dir, delegate.clone())?;
12 std::fs::write(
13 &output_dir
14 .join(JsDebugAdapter::ADAPTER_NAME)
15 .with_extension("json"),
16 serde_json::to_string(&schema)?,
17 )?;
18 let schema = PythonDebugAdapter::get_schema(&temp_dir, delegate.clone())?;
19 std::fs::write(
20 &output_dir
21 .join(PythonDebugAdapter::ADAPTER_NAME)
22 .with_extension("json"),
23 serde_json::to_string(&schema)?,
24 )?;
25
26 Command::new("npx")
27 .arg("prettier")
28 .arg("--write")
29 .arg(output_dir.join("*"))
30 .status()?;
31 Ok(())
32}