1 | import * as t from "io-ts";
|
2 | import { AsyncSeriesBailHook, SyncHook } from "tapable";
|
3 | import { ICreateLabelsOptions } from "./auto-args";
|
4 | import Changelog from "./changelog";
|
5 | import Git from "./git";
|
6 | import LogParse, { IExtendedCommit } from "./log-parse";
|
7 | import SEMVER, { IVersionLabels } from "./semver";
|
8 | import { ILogger } from "./utils/logger";
|
9 | import { LoadedAutoRc } from "./types";
|
10 | export declare type VersionLabel = SEMVER.major | SEMVER.minor | SEMVER.patch | "skip" | "release";
|
11 | export declare const releaseLabels: VersionLabel[];
|
12 |
|
13 | export declare const isVersionLabel: (label: string) => label is VersionLabel;
|
14 | export declare const labelDefinition: t.IntersectionC<[t.PartialC<{
|
15 |
|
16 | changelogTitle: t.StringC;
|
17 |
|
18 | color: t.StringC;
|
19 |
|
20 | description: t.StringC;
|
21 |
|
22 | releaseType: t.UnionC<[t.LiteralC<"none">, t.LiteralC<"skip">, ...t.LiteralC<VersionLabel>[]]>;
|
23 |
|
24 | overwrite: t.BooleanC;
|
25 | }>, t.TypeC<{
|
26 |
|
27 | name: t.StringC;
|
28 | }>]>;
|
29 | export declare type ILabelDefinition = t.TypeOf<typeof labelDefinition>;
|
30 | export declare const defaultLabels: ILabelDefinition[];
|
31 |
|
32 | export declare const getVersionMap: (labels?: ({
|
33 | changelogTitle?: string | undefined;
|
34 | color?: string | undefined;
|
35 | description?: string | undefined;
|
36 | releaseType?: "none" | SEMVER.major | SEMVER.minor | SEMVER.patch | "skip" | "release" | undefined;
|
37 | overwrite?: boolean | undefined;
|
38 | } & {
|
39 | name: string;
|
40 | })[]) => IVersionLabels;
|
41 | export interface IReleaseHooks {
|
42 |
|
43 | onCreateChangelog: SyncHook<[Changelog, SEMVER | undefined]>;
|
44 |
|
45 | createChangelogTitle: AsyncSeriesBailHook<[], string | void>;
|
46 |
|
47 | onCreateLogParse: SyncHook<[LogParse]>;
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 | export default class Release {
|
53 |
|
54 | readonly hooks: IReleaseHooks;
|
55 |
|
56 | readonly config: LoadedAutoRc;
|
57 |
|
58 | private readonly git;
|
59 |
|
60 | private readonly logger;
|
61 |
|
62 | private readonly versionLabels;
|
63 |
|
64 | constructor(git: Git, config?: LoadedAutoRc, logger?: ILogger);
|
65 | /** Make the class that will generate changelogs for the project */
|
66 | makeChangelog(version?: SEMVER): Promise<Changelog>;
|
67 | /**
|
68 | * Generate a changelog from a range of commits.
|
69 | *
|
70 | * @param from - sha or tag to start changelog from
|
71 | * @param to - sha or tag to end changelog at (defaults to HEAD)
|
72 | */
|
73 | generateReleaseNotes(from: string, to?: string, version?: SEMVER): Promise<string>;
|
74 | /** Get all the commits that will be included in a release */
|
75 | getCommitsInRelease(from: string, to?: string): Promise<IExtendedCommit[]>;
|
76 | /** Update a changelog with a new set of release notes */
|
77 | updateChangelogFile(title: string, releaseNotes: string, changelogPath: string): Promise<void>;
|
78 | /**
|
79 | * Prepend a set of release notes to the changelog.md
|
80 | *
|
81 | * @param releaseNotes - Release notes to prepend to the changelog
|
82 | * @param lastRelease - Last release version of the code. Could be the first commit SHA
|
83 | * @param currentVersion - Current version of the code
|
84 | */
|
85 | addToChangelog(releaseNotes: string, lastRelease: string, currentVersion: string): Promise<void>;
|
86 | /**
|
87 | * Get a range of commits. The commits will have PR numbers and labels attached
|
88 | *
|
89 | * @param from - Tag or SHA to start at
|
90 | * @param to - Tag or SHA to end at (defaults to HEAD)
|
91 | */
|
92 | getCommits(from: string, to?: string): Promise<IExtendedCommit[]>;
|
93 | /** Go through the configured labels and either add them to the project or update them */
|
94 | addLabelsToProject(labels: ILabelDefinition[], options?: ICreateLabelsOptions): Promise<void>;
|
95 | /**
|
96 | * Calculate the SEMVER bump over a range of commits using the PR labels
|
97 | *
|
98 | * @param from - Tag or SHA to start at
|
99 | * @param to - Tag or SHA to end at (defaults to HEAD)
|
100 | */
|
101 | getSemverBump(from: string, to?: string): Promise<SEMVER>;
|
102 | /** Given a tag get the next incremented version */
|
103 | calcNextVersion(lastTag: string): Promise<string | null>;
|
104 | /** Create the class that will parse the log for PR info */
|
105 | private createLogParse;
|
106 | /** Get a the PRs that have been merged since the last GitHub release. */
|
107 | private getPRsSinceLastRelease;
|
108 | /**
|
109 | * Add the PR info (labels and body) to the commit
|
110 | *
|
111 | * @param commit - Commit to modify
|
112 | */
|
113 | private addPrInfoToCommit;
|
114 | /**
|
115 | * Commits from rebased PRs do not have messages that tie them to a PR
|
116 | * Instead we have to find all PRs since the last release and try to match
|
117 | * their merge commit SHAs.
|
118 | */
|
119 | private getPRForRebasedCommits;
|
120 | /** Parse the commit for information about the author and any other author that might have helped. */
|
121 | private attachAuthor;
|
122 | }
|
123 | //# sourceMappingURL=release.d.ts.map |
\ | No newline at end of file |