create-nx-workspace 22.7.0-beta.5 → 22.7.0-beta.7

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.
package/assets.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "outDir": "dist/packages/create-nx-workspace",
3
+ "assets": [
4
+ {
5
+ "glob": "**/files/**"
6
+ },
7
+ {
8
+ "glob": "**/files/**/.gitkeep"
9
+ },
10
+ {
11
+ "glob": "**/*.json",
12
+ "ignore": ["tsconfig*.json", "project.json", ".eslintrc.json"]
13
+ },
14
+ {
15
+ "glob": "**/*.js",
16
+ "ignore": ["**/jest.config.js"]
17
+ },
18
+ {
19
+ "glob": "**/*.d.ts"
20
+ },
21
+ "LICENSE"
22
+ ]
23
+ }
@@ -170,13 +170,13 @@ exports.commandsObject = yargs_1.default
170
170
  if ((0, ai_output_1.isAiAgent)()) {
171
171
  exports.commandsObject
172
172
  .example(chalk_1.default.green('AI AGENTS (RECOMMENDED):'), '')
173
- .example(' npx create-nx-workspace@latest myorg --template=nrwl/empty-template --nxCloud=yes --interactive=false', '')
173
+ .example(' npx create-nx-workspace@latest myorg --template=empty --nxCloud=yes --interactive=false', '')
174
174
  .example('', '')
175
175
  .example(chalk_1.default.green('AVAILABLE TEMPLATES:'), '')
176
- .example(' --template=nrwl/empty-template Empty monorepo', '')
177
- .example(' --template=nrwl/react-template React fullstack', '')
178
- .example(' --template=nrwl/angular-template Angular fullstack', '')
179
- .example(' --template=nrwl/typescript-template NPM packages', '')
176
+ .example(' --template=empty Empty monorepo', '')
177
+ .example(' --template=react React fullstack', '')
178
+ .example(' --template=angular Angular fullstack', '')
179
+ .example(' --template=typescript NPM packages', '')
180
180
  .epilogue(`${chalk_1.default.cyan('AI Agent Mode:')}
181
181
  Set CLAUDECODE=1 or OPENCODE=1 for JSON output and non-interactive mode.
182
182
  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.7.0-beta.5",
3
+ "version": "22.7.0-beta.7",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast Builds",
6
6
  "repository": {
@@ -42,8 +42,5 @@
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public"
45
- },
46
- "main": "index.js",
47
- "types": "./src/index.d.ts",
48
- "type": "commonjs"
45
+ }
49
46
  }
package/project.json CHANGED
@@ -24,47 +24,7 @@
24
24
  ],
25
25
  "parallel": false
26
26
  },
27
- "dependsOn": ["^build", "build-base", "legacy-post-build"]
28
- },
29
- "legacy-post-build": {
30
- "executor": "@nx/workspace-plugin:legacy-post-build",
31
- "options": {
32
- "tsConfig": "./tsconfig.lib.json",
33
- "assets": [
34
- {
35
- "input": "packages/create-nx-workspace",
36
- "glob": "**/files/**",
37
- "output": "/"
38
- },
39
- {
40
- "input": "packages/create-nx-workspace",
41
- "glob": "**/files/**/.gitkeep",
42
- "output": "/"
43
- },
44
- {
45
- "input": "packages/create-nx-workspace",
46
- "glob": "**/*.json",
47
- "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
48
- "output": "/"
49
- },
50
- {
51
- "input": "packages/create-nx-workspace",
52
- "glob": "**/*.js",
53
- "ignore": ["**/jest.config.js"],
54
- "output": "/"
55
- },
56
- {
57
- "input": "packages/create-nx-workspace",
58
- "glob": "**/*.d.ts",
59
- "output": "/"
60
- },
61
- {
62
- "input": "",
63
- "glob": "LICENSE",
64
- "output": "/"
65
- }
66
- ]
67
- }
27
+ "inputs": ["copyReadme"]
68
28
  }
69
29
  },
70
30
  "implicitDependencies": [
@@ -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) {
@@ -96,7 +96,7 @@ async function determineTemplate(parsedArgs) {
96
96
  if (parsedArgs.preset)
97
97
  return 'custom';
98
98
  if (!parsedArgs.interactive || (0, is_ci_1.isCI)())
99
- return 'custom';
99
+ return 'nrwl/empty-template';
100
100
  // Docs generation needs preset flow to document all presets
101
101
  if (process.env.NX_GENERATE_DOCS_PROCESS === 'true')
102
102
  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,CA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B,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,14 +3,15 @@ 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;
9
+ const tslib_1 = require("tslib");
10
10
  const node_child_process_1 = require("node:child_process");
11
11
  const node_fs_1 = require("node:fs");
12
12
  const node_path_1 = require("node:path");
13
13
  const node_os_1 = require("node:os");
14
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
14
15
  const is_ci_1 = require("../ci/is-ci");
15
16
  // Flow variant controls both tracking and banner display (CLOUD-4235)
16
17
  // Variants: 0 = control, 1 = updated prompt, 2 = no prompt (auto-connect)
@@ -91,11 +92,6 @@ function getFlowVariant() {
91
92
  function getCompletionMessageKeyForVariant() {
92
93
  return 'platform-setup';
93
94
  }
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
95
  // ============================================================================
100
96
  // Banner Variant A/B Testing (CLOUD-4235)
101
97
  // ============================================================================
@@ -205,12 +201,38 @@ const messageOptions = {
205
201
  choices: [
206
202
  { value: 'yes', name: 'Yes' },
207
203
  { value: 'skip', name: 'Skip for now' },
208
- { value: 'never', name: "No, don't ask again" },
204
+ { value: 'never', name: chalk_1.default.dim("No, don't ask again") },
209
205
  ],
210
206
  footer: '\nAutomatically fix broken PRs, 70% faster CI: https://nx.dev/nx-cloud',
211
207
  fallback: undefined,
212
208
  completionMessage: 'platform-setup',
213
209
  },
210
+ {
211
+ code: 'cloud-ab-remote-cache-speed',
212
+ message: 'Enable remote caching to speed up builds with Nx Cloud?',
213
+ initial: 0,
214
+ choices: [
215
+ { value: 'yes', name: 'Yes' },
216
+ { value: 'skip', name: 'Skip for now' },
217
+ { value: 'never', name: chalk_1.default.dim("No, don't ask again") },
218
+ ],
219
+ footer: '\nFree for small teams. 2-minute setup with GitHub — cache locally and in CI: https://nx.dev/nx-cloud',
220
+ fallback: undefined,
221
+ completionMessage: 'platform-setup',
222
+ },
223
+ {
224
+ code: 'cloud-ab-fast-ci-setup',
225
+ message: 'Speed up your CI with Nx Cloud?',
226
+ initial: 0,
227
+ choices: [
228
+ { value: 'yes', name: 'Yes' },
229
+ { value: 'skip', name: 'Skip for now' },
230
+ { value: 'never', name: chalk_1.default.dim("No, don't ask again") },
231
+ ],
232
+ footer: '\n70% faster CI on GitHub, GitLab, and more. Free tier, 2-minute setup: https://nx.dev/nx-cloud',
233
+ fallback: undefined,
234
+ completionMessage: 'platform-setup',
235
+ },
214
236
  ],
215
237
  };
216
238
  class PromptMessages {
@@ -223,7 +245,9 @@ class PromptMessages {
223
245
  this.selectedMessages[key] = 0;
224
246
  }
225
247
  else {
226
- this.selectedMessages[key] = Math.floor(Math.random() * messageOptions[key].length);
248
+ const variant = Number(getFlowVariant());
249
+ this.selectedMessages[key] =
250
+ variant < messageOptions[key].length ? variant : 0;
227
251
  }
228
252
  }
229
253
  return messageOptions[key][this.selectedMessages[key]];