Semver icon

Semver

Semantic Versioning utilities for version management

Range → Min Version

AI-generated

Overview

This node provides utilities for working with semantic versioning (semver) ranges. Specifically, the "Range" resource with the "Min Version" operation returns the minimum version that satisfies a given semver range expression. This is useful when you want to determine the lowest version number that meets certain version constraints.

Common scenarios include:

  • Determining the minimum supported version of a software package based on a version range.
  • Automating dependency checks where you need to know the earliest compatible version.
  • Validating or filtering versions in CI/CD pipelines or deployment scripts.

For example, given a range ^1.2.0, the node can output 1.2.0 as the minimum version satisfying this range.

Properties

Name Meaning
Range The semantic version range string to evaluate, e.g., ^1.2.0.
Options Additional options to control parsing behavior:
- 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 (only for coercion resource).

Output

The node outputs a JSON object containing the following fields inside the result property:

  • operation: The string "minVersion" indicating the performed operation.
  • range: The input version range string.
  • result: The minimum version string that satisfies the given range, or null if no such version exists.

Example output JSON snippet:

{
  "result": {
    "operation": "minVersion",
    "range": "^1.2.0",
    "result": "1.2.0"
  }
}

No binary data is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid Range String: If the provided range string is invalid or malformed, the node may return null or throw an error. Ensure the range follows semver syntax.
  • Empty Result: If no version satisfies the range, the result will be null. Verify the range and consider including prerelease versions if relevant.
  • Loose Parsing: Enabling the "Loose" option allows more permissive parsing but may lead to unexpected results if version strings are not strictly semver compliant.
  • Include Prerelease: If you expect prerelease versions to be considered, enable the "Include Prerelease" option; otherwise, they will be ignored.

If errors occur, check the error message for details and verify input parameters.

Links and References

Discussion