Skip to content

Commit

Permalink
fix: correctly find the closest previous version
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Apr 25, 2023
1 parent 4ba9b57 commit 5bb2f90
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/commands/cli/artifacts/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export default class ArtifactsTest extends SfCommand<ArtifactsCompareResult> {

private resolveVersions(): void {
this.current = this.flags.current || this.packageJson.version;
this.previous = this.flags.previous ?? this.versions[this.versions.indexOf(this.current) + 1];
this.previous = this.flags.previous ?? this.versions.find((version) => semver.lt(version, this.current));
this.log('Current Version:', this.current);
this.log('Previous Version:', this.previous);
if (this.flags.current && !this.versions.includes(this.flags.current)) {
Expand Down Expand Up @@ -590,7 +590,6 @@ export default class ArtifactsTest extends SfCommand<ArtifactsCompareResult> {
this.warn(`No command-snapshot.json found for ${owner}/${repo}@${ref}`);
return [];
}

}

private async getTags(owner: string, repo: string): Promise<string[]> {
Expand Down

0 comments on commit 5bb2f90

Please sign in to comment.