1 | import { ReposCreateReleaseResponse, Response } from '@octokit/rest';
|
2 | import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook, SyncWaterfallHook, AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable';
|
3 | import { ApiOptions, ICanaryOptions, IChangelogOptions, ICommentOptions, ICreateLabelsOptions, IInitOptions, ILabelOptions, IPRCheckOptions, IPRStatusOptions, IReleaseOptions, IShipItOptions, IVersionOptions, INextOptions } from './auto-args';
|
4 | import Changelog from './changelog';
|
5 | import Git from './git';
|
6 | import LogParse, { IExtendedCommit } from './log-parse';
|
7 | import Release, { IAutoConfig, ILabelDefinition } from './release';
|
8 | import SEMVER, { IVersionLabels } from './semver';
|
9 | import { ILogger } from './utils/logger';
|
10 | import { IAuthorOptions, IRepoOptions } from './auto-args';
|
11 | interface ChangelogLifecycle {
|
12 |
|
13 | bump: SEMVER;
|
14 |
|
15 | commits: IExtendedCommit[];
|
16 |
|
17 | releaseNotes: string;
|
18 |
|
19 | currentVersion: string;
|
20 |
|
21 | lastRelease: string;
|
22 | }
|
23 | interface TestingToken {
|
24 |
|
25 | token?: string;
|
26 | }
|
27 | export interface IAutoHooks {
|
28 |
|
29 | modifyConfig: SyncWaterfallHook<[IAutoConfig]>;
|
30 |
|
31 | beforeRun: SyncHook<[IAutoConfig]>;
|
32 |
|
33 | beforeShipIt: SyncHook<[]>;
|
34 |
|
35 | beforeCommitChangelog: AsyncSeriesHook<[ChangelogLifecycle]>;
|
36 |
|
37 | afterAddToChangelog: AsyncSeriesHook<[ChangelogLifecycle]>;
|
38 |
|
39 | afterShipIt: AsyncParallelHook<[string | undefined, IExtendedCommit[]]>;
|
40 |
|
41 | afterRelease: AsyncParallelHook<[{
|
42 |
|
43 | lastRelease: string;
|
44 |
|
45 | newVersion?: string;
|
46 |
|
47 | commits: IExtendedCommit[];
|
48 |
|
49 | releaseNotes: string;
|
50 |
|
51 | response?: Response<ReposCreateReleaseResponse>;
|
52 | }]>;
|
53 |
|
54 | getAuthor: AsyncSeriesBailHook<[], IAuthorOptions | void>;
|
55 |
|
56 | getPreviousVersion: AsyncSeriesBailHook<[], string>;
|
57 |
|
58 | getRepository: AsyncSeriesBailHook<[], (IRepoOptions & TestingToken) | void>;
|
59 |
|
60 | onCreateRelease: SyncHook<[Release]>;
|
61 |
|
62 | onCreateLogParse: SyncHook<[LogParse]>;
|
63 |
|
64 | onCreateChangelog: SyncHook<[Changelog, SEMVER | undefined]>;
|
65 |
|
66 | version: AsyncParallelHook<[SEMVER]>;
|
67 |
|
68 | afterVersion: AsyncParallelHook<[]>;
|
69 |
|
70 | publish: AsyncParallelHook<[SEMVER]>;
|
71 |
|
72 | canary: AsyncSeriesBailHook<[SEMVER, string], string | {
|
73 |
|
74 | error: string;
|
75 | }>;
|
76 | |
77 |
|
78 |
|
79 |
|
80 |
|
81 | next: AsyncSeriesWaterfallHook<[string[], SEMVER]>;
|
82 |
|
83 | afterPublish: AsyncParallelHook<[]>;
|
84 | }
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | export declare function determineNextVersion(lastVersion: string, currentVersion: string, bump: SEMVER, tag: string): string;
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | export default class Auto {
|
99 |
|
100 | hooks: IAutoHooks;
|
101 |
|
102 | logger: ILogger;
|
103 |
|
104 | options: ApiOptions;
|
105 |
|
106 | baseBranch: string;
|
107 |
|
108 | config?: IAutoConfig;
|
109 |
|
110 | release?: Release;
|
111 |
|
112 | git?: Git;
|
113 |
|
114 | labels?: ILabelDefinition[];
|
115 |
|
116 | semVerLabels?: IVersionLabels;
|
117 |
|
118 | private versionBump?;
|
119 |
|
120 | constructor(options?: ApiOptions);
|
121 | /**
|
122 | * Load the .autorc from the file system, set up defaults, combine with CLI args
|
123 | * load the extends property, load the plugins and start the git remote interface.
|
124 | */
|
125 | loadConfig(): Promise<void>;
|
126 | /**
|
127 | * Interactive prompt for initializing an .autorc
|
128 | */
|
129 | init(options?: IInitOptions): Promise<void>;
|
130 | /**
|
131 | * Create all of the user's labels on the git remote if the don't already exist
|
132 | *
|
133 | * @param options - Options for the createLabels functionality
|
134 | */
|
135 | createLabels(options?: ICreateLabelsOptions): Promise<void>;
|
136 | /**
|
137 | * Get the labels on a specific PR. Defaults to the labels of the last merged PR
|
138 | *
|
139 | * @param options - Options for the createLabels functionality
|
140 | */
|
141 | label({ pr }?: ILabelOptions): Promise<void>;
|
142 | /**
|
143 | * Create a status on a PR.
|
144 | *
|
145 | * @param options - Options for the pr status functionality
|
146 | */
|
147 | prStatus({ dryRun, pr, url, ...options }: IPRStatusOptions): Promise<void>;
|
148 | /**
|
149 | * Check that a PR has a SEMVER label. Set a success status on the PR.
|
150 | *
|
151 | * @param options - Options for the pr check functionality
|
152 | */
|
153 | prCheck({ dryRun, pr, url, ...options }: IPRCheckOptions): Promise<void>;
|
154 | /**
|
155 | * Comment on a PR. Only one comment will be present on the PR, Older comments are removed.
|
156 | * You can use the "context" option to multiple comments on a PR.
|
157 | *
|
158 | * @param options - Options for the comment functionality
|
159 | */
|
160 | comment(options: ICommentOptions): Promise<void>;
|
161 | /**
|
162 | * Update the body of a PR with a message. Only one message will be present in the PR,
|
163 | * Older messages are removed. You can use the "context" option to multiple message
|
164 | * in a PR body.
|
165 | *
|
166 | * @param options - Options
|
167 | */
|
168 | prBody(options: ICommentOptions): Promise<void>;
|
169 | /**
|
170 | * Calculate the version bump for the current state of the repository.
|
171 | */
|
172 | version(options?: IVersionOptions): Promise<void>;
|
173 | /**
|
174 | * Calculate the the changelog and commit it.
|
175 | */
|
176 | changelog(options?: IChangelogOptions): Promise<void>;
|
177 | /**
|
178 | * Make a release to the git remote with the changes.
|
179 | */
|
180 | runRelease(options?: IReleaseOptions): Promise<void>;
|
181 | /** Create a canary (or test) version of the project */
|
182 | canary(options?: ICanaryOptions): Promise<{
|
183 | newVersion: string;
|
184 | commitsInRelease: IExtendedCommit[];
|
185 | } | undefined>;
|
186 | |
187 |
|
188 |
|
189 |
|
190 | next(options: INextOptions): Promise<{
|
191 | newVersion: string;
|
192 | commitsInRelease: IExtendedCommit[];
|
193 | }>;
|
194 | |
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | shipit(options?: IShipItOptions): Promise<void>;
|
203 |
|
204 | getCurrentVersion(lastRelease: string): Promise<string>;
|
205 | |
206 |
|
207 |
|
208 | checkEnv(pluginName: string, key: string): void;
|
209 |
|
210 | private publishLatest;
|
211 |
|
212 | private getPrNumber;
|
213 |
|
214 | private startGit;
|
215 |
|
216 | private getVersion;
|
217 |
|
218 | private makeChangelog;
|
219 |
|
220 | private makeRelease;
|
221 |
|
222 | readonly checkClean: () => Promise<void>;
|
223 |
|
224 | readonly prefixRelease: (release: string) => string;
|
225 |
|
226 | private createErrorMessage;
|
227 | |
228 |
|
229 |
|
230 | private setGitUser;
|
231 |
|
232 | private getRepo;
|
233 | |
234 |
|
235 |
|
236 | private loadPlugins;
|
237 | }
|
238 | export * from './auto-args';
|
239 | export { ILogger } from './utils/logger';
|
240 | export { IPlugin } from './utils/load-plugins';
|
241 | export { default as Auto } from './auto';
|
242 | export { default as SEMVER } from './semver';
|
243 | export { default as execPromise } from './utils/exec-promise';
|
244 | export { VersionLabel } from './release';
|
245 |
|
\ | No newline at end of file |