Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (SemVer) strings. It supports parsing, extracting components, and analyzing version numbers according to SemVer rules. The "Parsing" resource with the "Major" operation specifically extracts the major version number from a given version string.

Common scenarios where this node is useful include:

  • Automating version checks in CI/CD pipelines.
  • Extracting version components for conditional logic or reporting.
  • Validating and processing version strings in software release workflows.

For example, given a version string "2.5.1-beta", the node can extract the major version number 2, which might be used to determine compatibility or trigger specific deployment steps.

Properties

Name Meaning
Version The semantic version string to process, e.g., "1.2.3".
Options Collection of optional flags:
• Loose: Use loose parsing for version strings (boolean).
• Include Prerelease: Include prerelease versions in range matching (boolean).
• RTL (Right to Left): Only shown for coercion resource; irrelevant here.

Output

The output JSON contains the following structure:

{
  "result": {
    "operation": "major",
    "version": "<input version string>",
    "result": <major version number as integer or null>
  }
}
  • result: An object describing the operation performed.
  • operation: Always "major" for this operation.
  • version: The original input version string.
  • result: The extracted major version number as an integer. If the version string is invalid or cannot be parsed, this will be null.

No binary data is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid version strings: If the input version string is malformed or not compliant with SemVer, the result will be null. Ensure the version string follows semantic versioning format (e.g., "1.0.0", "2.1.3-beta").
  • Loose parsing option: Enabling the "Loose" option may allow parsing of non-standard version strings but could lead to unexpected results.
  • Empty input: Providing an empty version string will result in null output.
  • Error handling: If an error occurs during execution and "Continue On Fail" is disabled, the node will throw an error stopping the workflow.

Links and References

Discussion