Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (semver) ranges, specifically focusing on the "Greater Than Range" operation within the "Range" resource. It checks whether a given version is greater than a specified version range according to semver rules.

Common scenarios where this node is useful include:

  • Validating if a software version exceeds a certain compatibility or support range.
  • Automating deployment pipelines by checking if a version qualifies as newer than a defined range.
  • Filtering versions in package management or release workflows.

For example, you can input a version like 1.3.0 and a range like ^1.2.0, and the node will determine if 1.3.0 is greater than all versions allowed by the range ^1.2.0.

Properties

Name Meaning
Version The specific version string to check against the range (e.g., 1.3.0).
Range The version range string defining the boundary (e.g., ^1.2.0).
Options Additional options to customize parsing behavior:
- Loose: Whether to use loose parsing for version strings (true/false).
- Include Prerelease: Whether to include prerelease versions in range matching (true/false).

Output

The node outputs a JSON object containing the following fields:

  • operation: The operation performed, here "gtr" indicating "greater than range".
  • version: The input version string.
  • range: The input version range string.
  • result: A boolean value indicating whether the version is greater than the range (true or false).

Example output JSON snippet:

{
  "operation": "gtr",
  "version": "1.3.0",
  "range": "^1.2.0",
  "result": true
}

No binary data output is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid version or range strings: If the version or range inputs are malformed or invalid semver strings, the node may throw errors or return unexpected results. Ensure inputs conform to semver format.
  • Loose parsing option: If your version strings do not strictly follow semver, enabling the "Loose" option may help parse them correctly.
  • Prerelease handling: By default, prerelease versions are excluded from range matching unless "Include Prerelease" is enabled.
  • Error messages: Errors typically indicate invalid input formats or unknown resources/operations. Verify that the Resource is set to "Range" and Operation to "Greater Than Range".

Links and References

Discussion