-
Notifications
You must be signed in to change notification settings - Fork 12
fix: use SemVer for pkgx version comparison #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -518,8 +518,8 @@ function get_pkgx() { | |
| if (existsSync(pkgx)) { | ||
| const out = new Deno.Command(pkgx, { args: ["--version"] }).outputSync(); | ||
| const stdout = new TextDecoder().decode(out.stdout); | ||
| const match = stdout.match(/^pkgx (\d+.\d+)/); | ||
| if (!match || parseFloat(match[1]) < 2.4) { | ||
| const match = stdout.match(/^pkgx (\d+\.\d+\.\d+)/); | ||
| if (!match || new SemVer(match[1]).lt(new SemVer("2.4.0"))) { | ||
| Deno.exit(1); | ||
|
Comment on lines
+522
to
523
|
||
| } | ||
| return pkgx; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex only captures the numeric
major.minor.patchportion, which drops valid SemVer prerelease/build metadata frompkgx --version(eg2.8.0-beta.1,2.8.0+abc123). That can misclassify prereleases (eg2.4.0-beta.1) as2.4.0and incorrectly pass the minimum-version gate. Consider capturing the full version token and comparing that full SemVer value instead of truncating it.