create-nx-workspace 23.3.0-beta.1 → 23.3.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -436,7 +436,7 @@ async function normalizeArgsMiddleware(argv) {
436
436
  applyEmptyPresetAlias(argv);
437
437
  argv.workspaces ??= true;
438
438
  argv.useProjectJson ??= !argv.workspaces;
439
- useCloud = argv.nxCloud !== 'skip' && argv.nxCloud !== 'never';
439
+ useCloud = argv.nxCloud !== 'skip';
440
440
  await (0, ab_testing_1.recordStat)({
441
441
  nxVersion: nx_version_1.nxVersion,
442
442
  command: 'create-nx-workspace',
@@ -461,37 +461,21 @@ async function normalizeArgsMiddleware(argv) {
461
461
  let nxCloud;
462
462
  let completionMessageKey;
463
463
  let skipCloudConnect = false;
464
- let neverConnectToCloud = false;
465
464
  if (argv.skipGit === true) {
466
465
  nxCloud = 'skip';
467
466
  completionMessageKey = undefined;
468
467
  }
469
468
  else {
470
- const cloudChoice = await (0, prompts_1.determineNxCloudV2)(argv);
471
- if (cloudChoice === 'yes') {
472
- nxCloud = 'yes';
473
- skipCloudConnect = false;
474
- }
475
- else if (cloudChoice === 'skip') {
476
- nxCloud = 'skip';
477
- }
478
- else {
479
- nxCloud = 'never';
480
- neverConnectToCloud = true;
481
- }
482
- completionMessageKey =
483
- cloudChoice === 'never'
484
- ? undefined
485
- : (0, ab_testing_1.getCompletionMessageKeyForVariant)();
469
+ nxCloud = await (0, prompts_1.determineNxCloudV2)(argv);
470
+ completionMessageKey = (0, ab_testing_1.getCompletionMessageKeyForVariant)();
486
471
  }
487
472
  analyticsPrompt = await (0, prompts_1.determineAnalytics)(argv);
488
473
  const analytics = analyticsPrompt === 'yes';
489
474
  packageManager = argv.packageManager ?? (0, package_manager_1.detectInvokedPackageManager)();
490
475
  Object.assign(argv, {
491
476
  nxCloud,
492
- useGitHub: nxCloud !== 'skip' && nxCloud !== 'never',
477
+ useGitHub: nxCloud !== 'skip',
493
478
  skipCloudConnect,
494
- neverConnectToCloud,
495
479
  completionMessageKey,
496
480
  packageManager,
497
481
  defaultBase: 'main',
@@ -540,7 +524,6 @@ async function normalizeArgsMiddleware(argv) {
540
524
  let useGitHub;
541
525
  let completionMessageKey;
542
526
  let skipCloudConnect = false;
543
- let neverConnectToCloud = false;
544
527
  if (argv.skipGit === true) {
545
528
  nxCloud = 'skip';
546
529
  useGitHub = undefined;
@@ -549,34 +532,16 @@ async function normalizeArgsMiddleware(argv) {
549
532
  // CLI arg provided: use existing flow (CI provider selection if needed)
550
533
  nxCloud = await (0, prompts_1.determineNxCloud)(argv);
551
534
  useGitHub =
552
- nxCloud === 'skip' || nxCloud === 'never'
535
+ nxCloud === 'skip'
553
536
  ? undefined
554
537
  : nxCloud === 'github' ||
555
538
  (await (0, prompts_1.determineIfGitHubWillBeUsed)(argv));
556
- if (nxCloud === 'never') {
557
- neverConnectToCloud = true;
558
- }
559
539
  }
560
540
  else {
561
541
  // No CLI arg: use simplified prompt (same as template flow)
562
- const cloudChoice = await (0, prompts_1.determineNxCloudV2)(argv);
563
- if (cloudChoice === 'yes') {
564
- nxCloud = 'yes';
565
- skipCloudConnect = false;
566
- }
567
- else if (cloudChoice === 'skip') {
568
- nxCloud = 'skip';
569
- }
570
- else {
571
- nxCloud = 'never';
572
- neverConnectToCloud = true;
573
- }
574
- useGitHub =
575
- nxCloud !== 'skip' && nxCloud !== 'never' ? true : undefined;
576
- completionMessageKey =
577
- cloudChoice === 'never'
578
- ? undefined
579
- : (0, ab_testing_1.getCompletionMessageKeyForVariant)();
542
+ nxCloud = await (0, prompts_1.determineNxCloudV2)(argv);
543
+ useGitHub = nxCloud !== 'skip' ? true : undefined;
544
+ completionMessageKey = (0, ab_testing_1.getCompletionMessageKeyForVariant)();
580
545
  }
581
546
  analyticsPrompt = await (0, prompts_1.determineAnalytics)(argv);
582
547
  const analytics = analyticsPrompt === 'yes';
@@ -584,7 +549,6 @@ async function normalizeArgsMiddleware(argv) {
584
549
  nxCloud,
585
550
  useGitHub,
586
551
  skipCloudConnect,
587
- neverConnectToCloud,
588
552
  completionMessageKey,
589
553
  packageManager,
590
554
  defaultBase,
@@ -57,11 +57,6 @@ export interface CreateWorkspaceOptions {
57
57
  * @default false
58
58
  */
59
59
  skipCloudConnect?: boolean;
60
- /**
61
- * @description Set neverConnectToCloud in nx.json (full opt-out)
62
- * @default false
63
- */
64
- neverConnectToCloud?: boolean;
65
60
  /**
66
61
  * @description Whether GitHub CLI (gh) is available on the system (for telemetry)
67
62
  */
@@ -100,9 +100,7 @@ async function createWorkspace(preset, options, rawArgs) {
100
100
  throw e;
101
101
  }
102
102
  // Connect to Nx Cloud for template flow
103
- if (nxCloud !== 'skip' &&
104
- nxCloud !== 'never' &&
105
- !options.skipCloudConnect) {
103
+ if (nxCloud !== 'skip' && !options.skipCloudConnect) {
106
104
  await (0, nx_cloud_1.connectToNxCloudForTemplate)(directory, 'create-nx-workspace', useGitHub);
107
105
  }
108
106
  }
@@ -142,10 +140,6 @@ async function createWorkspace(preset, options, rawArgs) {
142
140
  }
143
141
  }
144
142
  const isTemplate = !!options.template;
145
- // Handle "Never" opt-out: set neverConnectToCloud in nx.json
146
- if (options.neverConnectToCloud) {
147
- (0, nx_cloud_1.setNeverConnectToCloud)(directory);
148
- }
149
143
  // For template flow, save analytics preference directly to nx.json.
150
144
  // For preset flow, this is handled by the workspace generator via createNxJson.
151
145
  if (isTemplate && typeof options.analytics === 'boolean') {
@@ -153,7 +147,7 @@ async function createWorkspace(preset, options, rawArgs) {
153
147
  }
154
148
  // Generate CI for preset flow (not template)
155
149
  // When nxCloud === 'yes' (from simplified prompt), use GitHub as the CI provider
156
- if (nxCloud !== 'skip' && nxCloud !== 'never' && !isTemplate) {
150
+ if (nxCloud !== 'skip' && !isTemplate) {
157
151
  const ciProvider = nxCloud === 'yes' ? 'github' : nxCloud;
158
152
  await (0, setup_ci_1.setupCI)(directory, ciProvider, packageManager);
159
153
  }
@@ -252,7 +246,7 @@ async function createWorkspace(preset, options, rawArgs) {
252
246
  // Create onboarding URL AFTER git operations so getVcsRemoteInfo() can detect the repo
253
247
  let connectUrl;
254
248
  let nxCloudInfo;
255
- if (nxCloud !== 'skip' && nxCloud !== 'never') {
249
+ if (nxCloud !== 'skip') {
256
250
  // "Yes" or "Maybe later" — generate URL, update README, show banner
257
251
  const aiModeForCloud = (0, ai_output_1.isAiAgent)();
258
252
  if (aiModeForCloud) {
@@ -281,17 +275,14 @@ async function createWorkspace(preset, options, rawArgs) {
281
275
  await (0, nx_cloud_1.openCloudSetupUrl)(connectUrl);
282
276
  }
283
277
  }
284
- else if (isTemplate && (nxCloud === 'skip' || nxCloud === 'never')) {
278
+ else if (isTemplate && nxCloud === 'skip') {
285
279
  // Strip marker comments from README
286
280
  const readmeUpdated = (0, update_readme_1.addConnectUrlToReadme)(directory, undefined);
287
281
  if (readmeUpdated && !skipGit && commit) {
288
282
  const alreadyPushed = pushedToVcs === git_1.VcsPushStatus.PushedToVcs;
289
283
  await (0, update_readme_1.amendOrCommitReadme)(directory, alreadyPushed);
290
284
  }
291
- // Only show "nx connect" message for 'skip', not 'never'
292
- if (nxCloud === 'skip') {
293
- nxCloudInfo = (0, nx_cloud_1.getSkippedNxCloudInfo)();
294
- }
285
+ nxCloudInfo = (0, nx_cloud_1.getSkippedNxCloudInfo)();
295
286
  }
296
287
  return {
297
288
  nxCloudInfo,
@@ -8,7 +8,7 @@ export declare function determineNxCloud(parsedArgs: yargs.Arguments<{
8
8
  export declare function determineNxCloudV2(parsedArgs: yargs.Arguments<{
9
9
  nxCloud?: string;
10
10
  interactive?: boolean;
11
- }>): Promise<'yes' | 'skip' | 'never'>;
11
+ }>): Promise<'yes' | 'skip'>;
12
12
  export declare function determineIfGitHubWillBeUsed(parsedArgs: yargs.Arguments<{
13
13
  nxCloud: NxCloud;
14
14
  useGitHub?: boolean;
@@ -38,22 +38,14 @@ async function determineNxCloud(parsedArgs) {
38
38
  async function determineNxCloudV2(parsedArgs) {
39
39
  // Provided via flag
40
40
  if (parsedArgs.nxCloud) {
41
- if (parsedArgs.nxCloud === 'skip')
42
- return 'skip';
43
- if (parsedArgs.nxCloud === 'never')
44
- return 'never';
45
- return 'yes';
41
+ return parsedArgs.nxCloud === 'skip' ? 'skip' : 'yes';
46
42
  }
47
43
  // Non-interactive mode
48
44
  if (!parsedArgs.interactive || (0, is_ci_1.isCI)()) {
49
45
  return 'skip';
50
46
  }
51
47
  const result = await nxCloudPrompt('setupNxCloudV2');
52
- if (result === 'never')
53
- return 'never';
54
- if (result === 'skip')
55
- return 'skip';
56
- return 'yes';
48
+ return result === 'skip' ? 'skip' : 'yes';
57
49
  }
58
50
  async function determineIfGitHubWillBeUsed(parsedArgs) {
59
51
  if (parsedArgs.nxCloud === 'yes' || parsedArgs.nxCloud === 'circleci') {
@@ -6,12 +6,10 @@ exports.getCompletionMessageKeyForVariant = getCompletionMessageKeyForVariant;
6
6
  exports.isEnterpriseCloudUrl = isEnterpriseCloudUrl;
7
7
  exports.getBannerVariant = getBannerVariant;
8
8
  exports.recordStat = recordStat;
9
- const tslib_1 = require("tslib");
10
9
  const node_child_process_1 = require("node:child_process");
11
10
  const node_fs_1 = require("node:fs");
12
11
  const node_path_1 = require("node:path");
13
12
  const node_os_1 = require("node:os");
14
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
15
13
  const is_ci_1 = require("../ci/is-ci");
16
14
  const terminal_link_1 = require("../terminal-link");
17
15
  exports.NX_CLOUD_URL = 'https://nx.dev/nx-cloud';
@@ -161,7 +159,6 @@ exports.NxCloudChoices = [
161
159
  'bitbucket-pipelines',
162
160
  'circleci',
163
161
  'skip',
164
- 'never',
165
162
  'yes', // Deprecated but still handled
166
163
  ];
167
164
  const messageOptions = {
@@ -217,7 +214,6 @@ const messageOptions = {
217
214
  choices: [
218
215
  { value: 'yes', name: 'Yes' },
219
216
  { value: 'skip', name: 'Skip for now' },
220
- { value: 'never', name: chalk_1.default.dim("No, don't ask again") },
221
217
  ],
222
218
  footer: `\nFree for small teams. Remote caching and task distribution. 2-minute setup: ${exports.NX_CLOUD_HYPERLINK}\nSee it in action: ${exports.NX_CLOUD_DEMO_HYPERLINK}`,
223
219
  fallback: undefined,
@@ -1,10 +1,9 @@
1
1
  import { VcsPushStatus } from '../git/git';
2
2
  import { CompletionMessageKey } from './messages';
3
- export type NxCloud = 'yes' | 'github' | 'gitlab' | 'azure' | 'bitbucket-pipelines' | 'circleci' | 'skip' | 'never';
3
+ export type NxCloud = 'yes' | 'github' | 'gitlab' | 'azure' | 'bitbucket-pipelines' | 'circleci' | 'skip';
4
4
  export declare function connectToNxCloudForTemplate(directory: string, installationSource: string, useGitHub?: boolean): Promise<string | null>;
5
5
  export declare function readNxCloudToken(directory: string): string;
6
6
  export declare function createNxCloudOnboardingUrl(nxCloud: NxCloud, token: string | undefined, directory: string, useGitHub?: boolean): Promise<string>;
7
7
  export declare function getNxCloudInfo(connectCloudUrl: string, pushedToVcs: VcsPushStatus, completionMessageKey?: CompletionMessageKey, workspaceName?: string): Promise<string>;
8
8
  export declare function getSkippedNxCloudInfo(): string;
9
9
  export declare function openCloudSetupUrl(connectUrl: string): Promise<void>;
10
- export declare function setNeverConnectToCloud(directory: string): void;
@@ -6,7 +6,6 @@ exports.createNxCloudOnboardingUrl = createNxCloudOnboardingUrl;
6
6
  exports.getNxCloudInfo = getNxCloudInfo;
7
7
  exports.getSkippedNxCloudInfo = getSkippedNxCloudInfo;
8
8
  exports.openCloudSetupUrl = openCloudSetupUrl;
9
- exports.setNeverConnectToCloud = setNeverConnectToCloud;
10
9
  const tslib_1 = require("tslib");
11
10
  const is_ci_1 = require("../ci/is-ci");
12
11
  const output_1 = require("../output");
@@ -100,11 +99,3 @@ async function openCloudSetupUrl(connectUrl) {
100
99
  // Fail gracefully — the URL is already displayed in the terminal banner
101
100
  }
102
101
  }
103
- function setNeverConnectToCloud(directory) {
104
- const { readFileSync, writeFileSync } = require('fs');
105
- const { join } = require('path');
106
- const nxJsonPath = join(directory, 'nx.json');
107
- const nxJson = JSON.parse(readFileSync(nxJsonPath, 'utf-8'));
108
- nxJson.neverConnectToCloud = true;
109
- writeFileSync(nxJsonPath, JSON.stringify(nxJson, null, 2) + '\n');
110
- }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unparse = unparse;
4
- const flat_1 = require("flat");
5
4
  function unparse(options) {
6
5
  const unparsed = [];
7
6
  for (const key of Object.keys(options)) {
@@ -21,9 +20,8 @@ function unparseOption(key, value, unparsed) {
21
20
  value.forEach((item) => unparseOption(key, item, unparsed));
22
21
  }
23
22
  else if (Object.prototype.toString.call(value) === '[object Object]') {
24
- const flattened = (0, flat_1.flatten)(value, { safe: true });
25
- for (const flattenedKey in flattened) {
26
- unparseOption(`${key}.${flattenedKey}`, flattened[flattenedKey], unparsed);
23
+ for (const nestedKey of Object.keys(value)) {
24
+ unparseOption(`${key}.${nestedKey}`, value[nestedKey], unparsed);
27
25
  }
28
26
  }
29
27
  else if (typeof value === 'string' && value.includes(' ')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "23.3.0-beta.1",
3
+ "version": "23.3.0-beta.2",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast Builds",
6
6
  "repository": {
@@ -40,7 +40,6 @@
40
40
  "@clack/prompts": "^1.7.0",
41
41
  "axios": "1.18.1",
42
42
  "chalk": "^4.1.0",
43
- "flat": "^5.0.2",
44
43
  "open": "^8.4.0",
45
44
  "ora": "^5.3.0",
46
45
  "tar-stream": "~2.2.0",