@@ -7,6 +7,7 @@ import { Config, InbuiltMergeStrategies } from "./types";
77import { backupFile , listMatchingFiles } from "./utils" ;
88import fs from "node:fs/promises" ;
99import { reconstructConflict } from "./conflict-helper" ;
10+ import { globalLogger } from "./logger" ;
1011
1112export * from "./types" ;
1213
@@ -17,6 +18,9 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
1718) => {
1819 const normalizedConfig : NormalizedConfig = await normalizeConfig < T > ( config ) ;
1920 const filesEntries = await listMatchingFiles ( normalizedConfig ) ;
21+ if ( normalizedConfig . debug ) {
22+ globalLogger . info ( "all" , JSON . stringify ( { normalizedConfig, filesEntries } , null , 2 ) ) ;
23+ }
2024 await Promise . all (
2125 filesEntries . map ( async ( { filePath, content } ) => {
2226 const { theirs, ours, format } = await parseConflictContent ( content , { filename : filePath } ) ;
@@ -38,6 +42,10 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
3842 backupFile ( filePath ) ,
3943 ] ) ;
4044
45+ if ( normalizedConfig . debug ) {
46+ globalLogger . debug ( filePath , JSON . stringify ( { merged, conflicts } , null , 2 ) ) ;
47+ }
48+
4149 if ( conflicts . length === 0 ) {
4250 const serialized = await serialize ( format , merged ) ;
4351 await fs . writeFile ( filePath , serialized , "utf8" ) ;
@@ -53,4 +61,5 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
5361 }
5462 } ) ,
5563 ) ;
64+ globalLogger . flush ( ) ;
5665} ;
0 commit comments