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