@@ -7,6 +7,7 @@ import { Config, InbuiltMergeStrategies } from "./types";
7
7
import { backupFile , listMatchingFiles } from "./utils" ;
8
8
import fs from "node:fs/promises" ;
9
9
import { reconstructConflict } from "./conflict-helper" ;
10
+ import { globalLogger } from "./logger" ;
10
11
11
12
export * from "./types" ;
12
13
@@ -17,6 +18,9 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
17
18
) => {
18
19
const normalizedConfig : NormalizedConfig = await normalizeConfig < T > ( config ) ;
19
20
const filesEntries = await listMatchingFiles ( normalizedConfig ) ;
21
+ if ( normalizedConfig . debug ) {
22
+ globalLogger . info ( "all" , JSON . stringify ( { normalizedConfig, filesEntries } , null , 2 ) ) ;
23
+ }
20
24
await Promise . all (
21
25
filesEntries . map ( async ( { filePath, content } ) => {
22
26
const { theirs, ours, format } = await parseConflictContent ( content , { filename : filePath } ) ;
@@ -38,6 +42,10 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
38
42
backupFile ( filePath ) ,
39
43
] ) ;
40
44
45
+ if ( normalizedConfig . debug ) {
46
+ globalLogger . debug ( filePath , JSON . stringify ( { merged, conflicts } , null , 2 ) ) ;
47
+ }
48
+
41
49
if ( conflicts . length === 0 ) {
42
50
const serialized = await serialize ( format , merged ) ;
43
51
await fs . writeFile ( filePath , serialized , "utf8" ) ;
@@ -53,4 +61,5 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
53
61
}
54
62
} ) ,
55
63
) ;
64
+ globalLogger . flush ( ) ;
56
65
} ;
0 commit comments