import { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from "tapable"; import { ICommitAuthor, IExtendedCommit } from "./log-parse"; import { ILabelDefinition } from "./release"; import { ILogger } from "./utils/logger"; export interface IGenerateReleaseNotesOptions { /** Github repo owner (user) */ owner: string; /** GitHub project to operate on */ repo: string; /** The URL to the GitHub (public or enterprise) the project is using */ baseUrl: string; /** The labels configured by the user */ labels: ILabelDefinition[]; /** The branch that is used as the base. defaults to master */ baseBranch: string; /** The branches that is used as prerelease branches. defaults to next */ prereleaseBranches: string[]; } export interface IChangelogHooks { /** Change how the changelog renders lines. */ renderChangelogLine: AsyncSeriesWaterfallHook<[[IExtendedCommit, string]]>; /** Change how the changelog renders titles */ renderChangelogTitle: AsyncSeriesBailHook<[string, { [label: string]: string; }], string | void>; /** Change how the changelog renders authors. This is both the author on each commit note and the user in the author section (the part between parentheses). This is generally a link to some profile. */ renderChangelogAuthor: AsyncSeriesBailHook<[ICommitAuthor, IExtendedCommit, IGenerateReleaseNotesOptions], string | void>; /** Change how the changelog renders authors in the authors section. The hook provides the author object and the user created with `renderChangelogAuthor`. Here is where you might display extra info about the author, such as their full name. */ renderChangelogAuthorLine: AsyncSeriesBailHook<[ICommitAuthor, string], string | void>; /** * Add extra content to your changelogs. This hook provide * all the current "extra" notes and all of the commits for * the changelog. */ addToBody: AsyncSeriesWaterfallHook<[string[], IExtendedCommit[]]>; /** Control what commits effect the additional release notes section. */ omitReleaseNotes: AsyncSeriesBailHook<[IExtendedCommit], boolean | void>; } /** * Manages creating the "Release Notes" that are included in * both the CHANGELOG.md and GitHub releases. */ export default class Changelog { /** Plugin entry points */ readonly hooks: IChangelogHooks; /** The options the changelog was initialized with */ readonly options: IGenerateReleaseNotesOptions; /** The authors in the current changelog */ private authors?; /** A logger that uses log levels */ private readonly logger; /** Initialize the changelog generator with default hooks and labels */ constructor(logger: ILogger, options: IGenerateReleaseNotesOptions); /** Load the default configuration */ loadDefaultHooks(): void; /** Generate the release notes for a group of commits */ generateReleaseNotes(commits: IExtendedCommit[]): Promise; /** Create a link to a user for use in the changelog */ createUserLink(author: ICommitAuthor, commit: IExtendedCommit): string | undefined; /** Split commits into changelogTitle sections. */ private splitCommits; /** Get the default label for a label key */ private getFirstLabelNameFromLabelKey; /** Create a list of users */ private createUserLinkList; /** Transform a commit into a line in the changelog */ private generateCommitNote; /** Get all the authors in the provided commits */ private getAllAuthors; /** Create a section in the changelog to showcase contributing authors */ private createAuthorSection; /** Create a section in the changelog to with all of the changelog notes organized by change type */ private createLabelSection; /** Gather extra release notes to display at the top of the changelog */ private createReleaseNotesSection; } //# sourceMappingURL=changelog.d.ts.map