fix: allow post_create on dx new to fail silently

This commit is contained in:
Jonathan Kelley committed 2024-12-06 12:04:02 -08:00
1 parent aa7d952a72
commit 2c9d8aea56
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -81,7 +81,7 @@ impl Create {
};
restore_cursor_on_sigint();
let path = cargo_generate::generate(args)?;
post_create(&path)?;
_ = post_create(&path);
Ok(StructuredOutput::Success)
}
}
@@ -183,7 +183,10 @@ pub(crate) fn post_create(path: &Path) -> Result<()> {
// 3. Format the `Cargo.toml` and `Dioxus.toml` files.
let toml_paths = [path.join("Cargo.toml"), path.join("Dioxus.toml")];
for toml_path in &toml_paths {
let toml = std::fs::read_to_string(toml_path)?;
let Ok(toml) = std::fs::read_to_string(toml_path) else {
continue;
};
let mut toml = toml.parse::<toml_edit::DocumentMut>().map_err(|e| {
anyhow::anyhow!(
"failed to parse toml at {}: {}",
+1 -1
View File
@@ -73,7 +73,7 @@ impl Init {
};
create::restore_cursor_on_sigint();
let path = cargo_generate::generate(args)?;
create::post_create(&path)?;
_ = create::post_create(&path);
Ok(StructuredOutput::Success)
}
}