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 "Satisfies" operation checks if a given version string satisfies a specified semver range expression. This is useful in scenarios such as validating software versions against compatibility requirements, ensuring dependencies meet minimum or maximum version constraints, or gating features based on version ranges.

For example, you can use this node to verify if version 1.2.3 falls within the range ^1.2.0, which means any version compatible with 1.2.x but less than 2.0.0.

Properties

Name Meaning
Version The specific version string to check against the range, e.g., 1.2.3.
Range The semver range string defining acceptable versions, e.g., ^1.2.0.
Options Additional options to control parsing and matching behavior:
- Loose: Whether to allow loose parsing of version strings (boolean).
- Include Prerelease: Whether prerelease versions should be included in matching (boolean).
- RTL (Right to Left): Not applicable for this operation (used only in coercion resource).

Output

The output JSON contains the following structure:

{
  "operation": "satisfies",
  "version": "1.2.3",
  "range": "^1.2.0",
  "result": true
}
  • operation: The performed operation name ("satisfies").
  • version: The input version string.
  • range: The input range string.
  • result: A boolean indicating whether the version satisfies the range (true or 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

  • Common issues:

    • Invalid version or range strings may cause errors or unexpected results. Ensure inputs conform to semver specifications.
    • Using prerelease versions without enabling the "Include Prerelease" option might lead to false negatives.
    • Loose parsing can accept non-standard version formats but may produce inconsistent results; enable it only if necessary.
  • Error messages:

    • Errors related to invalid version or range strings typically indicate malformed input. Validate your version and range strings before using them.
    • If an unknown resource or operation error occurs, verify that the node's Resource is set to "Range" and Operation to "Satisfies".

Links and References

Discussion