Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (semver) strings. Specifically, the Validation - Clean operation cleans and normalizes a given version string according to semver rules. This is useful when you receive version inputs that may contain extraneous characters or formatting inconsistencies and want to standardize them into a proper semver format.

Common scenarios include:

  • Normalizing user input versions before storing or comparing.
  • Cleaning version strings extracted from external sources or logs.
  • Preparing version data for further processing like comparison or range checks.

For example, if you input a version string like " v1.2.3-beta+exp.sha.5114f85 ", the clean operation will return a normalized version string such as "1.2.3-beta+exp.sha.5114f85".

Properties

Name Meaning
Version The version string to process and clean.
Options Collection of options to customize cleaning 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) Whether to coerce version strings right to left (boolean). Only relevant for coercion resource, not used here.

Output

The output JSON contains the following fields:

  • operation: Always "clean" for this operation.
  • version: The original input version string.
  • result: The cleaned and normalized version string according to semver rules. If the input cannot be cleaned into a valid semver, this may be null.

Example output JSON:

{
  "operation": "clean",
  "version": "  v1.2.3-beta+exp.sha.5114f85 ",
  "result": "1.2.3-beta+exp.sha.5114f85"
}

No binary data is produced by this node.

Dependencies

  • Uses the external semver library for all version parsing and cleaning logic.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials needed.

Troubleshooting

  • Invalid version strings: If the input version string is malformed beyond recognition, the cleaned result may be null. Ensure the input resembles a semver format.
  • Loose option: Enabling the "Loose" option allows more permissive parsing but may produce unexpected results if the input is very irregular.
  • Error handling: If an error occurs during processing, it will be returned in the output under an error field if "Continue On Fail" is enabled; otherwise, the node execution will stop with an error.

Links and References

Discussion