import * as t from "io-ts"; import { AsyncSeriesBailHook, SyncHook } from "tapable"; import { ICreateLabelsOptions } from "./auto-args"; import Changelog from "./changelog"; import Git from "./git"; import LogParse, { IExtendedCommit } from "./log-parse"; import SEMVER, { IVersionLabels } from "./semver"; import { ILogger } from "./utils/logger"; import { LoadedAutoRc } from "./types"; export declare type VersionLabel = SEMVER.major | SEMVER.minor | SEMVER.patch | "skip" | "release"; export declare const releaseLabels: VersionLabel[]; /** Determine if a label is a label used for versioning */ export declare const isVersionLabel: (label: string) => label is VersionLabel; export declare const labelDefinition: t.IntersectionC<[t.PartialC<{ /** A title to put in the changelog for the label */ changelogTitle: t.StringC; /** The color of the label */ color: t.StringC; /** The description of the label */ description: t.StringC; /** What type of release this label signifies */ releaseType: t.UnionC<[t.LiteralC<"none">, t.LiteralC<"skip">, ...t.LiteralC[]]>; /** Whether to overwrite the base label */ overwrite: t.BooleanC; }>, t.TypeC<{ /** The label text */ name: t.StringC; }>]>; export declare type ILabelDefinition = t.TypeOf; export declare const defaultLabels: ILabelDefinition[]; /** Construct a map of label => semver label */ export declare const getVersionMap: (labels?: ({ changelogTitle?: string | undefined; color?: string | undefined; description?: string | undefined; releaseType?: "none" | SEMVER.major | SEMVER.minor | SEMVER.patch | "skip" | "release" | undefined; overwrite?: boolean | undefined; } & { name: string; })[]) => IVersionLabels; export interface IReleaseHooks { /** This is where you hook into the changelog's hooks. This hook is exposed for convenience on during `this.hooks.onCreateRelease` and at the root `this.hooks` */ onCreateChangelog: SyncHook<[Changelog, SEMVER | undefined]>; /** Control the titles in the `CHANGELOG.md` */ createChangelogTitle: AsyncSeriesBailHook<[], string | void>; /** This is where you hook into the LogParse's hooks. This hook is exposed for convenience on during `this.hooks.onCreateRelease` and at the root `this.hooks` */ onCreateLogParse: SyncHook<[LogParse]>; } /** * A class for interacting with the git remote */ export default class Release { /** Plugin entry points */ readonly hooks: IReleaseHooks; /** Options Release was initialized with */ readonly config: LoadedAutoRc; /** A class that handles interacting with git and GitHub */ private readonly git; /** A logger that uses log levels */ private readonly logger; /** The version bump being used during "shipit" */ private readonly versionLabels; /** Initialize the release manager */ constructor(git: Git, config?: LoadedAutoRc, logger?: ILogger); /** Make the class that will generate changelogs for the project */ makeChangelog(version?: SEMVER): Promise; /** * Generate a changelog from a range of commits. * * @param from - sha or tag to start changelog from * @param to - sha or tag to end changelog at (defaults to HEAD) */ generateReleaseNotes(from: string, to?: string, version?: SEMVER): Promise; /** Get all the commits that will be included in a release */ getCommitsInRelease(from: string, to?: string): Promise; /** Update a changelog with a new set of release notes */ updateChangelogFile(title: string, releaseNotes: string, changelogPath: string): Promise; /** * Prepend a set of release notes to the changelog.md * * @param releaseNotes - Release notes to prepend to the changelog * @param lastRelease - Last release version of the code. Could be the first commit SHA * @param currentVersion - Current version of the code */ addToChangelog(releaseNotes: string, lastRelease: string, currentVersion: string): Promise; /** * Get a range of commits. The commits will have PR numbers and labels attached * * @param from - Tag or SHA to start at * @param to - Tag or SHA to end at (defaults to HEAD) */ getCommits(from: string, to?: string): Promise; /** Go through the configured labels and either add them to the project or update them */ addLabelsToProject(labels: ILabelDefinition[], options?: ICreateLabelsOptions): Promise; /** * Calculate the SEMVER bump over a range of commits using the PR labels * * @param from - Tag or SHA to start at * @param to - Tag or SHA to end at (defaults to HEAD) */ getSemverBump(from: string, to?: string): Promise; /** Given a tag get the next incremented version */ calcNextVersion(lastTag: string): Promise; /** Create the class that will parse the log for PR info */ private createLogParse; /** Get a the PRs that have been merged since the last GitHub release. */ private getPRsSinceLastRelease; /** * Add the PR info (labels and body) to the commit * * @param commit - Commit to modify */ private addPrInfoToCommit; /** * Commits from rebased PRs do not have messages that tie them to a PR * Instead we have to find all PRs since the last release and try to match * their merge commit SHAs. */ private getPRForRebasedCommits; /** Parse the commit for information about the author and any other author that might have helped. */ private attachAuthor; } //# sourceMappingURL=release.d.ts.map