Semver icon

Semver

Semantic Versioning utilities for version management

Overview

This node provides semantic versioning (semver) utilities focused on incrementing version numbers. It allows users to increase a given version string according to standard semver release types such as major, minor, patch, and various prerelease increments. This is useful in software development workflows where automated version bumping is required, for example:

  • Automatically incrementing the patch version after a bug fix.
  • Bumping the minor version when new features are added.
  • Creating prerelease versions like alpha or beta builds before a stable release.

By specifying the current version and the type of increment, the node outputs the next version string accordingly.

Properties

Name Meaning
Version The current semantic version string to be incremented (e.g., "1.2.3").
Release Type The type of version increment to perform. Options: Major, Minor, Patch, Pre-major, Pre-minor, Pre-patch, Prerelease, Release.
Prerelease Identifier (Optional) Identifier for prerelease versions (e.g., "alpha", "beta"). Only used with prerelease increments.
Identifier Base (Optional) Base numbering for prerelease identifiers. Options: 0 (zero-based), 1 (one-based), False (no number).
Options Additional options:
- Loose: Use loose parsing for version strings (boolean).
- Include Prerelease: Include prerelease versions in range matching (boolean).
- RTL (Right to Left): Coerce version strings right to left (boolean, only relevant for coercion resource).

Output

The output JSON contains the following fields:

  • operation: Always "inc" indicating an increment operation.
  • version: The original input version string.
  • releaseType: The type of increment performed.
  • identifier: The prerelease identifier used if applicable.
  • identifierBase: The base numbering for the prerelease identifier if applicable.
  • result: The resulting incremented version string.

Example output JSON snippet:

{
  "operation": "inc",
  "version": "1.2.3",
  "releaseType": "minor",
  "identifier": "alpha",
  "identifierBase": "0",
  "result": "1.3.0"
}

No binary data output is produced by this node.

Dependencies

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

Troubleshooting

  • Invalid version string: If the input version string is not a valid semantic version, the increment operation may fail or return unexpected results. Ensure the version string follows semver format (e.g., "1.2.3").
  • Incorrect prerelease options: When using prerelease increments, ensure the Prerelease Identifier and Identifier Base are set correctly. Using incompatible values may cause errors or unexpected version strings.
  • Unknown release type: Providing a release type outside the supported options will cause an error.
  • Loose parsing issues: Enabling loose parsing can allow non-standard version strings but may lead to ambiguous results.

If the node throws an error, check the input parameters for correctness and adherence to semantic versioning standards.

Links and References

Discussion