create-nx-workspace 22.6.2 → 22.6.4

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.
@@ -66,5 +66,19 @@ interface UnknownStackArguments extends BaseArguments {
66
66
  type Arguments = NoneArguments | ReactArguments | AngularArguments | VueArguments | NodeArguments | UnknownStackArguments;
67
67
  export declare const commandsObject: yargs.Argv<Arguments>;
68
68
  export declare function validateWorkspaceName(name: string): void;
69
+ /**
70
+ * Resolves special folder name patterns (`.`, `./`, absolute paths) into a
71
+ * workspace name and a `workingDir` override so that downstream functions
72
+ * create the workspace at the intended location.
73
+ *
74
+ * @visibleForTesting
75
+ *
76
+ * Returns `{ name, workingDir }` for special inputs, or `null` if the
77
+ * input is a regular name that needs no special handling.
78
+ */
79
+ export declare function resolveSpecialFolderName(folderName: string): {
80
+ name: string;
81
+ workingDir: string;
82
+ } | null;
69
83
  export {};
70
84
  //# sourceMappingURL=create-nx-workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-nx-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/create-nx-workspace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,sBAAsB,EAEvB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAwEnE,KAAK,qBAAqB,GACtB,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAEpB,UAAU,aAAc,SAAQ,sBAAsB;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,aAAc,SAAQ,aAAa;IA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YAAY,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;CAClD;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,YAAY,GAAG,YAAY,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,UAAU,qBAAsB,SAAQ,aAAa;IACnD,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,KAAK,SAAS,GACV,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,aAAa,GACb,qBAAqB,CAAC;AAE1B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAiJrB,CAAC;AAigB7B,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQxD"}
1
+ {"version":3,"file":"create-nx-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/create-nx-workspace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,sBAAsB,EAEvB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAyEnE,KAAK,qBAAqB,GACtB,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAEpB,UAAU,aAAc,SAAQ,sBAAsB;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CA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
  exports.commandsObject = void 0;
4
4
  exports.validateWorkspaceName = validateWorkspaceName;
5
+ exports.resolveSpecialFolderName = resolveSpecialFolderName;
5
6
  const enquirer = require("enquirer");
6
7
  const yargs = require("yargs");
7
8
  const chalk = require("chalk");
@@ -18,6 +19,7 @@ const yargs_options_1 = require("../src/internal-utils/yargs-options");
18
19
  const ab_testing_1 = require("../src/utils/nx/ab-testing");
19
20
  const error_utils_1 = require("../src/utils/error-utils");
20
21
  const fs_1 = require("fs");
22
+ const path_1 = require("path");
21
23
  const is_ci_1 = require("../src/utils/ci/is-ci");
22
24
  const git_1 = require("../src/utils/git/git");
23
25
  const ai_output_1 = require("../src/utils/ai/ai-output");
@@ -169,13 +171,13 @@ exports.commandsObject = yargs
169
171
  if ((0, ai_output_1.isAiAgent)()) {
170
172
  exports.commandsObject
171
173
  .example(chalk.green('AI AGENTS (RECOMMENDED):'), '')
172
- .example(' npx create-nx-workspace@latest myorg --template=nrwl/empty-template --nxCloud=yes --interactive=false', '')
174
+ .example(' npx create-nx-workspace@latest myorg --template=empty --nxCloud=yes --interactive=false', '')
173
175
  .example('', '')
174
176
  .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', '')
177
+ .example(' --template=empty Empty monorepo', '')
178
+ .example(' --template=react React fullstack', '')
179
+ .example(' --template=angular Angular fullstack', '')
180
+ .example(' --template=typescript NPM packages', '')
179
181
  .epilogue(`${chalk.cyan('AI Agent Mode:')}
180
182
  Set CLAUDECODE=1 or OPENCODE=1 for JSON output and non-interactive mode.
181
183
  In AI mode: auto non-interactive, NDJSON progress output, structured results.
@@ -617,14 +619,54 @@ function validateWorkspaceName(name) {
617
619
  throw new error_utils_1.CnwError('INVALID_WORKSPACE_NAME', `The workspace name "${name}" is invalid. Workspace names must start with a letter. Examples of valid names: myapp, MyApp, my-app, my_app`);
618
620
  }
619
621
  }
622
+ /**
623
+ * Resolves special folder name patterns (`.`, `./`, absolute paths) into a
624
+ * workspace name and a `workingDir` override so that downstream functions
625
+ * create the workspace at the intended location.
626
+ *
627
+ * @visibleForTesting
628
+ *
629
+ * Returns `{ name, workingDir }` for special inputs, or `null` if the
630
+ * input is a regular name that needs no special handling.
631
+ */
632
+ function resolveSpecialFolderName(folderName) {
633
+ // Handle "." and "./" — user wants to init in the current directory
634
+ if (folderName === '.' || folderName === './') {
635
+ const cwd = (0, path_1.resolve)(process.cwd());
636
+ if ((0, fs_1.readdirSync)(cwd).length > 0) {
637
+ throw new error_utils_1.CnwError('DIRECTORY_EXISTS', `The current directory is not empty. Use "nx init" to add Nx to an existing project.`);
638
+ }
639
+ return { name: (0, path_1.basename)(cwd), workingDir: (0, path_1.dirname)(cwd) };
640
+ }
641
+ // Handle absolute paths like /tmp/acme
642
+ if ((0, path_1.isAbsolute)(folderName)) {
643
+ const parentDir = (0, path_1.dirname)(folderName);
644
+ const name = (0, path_1.basename)(folderName);
645
+ if (!(0, fs_1.existsSync)(parentDir)) {
646
+ throw new error_utils_1.CnwError('INVALID_PATH', `The parent directory "${parentDir}" does not exist.`);
647
+ }
648
+ return { name, workingDir: parentDir };
649
+ }
650
+ return null;
651
+ }
620
652
  async function determineFolder(parsedArgs) {
621
- const folderName = parsedArgs._[0]
653
+ const rawFolderName = parsedArgs._[0]
622
654
  ? parsedArgs._[0].toString()
623
655
  : parsedArgs.name;
624
- if (folderName) {
656
+ if (rawFolderName) {
657
+ // Resolve ".", "./", and absolute paths before validation
658
+ const resolved = resolveSpecialFolderName(rawFolderName);
659
+ const folderName = resolved?.name ?? rawFolderName;
660
+ if (resolved?.workingDir) {
661
+ parsedArgs.workingDir = resolved.workingDir;
662
+ }
625
663
  validateWorkspaceName(folderName);
626
664
  // If directory exists, either re-prompt (interactive) or error (non-interactive)
627
- if ((0, fs_1.existsSync)(folderName)) {
665
+ // Check relative to workingDir when set (e.g. absolute path resolved to a different parent)
666
+ const targetDir = resolved?.workingDir
667
+ ? (0, path_1.join)(resolved.workingDir, folderName)
668
+ : folderName;
669
+ if ((0, fs_1.existsSync)(targetDir)) {
628
670
  if (parsedArgs.interactive && !(0, is_ci_1.isCI)()) {
629
671
  output_1.output.warn({
630
672
  title: `Directory ${folderName} already exists.`,
@@ -1151,7 +1193,11 @@ async function determineAngularOptions(parsedArgs) {
1151
1193
  appName = await determineAppName(parsedArgs);
1152
1194
  }
1153
1195
  }
1196
+ const validAngularBundlers = ['esbuild', 'rspack', 'webpack'];
1154
1197
  if (parsedArgs.bundler) {
1198
+ if (!validAngularBundlers.includes(parsedArgs.bundler)) {
1199
+ throw new error_utils_1.CnwError('INVALID_BUNDLER', `Invalid bundler "${parsedArgs.bundler}" for Angular. Valid options are: ${validAngularBundlers.join(', ')}`);
1200
+ }
1155
1201
  bundler = parsedArgs.bundler;
1156
1202
  }
1157
1203
  else {
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.4",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast Builds",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://nx.dev",
32
32
  "dependencies": {
33
- "axios": "^1.12.0",
33
+ "axios": "1.12.0",
34
34
  "chalk": "^4.1.0",
35
35
  "enquirer": "~2.3.6",
36
36
  "flat": "^5.0.2",
@@ -1 +1 @@
1
- {"version":3,"file":"create-empty-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-empty-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,sBAAsB,EACzE,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GACT,OAAO,CAAC,MAAM,CAAC,CA6DjB"}
1
+ {"version":3,"file":"create-empty-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-empty-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,sBAAsB,EACzE,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GACT,OAAO,CAAC,MAAM,CAAC,CAgEjB"}
@@ -26,12 +26,14 @@ async function createEmptyWorkspace(tmpDir, name, packageManager, options) {
26
26
  // Even though --skipInstall is not an option to create-nx-workspace, we pass through extra options to presets.
27
27
  // See: https://github.com/nrwl/nx/issues/31834
28
28
  delete options.skipInstall;
29
+ // workingDir is consumed by CNW itself, not passed to `nx new`
30
+ const { workingDir: _workingDir, ...nxNewOptions } = options;
29
31
  const args = (0, unparse_1.unparse)({
30
- ...options,
32
+ ...nxNewOptions,
31
33
  }).join(' ');
32
34
  const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
33
35
  const command = `new ${args}`;
34
- const workingDir = process.cwd().replace(/\\/g, '/');
36
+ const workingDir = (options.workingDir ?? process.cwd()).replace(/\\/g, '/');
35
37
  let nxWorkspaceRoot = `"${workingDir}"`;
36
38
  // If path contains spaces there is a problem in Windows for npm@6.
37
39
  // In this case we have to escape the wrapping quotes.
@@ -1 +1 @@
1
- {"version":3,"file":"create-preset.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAIjC,wBAAsB,YAAY,CAAC,CAAC,SAAS,sBAAsB,EACjE,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,CAAC,EACb,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAoDf"}
1
+ {"version":3,"file":"create-preset.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAIjC,wBAAsB,YAAY,CAAC,CAAC,SAAS,sBAAsB,EACjE,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,CAAC,EACb,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA6Df"}
@@ -6,7 +6,7 @@ const package_manager_1 = require("./utils/package-manager");
6
6
  const child_process_utils_1 = require("./utils/child-process-utils");
7
7
  const unparse_1 = require("./utils/unparse");
8
8
  async function createPreset(preset, parsedArgs, packageManager, directory) {
9
- const { skipGit, commit, nxCloud, ...restArgs } = parsedArgs;
9
+ const { skipGit, commit, nxCloud, workingDir: _workingDir, ...restArgs } = parsedArgs;
10
10
  // Delete verbose because it will conflict with the --quiet flag
11
11
  if (!restArgs.verbose) {
12
12
  delete restArgs.verbose;
@@ -16,7 +16,7 @@ async function createPreset(preset, parsedArgs, packageManager, directory) {
16
16
  ...restArgs,
17
17
  }).join(' ');
18
18
  const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
19
- const workingDir = process.cwd().replace(/\\/g, '/');
19
+ const workingDir = (parsedArgs.workingDir ?? process.cwd()).replace(/\\/g, '/');
20
20
  let nxWorkspaceRoot = `"${workingDir}"`;
21
21
  // If path contains spaces there is a problem in Windows for npm@6.
22
22
  // In this case we have to escape the wrapping quotes.
@@ -3,6 +3,12 @@ import type { CompletionMessageKey } from './utils/nx/messages';
3
3
  import { PackageManager } from './utils/package-manager';
4
4
  export interface CreateWorkspaceOptions {
5
5
  name: string;
6
+ /**
7
+ * @description Override the working directory for workspace creation.
8
+ * When set, the workspace is created under this directory instead of process.cwd().
9
+ * Used when the user provides "." or an absolute path as the workspace name.
10
+ */
11
+ workingDir?: string;
6
12
  packageManager: PackageManager;
7
13
  nxCloud: NxCloud;
8
14
  useGitHub?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"create-workspace-options.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,yEAOlB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAOjD,CAAC"}
1
+ {"version":3,"file":"create-workspace-options.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,yEAOlB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAOjD,CAAC"}
@@ -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;;;;;;GA+RZ;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,10 +34,12 @@ 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}`;
39
- const workingDir = process.cwd().replace(/\\/g, '/');
42
+ const workingDir = (options.workingDir ?? process.cwd()).replace(/\\/g, '/');
40
43
  directory = (0, path_1.join)(workingDir, name);
41
44
  const aiMode = (0, ai_output_1.isAiAgent)();
42
45
  // Use spinner for human mode, progress logs for AI mode
@@ -49,7 +52,7 @@ async function createWorkspace(preset, options, rawArgs) {
49
52
  workspaceSetupSpinner = ora(`Creating workspace from template`).start();
50
53
  }
51
54
  try {
52
- await (0, clone_template_1.cloneTemplate)(templateUrl, name);
55
+ await (0, clone_template_1.cloneTemplate)(templateUrl, name, workingDir);
53
56
  // Remove npm lockfile from template since we'll generate the correct one
54
57
  const npmLockPath = (0, path_1.join)(directory, 'package-lock.json');
55
58
  if ((0, node_fs_1.existsSync)(npmLockPath)) {
@@ -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';
@@ -2,7 +2,7 @@
2
2
  * Error codes for CNW errors.
3
3
  * These are used for telemetry and error tracking.
4
4
  */
5
- export type CnwErrorCode = 'DIRECTORY_EXISTS' | 'INVALID_WORKSPACE_NAME' | 'INVALID_FOLDER_NAME' | 'INVALID_BRANCH_NAME' | 'INVALID_PACKAGE_MANAGER' | 'INVALID_PRESET' | 'INVALID_WORKSPACE_TYPE' | 'INVALID_APP_NAME' | 'PRESET_FAILED' | 'SANDBOX_FAILED' | 'TEMPLATE_CLONE_FAILED' | 'CI_WORKFLOW_FAILED' | 'WORKSPACE_CREATION_FAILED' | 'ANGULAR_PREFIX_INVALID' | 'NETWORK_ERROR' | 'PACKAGE_INSTALL_ERROR' | 'UNKNOWN';
5
+ export type CnwErrorCode = 'DIRECTORY_EXISTS' | 'INVALID_WORKSPACE_NAME' | 'INVALID_FOLDER_NAME' | 'INVALID_BRANCH_NAME' | 'INVALID_PACKAGE_MANAGER' | 'INVALID_PATH' | 'INVALID_PRESET' | 'INVALID_WORKSPACE_TYPE' | 'INVALID_APP_NAME' | 'PRESET_FAILED' | 'SANDBOX_FAILED' | 'TEMPLATE_CLONE_FAILED' | 'CI_WORKFLOW_FAILED' | 'WORKSPACE_CREATION_FAILED' | 'ANGULAR_PREFIX_INVALID' | 'INVALID_BUNDLER' | 'NETWORK_ERROR' | 'PACKAGE_INSTALL_ERROR' | 'UNKNOWN';
6
6
  /**
7
7
  * Custom error class for CNW errors.
8
8
  * Used for structured error reporting and telemetry.
@@ -1 +1 @@
1
- {"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/error-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,yBAAyB,GACzB,gBAAgB,GAChB,wBAAwB,GACxB,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,uBAAuB,GACvB,oBAAoB,GACpB,2BAA2B,GAC3B,wBAAwB,GACxB,eAAe,GACf,uBAAuB,GACvB,SAAS,CAAC;AAEd;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAEf,IAAI,EAAE,YAAY;aAElB,OAAO,CAAC,EAAE,MAAM;aAChB,QAAQ,CAAC,EAAE,MAAM;gBAHjB,IAAI,EAAE,YAAY,EAClC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM;CAKpC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAEtC,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAC/B,OAAO,EAAE,MAAM;gBAFf,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,OAAO,EAAE,MAAM;CAKzB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAsB1D"}
1
+ {"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/error-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,yBAAyB,GACzB,cAAc,GACd,gBAAgB,GAChB,wBAAwB,GACxB,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,uBAAuB,GACvB,oBAAoB,GACpB,2BAA2B,GAC3B,wBAAwB,GACxB,iBAAiB,GACjB,eAAe,GACf,uBAAuB,GACvB,SAAS,CAAC;AAEd;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAEf,IAAI,EAAE,YAAY;aAElB,OAAO,CAAC,EAAE,MAAM;aAChB,QAAQ,CAAC,EAAE,MAAM;gBAHjB,IAAI,EAAE,YAAY,EAClC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM;CAKpC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAEtC,UAAU,EAAE,MAAM;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAC/B,OAAO,EAAE,MAAM;gBAFf,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,OAAO,EAAE,MAAM;CAKzB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAsB1D"}
@@ -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,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Q,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,CAAC;AAE5B;;;GAGG;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"}
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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,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,CAAC;AAE5B;;;GAGG;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]];
@@ -1,2 +1,2 @@
1
- export declare function cloneTemplate(templateUrl: string, targetDirectory: string): Promise<void>;
1
+ export declare function cloneTemplate(templateUrl: string, targetDirectory: string, workingDir?: string): Promise<void>;
2
2
  //# sourceMappingURL=clone-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clone-template.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/template/clone-template.ts"],"names":[],"mappings":"AAMA,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
1
+ {"version":3,"file":"clone-template.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/template/clone-template.ts"],"names":[],"mappings":"AAMA,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -6,12 +6,12 @@ const fs_1 = require("fs");
6
6
  const promises_1 = require("fs/promises");
7
7
  const path_1 = require("path");
8
8
  const error_utils_1 = require("../error-utils");
9
- async function cloneTemplate(templateUrl, targetDirectory) {
9
+ async function cloneTemplate(templateUrl, targetDirectory, workingDir) {
10
10
  if ((0, fs_1.existsSync)(targetDirectory)) {
11
11
  throw new error_utils_1.CnwError('DIRECTORY_EXISTS', `The directory '${targetDirectory}' already exists. Choose a different name or remove the existing directory.`);
12
12
  }
13
13
  try {
14
- await (0, child_process_utils_1.execAndWait)(`git clone --depth 1 "${templateUrl}" "${targetDirectory}"`, process.cwd());
14
+ await (0, child_process_utils_1.execAndWait)(`git clone --depth 1 "${templateUrl}" "${targetDirectory}"`, workingDir ?? process.cwd());
15
15
  // Ensure clean history
16
16
  const gitDir = (0, path_1.join)(targetDirectory, '.git');
17
17
  if ((0, fs_1.existsSync)(gitDir)) {