Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (semver) ranges. Specifically, the "Range" resource with the "Max Satisfying" operation finds the highest version from a list of versions that satisfies a given semver range expression.

This is useful in scenarios such as:

  • Selecting the latest compatible software version from a set of available releases.
  • Automating dependency resolution where you want to pick the maximum version that fits within specified constraints.
  • Managing package versions in CI/CD pipelines or deployment scripts.

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

Properties

Name Meaning
Range The semantic version range string to match against (e.g., ^1.2.0).
Versions Comma-separated list of version strings to evaluate (e.g., 1.2.3,1.2.4,1.3.0).
Options Collection of optional flags:
- Loose: Whether to use loose parsing for version strings (boolean).
- Include Prerelease: Whether to include prerelease versions when matching (boolean).
- RTL (Right to Left): Not applicable for this operation (shown only for coercion resource).

Output

The output JSON contains the following structure:

{
  "operation": "maxSatisfying",
  "versions": ["1.2.3", "1.2.4", "1.3.0"],
  "range": "^1.2.0",
  "result": "1.3.0"
}
  • operation: The performed operation name.
  • versions: The array of input versions after splitting and trimming.
  • range: The input version range string.
  • result: The highest version string from the list that satisfies the range, or null if none match.

The node does not output binary data.

Dependencies

  • This node depends on the external semver library for all semantic version parsing and comparison logic.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials are needed.

Troubleshooting

  • Empty or invalid versions list: If the versions input is empty or malformed, the result may be null. Ensure versions are comma-separated and valid semver strings.
  • Invalid range string: An invalid range string can cause errors or no matches. Validate the range format before running.
  • Loose parsing option: Enabling loose parsing can allow non-strict semver strings but might produce unexpected results.
  • Include Prerelease: By default, prerelease versions are excluded. Enable this option if you want to consider prerelease versions in the matching.
  • Error messages: Errors typically indicate invalid inputs or unknown resources/operations. Check the property values carefully.

Links and References

Discussion