Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 4d9f9b3

Browse files
axe312gerrakannimer
authored andcommitted
fix(docz-core): properly support node_modules for multiple file patterns (#1315)
* fix(docz-core): properly support node_modules for multiple file patterns * fix: add check for node_modules in src
1 parent 13b1109 commit 4d9f9b3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/docz-core/src/lib/Entries.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ export class Entries {
4747
}
4848

4949
private async getMap(config: Config): Promise<EntryMap> {
50-
const { paths, ignore, plugins, mdPlugins } = config
51-
const globIgnore =
52-
config.src.indexOf('node_modules') === -1 ? ['**/node_modules/**'] : []
50+
const { paths, ignore, plugins, mdPlugins, src } = config
5351
const fileMatchingPatterns = getFilesToMatch(config)
54-
52+
const srcHasNodeModules = src.indexOf('node_modules') !== -1
5553
// Hack around fast-glob not returning the whole set when many patterns are provided in the array
5654
let initialFiles: string[] = []
5755
for (let filePattern of fileMatchingPatterns) {
56+
const filePatternHasNodeModules = filePattern.indexOf('node_modules') !== -1
57+
const shouldIncludeNodeModules = srcHasNodeModules || filePatternHasNodeModules
58+
const globIgnore = shouldIncludeNodeModules ? [] : ['**/node_modules/**']
59+
5860
const filesFromPattern = await glob([filePattern], {
5961
cwd: paths.getRootDir(config),
6062
ignore: globIgnore,

0 commit comments

Comments
 (0)