Skip to content

Commit

Permalink
Fix edge case when no config is provided (#734)
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 authored Nov 21, 2018
1 parent 6104d84 commit 6d185c9
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 6d185c9

Please sign in to comment.