Skip to content

ChangelogSource

type ChangelogSource =
    {
        Label: string
        Path: string
        Slug: string option
        Group: string option
        LabelFrom: (string -> string) option
    }
AssemblyNacara.Plugin.Changelog

A changelog to publish.

Fields

Label: string

Title of the generated page.

Path: string

Path of the changelog file, relative to the project root.

Slug: string option

Route segment. Defaults to a slug of the label.

Group: string option

Group this changelog belongs to, like "Plugins" or "Themes".

The menu offered by the plugin uses it: changelogs sharing the same group are listed together under a heading with that name. If you don't set it, the changelog is listed on its own.

LabelFrom: (string -> string) option

Set when Path is a pattern: how each match is named.

Given the full path of the file that matched.

Functions and values

create (label: string) (path: string) : ChangelogSource

A changelog file to publish as a page.

Parameter
labelWhat the page is called - the package the changelog belongs to.
pathWhere the file is, relative to the project root. ../CHANGELOG.md reaches above the site's own project.
defaultLabel (path: string) : string

How a match is named when nothing else says.

The directory holding the file, which is the package in the usual layout. One at the root of a repository is named after the file instead - the directory there is only what whoever cloned it chose.

Parameter
pathThe full path of the file.
group (value: string) (source: ChangelogSource) : ChangelogSource

Put this changelog under a heading in the menu.

Parameter
valueName of the heading, for example "Plugins". Changelogs you give the same name are listed together, in the order you declared them.
sourceThe changelog to group.
labelledBy (value: string -> string) (source: ChangelogSource) : ChangelogSource

How a matched path is named, when the default does not suit your layout.

Given the full path of the file that matched, so you can take whichever part of it names the thing. Only used by matching.

Parameter
valuePath in, name out.
sourceThe changelogs being described.
matching (pattern: string) : ChangelogSource

Every changelog matching a pattern, named after the directory holding it.

One line instead of a list you have to keep in step with your solution: ../src/*/CHANGELOG.md finds them all, and adding a package needs no edit here.

Anything set on it applies to every match, so a group is declared once. Use labelledBy when the directory is not the name you want.

Parameter
patternWhere to look, relative to the project root, with * in it.
ChangelogSource.matching "../src/Nacara.Plugin.*/CHANGELOG.md"
|> ChangelogSource.group "Plugins"
slug (value: string) (source: ChangelogSource) : ChangelogSource

What the page is called in a URL, rather than a slug of its label.

Parameter
valueThe segment to publish it under - core rather than nacara-core.
sourceThe changelog being described.