create-nx-workspace 22.5.0-canary.20260123-bc9b322 → 22.5.0-canary.20260127-de67da4
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/bin/create-nx-workspace.d.ts.map +1 -1
- package/bin/create-nx-workspace.js +27 -7
- package/package.json +1 -1
- package/src/create-workspace-options.d.ts +10 -1
- package/src/create-workspace-options.d.ts.map +1 -1
- package/src/create-workspace-options.js +2 -0
- package/src/create-workspace.d.ts.map +1 -1
- package/src/create-workspace.js +11 -2
- package/src/internal-utils/prompts.d.ts.map +1 -1
- package/src/internal-utils/prompts.js +29 -14
- package/src/utils/git/git.d.ts +5 -0
- package/src/utils/git/git.d.ts.map +1 -1
- package/src/utils/git/git.js +14 -0
- package/src/utils/nx/ab-testing.d.ts +14 -0
- package/src/utils/nx/ab-testing.d.ts.map +1 -1
- package/src/utils/nx/ab-testing.js +46 -3
- package/src/utils/nx/messages.d.ts +4 -0
- package/src/utils/nx/messages.d.ts.map +1 -1
- package/src/utils/nx/messages.js +27 -6
- package/src/utils/nx/nx-cloud.d.ts +1 -1
- package/src/utils/nx/nx-cloud.d.ts.map +1 -1
- package/src/utils/nx/nx-cloud.js +1 -1
|
@@ -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;
|
|
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,iC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xD"}
|
|
@@ -19,6 +19,7 @@ const ab_testing_1 = require("../src/utils/nx/ab-testing");
|
|
|
19
19
|
const error_utils_1 = require("../src/utils/error-utils");
|
|
20
20
|
const fs_1 = require("fs");
|
|
21
21
|
const is_ci_1 = require("../src/utils/ci/is-ci");
|
|
22
|
+
const git_1 = require("../src/utils/git/git");
|
|
22
23
|
function extractErrorFile(error) {
|
|
23
24
|
if (!error.stack)
|
|
24
25
|
return undefined;
|
|
@@ -295,10 +296,28 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
295
296
|
// Template flow - respects CLI arg, otherwise uses detected package manager (from invoking command)
|
|
296
297
|
argv.template = template;
|
|
297
298
|
const aiAgents = await (0, prompts_1.determineAiAgents)(argv);
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
// Track GH CLI availability for telemetry
|
|
300
|
+
const ghAvailable = (0, git_1.isGhCliAvailable)();
|
|
301
|
+
let nxCloud;
|
|
302
|
+
let completionMessageKey;
|
|
303
|
+
const flowVariant = (0, ab_testing_1.getFlowVariant)();
|
|
304
|
+
if (argv.skipGit === true) {
|
|
305
|
+
nxCloud = 'skip';
|
|
306
|
+
completionMessageKey = undefined;
|
|
307
|
+
}
|
|
308
|
+
else if (flowVariant === '2') {
|
|
309
|
+
// Variant 2: Skip cloud prompt, auto-connect
|
|
310
|
+
// Respect --nxCloud=skip if explicitly provided
|
|
311
|
+
nxCloud = argv.nxCloud === 'skip' ? 'skip' : 'yes';
|
|
312
|
+
completionMessageKey =
|
|
313
|
+
nxCloud === 'skip' ? undefined : (0, ab_testing_1.getCompletionMessageKeyForVariant)();
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
// Variants 0 & 1: Show cloud prompt (different copy based on variant)
|
|
317
|
+
nxCloud = await (0, prompts_1.determineNxCloudV2)(argv);
|
|
318
|
+
completionMessageKey =
|
|
319
|
+
nxCloud === 'skip' ? undefined : (0, ab_testing_1.getCompletionMessageKeyForVariant)();
|
|
320
|
+
}
|
|
302
321
|
packageManager = argv.packageManager ?? (0, package_manager_1.detectInvokedPackageManager)();
|
|
303
322
|
Object.assign(argv, {
|
|
304
323
|
nxCloud,
|
|
@@ -307,6 +326,8 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
307
326
|
packageManager,
|
|
308
327
|
defaultBase: 'main',
|
|
309
328
|
aiAgents,
|
|
329
|
+
ghAvailable,
|
|
330
|
+
skipCloudConnect: flowVariant === '2',
|
|
310
331
|
});
|
|
311
332
|
await (0, ab_testing_1.recordStat)({
|
|
312
333
|
nxVersion: nx_version_1.nxVersion,
|
|
@@ -319,6 +340,7 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
319
340
|
preset: '',
|
|
320
341
|
nodeVersion: process.versions.node ?? '',
|
|
321
342
|
packageManager,
|
|
343
|
+
ghAvailable: ghAvailable ? 'true' : 'false',
|
|
322
344
|
},
|
|
323
345
|
});
|
|
324
346
|
}
|
|
@@ -363,9 +385,7 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
363
385
|
nxCloud = await (0, prompts_1.determineNxCloudV2)(argv);
|
|
364
386
|
useGitHub = nxCloud !== 'skip';
|
|
365
387
|
completionMessageKey =
|
|
366
|
-
nxCloud === 'skip'
|
|
367
|
-
? undefined
|
|
368
|
-
: ab_testing_1.messages.completionMessageOfSelectedPrompt('setupNxCloudV2');
|
|
388
|
+
nxCloud === 'skip' ? undefined : (0, ab_testing_1.getCompletionMessageKeyForVariant)();
|
|
369
389
|
}
|
|
370
390
|
Object.assign(argv, {
|
|
371
391
|
nxCloud,
|
package/package.json
CHANGED
|
@@ -40,8 +40,17 @@ export interface CreateWorkspaceOptions {
|
|
|
40
40
|
};
|
|
41
41
|
cliName?: string;
|
|
42
42
|
aiAgents?: Agent[];
|
|
43
|
+
/**
|
|
44
|
+
* @description Skip cloud connection (variant 1 experiment - NXC-3628)
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
skipCloudConnect?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description Whether GitHub CLI (gh) is available on the system (for telemetry)
|
|
50
|
+
*/
|
|
51
|
+
ghAvailable?: boolean;
|
|
43
52
|
}
|
|
44
|
-
export declare const supportedAgents: readonly ["claude", "codex", "copilot", "cursor", "gemini"];
|
|
53
|
+
export declare const supportedAgents: readonly ["claude", "codex", "copilot", "cursor", "gemini", "opencode"];
|
|
45
54
|
export type Agent = (typeof supportedAgents)[number];
|
|
46
55
|
export declare const agentDisplayMap: Record<Agent, string>;
|
|
47
56
|
//# sourceMappingURL=create-workspace-options.d.ts.map
|
|
@@ -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;
|
|
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;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;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"}
|
|
@@ -7,6 +7,7 @@ exports.supportedAgents = [
|
|
|
7
7
|
'copilot',
|
|
8
8
|
'cursor',
|
|
9
9
|
'gemini',
|
|
10
|
+
'opencode',
|
|
10
11
|
];
|
|
11
12
|
exports.agentDisplayMap = {
|
|
12
13
|
claude: 'Claude Code',
|
|
@@ -14,4 +15,5 @@ exports.agentDisplayMap = {
|
|
|
14
15
|
codex: 'OpenAI Codex',
|
|
15
16
|
copilot: 'GitHub Copilot for VSCode',
|
|
16
17
|
cursor: 'Cursor',
|
|
18
|
+
opencode: 'OpenCode',
|
|
17
19
|
};
|
|
@@ -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,EAGL,aAAa,EACd,MAAM,iBAAiB,CAAC;AAsBzB,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,EACd,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;
|
|
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,EAGL,aAAa,EACd,MAAM,iBAAiB,CAAC;AAsBzB,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,EACd,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;GA0LZ;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D"}
|
package/src/create-workspace.js
CHANGED
|
@@ -62,7 +62,8 @@ async function createWorkspace(preset, options, rawArgs) {
|
|
|
62
62
|
throw e;
|
|
63
63
|
}
|
|
64
64
|
// Connect to Nx Cloud for template flow
|
|
65
|
-
|
|
65
|
+
// For variant 1 (NXC-3628): Skip connection, use GitHub flow for URL generation
|
|
66
|
+
if (nxCloud !== 'skip' && !options.skipCloudConnect) {
|
|
66
67
|
await (0, nx_cloud_1.connectToNxCloudForTemplate)(directory, 'create-nx-workspace', useGitHub);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -127,7 +128,15 @@ async function createWorkspace(preset, options, rawArgs) {
|
|
|
127
128
|
let connectUrl;
|
|
128
129
|
let nxCloudInfo;
|
|
129
130
|
if (nxCloud !== 'skip') {
|
|
130
|
-
|
|
131
|
+
// For variant 1 (skipCloudConnect=true): Skip readNxCloudToken() entirely
|
|
132
|
+
// - We didn't call connectToNxCloudForTemplate(), so no token exists
|
|
133
|
+
// - The spinner message "Checking Nx Cloud setup" would be misleading
|
|
134
|
+
// - createNxCloudOnboardingUrl() uses GitHub flow which sends accessToken: null
|
|
135
|
+
//
|
|
136
|
+
// For variant 0: Read the token as before (cloud was connected)
|
|
137
|
+
const token = options.skipCloudConnect
|
|
138
|
+
? undefined
|
|
139
|
+
: (0, nx_cloud_1.readNxCloudToken)(directory);
|
|
131
140
|
connectUrl = await (0, nx_cloud_1.createNxCloudOnboardingUrl)(nxCloud, token, directory, useGitHub);
|
|
132
141
|
// Store for SIGINT handler
|
|
133
142
|
cloudConnectUrl = connectUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/internal-utils/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/internal-utils/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,EAEL,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EACL,KAAK,EAGN,MAAM,6BAA6B,CAAC;AAGrC,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACvE,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,CAsD5B;AAED,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACrE,OAAO,CAAC,OAAO,CAAC,CAelB;AA4BD,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC,GACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CA4C5B;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACzE,OAAO,CAAC,KAAK,EAAE,CAAC,CAElB;AAqBD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,OAAO,CAAC,MAAM,CAAC,CAwBjB;AAED,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
|
|
@@ -37,21 +37,36 @@ async function determineNxCloudV2(parsedArgs) {
|
|
|
37
37
|
if (!parsedArgs.interactive || (0, is_ci_1.isCI)()) {
|
|
38
38
|
return 'skip';
|
|
39
39
|
}
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
name: 'nxCloud',
|
|
44
|
-
message,
|
|
45
|
-
type: 'autocomplete',
|
|
46
|
-
choices,
|
|
47
|
-
initial,
|
|
48
|
-
}; // types in enquirer are not up to date
|
|
49
|
-
if (footer) {
|
|
50
|
-
promptConfig.footer = () => footer;
|
|
51
|
-
}
|
|
52
|
-
if (hint) {
|
|
53
|
-
promptConfig.hint = () => hint;
|
|
40
|
+
// Variant 2: Skip prompt and auto-connect
|
|
41
|
+
if (!(0, ab_testing_1.shouldShowCloudPrompt)()) {
|
|
42
|
+
return 'github';
|
|
54
43
|
}
|
|
44
|
+
// Variants 0 & 1: Show cloud prompt with different copy
|
|
45
|
+
const variant = (0, ab_testing_1.getFlowVariant)();
|
|
46
|
+
const promptConfig = variant === '1'
|
|
47
|
+
? {
|
|
48
|
+
name: 'nxCloud',
|
|
49
|
+
message: 'Would you like remote caching to make your build faster?',
|
|
50
|
+
type: 'autocomplete',
|
|
51
|
+
choices: [
|
|
52
|
+
{ value: 'yes', name: 'Yes' },
|
|
53
|
+
{ value: 'skip', name: 'Skip' },
|
|
54
|
+
],
|
|
55
|
+
initial: 0,
|
|
56
|
+
hint: () => chalk.dim('\n(can be disabled any time)'),
|
|
57
|
+
footer: () => chalk.dim('\nRead more about remote caching at https://nx.dev/ci/features/remote-cache'),
|
|
58
|
+
}
|
|
59
|
+
: {
|
|
60
|
+
name: 'nxCloud',
|
|
61
|
+
message: 'Try the full Nx platform?',
|
|
62
|
+
type: 'autocomplete',
|
|
63
|
+
choices: [
|
|
64
|
+
{ value: 'yes', name: 'Yes' },
|
|
65
|
+
{ value: 'skip', name: 'Skip' },
|
|
66
|
+
],
|
|
67
|
+
initial: 0,
|
|
68
|
+
footer: () => chalk.dim('\nAutomatically fix broken PRs, 70% faster CI: https://nx.dev/nx-cloud'),
|
|
69
|
+
};
|
|
55
70
|
const result = await enquirer.prompt([
|
|
56
71
|
promptConfig,
|
|
57
72
|
]);
|
package/src/utils/git/git.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export declare function checkGitVersion(): Promise<string | null | undefined>;
|
|
|
14
14
|
* Returns true if git command can be executed, false otherwise.
|
|
15
15
|
*/
|
|
16
16
|
export declare function isGitAvailable(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Synchronously checks if GitHub CLI (gh) is available on the system.
|
|
19
|
+
* Returns true if gh command can be executed, false otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isGhCliAvailable(): boolean;
|
|
17
22
|
export declare function initializeGitRepo(directory: string, options: {
|
|
18
23
|
defaultBase: string;
|
|
19
24
|
commit?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/git/git.ts"],"names":[],"mappings":"AAMA,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,sBAAsB,2BAA2B;IACjD,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;CAC1B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,KAAK,yBAAyB;gBAElC,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAQ1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AA0ED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,iBAsDF;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CAuGxB"}
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/git/git.ts"],"names":[],"mappings":"AAMA,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,sBAAsB,2BAA2B;IACjD,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;CAC1B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,KAAK,yBAAyB;gBAElC,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAQ1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAO1C;AA0ED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,iBAsDF;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CAuGxB"}
|
package/src/utils/git/git.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GitHubPushSkippedError = exports.VcsPushStatus = void 0;
|
|
4
4
|
exports.checkGitVersion = checkGitVersion;
|
|
5
5
|
exports.isGitAvailable = isGitAvailable;
|
|
6
|
+
exports.isGhCliAvailable = isGhCliAvailable;
|
|
6
7
|
exports.initializeGitRepo = initializeGitRepo;
|
|
7
8
|
exports.pushToGitHub = pushToGitHub;
|
|
8
9
|
const child_process_1 = require("child_process");
|
|
@@ -48,6 +49,19 @@ function isGitAvailable() {
|
|
|
48
49
|
return false;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Synchronously checks if GitHub CLI (gh) is available on the system.
|
|
54
|
+
* Returns true if gh command can be executed, false otherwise.
|
|
55
|
+
*/
|
|
56
|
+
function isGhCliAvailable() {
|
|
57
|
+
try {
|
|
58
|
+
(0, child_process_1.execSync)('gh --version', { stdio: 'ignore' });
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
51
65
|
async function getGitHubUsername(directory) {
|
|
52
66
|
const result = await (0, child_process_utils_1.execAndWait)('gh api user --jq .login', directory);
|
|
53
67
|
const username = result.stdout.trim();
|
|
@@ -3,6 +3,19 @@ import type { CompletionMessageKey } from './messages';
|
|
|
3
3
|
* Returns the flow variant for tracking (0 = preset, 1 = template).
|
|
4
4
|
*/
|
|
5
5
|
export declare function getFlowVariant(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the completion message key based on the current flow variant.
|
|
8
|
+
* - Variant 0: 'platform-setup' (shows "Try the full Nx platform?" prompt)
|
|
9
|
+
* - Variant 1: 'cache-setup' (shows "Would you like remote caching..." prompt)
|
|
10
|
+
* - Variant 2: 'platform-promo' (skips prompt, auto-connects, shows promo message)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCompletionMessageKeyForVariant(): CompletionMessageKey;
|
|
13
|
+
/**
|
|
14
|
+
* Returns whether the cloud prompt should be shown.
|
|
15
|
+
* Variants 0 and 1 show prompts (with different copy).
|
|
16
|
+
* Variant 2 skips the prompt and auto-connects.
|
|
17
|
+
*/
|
|
18
|
+
export declare function shouldShowCloudPrompt(): boolean;
|
|
6
19
|
export declare const NxCloudChoices: string[];
|
|
7
20
|
declare const messageOptions: Record<string, MessageData[]>;
|
|
8
21
|
export type MessageKey = keyof typeof messageOptions;
|
|
@@ -59,6 +72,7 @@ export interface RecordStatMetaPrecreate {
|
|
|
59
72
|
preset: string;
|
|
60
73
|
nodeVersion: string;
|
|
61
74
|
packageManager: string;
|
|
75
|
+
ghAvailable?: string;
|
|
62
76
|
}
|
|
63
77
|
export type RecordStatMeta = RecordStatMetaStart | RecordStatMetaComplete | RecordStatMetaError | RecordStatMetaCancel | RecordStatMetaPrecreate;
|
|
64
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":"
|
|
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,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAqEvD;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,oBAAoB,CASxE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAG/C;AAED,eAAO,MAAM,cAAc,UAQ1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAsGjD,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,GAAG,WAAW;IAavC,2BAA2B,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM;IAQpD,iCAAiC,CAAC,GAAG,EAAE,UAAU,GAAG,oBAAoB;CAQzE;A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ages = exports.NxCloudChoices = void 0;
|
|
4
4
|
exports.getFlowVariant = getFlowVariant;
|
|
5
|
+
exports.getCompletionMessageKeyForVariant = getCompletionMessageKeyForVariant;
|
|
6
|
+
exports.shouldShowCloudPrompt = shouldShowCloudPrompt;
|
|
5
7
|
exports.recordStat = recordStat;
|
|
6
8
|
const node_child_process_1 = require("node:child_process");
|
|
7
9
|
const node_fs_1 = require("node:fs");
|
|
@@ -18,10 +20,18 @@ function readCachedFlowVariant() {
|
|
|
18
20
|
if (!(0, node_fs_1.existsSync)(FLOW_VARIANT_CACHE_FILE))
|
|
19
21
|
return null;
|
|
20
22
|
const stats = (0, node_fs_1.statSync)(FLOW_VARIANT_CACHE_FILE);
|
|
21
|
-
if (Date.now() - stats.mtimeMs > FLOW_VARIANT_EXPIRY_MS)
|
|
23
|
+
if (Date.now() - stats.mtimeMs > FLOW_VARIANT_EXPIRY_MS) {
|
|
24
|
+
// Delete expired file so a new variant can be written
|
|
25
|
+
try {
|
|
26
|
+
(0, node_fs_1.unlinkSync)(FLOW_VARIANT_CACHE_FILE);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Ignore delete errors
|
|
30
|
+
}
|
|
22
31
|
return null;
|
|
32
|
+
}
|
|
23
33
|
const value = (0, node_fs_1.readFileSync)(FLOW_VARIANT_CACHE_FILE, 'utf-8').trim();
|
|
24
|
-
return value === '0' || value === '1' ? value : null;
|
|
34
|
+
return value === '0' || value === '1' || value === '2' ? value : null;
|
|
25
35
|
}
|
|
26
36
|
catch {
|
|
27
37
|
return null;
|
|
@@ -35,6 +45,14 @@ function writeCachedFlowVariant(variant) {
|
|
|
35
45
|
// Ignore write errors
|
|
36
46
|
}
|
|
37
47
|
}
|
|
48
|
+
function selectRandomVariant() {
|
|
49
|
+
const rand = Math.random();
|
|
50
|
+
if (rand < 0.33)
|
|
51
|
+
return '0';
|
|
52
|
+
if (rand < 0.66)
|
|
53
|
+
return '1';
|
|
54
|
+
return '2';
|
|
55
|
+
}
|
|
38
56
|
/**
|
|
39
57
|
* Internal function to determine and cache the flow variant.
|
|
40
58
|
*/
|
|
@@ -43,7 +61,7 @@ function getFlowVariantInternal() {
|
|
|
43
61
|
return flowVariantCache;
|
|
44
62
|
const variant = process.env.NX_CNW_FLOW_VARIANT ??
|
|
45
63
|
readCachedFlowVariant() ??
|
|
46
|
-
(
|
|
64
|
+
selectRandomVariant();
|
|
47
65
|
flowVariantCache = variant;
|
|
48
66
|
// Only write to cache if we randomly assigned a variant and no cache exists yet
|
|
49
67
|
// This ensures the cache expiry is based on original creation time, not last access
|
|
@@ -62,6 +80,31 @@ function getFlowVariant() {
|
|
|
62
80
|
}
|
|
63
81
|
return flowVariantCache ?? getFlowVariantInternal();
|
|
64
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns the completion message key based on the current flow variant.
|
|
85
|
+
* - Variant 0: 'platform-setup' (shows "Try the full Nx platform?" prompt)
|
|
86
|
+
* - Variant 1: 'cache-setup' (shows "Would you like remote caching..." prompt)
|
|
87
|
+
* - Variant 2: 'platform-promo' (skips prompt, auto-connects, shows promo message)
|
|
88
|
+
*/
|
|
89
|
+
function getCompletionMessageKeyForVariant() {
|
|
90
|
+
const variant = getFlowVariant();
|
|
91
|
+
if (variant === '1') {
|
|
92
|
+
return 'cache-setup';
|
|
93
|
+
}
|
|
94
|
+
if (variant === '2') {
|
|
95
|
+
return 'platform-promo';
|
|
96
|
+
}
|
|
97
|
+
return 'platform-setup';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Returns whether the cloud prompt should be shown.
|
|
101
|
+
* Variants 0 and 1 show prompts (with different copy).
|
|
102
|
+
* Variant 2 skips the prompt and auto-connects.
|
|
103
|
+
*/
|
|
104
|
+
function shouldShowCloudPrompt() {
|
|
105
|
+
const variant = getFlowVariant();
|
|
106
|
+
return variant !== '2';
|
|
107
|
+
}
|
|
65
108
|
exports.NxCloudChoices = [
|
|
66
109
|
'github',
|
|
67
110
|
'gitlab',
|
|
@@ -13,6 +13,10 @@ declare const completionMessages: {
|
|
|
13
13
|
readonly 'platform-setup': {
|
|
14
14
|
readonly title: "Your platform setup is almost complete.";
|
|
15
15
|
};
|
|
16
|
+
readonly 'platform-promo': {
|
|
17
|
+
readonly title: "Want faster builds?";
|
|
18
|
+
readonly subtext: "Remote caching · Self-healing CI · Task distribution";
|
|
19
|
+
};
|
|
16
20
|
};
|
|
17
21
|
export type CompletionMessageKey = keyof typeof completionMessages;
|
|
18
22
|
export declare function getCompletionMessage(completionMessageKey: CompletionMessageKey | undefined, url: string | null, pushedToVcs: VcsPushStatus, workspaceName?: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoC3C;;;GAGG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;CAcd,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAEnE,wBAAgB,oBAAoB,CAClC,oBAAoB,EAAE,oBAAoB,GAAG,SAAS,EACtD,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,WAAW,EAAE,aAAa,EAC1B,aAAa,CAAC,EAAE,MAAM,GACrB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAgBxC;AAED,wBAAgB,sBAAsB,IAAI;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAUA"}
|
package/src/utils/nx/messages.js
CHANGED
|
@@ -3,16 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCompletionMessage = getCompletionMessage;
|
|
4
4
|
exports.getSkippedCloudMessage = getSkippedCloudMessage;
|
|
5
5
|
const git_1 = require("../git/git");
|
|
6
|
-
function getSetupMessage(url, pushedToVcs, workspaceName) {
|
|
6
|
+
function getSetupMessage(url, pushedToVcs, workspaceName, isPromo) {
|
|
7
|
+
const githubUrl = workspaceName
|
|
8
|
+
? `https://github.com/new?name=${encodeURIComponent(workspaceName)}`
|
|
9
|
+
: 'https://github.com/new';
|
|
10
|
+
if (isPromo) {
|
|
11
|
+
if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
|
|
12
|
+
return url
|
|
13
|
+
? `Connect your repo to enable remote caching and self-healing CI at: ${url}`
|
|
14
|
+
: 'Connect your repo at https://cloud.nx.app to enable remote caching and self-healing CI.';
|
|
15
|
+
}
|
|
16
|
+
return url
|
|
17
|
+
? `Connect your repo (${githubUrl}) to enable remote caching and self-healing CI at: ${url}`
|
|
18
|
+
: `Connect your repo (${githubUrl}) to enable remote caching and self-healing CI at https://cloud.nx.app`;
|
|
19
|
+
}
|
|
7
20
|
if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
|
|
8
21
|
return url
|
|
9
22
|
? `Go to Nx Cloud and finish the setup: ${url}`
|
|
10
23
|
: 'Return to Nx Cloud and finish the setup.';
|
|
11
24
|
}
|
|
12
25
|
// User needs to push first
|
|
13
|
-
const githubUrl = workspaceName
|
|
14
|
-
? `https://github.com/new?name=${encodeURIComponent(workspaceName)}`
|
|
15
|
-
: 'https://github.com/new';
|
|
16
26
|
const action = url ? 'go' : 'return';
|
|
17
27
|
const urlSuffix = url ? `: ${url}` : '.';
|
|
18
28
|
return `Push your repo (${githubUrl}), then ${action} to Nx Cloud and finish the setup${urlSuffix}`;
|
|
@@ -31,12 +41,23 @@ const completionMessages = {
|
|
|
31
41
|
'platform-setup': {
|
|
32
42
|
title: 'Your platform setup is almost complete.',
|
|
33
43
|
},
|
|
44
|
+
'platform-promo': {
|
|
45
|
+
title: 'Want faster builds?',
|
|
46
|
+
subtext: 'Remote caching \u00b7 Self-healing CI \u00b7 Task distribution',
|
|
47
|
+
},
|
|
34
48
|
};
|
|
35
49
|
function getCompletionMessage(completionMessageKey, url, pushedToVcs, workspaceName) {
|
|
36
50
|
const key = completionMessageKey ?? 'ci-setup';
|
|
51
|
+
const messageConfig = completionMessages[key];
|
|
52
|
+
const isPromo = key === 'platform-promo';
|
|
53
|
+
const bodyLines = [getSetupMessage(url, pushedToVcs, workspaceName, isPromo)];
|
|
54
|
+
if ('subtext' in messageConfig && messageConfig.subtext) {
|
|
55
|
+
bodyLines.push('');
|
|
56
|
+
bodyLines.push(messageConfig.subtext);
|
|
57
|
+
}
|
|
37
58
|
return {
|
|
38
|
-
title:
|
|
39
|
-
bodyLines
|
|
59
|
+
title: messageConfig.title,
|
|
60
|
+
bodyLines,
|
|
40
61
|
};
|
|
41
62
|
}
|
|
42
63
|
function getSkippedCloudMessage() {
|
|
@@ -3,7 +3,7 @@ import { CompletionMessageKey } from './messages';
|
|
|
3
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
|
-
export declare function createNxCloudOnboardingUrl(nxCloud: NxCloud, token: string, directory: string, useGitHub?: boolean): Promise<string>;
|
|
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
|
//# sourceMappingURL=nx-cloud.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/nx-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAGL,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB,MAAM,MAAM,OAAO,GACf,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,qBAAqB,GACrB,UAAU,GACV,MAAM,CAAC;AAEX,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BxB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAgBjD;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/nx-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAGL,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB,MAAM,MAAM,OAAO,GACf,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,qBAAqB,GACrB,UAAU,GACV,MAAM,CAAC;AAEX,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BxB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAgBjD;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAED,wBAAsB,cAAc,CAClC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,aAAa,EAC1B,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM,mBAWvB;AAED,wBAAgB,qBAAqB,WAIpC"}
|
package/src/utils/nx/nx-cloud.js
CHANGED
|
@@ -54,7 +54,7 @@ async function createNxCloudOnboardingUrl(nxCloud, token, directory, useGitHub)
|
|
|
54
54
|
const source = nxCloud === 'yes'
|
|
55
55
|
? 'create-nx-workspace-success-cache-setup'
|
|
56
56
|
: 'create-nx-workspace-success-ci-setup';
|
|
57
|
-
const meta = ab_testing_1.
|
|
57
|
+
const meta = `variant-${(0, ab_testing_1.getFlowVariant)()}`;
|
|
58
58
|
return createNxCloudOnboardingURL(source, token, meta, false, useGitHub ??
|
|
59
59
|
(nxCloud === 'yes' || nxCloud === 'github' || nxCloud === 'circleci'), directory);
|
|
60
60
|
}
|