Skip to content

Commit 27daef2

Browse files
committed
docs(changeset):
1 parent df062c3 commit 27daef2

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

.changeset/tame-pumas-drop.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

lib/src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ export const resolveConflicts = async <T extends string = InbuiltMergeStrategies
1313
const globalLogger = await createLogger(config.loggerConfig);
1414
const normalizedConfig: NormalizedConfig = await normalizeConfig<T>(config);
1515
const filesEntries = await listMatchingFiles(normalizedConfig);
16-
if (normalizedConfig.debug) {
17-
globalLogger.info("all", JSON.stringify({ normalizedConfig, filesEntries }, null, 2));
18-
}
1916
await Promise.all(
2017
filesEntries.map(async ({ filePath, content }) => {
21-
const { theirs, ours, format } = await parseConflictContent(content, {
18+
const { theirs, ours, base, format } = await parseConflictContent(content, {
2219
filename: filePath,
2320
parsers: normalizedConfig.parsers,
2421
});
22+
globalLogger.debug(filePath, JSON.stringify({ ours, theirs, base, format }));
2523
await processMerge({
2624
ours,
2725
theirs,
28-
base: undefined,
26+
base,
2927
format,
3028
filePath,
3129
config,

lib/src/logger.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ interface LogEntry {
99
message: string;
1010
}
1111

12-
export const createLogger = async (config: LoggerConfig = {}) => {
12+
export const createLogger = async (config: LoggerConfig = {}, debug?: boolean) => {
1313
const mode: Mode = config.mode ?? "memory";
1414
const logDir = config.logDir ?? ".logs";
1515
const singleFile = config.singleFile ?? false;
1616
const levels = {
17-
stdout: config.levels?.stdout ?? ["warn", "error"],
18-
file: config.levels?.file ?? ["info", "warn", "error"],
17+
stdout:
18+
config.levels?.stdout ?? (debug ? ["debug", "info", "warn", "error"] : ["warn", "error"]),
19+
file: config.levels?.file ?? (debug ? ["info", "debug", "warn", "error"] : ["error"]),
1920
};
2021

2122
// Async directory creation

lib/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const createSkipDirectoryMatcher = (
152152
};
153153
};
154154

155-
export const backupFile = async (filePath: string, backupDir: string) => {
155+
export const backupFile = async (filePath: string, backupDir = DEFAULT_BACKUP_DIR) => {
156156
const relPath = path.relative(process.cwd(), filePath);
157157
const backupPath = path.join(backupDir, relPath);
158158

0 commit comments

Comments
 (0)