Skip to content

Commit

Permalink
fix(docz-core): properly support node_modules for multiple file patte…
Browse files Browse the repository at this point in the history
…rns (#1315)

* fix(docz-core): properly support node_modules for multiple file patterns

* fix: add check for node_modules in src
  • Loading branch information
axe312ger authored and rakannimer committed Dec 13, 2019
1 parent 13b1109 commit 4d9f9b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/docz-core/src/lib/Entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ export class Entries {
}

private async getMap(config: Config): Promise<EntryMap> {
const { paths, ignore, plugins, mdPlugins } = config
const globIgnore =
config.src.indexOf('node_modules') === -1 ? ['**/node_modules/**'] : []
const { paths, ignore, plugins, mdPlugins, src } = config
const fileMatchingPatterns = getFilesToMatch(config)

const srcHasNodeModules = src.indexOf('node_modules') !== -1
// Hack around fast-glob not returning the whole set when many patterns are provided in the array
let initialFiles: string[] = []
for (let filePattern of fileMatchingPatterns) {
const filePatternHasNodeModules = filePattern.indexOf('node_modules') !== -1
const shouldIncludeNodeModules = srcHasNodeModules || filePatternHasNodeModules
const globIgnore = shouldIncludeNodeModules ? [] : ['**/node_modules/**']

const filesFromPattern = await glob([filePattern], {
cwd: paths.getRootDir(config),
ignore: globIgnore,
Expand Down

0 comments on commit 4d9f9b3

Please sign in to comment.