Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides semantic versioning (semver) comparison utilities, allowing users to compare two version strings using various comparison operations. The "Not Equal" operation specifically checks whether two given versions are different according to semver rules.

Common scenarios where this node is useful include:

  • Validating that a software dependency version has changed.
  • Triggering workflows only when a version update occurs.
  • Comparing release versions in CI/CD pipelines to decide deployment steps.

For example, you can input two version strings like "1.2.3" and "1.2.4" and the node will return true if they are not equal, or false otherwise.

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 options for comparison:
- Loose: Whether to use loose parsing of version strings (boolean).
- Include Prerelease: Whether to consider prerelease versions in comparisons (boolean).
- RTL (Right to Left): Only shown for coercion resource; irrelevant here.

Output

The output JSON contains the following structure:

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

No binary data 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 produce unexpected results. Ensure inputs conform to semantic versioning format.
  • Loose option usage: Enabling the "Loose" option allows more permissive parsing but may lead to surprising comparison outcomes if versions are not strictly semver compliant.
  • Prerelease handling: By default, prerelease versions might be excluded from some comparisons unless "Include Prerelease" is enabled.
  • Error messages: Errors typically indicate invalid input versions or unknown resources/operations. Verify that the Resource is set to "Comparison" and Operation to "Not Equal".

Links and References

Discussion