Skip to content

Commit

Permalink
Write the package.json and package-lock.json files with pretty json f…
Browse files Browse the repository at this point in the history
…ormatting
  • Loading branch information
elizabethengelman committed Feb 26, 2024
1 parent a600f8e commit acb0aed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/soroban-cli/src/commands/contract/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use clap::{
use gix::{clone, create, open, progress, remote};
use rust_embed::RustEmbed;
use serde::Deserialize;
use serde_json::{from_str, json, Error as JsonError, Value as JsonValue};
use serde_json::{from_str, json, to_string_pretty, Error as JsonError, Value as JsonValue};
use toml_edit::{Document, Formatted, InlineTable, Item, TomlError, Value as TomlValue};
use ureq::{get, Error as UreqError};

Expand Down Expand Up @@ -438,7 +438,9 @@ fn edit_package_name(

doc["name"] = json!(package_name.to_string_lossy());

write(&file_path, doc.to_string())?;
let formatted_json = to_string_pretty(&doc)?;

write(&file_path, formatted_json)?;

Ok(())
}
Expand Down

0 comments on commit acb0aed

Please sign in to comment.