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 "Intersects" operation checks whether two given semver ranges overlap or intersect. This is useful in scenarios where you want to determine if two sets of version constraints have any versions in common.

Practical examples include:

  • Validating compatibility between software dependencies by checking if their version ranges intersect.
  • Ensuring that a package update range does not conflict with another component's required version range.
  • Automating dependency resolution workflows where overlapping version ranges indicate potential compatibility.

Properties

Name Meaning
Range 1 The first semantic version range string to compare, e.g., ^1.2.0.
Range 2 The second semantic version range string to compare, e.g., ^1.3.0.
Options Additional options affecting parsing and comparison:
- Loose: Whether to use loose parsing for version strings (boolean).
- Include Prerelease: Whether to include prerelease versions in range 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": "intersects",
  "range1": "<first range string>",
  "range2": "<second range string>",
  "result": <boolean>
}
  • result: A boolean indicating whether the two version ranges intersect (true) or not (false).

No binary data output is produced by this node.

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

  • Invalid Range Strings: If either Range 1 or Range 2 is not a valid semver range string, the node may throw an error or return unexpected results. Ensure input ranges conform to semver syntax.
  • Loose Parsing Option: If your version strings do not strictly follow semver, enabling the "Loose" option can help parse them correctly.
  • Include Prerelease: If you expect prerelease versions to affect intersection results, enable the "Include Prerelease" option; otherwise, they will be ignored.
  • Error Messages: Common errors relate to invalid input formats. Verify inputs and consult semver documentation for correct range syntax.

Links and References

Discussion