Skip to content

Commit

Permalink
fix: override file only needed in format_sql.ts (#707)
Browse files Browse the repository at this point in the history
Change that makes format_sql.ts script only override file if there was
some formatting to do. This change is needed to prevent rust build
system from dropping build caches when files did not change
  • Loading branch information
tomg10 committed Dec 19, 2023
1 parent 031446f commit 8351f25
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions infrastructure/zk/src/format_sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@ async function formatFile(filePath: string, check: boolean) {
}
}
modifiedFile = modifiedFile.slice(0, modifiedFile.length - 1);

if (!check) {
await fs.promises.writeFile(filePath, modifiedFile);
} else {
if (content !== modifiedFile) {
if (content !== modifiedFile) {
if (check) {
console.warn(`Sqlx query format issues found in ${filePath}.`);
} else {
await fs.promises.writeFile(filePath, modifiedFile);
}
}
return content === modifiedFile;
Expand Down

0 comments on commit 8351f25

Please sign in to comment.