Scripting API

Scripting API

PackageVersion

Record struct in Abyss.Core, from Abyss.Core.

A package's version, major.minor.patch with a pre-release after - if it is one, as its manifest gives it (PackageManifest.IsVersion), compared as semantic versions are, and the ranges a package's dependencies are given in: ^1.2.0, ~1.2.0, 1.2.0.

public readonly record struct PackageVersion

Constructors

PackageVersion

public PackageVersion(int Major, int Minor, int Patch, string? PreRelease = null)

A package's version, major.minor.patch with a pre-release after - if it is one, as its manifest gives it (PackageManifest.IsVersion), compared as semantic versions are, and the ranges a package's dependencies are given in: ^1.2.0, ~1.2.0, 1.2.0.

Parameters

  • Major: What changes where it breaks what used it.
  • Minor: What changes where something is added.
  • Patch: What changes for a fix.
  • PreRelease: What it is before its release, beta.1; null for a release.

Properties

Major

public int Major { get; init; }

What changes where it breaks what used it.

Minor

public int Minor { get; init; }

What changes where something is added.

Patch

public int Patch { get; init; }

What changes for a fix.

PreRelease

public string? PreRelease { get; init; }

What it is before its release, beta.1; null for a release.

Methods

Parse

public static PackageVersion? Parse(string? text)

A version as its manifest writes it, build metadata left out; null where it is none.

Parameters

  • text

Next

public PackageVersion Next(PackageBump bump)

The version after this one, raised as bump says, the parts after it zero.

Parameters

  • bump

CompareTo

public int CompareTo(PackageVersion other)

Parameters

  • other

Satisfies

public bool Satisfies(string range)

Whether this version is one range takes: ^1.2.0 any from it to the next major — or, below 1, to the next minor, ^0.2.0 up to 0.3.0 — ~1.2.0 any from it to the next minor, and 1.2.0 it alone; a part left out is zero, ^1.0. A pre-release only where the range names one of the same three numbers.

Parameters

  • range

IsRange

public static bool IsRange(string? range)

Whether range is a range a dependency may be given in.

Parameters

  • range

Newest

public static string? Newest(IEnumerable<string> versions, string range)

The newest of versions that range takes; null where none does.

Parameters

  • versions
  • range

ToString

public override string ToString()