Skip to content

Commit

Permalink
Fix writeIfChanged plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanceylan committed Dec 26, 2024
1 parent 5c53fd3 commit f92ff27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/sleekgrid
Submodule sleekgrid updated 1 files
+19 −18 build/build.js
10 changes: 8 additions & 2 deletions packages/tsbuild/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export const esbuildOptions = (opt) => {
plugins.push(importAsGlobalsPlugin(opt.importAsGlobals ?? importAsGlobalsMapping));
}

if (opt.write === undefined && opt.writeIfChanged === undefined || opt.writeIfChanged) {
plugins.push(writeIfChanged());
opt.write = false;
}

delete opt.clean;
delete opt.importAsGlobals;
delete opt.writeIfChanged;
Expand Down Expand Up @@ -207,10 +212,11 @@ export function writeIfChanged() {
const old = readFileSync(file.path);
if (old.equals(file.contents))
return;
console.log("overwriting " + file.path);
}
else {
mkdirSync(dirname(file.path), { recursive: true });
writeFileSync(file.path, file.text);
}
writeFileSync(file.path, file.text);
});
});
}
Expand Down

0 comments on commit f92ff27

Please # to comment.