Skip to content

Commit

Permalink
fix invalid versionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
chemzqm committed Oct 20, 2022
1 parent 5d81320 commit d79f22c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/extension/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function readDependencies(directory: string): { [key: string]: string } {
}

export function getVersion(requirement: string, versions: string[], latest?: string): string | undefined {
if (latest && validVersionInfo(versions[latest]) && semver.satisfies(latest, requirement)) return latest
if (latest && semver.satisfies(latest, requirement)) return latest
let sorted = semver.rsort(versions.filter(v => semver.valid(v, { includePrerelease: false })))
for (let v of sorted) {
if (semver.satisfies(v, requirement)) return v
Expand Down Expand Up @@ -285,7 +285,6 @@ export class DependenciesInstaller {
let version = getVersion(requirement, Object.keys(info.versions), info.latest)
if (version) {
let versionInfo = info.versions[version]
versionInfo.version = version
if (validVersionInfo(versionInfo)) return versionInfo
}
}
Expand Down

0 comments on commit d79f22c

Please sign in to comment.