Skip to content

feat(core): prompt for analytics preference during workspace creation#34818

Merged
FrozenPandaz merged 2 commits into
masterfrom
feat/analytics-prompt-create-nx-workspace
Mar 13, 2026
Merged

feat(core): prompt for analytics preference during workspace creation#34818
FrozenPandaz merged 2 commits into
masterfrom
feat/analytics-prompt-create-nx-workspace

Conversation

@FrozenPandaz

Copy link
Copy Markdown
Contributor

Current Behavior

When a user creates a new workspace with create-nx-workspace, they are not asked about analytics. The analytics prompt only appears later on the first nx command run, or via the 22.6.0 migration.

Expected Behavior

Users are prompted to opt in or out of usage analytics during create-nx-workspace, so the preference is set from the start. The prompt matches the style of other prompts in the flow (autocomplete with Yes/No choices).

  • Preset flow: The analytics property is set via the workspace generator's createNxJson, so nx.json is properly formatted by prettier through formatFiles(tree)
  • Template flow: The analytics property is written directly to nx.json (matching the pattern used by setNeverConnectToCloud)
  • Supports --analytics CLI flag for non-interactive usage
  • Skips the prompt in CI and non-interactive environments (defaults to false)

Adds an analytics opt-in prompt to create-nx-workspace so users can set
their preference at workspace creation time rather than on first nx command.

- Preset flow: analytics preference is set via the workspace generator,
  so nx.json is properly formatted by prettier
- Template flow: analytics preference is written directly to nx.json
- Supports --analytics CLI flag for non-interactive usage
- Skips prompt in CI and non-interactive environments
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner March 13, 2026 18:38
@netlify

netlify Bot commented Mar 13, 2026

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit f6af4dd
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69b45b5b133b4b000843dd6e
😎 Deploy Preview https://deploy-preview-34818--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 13, 2026

Copy link
Copy Markdown

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit f6af4dd
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69b45b5bc47546000885ae5c
😎 Deploy Preview https://deploy-preview-34818--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit f6af4dd

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 56m 5s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 46s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-13 19:46:11 UTC

The SIGINT handler at the process level handles Ctrl+C, so the
try/catch around the prompt was dead code. Also removed "anonymous"
from descriptions.
@FrozenPandaz FrozenPandaz enabled auto-merge (squash) March 13, 2026 19:08
@FrozenPandaz FrozenPandaz merged commit 3d1b1ec into master Mar 13, 2026
23 of 24 checks passed
@FrozenPandaz FrozenPandaz deleted the feat/analytics-prompt-create-nx-workspace branch March 13, 2026 19:46
jaysoo added a commit that referenced this pull request Mar 17, 2026
## Current Behavior

CNW flow matches v22.1.3 (restored in #34671): no template prompt is
shown, the cloud prompt uses simplified "Would you like remote caching?"
wording, banner variant is locked to 0, and preset flow connects to
cloud during workspace creation.

## Expected Behavior

Restore the template prompt and cloud prompts that were removed in
#34671:
- **Template prompt**: "Which starter do you want to use?" with 5
choices (Minimal, React, Angular, NPM Packages, Custom)
- **Cloud prompt**: `determineNxCloudV2` ("Connect to Nx Cloud?") for
preset flow when no `--nxCloud` CLI arg; existing CI provider prompt
when `--nxCloud` is explicitly provided
- **Banner**: Variant 2 (box banner) for standard Nx Cloud URLs, variant
0 for enterprise
- **Preset flow**: Deferred cloud connection (`nxCloud: 'skip'`) instead
of connecting during workspace creation
- **Push logic**: Push to GitHub for both `nxCloud === 'github'` and
`nxCloud === 'yes'`
- **Messages**: "Try the full Nx platform?" wording, GitHub repo link in
push messages, "Your remote cache setup is almost complete." title

Preserves all subsequent changes (analytics prompt from #34818,
SANDBOX_FAILED fix, .gitignore updates).

## Related Issue(s)

Fixes NXC-4096
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants