Skip to content

Commit

Permalink
Fix edge case when no config is provided
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trevor-scheer committed Nov 21, 2018
1 parent 22d2bc0 commit f6e5f5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/apollo/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,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,
Expand Down

0 comments on commit f6e5f5a

Please sign in to comment.