Skip to content

Commit 355af5b

Browse files
committed
feat: open onboarding URL via prompt
1 parent 2aab623 commit 355af5b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cli/src/commands/demo/command.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pc from 'picocolors';
22
import { program } from 'commander';
3+
import open from 'open';
34
import type { FederatedGraph, Subgraph, WhoAmIResponse } from '@wundergraph/cosmo-connect/dist/platform/v1/platform_pb';
45
import { config } from '../../core/config.js';
56
import { createRouterToken, deleteRouterToken } from '../../core/router-token.js';
@@ -403,11 +404,22 @@ export default function (opts: BaseCommandOptions) {
403404
const userInfo = await getUserInfo(opts.client);
404405
updateScreenWithUserInfo(userInfo);
405406

407+
const onboardingUrl = `${config.webURL}/onboarding`;
408+
409+
async function openOnboardingUrl() {
410+
const process = await open(onboardingUrl);
411+
process.on('error', (error) => {
412+
console.log(pc.yellow(`\nCouldn't open browser: ${error.message}`));
413+
});
414+
}
415+
406416
await waitForKeyPress(
407417
{
408418
Enter: () => undefined,
419+
s: { callback: openOnboardingUrl, persistent: true },
420+
S: { callback: openOnboardingUrl, persistent: true },
409421
},
410-
`It is recommended you run this command along the onboarding wizard at ${config.baseURL}/onboarding with the same account.\nPress ENTER to continue…`,
422+
`It is recommended you run this command along the onboarding wizard at ${onboardingUrl} with the same account.\nPress [s] to open it in your browser, or [ENTER] to continue…`,
411423
);
412424

413425
resetScreen(userInfo);

0 commit comments

Comments
 (0)