Skip to content

feat(semver): add minVersion and coerce functions#7038

Open
sxzz wants to merge 5 commits intodenoland:mainfrom
sxzz:feat/semver-min-version-coerce
Open

feat(semver): add minVersion and coerce functions#7038
sxzz wants to merge 5 commits intodenoland:mainfrom
sxzz:feat/semver-min-version-coerce

Conversation

@sxzz
Copy link

@sxzz sxzz commented Mar 9, 2026

Summary

  • Add minVersion(range) which returns the lowest SemVer that satisfies a given range, ported from node-semver's minVersion
  • Add coerce(version, options?) which extracts a valid SemVer from a loosely-formatted string or number, ported from node-semver's coerce. Supports rtl and includePrerelease options

Test plan

  • deno test semver/min_version_test.ts — 26 test cases pass
  • deno test semver/coerce_test.ts — 20 test cases pass
  • deno check passes for both files

Add `minVersion(range)` which returns the lowest SemVer that satisfies a
given range, ported from node-semver's `minVersion`.

Add `coerce(version, options?)` which extracts a valid SemVer from a
loosely-formatted string or number, ported from node-semver's `coerce`.
Supports `rtl` and `includePrerelease` options.
@sxzz sxzz requested a review from kt3k as a code owner March 9, 2026 17:56
@CLAassistant
Copy link

CLAassistant commented Mar 9, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the semver label Mar 9, 2026
@sxzz sxzz force-pushed the feat/semver-min-version-coerce branch from d53090b to 2f1e752 Compare March 9, 2026 18:00
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 90.16393% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.87%. Comparing base (48bd522) to head (cb5f47e).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
semver/coerce.ts 87.09% 5 Missing and 3 partials ⚠️
semver/min_version.ts 93.10% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7038      +/-   ##
==========================================
- Coverage   93.88%   93.87%   -0.01%     
==========================================
  Files         627      629       +2     
  Lines       49995    50117     +122     
  Branches     8794     8833      +39     
==========================================
+ Hits        46936    47047     +111     
- Misses       2478     2484       +6     
- Partials      581      586       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sxzz sxzz requested a review from tomas-zijdemans March 10, 2026 14:26
@tomas-zijdemans
Copy link
Contributor

Looks good 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants