From 821f217bd0142cee1af9e40702aec9f20378b7d1 Mon Sep 17 00:00:00 2001 From: Duy Do Date: Wed, 9 Jul 2025 13:54:47 +0700 Subject: [PATCH 1/2] . --- lib/space-operator-cli/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/space-operator-cli/src/main.rs b/lib/space-operator-cli/src/main.rs index c8b62ba6b..d327faac9 100644 --- a/lib/space-operator-cli/src/main.rs +++ b/lib/space-operator-cli/src/main.rs @@ -33,7 +33,7 @@ use url::Url; use uuid::Uuid; use xshell::{Shell, cmd}; -static CLIENT: LazyLock = LazyLock::new(|| reqwest::Client::new()); +static CLIENT: LazyLock = LazyLock::new(Default::default); pub mod schema; From 1c9fd8c0fb0fd49210a6c649e19997124449c492 Mon Sep 17 00:00:00 2001 From: Duy Do Date: Wed, 9 Jul 2025 16:12:03 +0700 Subject: [PATCH 2/2] temp --- lib/space-operator-cli/src/main.rs | 36 ++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/lib/space-operator-cli/src/main.rs b/lib/space-operator-cli/src/main.rs index d327faac9..0a16f03b0 100644 --- a/lib/space-operator-cli/src/main.rs +++ b/lib/space-operator-cli/src/main.rs @@ -219,6 +219,8 @@ enum NodeCommands { /// Specify which Rust package to add the new node to #[arg(long, short)] package: Option, + #[arg(long)] + deno: bool, }, /// Upload nodes #[command(visible_alias = "u")] @@ -1381,6 +1383,31 @@ async fn write_code( Ok(()) } +async fn write_deno_node_definition( + def: &CommandDefinition, +) -> Result, Report> { + let path = PathBuf::from(format!("{}.json", def.data.node_id)); + + println!("writing node definition to {}", path.display()); + if path.is_file() { + if !ask("file already exists, overwrite?").await { + return Ok(None); + } + } + let content = serde_json::to_string_pretty(def).change_context(Error::Json)?; + write_file(&path, content).await?; + Ok(Some(path)) +} + +async fn new_deno_node() -> Result<(), Report> { + let mut def = prompt_node_definition().await?; + def.r#type = "deno".to_owned(); + if let Some(nd) = write_deno_node_definition(&def).await? { + } + + Ok(()) +} + async fn new_node(allow_dirty: bool, package: &Option) -> Result<(), Report> { if is_dirty() .inspect_err(|error| { @@ -1400,7 +1427,7 @@ async fn new_node(allow_dirty: bool, package: &Option) -> Result<(), Rep } else if let Some(member) = find_target_crate(&meta)? { member } else { - eprintln!("could not determine which package to update"); + eprintln!("could not determine which Rust package to place your node in"); eprintln!("use `-p` option to specify a package"); let list = meta .workspace_packages() @@ -1836,9 +1863,14 @@ async fn run() -> Result<(), Report> { NodeCommands::New { allow_dirty, package, + deno, } => { check_latest_version().await?; - new_node(*allow_dirty, package).await?; + if *deno { + new_deno_node().await?; + } else { + new_node(*allow_dirty, package).await?; + } } NodeCommands::Upload { path,