From ae29fbb58533ea7636871c7e27754cd8d5790fb9 Mon Sep 17 00:00:00 2001 From: Trevor Scheer Date: Wed, 21 Nov 2018 12:13:58 -0800 Subject: [PATCH] Fix edge case when no config is provided When no config is provided, the URI is resolved to the _parent_ directory because we're not handling that case correctly. To resolve this, the URI should be set to the filepath itself. --- packages/apollo/src/Command.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/apollo/src/Command.ts b/packages/apollo/src/Command.ts index 42a4b00aa4..91115e1162 100644 --- a/packages/apollo/src/Command.ts +++ b/packages/apollo/src/Command.ts @@ -172,7 +172,14 @@ export abstract class ProjectCommand extends Command { flags: Flags ) { const loadingHandler = new OclifLoadingHandler(this); - const rootURI = `file://${parse(filepath).dir}`; + + // When no config is provided, filepath === process.cwd() + // In this case, we don't want to look to the .dir since that's the parent + const rootURI = + filepath === process.cwd() + ? `file://${filepath}` + : `file://${parse(filepath).dir}`; + const clientIdentity = { name: "Apollo CLI", version,