Giter Site home page Giter Site logo

nixsemver's Introduction

Nix Semantic Versioning library

This provides utility functions for working with semantic versions numbers. Please see semantic versioning to understand what is going on here.

Usage

This repository requires you to use Nix Flakes. You need to include it as Nix Flake input to get access to the library. Afterwards you can just use the provided functions.

inputs = {
  nixsemver = "gitlab:cynerd/nixsemver";
};

outputs = {
  nixsemver,
  ...
}: let
  inherit (nixsemver.lib) version changelog;

Working with semantic version

The core functions provided by this repository.

semverValid s

Validate given string that it matches valid semantic version.

semverSplit s

Split string with semantic version to attribute set with fields:

  • major with major version number
  • minor with minor version number
  • patch with patch version number
  • preRelease with pre-release string
  • build with build identifier string

semverToString attr

Reverse operation for the semverSplit.

Working with changelog file

This is convenient addition to also extract versions from CHANGELOG.md file that is maintained according to the Keep a Changelog.

changelog.releases p

Returns list of releases that are recorded in the changelog file on provided path.

changelog.latestRelease list

Returns the latest release and thus it skips Unreleased and instead provides the one right after it. The default is 0.0.0 if there is no release yet.

Note that this relies on the ordering in the changelog and thus it won't look for actually semantically newest version.

changelog.getLatestRelease p

Combination of changelog.releases and changelog.latestRelease and thus it provides latest release from changelog file on provided path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.