create-nx-workspace 22.6.2 → 22.6.3

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.
@@ -169,13 +169,13 @@ exports.commandsObject = yargs
169
169
  if ((0, ai_output_1.isAiAgent)()) {
170
170
  exports.commandsObject
171
171
  .example(chalk.green('AI AGENTS (RECOMMENDED):'), '')
172
- .example(' npx create-nx-workspace@latest myorg --template=nrwl/empty-template --nxCloud=yes --interactive=false', '')
172
+ .example(' npx create-nx-workspace@latest myorg --template=empty --nxCloud=yes --interactive=false', '')
173
173
  .example('', '')
174
174
  .example(chalk.green('AVAILABLE TEMPLATES:'), '')
175
- .example(' --template=nrwl/empty-template Empty monorepo', '')
176
- .example(' --template=nrwl/react-template React fullstack', '')
177
- .example(' --template=nrwl/angular-template Angular fullstack', '')
178
- .example(' --template=nrwl/typescript-template NPM packages', '')
175
+ .example(' --template=empty Empty monorepo', '')
176
+ .example(' --template=react React fullstack', '')
177
+ .example(' --template=angular Angular fullstack', '')
178
+ .example(' --template=typescript NPM packages', '')
179
179
  .epilogue(`${chalk.cyan('AI Agent Mode:')}
180
180
  Set CLAUDECODE=1 or OPENCODE=1 for JSON output and non-interactive mode.
181
181
  In AI mode: auto non-interactive, NDJSON progress output, structured results.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "22.6.2",
3
+ "version": "22.6.3",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast Builds",
6
6
  "repository": {
@@ -12,4 +12,5 @@ export declare function createWorkspace<T extends CreateWorkspaceOptions>(preset
12
12
  connectUrl: string;
13
13
  }>;
14
14
  export declare function extractConnectUrl(text: string): string | null;
15
+ export declare function resolveTemplateShorthand(template: string): string;
15
16
  //# sourceMappingURL=create-workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAIL,aAAa,EACd,MAAM,iBAAiB,CAAC;AA6BzB,wBAAgB,4BAA4B,IAAI;IAC9C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAEA;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,sBAAsB,EACpE,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;;GAyRZ;AAUD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D"}
1
+ {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAIL,aAAa,EACd,MAAM,iBAAiB,CAAC;AA6BzB,wBAAgB,4BAA4B,IAAI;IAC9C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAEA;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,sBAAsB,EACpE,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;;GA4RZ;AAUD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D;AASD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjE"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInterruptedWorkspaceState = getInterruptedWorkspaceState;
4
4
  exports.createWorkspace = createWorkspace;
5
5
  exports.extractConnectUrl = extractConnectUrl;
6
+ exports.resolveTemplateShorthand = resolveTemplateShorthand;
6
7
  const node_fs_1 = require("node:fs");
7
8
  const path_1 = require("path");
8
9
  const create_empty_workspace_1 = require("./create-empty-workspace");
@@ -33,6 +34,8 @@ async function createWorkspace(preset, options, rawArgs) {
33
34
  }
34
35
  let directory;
35
36
  if (options.template) {
37
+ // Resolve shorthand template names to full GitHub org/repo format
38
+ options.template = resolveTemplateShorthand(options.template);
36
39
  if (!options.template.startsWith('nrwl/'))
37
40
  throw new Error(`Invalid template. Only templates from the 'nrwl' GitHub org are supported.`);
38
41
  const templateUrl = `https://github.com/${options.template}`;
@@ -247,6 +250,15 @@ function extractConnectUrl(text) {
247
250
  const match = text.match(urlPattern);
248
251
  return match ? match[0] : null;
249
252
  }
253
+ const templateShorthands = {
254
+ angular: 'nrwl/angular-template',
255
+ react: 'nrwl/react-template',
256
+ typescript: 'nrwl/typescript-template',
257
+ empty: 'nrwl/empty-template',
258
+ };
259
+ function resolveTemplateShorthand(template) {
260
+ return templateShorthands[template] ?? template;
261
+ }
250
262
  function getWorkspaceGlobsFromPreset(preset) {
251
263
  // Should match how apps are created in `packages/workspace/src/generators/preset/preset.ts`.
252
264
  switch (preset) {
@@ -95,7 +95,7 @@ async function determineTemplate(parsedArgs) {
95
95
  if (parsedArgs.preset)
96
96
  return 'custom';
97
97
  if (!parsedArgs.interactive || (0, is_ci_1.isCI)())
98
- return 'custom';
98
+ return 'nrwl/empty-template';
99
99
  // Docs generation needs preset flow to document all presets
100
100
  if (process.env.NX_GENERATE_DOCS_PROCESS === 'true')
101
101
  return 'custom';
@@ -9,7 +9,6 @@ export declare function getFlowVariant(): string;
9
9
  * Now locked to 'platform-setup' after concluding the prompt A/B test.
10
10
  */
11
11
  export declare function getCompletionMessageKeyForVariant(): CompletionMessageKey;
12
- export declare function shouldShowCloudPrompt(): boolean;
13
12
  /**
14
13
  * Check if the given cloud URL is an enterprise URL.
15
14
  * Enterprise URLs are anything other than cloud.nx.app, eu.nx.app, staging.nx.app, or snapshot.nx.app.
@@ -1 +1 @@
1
- {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsEtE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,oBAAoB,CAExE;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAI/C;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAajE;AAED,eAAO,MAAM,cAAc,UAS1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CA6DjD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,UAAU,CAAA;KAAE,CAAC;IAC9C,iBAAiB,EAAE,oBAAoB,CAAC;CACzC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,gBAAgB,CAAwC;IAEhE,SAAS,CAAC,GAAG,EAAE,UAAU,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ACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;CACtB,iBAuBA"}
1
+ {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsEtE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,oBAAoB,CAExE;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAajE;AAED,eAAO,MAAM,cAAc,UAS1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAyFjD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,UAAU,CAAA;KAAE,CAAC;IAC9C,iBAAiB,EAAE,oBAAoB,CAAC;CACzC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,gBAAgB,C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AGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;CACtB,iBAuBA"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.messages = exports.PromptMessages = exports.NxCloudChoices = void 0;
4
4
  exports.getFlowVariant = getFlowVariant;
5
5
  exports.getCompletionMessageKeyForVariant = getCompletionMessageKeyForVariant;
6
- exports.shouldShowCloudPrompt = shouldShowCloudPrompt;
7
6
  exports.isEnterpriseCloudUrl = isEnterpriseCloudUrl;
8
7
  exports.getBannerVariant = getBannerVariant;
9
8
  exports.recordStat = recordStat;
@@ -11,6 +10,7 @@ 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");
13
+ const chalk = require("chalk");
14
14
  const is_ci_1 = require("../ci/is-ci");
15
15
  // Flow variant controls both tracking and banner display (CLOUD-4235)
16
16
  // Variants: 0 = control, 1 = updated prompt, 2 = no prompt (auto-connect)
@@ -91,11 +91,6 @@ function getFlowVariant() {
91
91
  function getCompletionMessageKeyForVariant() {
92
92
  return 'platform-setup';
93
93
  }
94
- function shouldShowCloudPrompt() {
95
- // CLOUD-4255: Lock to variant 2 behavior (no prompt)
96
- // To re-enable A/B testing: return getFlowVariant() !== '2';
97
- return false;
98
- }
99
94
  // ============================================================================
100
95
  // Banner Variant A/B Testing (CLOUD-4235)
101
96
  // ============================================================================
@@ -205,12 +200,38 @@ const messageOptions = {
205
200
  choices: [
206
201
  { value: 'yes', name: 'Yes' },
207
202
  { value: 'skip', name: 'Skip for now' },
208
- { value: 'never', name: "No, don't ask again" },
203
+ { value: 'never', name: chalk.dim("No, don't ask again") },
209
204
  ],
210
205
  footer: '\nAutomatically fix broken PRs, 70% faster CI: https://nx.dev/nx-cloud',
211
206
  fallback: undefined,
212
207
  completionMessage: 'platform-setup',
213
208
  },
209
+ {
210
+ code: 'cloud-ab-remote-cache-speed',
211
+ message: 'Enable remote caching to speed up builds with Nx Cloud?',
212
+ initial: 0,
213
+ choices: [
214
+ { value: 'yes', name: 'Yes' },
215
+ { value: 'skip', name: 'Skip for now' },
216
+ { value: 'never', name: chalk.dim("No, don't ask again") },
217
+ ],
218
+ footer: '\nFree for small teams. 2-minute setup with GitHub — cache locally and in CI: https://nx.dev/nx-cloud',
219
+ fallback: undefined,
220
+ completionMessage: 'platform-setup',
221
+ },
222
+ {
223
+ code: 'cloud-ab-fast-ci-setup',
224
+ message: 'Speed up your CI with Nx Cloud?',
225
+ initial: 0,
226
+ choices: [
227
+ { value: 'yes', name: 'Yes' },
228
+ { value: 'skip', name: 'Skip for now' },
229
+ { value: 'never', name: chalk.dim("No, don't ask again") },
230
+ ],
231
+ footer: '\n70% faster CI on GitHub, GitLab, and more. Free tier, 2-minute setup: https://nx.dev/nx-cloud',
232
+ fallback: undefined,
233
+ completionMessage: 'platform-setup',
234
+ },
214
235
  ],
215
236
  };
216
237
  class PromptMessages {
@@ -223,7 +244,9 @@ class PromptMessages {
223
244
  this.selectedMessages[key] = 0;
224
245
  }
225
246
  else {
226
- this.selectedMessages[key] = Math.floor(Math.random() * messageOptions[key].length);
247
+ const variant = Number(getFlowVariant());
248
+ this.selectedMessages[key] =
249
+ variant < messageOptions[key].length ? variant : 0;
227
250
  }
228
251
  }
229
252
  return messageOptions[key][this.selectedMessages[key]];