Skip to content

Commit ec58764

Browse files
authored
fix(amazonq): bundle flare version comparison using numbers (#7479)
## Problem String comparison says "1.11.0" < "1.9.0". We should compare numbers. ## Solution --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 4d44255 commit ec58764

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/lspArtifact.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fs from 'fs'
33
import * as crypto from 'crypto'
44
import * as path from 'path'
55
import * as os from 'os'
6+
import * as semver from 'semver'
67
import AdmZip from 'adm-zip'
78

89
interface ManifestContent {
@@ -27,6 +28,7 @@ interface ManifestVersion {
2728
interface Manifest {
2829
versions: ManifestVersion[]
2930
}
31+
3032
async function verifyFileHash(filePath: string, expectedHash: string): Promise<boolean> {
3133
return new Promise((resolve, reject) => {
3234
const hash = crypto.createHash('sha384')
@@ -86,7 +88,7 @@ export async function downloadLanguageServer(): Promise<void> {
8688

8789
const latestVersion = manifest.versions
8890
.filter((v) => !v.isDelisted)
89-
.sort((a, b) => b.serverVersion.localeCompare(a.serverVersion))[0]
91+
.sort((a, b) => semver.compare(b.serverVersion, a.serverVersion))[0]
9092

9193
if (!latestVersion) {
9294
throw new Error('No valid version found in manifest')

0 commit comments

Comments
 (0)