Skip to content

Commit

Permalink
fix: don't ask to overwrite if content is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Mar 13, 2024
1 parent 18c4471 commit 4ecad7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions generator/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export async function generateFiles(options: Options, poolConfigs: PoolConfigs):

async function askBeforeWrite(options: Options, path: string, content: string) {
if (!options.force && fs.existsSync(path)) {
const currentContent = fs.readFileSync(path, {encoding: 'utf8'});
// skip if content did not change
if (currentContent === content) return;
const force = await confirm({
message: `A file already exists at ${path} do you want to overwrite`,
default: false,
Expand Down

0 comments on commit 4ecad7f

Please sign in to comment.