Actions35
- Cleaning Actions
- Coercion Actions
- Comparison Actions
- Increment Actions
- Parsing Actions
- Range Actions
- Sorting Actions
- Validation Actions
Overview
This node provides utilities for working with semantic versioning (semver) ranges. Specifically, the "Simplify Range" operation takes a list of versions and a version range string, then returns a simplified version range that covers those versions. This is useful when you want to reduce complex or verbose semver ranges into a more concise form that still accurately represents the set of versions.
Common scenarios include:
- Simplifying dependency version ranges in package manifests.
- Cleaning up version constraints in automation workflows.
- Generating minimal version ranges for compatibility checks.
For example, given versions 1.2.3, 1.2.4, 1.3.0 and a range ^1.2.0, the node will output a simplified range that covers these versions, potentially making it easier to read or use in further processing.
Properties
| Name | Meaning |
|---|---|
| Range | The version range string to simplify (e.g., ^1.2.0). |
| Versions | Comma-separated list of versions to consider when simplifying the range (e.g., 1.2.3,1.2.4,1.3.0). |
| Options | Additional options: - Loose: Whether to use loose parsing for version strings. - Include Prerelease: Whether to include prerelease versions in range matching. |
Output
The node outputs a JSON object containing the original input data plus a result field with the following structure:
{
"operation": "simplifyRange",
"versions": ["1.2.3", "1.2.4", "1.3.0"],
"range": "^1.2.0",
"result": "<simplified_range_string>"
}
result: A string representing the simplified version range that covers the provided versions within the specified range.
No binary data output is produced by this node.
Dependencies
- This node depends on the
semverlibrary for all semantic versioning operations. - No external API keys or services are required.
- No special environment variables or n8n configurations are needed beyond standard node setup.
Troubleshooting
- Invalid Version Strings: If the versions or range strings are malformed or invalid, the node may throw errors or return null results. Ensure all version inputs conform to semantic versioning standards.
- Empty Versions List: Providing an empty or improperly formatted versions list may result in no simplification or errors.
- Loose Parsing Option: Enabling loose parsing can help if your version strings do not strictly follow semver but may also lead to unexpected results.
- Include Prerelease Option: If you expect prerelease versions to be considered, ensure this option is enabled; otherwise, they might be ignored.
If errors occur, check the error message returned in the output JSON under the error field (if continue-on-fail is enabled), which typically indicates the cause.