Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for semantic versioning (semver) management, focusing on comparing two version strings in the "Comparison" resource. Specifically, the "Equal" operation checks if two given versions are exactly equal according to semver rules.

Common scenarios where this node is beneficial include:

  • Validating that two software components or dependencies are at the same version.
  • Automating deployment pipelines by verifying version matches before proceeding.
  • Ensuring consistency between version tags in different systems.

For example, you can input version "1.2.3" as Version 1 and "1.2.4" as Version 2, and the node will return false because they are not equal. If both inputs are "1.2.3", it returns true.

Properties

Name Meaning
Version 1 The first version string to compare (e.g., "1.2.3").
Version 2 The second version string to compare (e.g., "1.2.4").
Options Additional comparison options:
- Loose: Use loose parsing of version strings (boolean).
- Include Prerelease: Include prerelease versions in matching (boolean).
- RTL (Right to Left): Coerce version strings right to left (boolean, only relevant for coercion resource).

Output

The output JSON contains the following structure:

{
  "operation": "eq",
  "version1": "1.2.3",
  "version2": "1.2.4",
  "result": false
}
  • operation: The performed operation, here always "eq" for equality check.
  • version1: The first input version string.
  • version2: The second input version string.
  • result: A boolean indicating whether the two versions are equal (true) or not (false).

No binary data output is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid version strings: If either version string is malformed or not a valid semver, the comparison may fail or return unexpected results. Ensure input versions conform to semantic versioning format.
  • Loose parsing option: Enabling "Loose" parsing allows non-strict version formats but may lead to less predictable comparisons.
  • Error messages: Errors typically indicate invalid input or unknown resource/operation. Verify that the Resource is set to "Comparison" and Operation to "Equal".
  • Continue on Fail: If enabled, errors per item will be returned in the output JSON under an error field instead of stopping execution.

Links and References

Discussion