Skip to content

Commit bf6963b

Browse files
leosvelperezFrozenPandaz
authored andcommitted
feat(misc): improve nx cloud setup prompts and messaging (#23218)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit d1c4073)
1 parent 1356ecd commit bf6963b

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

packages/create-nx-workspace/src/utils/nx/ab-testing.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const messageOptions = {
1515
{ value: 'skip', name: 'Skip for now' },
1616
],
1717
footer:
18-
'\nRead more about remote cache at https://nx.dev/ci/features/remote-cache',
18+
'\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud',
1919
hint: `\n(it's free and can be disabled any time)`,
2020
fallback: undefined,
2121
},
@@ -29,7 +29,7 @@ const messageOptions = {
2929
{ value: 'skip', name: 'Skip for now' },
3030
],
3131
footer:
32-
'\nRead more about CI benefits with Nx at https://nx.dev/ci/intro/ci-with-nx',
32+
'\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud',
3333
hint: `\n(it's free and can be disabled any time)`,
3434
fallback: { value: 'skip', key: 'setupNxCloud' },
3535
},
@@ -97,7 +97,7 @@ export async function recordStat(opts: {
9797
if (process.env.NX_VERBOSE_LOGGING === 'true') {
9898
console.log(`Record stat. Major: ${major}`);
9999
}
100-
if (major < 10 || major > 16) return; // test version, skip it
100+
if (major < 10 || major > 19) return; // test version, skip it
101101
const axios = require('axios');
102102
await (axios['default'] ?? axios)
103103
.create({

packages/nx/src/command-line/migrate/migrate.ts

+26-17
Original file line numberDiff line numberDiff line change
@@ -1215,23 +1215,6 @@ async function generateMigrationsJsonAndUpdatePackageJson(
12151215
originalNxJson.installation?.version ??
12161216
readNxVersion(originalPackageJson);
12171217

1218-
try {
1219-
if (
1220-
['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
1221-
(await isMigratingToNewMajor(from, opts.targetVersion)) &&
1222-
!isCI() &&
1223-
!isNxCloudUsed(originalNxJson)
1224-
) {
1225-
await connectToNxCloudWithPrompt('migrate');
1226-
originalPackageJson = readJsonFile<PackageJson>(
1227-
join(root, 'package.json')
1228-
);
1229-
}
1230-
} catch {
1231-
// The above code is to remind folks when updating to a new major and not currently using Nx cloud.
1232-
// If for some reason it fails, it shouldn't affect the overall migration process
1233-
}
1234-
12351218
logger.info(`Fetching meta data about packages.`);
12361219
logger.info(`It may take a few minutes.`);
12371220

@@ -1269,6 +1252,32 @@ async function generateMigrationsJsonAndUpdatePackageJson(
12691252
],
12701253
});
12711254

1255+
try {
1256+
if (
1257+
['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
1258+
(await isMigratingToNewMajor(from, opts.targetVersion)) &&
1259+
!isCI() &&
1260+
!isNxCloudUsed(originalNxJson)
1261+
) {
1262+
output.success({
1263+
title: 'Connect to Nx Cloud',
1264+
bodyLines: [
1265+
'Nx Cloud is a first-party CI companion for Nx projects. It improves critical aspects of CI:',
1266+
'- Speed: 30% - 70% faster CI',
1267+
'- Cost: 40% - 75% reduction in CI costs',
1268+
'- Reliability: by automatically identifying flaky tasks and re-running them',
1269+
],
1270+
});
1271+
await connectToNxCloudWithPrompt('migrate');
1272+
originalPackageJson = readJsonFile<PackageJson>(
1273+
join(root, 'package.json')
1274+
);
1275+
}
1276+
} catch {
1277+
// The above code is to remind folks when updating to a new major and not currently using Nx cloud.
1278+
// If for some reason it fails, it shouldn't affect the overall migration process
1279+
}
1280+
12721281
output.log({
12731282
title: 'Next steps:',
12741283
bodyLines: [

packages/nx/src/utils/ab-testing.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const messageOptions = {
1313
{ value: 'skip', name: 'Skip for now' },
1414
],
1515
footer:
16-
'\nRead more about remote cache at https://nx.dev/ci/features/remote-cache',
16+
'\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud',
1717
hint: `\n(it's free and can be disabled any time)`,
1818
},
1919
],
@@ -79,7 +79,7 @@ export async function recordStat(opts: {
7979
if (process.env.NX_VERBOSE_LOGGING === 'true') {
8080
console.log(`Record stat. Major: ${major}`);
8181
}
82-
if (major < 10 || major > 16) return; // test version, skip it
82+
if (major < 10 || major > 19) return; // test version, skip it
8383
const axios = require('axios');
8484
await (axios['default'] ?? axios)
8585
.create({

0 commit comments

Comments
 (0)