Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (SemVer) strings, specifically focusing on parsing version components in the "Parsing" resource with the "Patch" operation. It extracts the patch number from a given version string.

Common scenarios where this node is useful include:

  • Automating software release pipelines where you need to extract and manipulate specific parts of version numbers.
  • Validating or reporting the patch version component in CI/CD workflows.
  • Integrating with systems that require patch-level version information separately.

For example, given a version string "1.2.3", this node will output the patch number 3.

Properties

Name Meaning
Version The semantic version string to process, e.g., "1.2.3".
Options Collection of optional flags:
- 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 Parsing-Patch operation (only for coercion).

Output

The node outputs a JSON object containing:

  • operation: The operation performed, here always "patch".
  • version: The input version string.
  • result: The extracted patch version number as an integer, or null if the version string is invalid or cannot be parsed.

Example output JSON snippet:

{
  "operation": "patch",
  "version": "1.2.3",
  "result": 3
}

No binary data output is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid version string: If the input version string is malformed or not a valid semantic version, the result will be null. Ensure the version string follows SemVer format (e.g., "1.2.3").
  • Loose parsing option: Enabling the "Loose" option may allow parsing of non-standard version strings but can lead to unexpected results. Use it only if necessary.
  • Empty or missing version: Providing an empty string or no version will cause the node to return null for the patch number.
  • Error handling: If an error occurs during execution and "Continue On Fail" is disabled, the workflow will stop. Enable "Continue On Fail" to handle errors gracefully.

Links and References

Discussion