{"id":28516110,"url":"https://github.com/dev-build-deploy/version-it","last_synced_at":"2025-07-05T17:30:46.509Z","repository":{"id":176359236,"uuid":"656797761","full_name":"dev-build-deploy/version-it","owner":"dev-build-deploy","description":"Version Management library","archived":false,"fork":false,"pushed_at":"2025-07-01T19:19:25.000Z","size":320,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-01T20:26:15.784Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev-build-deploy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSES/CC0-1.0.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["Kevin-de-Jong"]}},"created_at":"2023-06-21T16:56:03.000Z","updated_at":"2025-07-01T19:19:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"67f2521a-2277-4848-bb20-c6549d6d4cde","html_url":"https://github.com/dev-build-deploy/version-it","commit_stats":null,"previous_names":["dev-build-deploy/version-it"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/dev-build-deploy/version-it","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-build-deploy%2Fversion-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-build-deploy%2Fversion-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-build-deploy%2Fversion-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-build-deploy%2Fversion-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-build-deploy","download_url":"https://codeload.github.com/dev-build-deploy/version-it/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-build-deploy%2Fversion-it/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263033667,"owners_count":23403209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T03:32:16.712Z","updated_at":"2025-07-05T17:30:46.494Z","avatar_url":"https://github.com/dev-build-deploy.png","language":"TypeScript","readme":"\u003c!-- \nSPDX-FileCopyrightText: 2023 Kevin de Jong \u003cmonkaii@hotmail.com\u003e\nSPDX-License-Identifier: MIT\n--\u003e\n\n# VersionIt - Version Management Library\n\nLightweight Version Management library for managing [Semantic Versioning](#semantic-versioning) and [Calendar Versioning](#calendar-versioning)\n\n## Features\n\n* Simple to use\n* Supports [Semantic Versioning](#semantic-versioning)\n  * Extended with key-value pair support in the `PRERELEASE` identifier (e.g. `0.1.0-rc.1 \u003c 0.1.0-rc.2` )\n* Supports [Calendar Versioning]\n  * Extended with key-value pair support in the `MODIFIER` identifier (e.g. `2023.25.1-build.1`)\n\n\n## Semantic Versioning\n\n\u003e [!NOTE]\n\u003e Please refer to the [SemVer 2.0.0] specification for information about Semantic Versioning.\n\n```typescript\nimport { SemVer } from \"@dev-build-deploy/version-it\";\n\n// Create from string\nconst currentVersion = SemVer.fromString(\"0.1.2\");\n\n// Increment the version\nconst alphaVersion = currentVersion.increment(\"PRERELEASE\", \"alpha\"); // =\u003e 0.1.2-alpha.1\nconst majorVersion = currentVersion.increment(\"MAJOR\"); // =\u003e 1.0.0\n\n// Create from interface\nconst constructed = new SemVer({\n  minor: 1,\n  patch: 2,\n  preReleases: [{ identifier: \"alpha\", value: 3 }]\n});\n```\n\n### Incrementing the version\n\nThe following increment types can be applied when using `.increment(...)`:\n\n| Type | Description |\n| --- | --- |\n| `MAJOR` | Increments the `MAJOR` version core |\n| `MINOR` | Increments the `MINOR` version core |\n| `PATCH` | Increments the `PATCH` version core |\n| `PRERELEASE` | Increments the `PRERELEASE` or adds `-rc.1` in case no `PRERELEASE` is present on the version to be incremented.\u003cbr\u003eYou can specify the pre-release element to increment by providing the optional `modifier` parameter\u003cbr\u003e\u003cbr\u003eThis will manage pre-release identifiers a key-value pair (e.g. `-alpha.1`, `-rc.7`) |\n\n## Calendar Versioning\n\n\u003e [!NOTE]\n\u003e Please refer to the [CalVer] specification for information about Calendar Versioning.\n\n```ts\nimport { CalVer } from \"@dev-build-deploy/version-it\";\n\nconst calverFormat = \"YYYY.0M.MICRO\";\n\n// Create from string\nconst currentVersion = new CalVer(calverFormat, \"2023.01.12-alpha.2\");\n\n// Create from interface\nconst constructed = new CalVer(\n  calverFormat, {\n    major: 2023,\n    minor: 1,\n    micro: 12,\n    modifiers: [{ identifier: \"alpha\", version: 1 }]\n  }\n);\n\n// Update the calendar related version (e.g. YYYY, MM, WW, DD)\nconst newVersion = currentVersion.increment(\"CALENDAR\"); // =\u003e 2024.0.0\n```\n\n### CalVer Formatting\n\n\u003e [!WARNING]\n\u003e We only support CalVer formatting with 2 or 3 version cores.\n\nFormatting is provided as a string, where each version core (`MAJOR`, `MINOR`, `MICRO`) can be assigned to a specific format:\n\n| Format | Description |\n| --- | --- |\n| `YYYY` | Full year |\n| `YY` | Last three digits of the year (e.g. 3, 23, 101)\n| `0Y` | Zero padded last three digits of the year (e.g. 003, 023, 101)\n| `MM` | Month number |\n| `0M` | Zero padded month number |\n| `WW` | Week number (according to ISO8601) |\n| `0W` | Zero padded week number (according to ISO8601) |\n| `DD` | Day of the month |\n| `0D` | Zero padded day of the month |\n| `MAJOR` | Incremental number |\n| `MINOR` | Incremental number |\n| `MICRO` | Incremental number |\n\n### Incrementing the version\n\n\u003e [!WARNING]\n\u003e The `MODIFIER` is using the same precedence rules as \"Pre-releases\" in the [SemVer] specification.\n\nThe following increment types can be applied when using `.increment(...)`:\n\n| Type | Description |\n| --- | --- |\n| `CALENDAR` | Updates any version core associated with calendar-related formatting.\u003cbr\u003e\u003cbr\u003eAdds the `build.1` modifier in case the exact version already exists |\n| `MAJOR` | Increments (+1) the version associated with `MAJOR` formatting |\n| `MINOR` | Increments (+1) the version associated with `MINOR` formatting |\n| `MICRO` | Increments (+1) the version associated with `MICRO` formatting |\n| `MODIFIER` | Increments the `MODIFIER` or adds `-rc.1` in case no `MODIFIER` is present on the version to be incremented.\u003cbr\u003eYou can specify the modifier element to increment by providing the optional `modifier` parameter\u003cbr\u003e\u003cbr\u003eThis will manage pre-release identifiers a key-value pair (e.g. `-alpha.1`, `-rc.7`)|\n\n## Comparing and sorting\n\nBoth [SemVer](#semantic-versioning) and [CalVer](#calendar-versioning) can be compared and/or sorted in the same manner:\n\n```typescript\n// Sort versions...\nconst unsortedVersions = [\n  previousVersion,\n  currentVersion,\n  newVersion\n]\n\nconst sortedVersions = unsortedVersions.sort((a, b) =\u003e a.compareTo(b));\n\n// ...or use the comparator functions:\n//   isEqualTo(..)\n//   isGreaterThan(..)\n//   isLessThan(..)\nif (newVersion.isGreaterThan(previousVersion)) {\n  // Hurray..!\n}\n```\n\n## Contributing\n\nIf you have suggestions for how version-it could be improved, or want to report a bug, open an issue! We'd love all and any contributions.\n\nFor more, check out the [Contributing Guide](CONTRIBUTING.md).\n\n## License\n\n- [MIT](./LICENSES/MIT.txt) © 2023 Kevin de Jong \\\u003cmonkaii@hotmail.com\\\u003e\n\n[SemVer 2.0.0]: https://semver.org\n[CalVer]: https://calver.org","funding_links":["https://github.com/sponsors/Kevin-de-Jong"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-build-deploy%2Fversion-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev-build-deploy%2Fversion-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-build-deploy%2Fversion-it/lists"}