File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,13 @@ scripts: {
7373 "make-types" : " make-federated-types --outputDir ../../my_types/"
7474}
7575```
76+
77+ #### ` package.json `
78+
79+ If you would like to specify custom path to the config, you can pass ` --config ` parameter like so:
80+
81+ ``` json
82+ scripts: {
83+ "make-types" : " make-federated-types --config ./path/to/my/config.json --outputDir ../../my_types/"
84+ }
85+ ```
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ const outputDir = outDirArg
1515 ? path . resolve ( './' , outDirArg )
1616 : path . resolve ( __dirname , '../../@types/__federated_types/' ) ;
1717
18+ const configPathArg = getArg ( '--config' ) ;
19+ const configPath = configPathArg
20+ ? path . resolve ( configPathArg )
21+ : null ;
22+
1823const findFederationConfig = ( base ) => {
1924 let files = fs . readdirSync ( base ) ;
2025 let queue = [ ] ;
@@ -34,7 +39,13 @@ const findFederationConfig = (base) => {
3439 }
3540} ;
3641
37- const federationConfigPath = findFederationConfig ( './' ) ;
42+ if ( configPath && ! fs . existsSync ( configPath ) ) {
43+ console . error ( `ERROR: Unable to find a provided config: ${ configPath } ` ) ;
44+ process . exit ( 1 ) ;
45+ }
46+
47+ const federationConfigPath = configPath || findFederationConfig ( './' ) ;
48+
3849
3950if ( federationConfigPath === undefined ) {
4051 console . error ( `ERROR: Unable to find a federation.config.json file in this package` ) ;
You can’t perform that action at this time.
0 commit comments