depngn icon indicating copy to clipboard operation
depngn copied to clipboard

[chore]: upgrade `compare-versions` to `6.0.0`

Open kindoflew opened this issue 2 years ago • 0 comments

This PR upgrades compare-versions to 6.0.0 because this version supports parsing "malformed" version ranges.

It still has the same limitations our solution did -- it will still return "invalid" for ranges like 1. 0 . 0 because the RegEx for matching unintentional spaces between numbers (and ignoring intentional spaces) is super complex. i don't think even npm's semver package fully supports this -- i believe they just have a bunch of logic to figure out a "best guess".

CHANGES

  • bump compare-versions to 6.0.0
  • removed our logic to strip white space between comparator operators
  • added a unit test for malformed ranges

TESTING

You can update the new test at the bottom of get-package-data.spec.ts for different variations of unintentional white space. it should support:

  • space in the middle of comparator operator characters (> =)
  • space between the operators and numbers (>= 10)
  • extra space between || operator and numbers (8 || 9)

kindoflew avatar Jul 28 '23 14:07 kindoflew