Skip to content

Commit 6d185c9

Browse files
Fix edge case when no config is provided (#734)
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.
1 parent 6104d84 commit 6d185c9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/apollo/src/Command.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ export abstract class ProjectCommand extends Command {
169169
flags: Flags
170170
) {
171171
const loadingHandler = new OclifLoadingHandler(this);
172-
const rootURI = `file://${parse(filepath).dir}`;
172+
173+
// When no config is provided, filepath === process.cwd()
174+
// In this case, we don't want to look to the .dir since that's the parent
175+
const rootURI =
176+
filepath === process.cwd()
177+
? `file://${filepath}`
178+
: `file://${parse(filepath).dir}`;
179+
173180
const clientIdentity = {
174181
name: "Apollo CLI",
175182
version,

0 commit comments

Comments
 (0)