{"id":16476386,"url":"https://github.com/softprops/semverfi","last_synced_at":"2025-03-23T11:32:58.775Z","repository":{"id":4103103,"uuid":"5212139","full_name":"softprops/semverfi","owner":"softprops","description":"always faithful, always loyal semantic versioning","archived":false,"fork":false,"pushed_at":"2017-09-13T16:17:57.000Z","size":248,"stargazers_count":23,"open_issues_count":5,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-17T12:00:01.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softprops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-28T05:01:36.000Z","updated_at":"2022-04-02T14:21:50.000Z","dependencies_parsed_at":"2022-08-24T02:50:58.250Z","dependency_job_id":null,"html_url":"https://github.com/softprops/semverfi","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fsemverfi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fsemverfi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fsemverfi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Fsemverfi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softprops","download_url":"https://codeload.github.com/softprops/semverfi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245097158,"owners_count":20560311,"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":"2024-10-11T12:42:19.729Z","updated_at":"2025-03-23T11:32:58.398Z","avatar_url":"https://github.com/softprops.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semverfi\n\n[![Build Status](https://secure.travis-ci.org/softprops/semverfi.png)](http://travis-ci.org/softprops/semverfi)\n\nA library for parsing, querying, and ordering the always faithful, always loyal [semantic versions][sv]\n\n\n## install\n\n### the cut and paste method\n\nAdd the following to your sbt build definition\n\n    libraryDependencies += \"me.lessis\" % \"semverfi\" % \"0.1.3\"\n    \n### the civilized method\n\nUsing [ls](https://github.com/softprops/ls#readme)\n\n    ls-install semverfi\n\n## usage.\n\n\n### it parses\n\n\n```scala\nimport semverfi._\n\nval patches =\n  Map(\"normal\"    -\u003e \"1.0.1\",\n    \"pre-release\" -\u003e \"1.0.2-alpha.1\",\n    \"build\"       -\u003e \"1.0.3-alpha.1+build10\",\n    \"garbage\"     -\u003e \"asfnaasfiasdf\")\n    .values\n    .map(Version.apply)\n    .map({\n       case n @ NormalVersion(_, _, p) =\u003e\n         p\n       case pr @ PreReleaseVersion(_, _, p, _) =\u003e\n         p\n       case b @ BuildVersion(_, _, p, _, _) =\u003e\n         p\n       case i @ Invalid(in) =\u003e\n         println(\"%s was invalid\" format in)\n         i.patch\n    })\n```\n\n### it orders\n\nThe semver specification defines precedence rules for how to order versions.\nThis library abides by those rules.\n\n```scala\nimport semverfi._\nimport scala.util.Random.shuffle\n\nval expected = List(\"1.0.0-alpha\", \"1.0.0-alpha.1\",  \"1.0.0-beta.2\", \"1.0.0-beta.11\", \"1.0.0-rc.1\", \"1.0.0-rc.1+build.1\", \"1.0.0\", \"1.0.0+0.3.7\", \"1.3.7+build\", \"1.3.7+build.2.b8f12d7\", \"1.3.7+build.11.e0f985a\")\n\nval shuffled = shuffle(expected)\n\nval parsed = shuffled.map(Version.apply)\n\n// print list of sorted versions zipped with expected input\n(parsed.sorted zip expected).foreach(println)\n```\n\n### it bumps ( valid versions )\n\n```scala\nimport semverfi._\nVersion(\"1.1.1\").opt { version =\u003e\n  println(version.bumpMajor) // NormalVersion(2,0,0)\n  println(version.bumpMinor) // NormalVersion(1,2,0)\n  println(version.bumpPatch) // NormalVersion(1,1,2)\n}\n```\n\n### it transitions ( valid versions )\n\n```scala\nimport semverfi._\nVersion(\"1.1.1\").opt.map(_.prerelease(\"SNAPSHOT\").build(\"123\").normalize)\n```\n\nDoug Tangren (softprops) 2012\n\n[sv]: http://semver.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fsemverfi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftprops%2Fsemverfi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Fsemverfi/lists"}