Skip to content

Commit

Permalink
Merge branch 'feature/gql-schema-from-nodemodules' of https://github.…
Browse files Browse the repository at this point in the history
…com/leerw4/graphql into leerw4-feature/gql-schema-from-nodemodules
  • Loading branch information
kamilmysliwiec committed Jul 9, 2020
2 parents 080670e + ac7ab37 commit 480963a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/graphql-types.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ export class GraphQLTypesLoader {
}

private async getTypesFromPaths(paths: string | string[]): Promise<string[]> {
let includeNodeModules = false;

if (util.isArray(paths)) {
includeNodeModules = paths.some((path) => path.includes('node_modules'));
} else {
includeNodeModules = paths.includes('node_modules');
}

paths = util.isArray(paths)
? paths.map((path) => normalize(path))
: normalize(paths);

const filePaths = await glob(paths, {
ignore: ['node_modules'],
ignore: includeNodeModules ? [] : ['node_modules'],
});
if (filePaths.length === 0) {
throw new Error(
Expand Down

0 comments on commit 480963a

Please sign in to comment.