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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Stop writing codegen files if it just changes new lines",
"packageName": "@react-native-windows/codegen",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
6 changes: 4 additions & 2 deletions packages/@react-native-windows/codegen/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ function checkFilesForChanges(
}

const currentContents = fs.readFileSync(fileName, 'utf8');
if (currentContents !== contents) {
// The current file may be saved using crlf, in which case the new lines may differ from the new output
if (currentContents.replaceAll('\r\n', '\n') !== contents) {
console.log(`- ${fileName} has changed`);
hasChanges = true;
continue;
Expand Down Expand Up @@ -146,7 +147,8 @@ function writeMapToFiles(map: Map<string, string>, outputDir: string) {
if (fs.existsSync(fileName)) {
const currentContents = fs.readFileSync(fileName, 'utf8');
// Don't update the files if there are no changes as this breaks incremental builds
if (currentContents === contents) {
// The current file may be saved using crlf, in which case the new lines may differ from the new output
if (currentContents.replaceAll('\r\n', '\n') === contents) {
continue;
}
}
Expand Down
Loading