Semver icon

Semver

Semantic Versioning utilities for version management

Overview

The node provides utilities for working with semantic versioning (semver) ranges. Specifically, the "Range" resource with the "Min Satisfying" operation finds the lowest version from a list of versions that satisfies a given semver range expression. This is useful when you want to determine the minimum compatible version from a set of available versions according to a specified version range.

Common scenarios include:

  • Selecting the earliest compatible software version that meets dependency constraints.
  • Automating version resolution in deployment pipelines.
  • Validating and filtering version lists based on semver ranges.

For example, given a range ^1.2.0 and versions 1.2.3, 1.2.4, 1.3.0, the node will return 1.2.3 as the minimum satisfying version.

Properties

Name Meaning
Range The semantic version range string to test against (e.g., ^1.2.0).
Versions Comma-separated list of versions to evaluate (e.g., 1.2.3,1.2.4,1.3.0).
Options Additional options:
- Loose: Use loose parsing for version strings (boolean).
- Include Prerelease: Include prerelease versions in matching (boolean).

Output

The output JSON contains the following structure:

{
  "operation": "minSatisfying",
  "versions": ["1.2.3", "1.2.4", "1.3.0"],
  "range": "^1.2.0",
  "result": "1.2.3"
}
  • operation: The performed operation name ("minSatisfying").
  • versions: The array of input versions parsed from the comma-separated string.
  • range: The input version range string.
  • result: The lowest version from the list that satisfies the range, or null if none match.

The node does not output binary data.

Dependencies

  • Uses the external semver library for all semantic version parsing and comparison logic.
  • No external API calls or credentials are required.
  • No special environment variables or n8n configurations needed beyond standard node setup.

Troubleshooting

  • Empty or invalid versions list: If the versions string is empty or improperly formatted, the result may be null. Ensure versions are comma-separated and valid semver strings.
  • Invalid range string: An invalid range expression will cause the underlying semver library to fail or return no matches. Validate the range syntax before use.
  • Loose parsing option: Enabling loose parsing can help handle non-strict semver strings but may produce unexpected results if versions are malformed.
  • Include prerelease option: By default, prerelease versions are excluded. Enable this option if you want to consider prerelease versions in the matching process.

Common error messages relate to invalid version or range inputs and can be resolved by correcting the input strings.

Links and References

Discussion