create-nx-workspace 22.5.0-canary.20260122-05de3ff → 22.5.0-canary.20260123-bc9b322
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 +8 -28
- package/package.json +1 -1
- package/src/create-workspace-options.d.ts +0 -9
- package/src/create-workspace-options.d.ts.map +1 -1
- package/src/create-workspace.d.ts.map +1 -1
- package/src/create-workspace.js +3 -12
- package/src/utils/git/git.d.ts +0 -5
- package/src/utils/git/git.d.ts.map +1 -1
- package/src/utils/git/git.js +2 -28
- package/src/utils/nx/ab-testing.d.ts +0 -1
- package/src/utils/nx/ab-testing.d.ts.map +1 -1
- package/src/utils/nx/ab-testing.js +1 -9
- package/src/utils/nx/messages.d.ts +1 -1
- package/src/utils/nx/messages.d.ts.map +1 -1
- package/src/utils/nx/messages.js +8 -5
- package/src/utils/nx/nx-cloud.d.ts +2 -2
- package/src/utils/nx/nx-cloud.d.ts.map +1 -1
- package/src/utils/nx/nx-cloud.js +3 -3
|
@@ -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,iCAAiC,CAAC;AAKzC,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AA2DnE,KAAK,qBA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_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");
|
|
23
22
|
function extractErrorFile(error) {
|
|
24
23
|
if (!error.stack)
|
|
25
24
|
return undefined;
|
|
@@ -209,6 +208,9 @@ process.on('uncaughtException', (error) => {
|
|
|
209
208
|
process.on('SIGINT', async () => {
|
|
210
209
|
const { directory, connectUrl } = (0, create_workspace_1.getInterruptedWorkspaceState)();
|
|
211
210
|
if (directory) {
|
|
211
|
+
const path = require('path');
|
|
212
|
+
const workspaceName = path.basename(directory);
|
|
213
|
+
const githubUrl = `https://github.com/new?name=${encodeURIComponent(workspaceName)}`;
|
|
212
214
|
console.log(''); // New line after ^C
|
|
213
215
|
output_1.output.log({
|
|
214
216
|
title: 'Workspace creation interrupted',
|
|
@@ -216,7 +218,7 @@ process.on('SIGINT', async () => {
|
|
|
216
218
|
`Your workspace was created at: ${directory}`,
|
|
217
219
|
'',
|
|
218
220
|
'To complete the setup:',
|
|
219
|
-
|
|
221
|
+
` 1. Ensure your repo is pushed (e.g. ${githubUrl})`,
|
|
220
222
|
connectUrl
|
|
221
223
|
? ` 2. Connect to Nx Cloud: ${connectUrl}`
|
|
222
224
|
: ' 2. Connect to Nx Cloud: Run "nx connect"',
|
|
@@ -293,29 +295,10 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
293
295
|
// Template flow - respects CLI arg, otherwise uses detected package manager (from invoking command)
|
|
294
296
|
argv.template = template;
|
|
295
297
|
const aiAgents = await (0, prompts_1.determineAiAgents)(argv);
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (argv.skipGit === true) {
|
|
301
|
-
nxCloud = 'skip';
|
|
302
|
-
completionMessageKey = undefined;
|
|
303
|
-
}
|
|
304
|
-
else if ((0, ab_testing_1.getFlowVariant)() === '1') {
|
|
305
|
-
// Variant 1 (NXC-3628): Skip cloud prompt, always show platform link
|
|
306
|
-
// Respect --nxCloud=skip if explicitly provided
|
|
307
|
-
nxCloud = argv.nxCloud === 'skip' ? 'skip' : 'yes';
|
|
308
|
-
completionMessageKey =
|
|
309
|
-
nxCloud === 'skip' ? undefined : 'platform-setup';
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
// Variant 0: Current behavior - show cloud prompt
|
|
313
|
-
nxCloud = await (0, prompts_1.determineNxCloudV2)(argv);
|
|
314
|
-
completionMessageKey =
|
|
315
|
-
nxCloud === 'skip'
|
|
316
|
-
? undefined
|
|
317
|
-
: ab_testing_1.messages.completionMessageOfSelectedPrompt('setupNxCloudV2');
|
|
318
|
-
}
|
|
298
|
+
const nxCloud = argv.skipGit === true ? 'skip' : await (0, prompts_1.determineNxCloudV2)(argv);
|
|
299
|
+
const completionMessageKey = nxCloud === 'skip'
|
|
300
|
+
? undefined
|
|
301
|
+
: ab_testing_1.messages.completionMessageOfSelectedPrompt('setupNxCloudV2');
|
|
319
302
|
packageManager = argv.packageManager ?? (0, package_manager_1.detectInvokedPackageManager)();
|
|
320
303
|
Object.assign(argv, {
|
|
321
304
|
nxCloud,
|
|
@@ -324,8 +307,6 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
324
307
|
packageManager,
|
|
325
308
|
defaultBase: 'main',
|
|
326
309
|
aiAgents,
|
|
327
|
-
ghAvailable,
|
|
328
|
-
skipCloudConnect: (0, ab_testing_1.getFlowVariant)() === '1',
|
|
329
310
|
});
|
|
330
311
|
await (0, ab_testing_1.recordStat)({
|
|
331
312
|
nxVersion: nx_version_1.nxVersion,
|
|
@@ -338,7 +319,6 @@ async function normalizeArgsMiddleware(argv) {
|
|
|
338
319
|
preset: '',
|
|
339
320
|
nodeVersion: process.versions.node ?? '',
|
|
340
321
|
packageManager,
|
|
341
|
-
ghAvailable: ghAvailable ? 'true' : 'false',
|
|
342
322
|
},
|
|
343
323
|
});
|
|
344
324
|
}
|
package/package.json
CHANGED
|
@@ -40,15 +40,6 @@ 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;
|
|
52
43
|
}
|
|
53
44
|
export declare const supportedAgents: readonly ["claude", "codex", "copilot", "cursor", "gemini"];
|
|
54
45
|
export type Agent = (typeof supportedAgents)[number];
|
|
@@ -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;CACpB;AAED,eAAO,MAAM,eAAe,6DAMlB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAMjD,CAAC"}
|
|
@@ -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;;;;;GAiLZ;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D"}
|
package/src/create-workspace.js
CHANGED
|
@@ -62,8 +62,7 @@ async function createWorkspace(preset, options, rawArgs) {
|
|
|
62
62
|
throw e;
|
|
63
63
|
}
|
|
64
64
|
// Connect to Nx Cloud for template flow
|
|
65
|
-
|
|
66
|
-
if (nxCloud !== 'skip' && !options.skipCloudConnect) {
|
|
65
|
+
if (nxCloud !== 'skip') {
|
|
67
66
|
await (0, nx_cloud_1.connectToNxCloudForTemplate)(directory, 'create-nx-workspace', useGitHub);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -128,19 +127,11 @@ async function createWorkspace(preset, options, rawArgs) {
|
|
|
128
127
|
let connectUrl;
|
|
129
128
|
let nxCloudInfo;
|
|
130
129
|
if (nxCloud !== 'skip') {
|
|
131
|
-
|
|
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);
|
|
130
|
+
const token = (0, nx_cloud_1.readNxCloudToken)(directory);
|
|
140
131
|
connectUrl = await (0, nx_cloud_1.createNxCloudOnboardingUrl)(nxCloud, token, directory, useGitHub);
|
|
141
132
|
// Store for SIGINT handler
|
|
142
133
|
cloudConnectUrl = connectUrl;
|
|
143
|
-
nxCloudInfo = await (0, nx_cloud_1.getNxCloudInfo)(connectUrl, pushedToVcs, options.completionMessageKey);
|
|
134
|
+
nxCloudInfo = await (0, nx_cloud_1.getNxCloudInfo)(connectUrl, pushedToVcs, options.completionMessageKey, name);
|
|
144
135
|
}
|
|
145
136
|
else if (isTemplate && nxCloud === 'skip') {
|
|
146
137
|
// Show nx connect message when user skips cloud in template flow
|
package/src/utils/git/git.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ 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;
|
|
22
17
|
export declare function initializeGitRepo(directory: string, options: {
|
|
23
18
|
defaultBase: string;
|
|
24
19
|
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;
|
|
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"}
|
package/src/utils/git/git.js
CHANGED
|
@@ -3,7 +3,6 @@ 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;
|
|
7
6
|
exports.initializeGitRepo = initializeGitRepo;
|
|
8
7
|
exports.pushToGitHub = pushToGitHub;
|
|
9
8
|
const child_process_1 = require("child_process");
|
|
@@ -49,19 +48,6 @@ function isGitAvailable() {
|
|
|
49
48
|
return false;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
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
|
-
}
|
|
65
51
|
async function getGitHubUsername(directory) {
|
|
66
52
|
const result = await (0, child_process_utils_1.execAndWait)('gh api user --jq .login', directory);
|
|
67
53
|
const username = result.stdout.trim();
|
|
@@ -235,24 +221,12 @@ async function pushToGitHub(directory, options) {
|
|
|
235
221
|
return VcsPushStatus.PushedToVcs;
|
|
236
222
|
}
|
|
237
223
|
catch (e) {
|
|
238
|
-
const isVerbose = options.verbose || process.env.NX_VERBOSE_LOGGING === 'true';
|
|
239
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
240
224
|
// Error code 127 means gh wasn't installed
|
|
241
225
|
// GitHubPushSkippedError means user hasn't opted in or we couldn't authenticate
|
|
242
226
|
const title = e instanceof GitHubPushSkippedError || e?.code === 127
|
|
243
227
|
? 'Push your workspace to GitHub.'
|
|
244
|
-
: 'Could not push.
|
|
245
|
-
|
|
246
|
-
output_1.output.log({
|
|
247
|
-
title,
|
|
248
|
-
bodyLines: isVerbose
|
|
249
|
-
? [
|
|
250
|
-
`Go to ${createRepoUrl} and push this workspace.`,
|
|
251
|
-
'Error details:',
|
|
252
|
-
errorMessage,
|
|
253
|
-
]
|
|
254
|
-
: [`Go to ${createRepoUrl} and push this workspace.`],
|
|
255
|
-
});
|
|
228
|
+
: 'Could not push.';
|
|
229
|
+
output_1.output.log({ title });
|
|
256
230
|
return VcsPushStatus.FailedToPushToVcs;
|
|
257
231
|
}
|
|
258
232
|
}
|
|
@@ -59,7 +59,6 @@ export interface RecordStatMetaPrecreate {
|
|
|
59
59
|
preset: string;
|
|
60
60
|
nodeVersion: string;
|
|
61
61
|
packageManager: string;
|
|
62
|
-
ghAvailable?: string;
|
|
63
62
|
}
|
|
64
63
|
export type RecordStatMeta = RecordStatMetaStart | RecordStatMetaComplete | RecordStatMetaError | RecordStatMetaCancel | RecordStatMetaPrecreate;
|
|
65
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":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AAU,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;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;CACxB;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"}
|
|
@@ -18,16 +18,8 @@ function readCachedFlowVariant() {
|
|
|
18
18
|
if (!(0, node_fs_1.existsSync)(FLOW_VARIANT_CACHE_FILE))
|
|
19
19
|
return null;
|
|
20
20
|
const stats = (0, node_fs_1.statSync)(FLOW_VARIANT_CACHE_FILE);
|
|
21
|
-
if (Date.now() - stats.mtimeMs > FLOW_VARIANT_EXPIRY_MS)
|
|
22
|
-
// Delete expired file so a new variant can be written
|
|
23
|
-
try {
|
|
24
|
-
(0, node_fs_1.unlinkSync)(FLOW_VARIANT_CACHE_FILE);
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
// Ignore delete errors
|
|
28
|
-
}
|
|
21
|
+
if (Date.now() - stats.mtimeMs > FLOW_VARIANT_EXPIRY_MS)
|
|
29
22
|
return null;
|
|
30
|
-
}
|
|
31
23
|
const value = (0, node_fs_1.readFileSync)(FLOW_VARIANT_CACHE_FILE, 'utf-8').trim();
|
|
32
24
|
return value === '0' || value === '1' ? value : null;
|
|
33
25
|
}
|
|
@@ -15,7 +15,7 @@ declare const completionMessages: {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
export type CompletionMessageKey = keyof typeof completionMessages;
|
|
18
|
-
export declare function getCompletionMessage(completionMessageKey: CompletionMessageKey | undefined, url: string | null, pushedToVcs: VcsPushStatus): {
|
|
18
|
+
export declare function getCompletionMessage(completionMessageKey: CompletionMessageKey | undefined, url: string | null, pushedToVcs: VcsPushStatus, workspaceName?: string): {
|
|
19
19
|
title: string;
|
|
20
20
|
bodyLines: string[];
|
|
21
21
|
};
|
|
@@ -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;AAuB3C;;;GAGG;AACH,QAAA,MAAM,kBAAkB;;;;;;;;;;CAUd,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,CAOxC;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,19 @@ 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) {
|
|
6
|
+
function getSetupMessage(url, pushedToVcs, workspaceName) {
|
|
7
7
|
if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
|
|
8
8
|
return url
|
|
9
9
|
? `Go to Nx Cloud and finish the setup: ${url}`
|
|
10
10
|
: 'Return to Nx Cloud and finish the setup.';
|
|
11
11
|
}
|
|
12
|
-
// User
|
|
12
|
+
// User needs to push first
|
|
13
|
+
const githubUrl = workspaceName
|
|
14
|
+
? `https://github.com/new?name=${encodeURIComponent(workspaceName)}`
|
|
15
|
+
: 'https://github.com/new';
|
|
13
16
|
const action = url ? 'go' : 'return';
|
|
14
17
|
const urlSuffix = url ? `: ${url}` : '.';
|
|
15
|
-
return `Push your repo (
|
|
18
|
+
return `Push your repo (${githubUrl}), then ${action} to Nx Cloud and finish the setup${urlSuffix}`;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
21
|
* Completion messages shown after workspace creation.
|
|
@@ -29,11 +32,11 @@ const completionMessages = {
|
|
|
29
32
|
title: 'Your platform setup is almost complete.',
|
|
30
33
|
},
|
|
31
34
|
};
|
|
32
|
-
function getCompletionMessage(completionMessageKey, url, pushedToVcs) {
|
|
35
|
+
function getCompletionMessage(completionMessageKey, url, pushedToVcs, workspaceName) {
|
|
33
36
|
const key = completionMessageKey ?? 'ci-setup';
|
|
34
37
|
return {
|
|
35
38
|
title: completionMessages[key].title,
|
|
36
|
-
bodyLines: [getSetupMessage(url, pushedToVcs)],
|
|
39
|
+
bodyLines: [getSetupMessage(url, pushedToVcs, workspaceName)],
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
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
|
|
7
|
-
export declare function getNxCloudInfo(connectCloudUrl: string, pushedToVcs: VcsPushStatus, completionMessageKey?: CompletionMessageKey): Promise<string>;
|
|
6
|
+
export declare function createNxCloudOnboardingUrl(nxCloud: NxCloud, token: string, directory: string, useGitHub?: boolean): Promise<string>;
|
|
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,EACb,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,13 +54,13 @@ 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 =
|
|
57
|
+
const meta = ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloudV2');
|
|
58
58
|
return createNxCloudOnboardingURL(source, token, meta, false, useGitHub ??
|
|
59
59
|
(nxCloud === 'yes' || nxCloud === 'github' || nxCloud === 'circleci'), directory);
|
|
60
60
|
}
|
|
61
|
-
async function getNxCloudInfo(connectCloudUrl, pushedToVcs, completionMessageKey) {
|
|
61
|
+
async function getNxCloudInfo(connectCloudUrl, pushedToVcs, completionMessageKey, workspaceName) {
|
|
62
62
|
const out = new output_1.CLIOutput(false);
|
|
63
|
-
const message = (0, messages_1.getCompletionMessage)(completionMessageKey, connectCloudUrl, pushedToVcs);
|
|
63
|
+
const message = (0, messages_1.getCompletionMessage)(completionMessageKey, connectCloudUrl, pushedToVcs, workspaceName);
|
|
64
64
|
out.success(message);
|
|
65
65
|
return out.getOutput();
|
|
66
66
|
}
|