Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides utilities for working with semantic versioning (semver) strings. It supports parsing, validating, comparing, incrementing, cleaning, coercing, sorting, and range operations on version strings following the semver specification.

The "Parsing" resource with the "Prerelease" operation specifically extracts prerelease components from a given version string. This is useful when you want to identify or manipulate prerelease tags such as "alpha", "beta", or "rc" in versions like 1.2.3-alpha.1.

Common scenarios:

  • Extracting prerelease identifiers from version strings to determine release stages.
  • Filtering or branching logic based on prerelease metadata.
  • Automating deployment pipelines that treat prerelease versions differently.

Example:
Input version: 1.4.0-beta.2
Output prerelease components: ["beta", 2]

Properties

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

Output

The output JSON contains the original input data merged with a result field holding the prerelease components extracted from the version string.

Structure example:

{
  "version": "1.4.0-beta.2",
  "result": ["beta", 2]
}

If the version has no prerelease components, the result will be null or an empty array depending on the underlying library behavior.

No binary data output is produced by this node.

Dependencies

  • Uses the external semver npm package for all semantic versioning operations.
  • No external API keys or services are required.
  • No special environment variables or n8n credentials needed.

Troubleshooting

  • Invalid version string: If the input version is not a valid semver string, the result may be null or an error might be thrown. Ensure the version string follows semver format.
  • Loose parsing option: Enabling "Loose" can help parse non-standard version strings but may produce unexpected results.
  • Empty or missing version: Providing an empty version string will result in no prerelease components found.
  • Error handling: If an error occurs during execution, it will be returned in the output under an error field if "Continue On Fail" is enabled.

Links and References

Discussion