# Semver Parser & Version Range Checker (`maximedupre/semver-parser-version-range-checker`) Actor

Parse, validate, sort, and range-check semantic versions. Add version strings and an optional range, then export parsed components, ranks, errors, and latest satisfying versions.

- **URL**: https://apify.com/maximedupre/semver-parser-version-range-checker.md
- **Developed by:** [Maxime Dupré](https://apify.com/maximedupre) (community)
- **Categories:** Developer tools, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.05 / 1,000 processed versions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### 🔎 Semver parser and version range checker

Parse, validate, sort, and range-check semantic versions in one Apify Actor. Paste release tags, dependency versions, or package manifest values, add an optional npm-style range, and get clean rows for audits, compatibility checks, exports, and API workflows.

- Check whether submitted versions match a [semver range](https://apify.com/maximedupre/semver-parser-version-range-checker/examples/semver-range-check) such as `^1.2.0` or `>=1.0.0 <3.0.0`.
- Parse [semantic version parts](https://apify.com/maximedupre/semver-parser-version-range-checker/examples/semantic-version-parts) into major, minor, patch, prerelease, and build metadata fields.
- [Rank versions](https://apify.com/maximedupre/semver-parser-version-range-checker/examples/rank-semver-versions) newest-first or oldest-first for release audits and upgrade planning.
- Keep [loose tags](https://apify.com/maximedupre/semver-parser-version-range-checker/examples/loose-version-tags) such as `v1.2` useful by returning the coerced semver value.
- [Export one row per submitted version](https://apify.com/maximedupre/semver-parser-version-range-checker/examples/semver-export-rows) for spreadsheets, scripts, and downstream automation.

#### 📊 Returned data

Each output row keeps the original submitted value and adds computed semver facts:

- `version` - the submitted version string.
- `coercedVersion` - the semver value used for parsing, range checks, and ranking.
- `isValid` - whether the submitted value is strict semver before coercion.
- `major`, `minor`, and `patch` - parsed numeric version components.
- `prerelease` and `build` - dot-joined metadata when present.
- `satisfiesRange` - whether the version matches the supplied range.
- `rank` - the 1-based sort rank among parseable submitted versions.
- `latestSatisfyingVersion` - the highest submitted version that satisfies the supplied range.
- `error` - a short reason when a version or range cannot be evaluated.

Invalid and loose version strings do not stop the run. The Actor returns a row with nullable computed fields and a clear error when a value cannot be parsed.

#### 🚀 How to run

1. Add one version string per line.
2. Optionally add a version range, such as `^1.2.0`, `~2.3`, `>=1.0.0 <3.0.0`, `1.x`, or `*`.
3. Choose whether prerelease versions should count in range checks.
4. Choose newest-first or oldest-first ranking.
5. Run the Actor and open the default dataset.

The Actor accepts up to 10,000 version strings per run. It is a pure computation utility, so it does not need cookies, API keys, proxies, browsers, package registry access, or source-site access.

#### ⚙️ Input

```json
{
  "versions": [
    "1.2.3",
    "2.0.0-beta.1",
    "v3.1.0+build.42",
    "not-a-version"
  ],
  "range": ">=1.0.0 <3.0.0",
  "includePrerelease": true,
  "sortOrder": "desc"
}
````

`versions` is required. `range` is optional, so you can use the Actor for parse-only and sorting work when you do not need compatibility checks.

#### 🧾 Output example

```json
{
  "version": "2.0.0-beta.1",
  "coercedVersion": "2.0.0-beta.1",
  "isValid": true,
  "major": 2,
  "minor": 0,
  "patch": 0,
  "prerelease": "beta.1",
  "build": null,
  "satisfiesRange": true,
  "rank": 2,
  "latestSatisfyingVersion": "2.0.0-beta.1",
  "error": null
}
```

#### 💳 Pricing

This Actor uses pay-per-event pricing. You are charged for each successfully processed version result that is saved to the dataset. Actor starts, empty inputs, and setup-only outcomes are not charged as separate events.

#### 🔌 Integrations

https://www.youtube.com/watch?v=bNACk1\_S\_6w\&list=PLObrtcm1Kw6MUrlLNDbK9QRg8VDJg0gOW\&index=4

- Run the Actor from the Apify API when a CI job or internal tool needs semver checks.
- Schedule repeated checks for maintained version lists or release audit inputs.
- Export results as JSON, CSV, Excel, XML, or HTML from the default dataset.
- Send completed-run webhooks to downstream tools that update dashboards or QA reports.

#### ❓ FAQ

##### Can this work as a semver parser version range checker library replacement?

It uses standard semver behavior in an Apify Actor run. It is useful when you want hosted batch processing, dataset exports, schedules, webhooks, or API-triggered checks without adding another service to your own codebase.

##### Does it support npm-style semver ranges?

Yes. The Actor supports common npm-style range expressions such as caret ranges, tilde ranges, comparator sets, wildcards, and `1.x` style ranges.

##### What happens to loose versions like `v1.2` or `1.0`?

The Actor preserves the original input, marks it as not strict semver, and returns a coerced semver value when one can be computed.

##### What happens if a version cannot be parsed?

The Actor emits a row with `isValid: false`, nullable computed fields, and an `error` message. Other submitted versions still produce their own rows.

##### Why not use the semver API?

There is no official remote semver API needed for this workflow. This Actor is for hosted batch runs, exports, schedules, and Apify integrations around semver parsing and range checks.

##### What are semver alternatives?

For local app code, a package such as npm's `semver` library is often the right choice. Use this Actor when you want no-code batch input, dataset output, scheduling, API runs, or webhooks on Apify.

### 📝 Changelog

- 0.0: Initial release.

### 🆘 Support

For issues, questions, or feature requests, [file a ticket](https://console.apify.com/actors/maximedupre~semver-parser-version-range-checker/issues) and I'll fix or implement it in less than 24h 🫡

### 🔗 Other actors

- [Email MX Verifier ↗](https://apify.com/maximedupre/email-mx-verifier) - Check email syntax, MX records, disposable domains, and delivery risk for data workflows.
- [Font Detector ↗](https://apify.com/maximedupre/font-detector) - Detect website fonts, font files, CSS families, and source evidence from public pages.
- [Chrome Extensions Scraper ↗](https://apify.com/maximedupre/chrome-extensions-scraper) - Export Chrome Web Store extension metadata, ratings, permissions, contacts, and media.
- [Google Play Store Scraper ↗](https://apify.com/maximedupre/google-play-store-scraper) - Export Android app, review, rating, and permission data from Google Play.
- [Amazon Keywords Discovery Tool ↗](https://apify.com/maximedupre/amazon-keywords-discovery-tool) - Collect Amazon autocomplete keyword ideas for SEO and marketplace research.

**Made with ❤️ by Maxime Dupré**

# Actor input Schema

## `versions` (type: `array`):

Enter semver values, release tags, or loose versions such as v1.2.3, 2.0.0-beta.1, or 1.0.

## `range` (type: `string`):

Optional npm-style range such as ^1.2.0, ~2.3, >=1.0.0 <3.0.0, 1.x, or \*.

## `includePrerelease` (type: `boolean`):

Turn this on when beta, rc, alpha, or other prerelease versions should count in range checks.

## `sortOrder` (type: `string`):

Choose how valid versions are ranked in the output.

## Actor input object example

```json
{
  "versions": [
    "1.2.3",
    "2.0.0-beta.1",
    "v3.1.0+build.42",
    "1.0",
    "not-a-version"
  ],
  "range": ">=1.0.0 <3.0.0",
  "includePrerelease": true,
  "sortOrder": "desc"
}
```

# Actor output Schema

## `results` (type: `string`):

Open one result row for each submitted version string.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "versions": [
        "1.2.3",
        "2.0.0-beta.1",
        "v3.1.0+build.42",
        "1.0",
        "not-a-version"
    ],
    "range": ">=1.0.0 <3.0.0"
};

// Run the Actor and wait for it to finish
const run = await client.actor("maximedupre/semver-parser-version-range-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "versions": [
        "1.2.3",
        "2.0.0-beta.1",
        "v3.1.0+build.42",
        "1.0",
        "not-a-version",
    ],
    "range": ">=1.0.0 <3.0.0",
}

# Run the Actor and wait for it to finish
run = client.actor("maximedupre/semver-parser-version-range-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "versions": [
    "1.2.3",
    "2.0.0-beta.1",
    "v3.1.0+build.42",
    "1.0",
    "not-a-version"
  ],
  "range": ">=1.0.0 <3.0.0"
}' |
apify call maximedupre/semver-parser-version-range-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=maximedupre/semver-parser-version-range-checker",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Semver Parser & Version Range Checker",
        "description": "Parse, validate, sort, and range-check semantic versions. Add version strings and an optional range, then export parsed components, ranks, errors, and latest satisfying versions.",
        "version": "0.0",
        "x-build-id": "EJyZ0Hpc9GPktc21D"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/maximedupre~semver-parser-version-range-checker/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-maximedupre-semver-parser-version-range-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/maximedupre~semver-parser-version-range-checker/runs": {
            "post": {
                "operationId": "runs-sync-maximedupre-semver-parser-version-range-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/maximedupre~semver-parser-version-range-checker/run-sync": {
            "post": {
                "operationId": "run-sync-maximedupre-semver-parser-version-range-checker",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "versions"
                ],
                "properties": {
                    "versions": {
                        "title": "Version strings",
                        "minItems": 1,
                        "maxItems": 10000,
                        "type": "array",
                        "description": "Enter semver values, release tags, or loose versions such as v1.2.3, 2.0.0-beta.1, or 1.0.",
                        "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                        }
                    },
                    "range": {
                        "title": "Version range",
                        "type": "string",
                        "description": "Optional npm-style range such as ^1.2.0, ~2.3, >=1.0.0 <3.0.0, 1.x, or *."
                    },
                    "includePrerelease": {
                        "title": "Include prerelease versions",
                        "type": "boolean",
                        "description": "Turn this on when beta, rc, alpha, or other prerelease versions should count in range checks.",
                        "default": true
                    },
                    "sortOrder": {
                        "title": "Sort order",
                        "enum": [
                            "desc",
                            "asc"
                        ],
                        "type": "string",
                        "description": "Choose how valid versions are ranked in the output.",
                        "default": "desc"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
