File tree 2 files changed +7
-1
lines changed
packages/graphql-codegen-cli/src
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @graphql-codegen/cli ' : patch
3
+ ---
4
+
5
+ Allow loading configuration from package.json file
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function generateSearchPlaces(moduleName: string) {
25
25
// gives .codegenrc.json... but no .codegenrc.config.js
26
26
const dot = extensions . filter ( ext => ext !== 'config.js' ) . map ( ext => `.${ moduleName } rc.${ ext } ` ) ;
27
27
28
- return regular . concat ( dot ) ;
28
+ return [ ... regular . concat ( dot ) , 'package.json' ] ;
29
29
}
30
30
31
31
function customLoader ( ext : 'json' | 'yaml' | 'js' ) {
@@ -54,6 +54,7 @@ export async function loadContext(configFilePath?: string): Promise<CodegenConte
54
54
const moduleName = 'codegen' ;
55
55
const cosmi = cosmiconfig ( moduleName , {
56
56
searchPlaces : generateSearchPlaces ( moduleName ) ,
57
+ packageProp : moduleName ,
57
58
loaders : {
58
59
'.json' : customLoader ( 'json' ) ,
59
60
'.yaml' : customLoader ( 'yaml' ) ,
You can’t perform that action at this time.
0 commit comments