Skip to content

Fix for npm versions like 1.2.x

Fabien Catteau requested to merge v3-fix-npm-version-dot-x into v3

What does this MR do?

Fix parsing and comparison of npm "versions" ending with .x.

  • Versions ending with .x now match any version, including prereleases. Prior to this change, the addition attribute was compared.
  • The parser now raises an error if .x isn't at the very end of the version string.

compare_tokens now takes the two arrays of tokens being compared. This makes it possible to trim an array before comparing it.

For consistency compare_addition has been renamed to compared_additions (plural) and now takes the two additions being compared.

This addresses incorrect results surfaced in !66 (comment 1861998472).

package:
  type: npm
  name: hapi
range: 2.0.x || 2.1.x
versions:
  not_in:
  - 2.0.0-preview
  not_out: []
  err: []

What are the relevant issue numbers?

gitlab-org/gitlab#386070 (comment 1821312900)

Does this MR meet the acceptance criteria?

Edited by Fabien Catteau

Merge request reports