Skip to content

Commit

Permalink
chore(tasks/transform-conformance): update only when the output diffe…
Browse files Browse the repository at this point in the history
…rs from the original output (#7779)

From `5xx` files changed to `3xx`
  • Loading branch information
Dunqing committed Dec 11, 2024
1 parent 4d33ffb commit 74bf141
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tasks/transform_conformance/update_fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ async function updateDir(dirPath, options, hasChangedOptions) {
) {
const inputPath = pathJoin(dirPath, filenames.input),
outputPath = pathJoin(dirPath, filenames.output);
await backupFile(outputPath);
await transform(inputPath, outputPath, options);
const originalCode = (await readFile(outputPath)).toString();
const code = await transform(inputPath, outputPath, options);
if (originalCode.trim() !== code.trim()) {
await backupFile(outputPath);
await writeFile(outputPath, code);
}
}

// Process subfolders
Expand Down Expand Up @@ -177,7 +181,7 @@ async function transform(inputPath, outputPath, options) {
}

const { code } = await transformFileAsync(inputPath, options);
await writeFile(outputPath, code);
return code;
}

/**
Expand Down

0 comments on commit 74bf141

Please sign in to comment.