summaryrefslogtreecommitdiff
path: root/cli/lockfile.rs
diff options
context:
space:
mode:
authorWenheLI <wl1508@nyu.edu>2021-12-07 18:21:04 -0600
committerGitHub <noreply@github.com>2021-12-07 19:21:04 -0500
commitb51b0c834b596383084d4a9991695759af9d27ad (patch)
treebe731200e2ea45d566c26fe709fb179ab6664446 /cli/lockfile.rs
parent5c0636888c7b8686fca671a48718c7cf11ef252f (diff)
feat(cli): use deno fmt for lock and coverage files (#13018)
Diffstat (limited to 'cli/lockfile.rs')
-rw-r--r--cli/lockfile.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/lockfile.rs b/cli/lockfile.rs
index 6b553bd15..5df3b1213 100644
--- a/cli/lockfile.rs
+++ b/cli/lockfile.rs
@@ -12,6 +12,8 @@ use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Arc;
+use crate::tools::fmt::format_json;
+
#[derive(Debug, Clone)]
pub struct Lockfile {
write: bool,
@@ -42,13 +44,15 @@ impl Lockfile {
}
let j = json!(&self.map);
let s = serde_json::to_string_pretty(&j).unwrap();
+
+ let format_s = format_json(&s, &Default::default()).unwrap_or(s);
let mut f = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(&self.filename)?;
use std::io::Write;
- f.write_all(s.as_bytes())?;
+ f.write_all(format_s.as_bytes())?;
debug!("lockfile write {}", self.filename.display());
Ok(())
}