Skip to content

Commit 3791224

Browse files
committed
docs(changeset): Ensure node_modules is always excluded to avoid common pitfall or missing it while providing custom exclude list.
1 parent 0e8365c commit 3791224

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/clear-friends-push.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"git-json-resolver": minor
3+
---
4+
5+
Ensure node_modules is always excluded to avoid common pitfall or missing it while providing custom exclude list.

lib/src/normalizer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export interface NormalizedConfig {
4040
export const DEFAULT_CONFIG = {
4141
defaultStrategy: ["merge", "ours"],
4242
include: ["**/*.json", "**/*.yaml", "**/*.yml", "**/*.xml", "**/*.toml"],
43-
exclude: ["node_modules/**", "dist/**"],
43+
// Add **/ prefix to ensure proper handling in monorepo
44+
exclude: ["**/node_modules/**", "**/dist/**"],
4445
debug: false,
4546
writeConflictSidecar: false,
4647
};
@@ -99,7 +100,7 @@ export const normalizeConfig = async <T extends string = InbuiltMergeStrategies>
99100

100101
const fileFilter = (filepath: string) => {
101102
if (!matcher.isMatch(filepath, userConfig.include)) return false;
102-
if (userConfig.exclude.length && matcher.isMatch(filepath, userConfig.exclude)) return false;
103+
if (matcher.isMatch(filepath, [...userConfig.exclude, "**/node_modules/**"])) return false;
103104
return true;
104105
};
105106

0 commit comments

Comments
 (0)