Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/create-nx-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"chalk": "catalog:",
"enquirer": "catalog:",
"flat": "^5.0.2",
"open": "^8.4.0",
"ora": "5.3.0",
"tmp": "~0.2.1",
"tslib": "catalog:typescript",
Expand Down
6 changes: 6 additions & 0 deletions packages/create-nx-workspace/src/create-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
createNxCloudOnboardingUrl,
getNxCloudInfo,
getSkippedNxCloudInfo,
openCloudSetupUrl,
readNxCloudToken,
setNeverConnectToCloud,
} from './utils/nx/nx-cloud';
Expand Down Expand Up @@ -287,6 +288,11 @@ export async function createWorkspace<T extends CreateWorkspaceOptions>(
options.completionMessageKey,
name
);

// Auto-open the Cloud setup URL in the browser when user selected 'yes'
if (!options.skipCloudConnect) {
await openCloudSetupUrl(connectUrl);
}
} else if (isTemplate && (nxCloud === 'skip' || nxCloud === 'never')) {
// Strip marker comments from README
const readmeUpdated = addConnectUrlToReadme(directory, undefined);
Expand Down
14 changes: 14 additions & 0 deletions packages/create-nx-workspace/src/utils/nx/nx-cloud.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VcsPushStatus } from '../git/git';
import { isCI } from '../ci/is-ci';
import { CLIOutput } from '../output';
import {
getCompletionMessage,
Expand Down Expand Up @@ -148,6 +149,19 @@ export function getSkippedNxCloudInfo() {
return out.getOutput();
}

export async function openCloudSetupUrl(connectUrl: string): Promise<void> {
if (isCI()) {
return;
}

try {
const open = require('open');
await open(connectUrl);
} catch {
// Fail gracefully — the URL is already displayed in the terminal banner
}
}

export function setNeverConnectToCloud(directory: string): void {
const { readFileSync, writeFileSync } = require('fs');
const { join } = require('path');
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading