Skip to content

Commit 6eca9b6

Browse files
authoredMar 31, 2023
fix(core): fix handling of legacy angular versions in nx init (#16000)
1 parent 64b44d3 commit 6eca9b6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎packages/nx/src/nx-init/angular/legacy-angular-versions.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function getLegacyMigrationFunctionIfApplicable(
2828
const angularVersion =
2929
readModulePackageJson('@angular/core').packageJson.version;
3030
const majorAngularVersion = major(angularVersion);
31-
if (majorAngularVersion > minMajorAngularVersionSupported) {
31+
if (majorAngularVersion >= minMajorAngularVersionSupported) {
3232
// non-legacy
3333
return null;
3434
}
@@ -51,9 +51,14 @@ export async function getLegacyMigrationFunctionIfApplicable(
5151
legacyMigrationCommand = `ng g ${pkgName}:ng-add --preserve-angular-cli-layout`;
5252
} else {
5353
// use the latest Nx version that supported the Angular version
54-
legacyMigrationCommand = `nx@${
54+
pkgName = '@nrwl/angular';
55+
pkgVersion = await resolvePackageVersion(
56+
'nx',
5557
nxAngularLegacyVersionMap[majorAngularVersion]
56-
} init ${process.argv.slice(2).join(' ')}`;
58+
);
59+
legacyMigrationCommand = `nx@${pkgVersion} init ${process.argv
60+
.slice(2)
61+
.join(' ')}`;
5762
}
5863

5964
return async () => {

1 commit comments

Comments
 (1)

vercel[bot] commented on Mar 31, 2023

@vercel[bot]

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app

Please sign in to comment.