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 @@ -27,6 +27,11 @@ const outputDir = outDirArg
2727 ? path . resolve ( './' , outDirArg )
2828 : path . resolve ( nodeModules , '@types/__federated_types/' ) ;
2929
30+ const configPathArg = getArg ( '--config' ) ;
31+ const configPath = configPathArg
32+ ? path . resolve ( configPathArg )
33+ : null ;
34+
3035const findFederationConfig = ( base ) => {
3136 let files = fs . readdirSync ( base ) ;
3237 let queue = [ ] ;
@@ -46,7 +51,13 @@ const findFederationConfig = (base) => {
4651 }
4752} ;
4853
49- const federationConfigPath = findFederationConfig ( './' ) ;
54+ if ( configPath && ! fs . existsSync ( configPath ) ) {
55+ console . error ( `ERROR: Unable to find a provided config: ${ configPath } ` ) ;
56+ process . exit ( 1 ) ;
57+ }
58+
59+ const federationConfigPath = configPath || findFederationConfig ( './' ) ;
60+
5061
5162if ( federationConfigPath === undefined ) {
5263 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