changelog

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVersionAlreadyExists = errors.New("version is already exist")
	ErrNothingToRelease     = errors.New("changelog does not contain unreleased changes")
)
View Source
var ErrNotIsChangesKind = errors.New("the node is not kind of changes")
View Source
var (
	ErrNotIsVersion = errors.New("the node is not version")
)

Functions

This section is empty.

Types

type Changelog

type Changelog struct {
	Header      string
	Description string
	Versions    map[VersionString]VersionChanges
}

func NewChangelog

func NewChangelog(header, description string, versions map[VersionString]VersionChanges) *Changelog

func (*Changelog) Add

func (l *Changelog) Add(ver Version, changes Changes) error

func (*Changelog) GetChanges

func (l *Changelog) GetChanges(ver Version) (Changes, bool)

func (*Changelog) GetDiff

func (l *Changelog) GetDiff(from, to Version) Changes

func (*Changelog) GetLatestVersion

func (l *Changelog) GetLatestVersion() Version

func (*Changelog) GetSortedVersions

func (l *Changelog) GetSortedVersions() []Version

func (*Changelog) Release

func (l *Changelog) Release(ver Version) error

func (*Changelog) ToMarkdown

func (l *Changelog) ToMarkdown() string

type Changes

type Changes map[ChangesKind]string

func NewChanges

func NewChanges() Changes

func (Changes) Get

func (c Changes) Get(kind ChangesKind) string

func (Changes) GetMajority

func (c Changes) GetMajority() ChangesMajority

func (Changes) Has

func (c Changes) Has(kind ChangesKind) bool

func (Changes) Set

func (c Changes) Set(kind ChangesKind, changes string)

func (Changes) ToMarkdown

func (c Changes) ToMarkdown() string

type ChangesKind

type ChangesKind string
const (
	Added      ChangesKind = "Added"      // for new features.
	Changed    ChangesKind = "Changed"    // for changes in existing functionality.
	Deprecated ChangesKind = "Deprecated" // for soon-to-be removed features.
	Removed    ChangesKind = "Removed"    // for now removed features.
	Fixed      ChangesKind = "Fixed"      // for any bug fixes.
	Security   ChangesKind = "Security"   // in case of vulnerabilities.
)

func NewChangesKindFromNode

func NewChangesKindFromNode(src []byte, node ast.Node, requiredLevel int) (ChangesKind, error)

type ChangesMajority

type ChangesMajority uint
const (
	NoChanges ChangesMajority = iota
	PatchChanges
	MinorChanges
	MajorChanges
)

type Version

type Version struct {
	// contains filtered or unexported fields
}

func NewVersion

func NewVersion(version VersionString, date *time.Time) (Version, error)

func NewVersionFromNode

func NewVersionFromNode(src []byte, node ast.Node, requiredLevel int) (Version, error)

NewVersionFromNode is method for parsing the version from changelog in markdown format

Valid variations: - [version] - 2000-01-01 - [version] - version - 2000-01-01 - version

The version should be supported by semver or be constant "Unrealized"

func RequireVersionFromString

func RequireVersionFromString(version VersionString, date *time.Time) Version

func (Version) BumpMajor

func (v Version) BumpMajor() Version

func (Version) BumpMinor

func (v Version) BumpMinor() Version

func (Version) BumpPatch

func (v Version) BumpPatch() Version

func (Version) Equal

func (v Version) Equal(ver Version) bool

func (Version) GetDate

func (v Version) GetDate() time.Time

func (Version) GetVersion

func (v Version) GetVersion() VersionString

func (Version) GreaterThan

func (v Version) GreaterThan(ver Version) bool

func (Version) IsCommon

func (v Version) IsCommon() bool

func (Version) IsLatest

func (v Version) IsLatest() bool

func (Version) IsUnrealized

func (v Version) IsUnrealized() bool

func (Version) IsValid

func (v Version) IsValid() bool

func (Version) LessThen

func (v Version) LessThen(ver Version) bool

type VersionChanges

type VersionChanges struct {
	Version Version
	Changes Changes
}

func NewVersionChanges

func NewVersionChanges(ver Version, changes Changes) VersionChanges

type VersionString

type VersionString string
const LatestValue VersionString = "Latest"
const UnreleasedValue VersionString = "Unreleased"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL