@@ -241,28 +241,34 @@ cd ${folderPath}; graphql playground`)
241241 let config
242242
243243 if ( input . cwd ) {
244- configPath = findUp . sync ( [ '.graphqlconfig' , '.graphqlconfig.yml' ] , {
245- cwd : input . cwd ,
246- } )
247- configString = configPath
248- ? fs . readFileSync ( configPath , 'utf-8' )
249- : undefined
250- folderName = configPath
251- ? path . basename ( path . dirname ( configPath ) )
252- : undefined
253- const rawConfig = getGraphQLConfig ( input . cwd ) . config
254- config = await patchEndpointsToConfigData (
255- resolveEnvsInValues ( rawConfig , input . env ) ,
256- input . cwd ,
257- input . env ,
258- )
259-
260- if ( ! this . configContainsEndpoints ( config ) ) {
261- const graphcoolNote = configString . includes ( 'graphcool' )
262- ? 'Please make sure to add stages to your graphcool.yml'
263- : ''
264- alert ( `${ configPath } does not include any endpoints. ${ graphcoolNote } ` )
265- return
244+ try {
245+ configPath = findUp . sync ( [ '.graphqlconfig' , '.graphqlconfig.yml' ] , {
246+ cwd : input . cwd ,
247+ } )
248+ configString = configPath
249+ ? fs . readFileSync ( configPath , 'utf-8' )
250+ : undefined
251+ folderName = configPath
252+ ? path . basename ( path . dirname ( configPath ) )
253+ : undefined
254+ const rawConfig = getGraphQLConfig ( input . cwd ) . config
255+ config = await patchEndpointsToConfigData (
256+ resolveEnvsInValues ( rawConfig , input . env ) ,
257+ input . cwd ,
258+ input . env ,
259+ )
260+
261+ if ( ! this . configContainsEndpoints ( config ) ) {
262+ const graphcoolNote = configString . includes ( 'graphcool' )
263+ ? 'Please make sure to add stages to your graphcool.yml'
264+ : ''
265+ alert (
266+ `${ configPath } does not include any endpoints. ${ graphcoolNote } ` ,
267+ )
268+ return
269+ }
270+ } catch ( e ) {
271+ //
266272 }
267273 }
268274
@@ -271,15 +277,17 @@ cd ${folderPath}; graphql playground`)
271277 JSON . stringify ( { cwd : input . cwd , id : remote . getCurrentWindow ( ) . id } ) ,
272278 )
273279
274- this . setState ( {
280+ const state = {
275281 configString,
276282 folderName,
277283 configPath,
278284 env : input . env ,
279285 endpoint,
280286 config,
281287 platformToken,
282- } )
288+ }
289+
290+ this . setState ( state )
283291 }
284292
285293 configContainsEndpoints ( config : GraphQLConfigData ) : boolean {
0 commit comments