Skip to content

Commit

Permalink
fix(core): fix handling of legacy angular versions in nx init (#16000)
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez committed Mar 31, 2023
1 parent 64b44d3 commit 6eca9b6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/nx/src/nx-init/angular/legacy-angular-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getLegacyMigrationFunctionIfApplicable(
const angularVersion =
readModulePackageJson('@angular/core').packageJson.version;
const majorAngularVersion = major(angularVersion);
if (majorAngularVersion > minMajorAngularVersionSupported) {
if (majorAngularVersion >= minMajorAngularVersionSupported) {
// non-legacy
return null;
}
Expand All @@ -51,9 +51,14 @@ export async function getLegacyMigrationFunctionIfApplicable(
legacyMigrationCommand = `ng g ${pkgName}:ng-add --preserve-angular-cli-layout`;
} else {
// use the latest Nx version that supported the Angular version
legacyMigrationCommand = `nx@${
pkgName = '@nrwl/angular';
pkgVersion = await resolvePackageVersion(
'nx',
nxAngularLegacyVersionMap[majorAngularVersion]
} init ${process.argv.slice(2).join(' ')}`;
);
legacyMigrationCommand = `nx@${pkgVersion} init ${process.argv
.slice(2)
.join(' ')}`;
}

return async () => {
Expand Down

1 comment on commit 6eca9b6

@vercel
Copy link

@vercel vercel bot commented on 6eca9b6 Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.