Skip to content

Commit

Permalink
feat(@nestjs/graphql): Include graphql schemas from node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
rich-w-lee committed Jun 28, 2020
1 parent 351f2d1 commit ac7ab37
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 ac7ab37

Please sign in to comment.