Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/cli/src/subcommands/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ fn upsert_env_db_names_and_hosts(env_path: &Path, server_host_url: &str, databas
} else {
String::new()
};
let original_contents = contents.clone();

for prefix in prefixes {
for (suffix, value) in [("DB_NAME", database_name), ("HOST", server_host_url)] {
Expand All @@ -343,7 +344,9 @@ fn upsert_env_db_names_and_hosts(env_path: &Path, server_host_url: &str, databas
contents.push('\n');
}

fs::write(env_path, contents)?;
if contents != original_contents {
fs::write(env_path, contents)?;
}
Ok(())
}

Expand Down
4 changes: 3 additions & 1 deletion crates/cli/src/subcommands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ pub async fn exec_ex(
fs::create_dir_all(out_dir.join(parent))?;
}
let path = out_dir.join(fname);
fs::write(&path, code)?;
if !path.exists() || fs::read_to_string(&path)? != code {
fs::write(&path, code)?;
}
paths.insert(path);
}

Expand Down
Loading