Skip to content

Commit 96f5585

Browse files
committed
fix(@angular/cli): correctly sort package versions in ascending order during ng add
When using the `ng add` command, the package version selection logic was not correctly sorting available versions in ascending order. This could lead to selecting an unintended version of the package. Closes: angular#28985
1 parent 7554cc1 commit 96f5585

File tree

1 file changed

+1
-1
lines changed
  • packages/angular/cli/src/commands/add

1 file changed

+1
-1
lines changed

packages/angular/cli/src/commands/add/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default class AddCommandModule
228228
);
229229

230230
// Sort in reverse SemVer order so that the newest compatible version is chosen
231-
versionManifests.sort((a, b) => compare(b.version, a.version, true));
231+
versionManifests.sort((a, b) => compare(a.version, b.version, true));
232232

233233
let found = false;
234234
for (const versionManifest of versionManifests) {

0 commit comments

Comments
 (0)