1 | import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook, SyncWaterfallHook } from 'tapable';
|
2 | import { ArgsType, ICanaryCommandOptions, IChangelogOptions, ICommentCommandOptions, ICreateLabelsCommandOptions, IInitCommandOptions, ILabelCommandOptions, IPRCheckCommandOptions, IPRCommandOptions, IReleaseCommandOptions, IShipItCommandOptions } from './cli/args';
|
3 | import Changelog from './changelog';
|
4 | import Git from './git';
|
5 | import LogParse, { IExtendedCommit } from './log-parse';
|
6 | import Release, { ILabelDefinitionMap, IReleaseOptions, VersionLabel } from './release';
|
7 | import SEMVER from './semver';
|
8 | import { ILogger } from './utils/logger';
|
9 | interface IAuthor {
|
10 | name?: string;
|
11 | email?: string;
|
12 | }
|
13 | interface IRepository {
|
14 | owner?: string;
|
15 | repo?: string;
|
16 | token?: string;
|
17 | }
|
18 | export interface IAutoHooks {
|
19 | modifyConfig: SyncWaterfallHook<[IReleaseOptions]>;
|
20 | beforeRun: SyncHook<[IReleaseOptions]>;
|
21 | beforeShipIt: SyncHook<[]>;
|
22 | afterShipIt: AsyncParallelHook<[string | undefined, IExtendedCommit[]]>;
|
23 | afterRelease: AsyncParallelHook<[string | undefined, IExtendedCommit[]]>;
|
24 | getAuthor: AsyncSeriesBailHook<[], IAuthor | void>;
|
25 | getPreviousVersion: AsyncSeriesBailHook<[(release: string) => string], string>;
|
26 | getRepository: AsyncSeriesBailHook<[], IRepository | void>;
|
27 | onCreateRelease: SyncHook<[Release]>;
|
28 | onCreateLogParse: SyncHook<[LogParse]>;
|
29 | onCreateChangelog: SyncHook<[Changelog]>;
|
30 | version: AsyncParallelHook<[SEMVER]>;
|
31 | afterVersion: AsyncParallelHook<[]>;
|
32 | publish: AsyncParallelHook<[SEMVER]>;
|
33 | canary: AsyncSeriesBailHook<[SEMVER, string], string | {
|
34 | error: string;
|
35 | }>;
|
36 | afterPublish: AsyncParallelHook<[]>;
|
37 | }
|
38 | export default class Auto {
|
39 | hooks: IAutoHooks;
|
40 | logger: ILogger;
|
41 | args: ArgsType;
|
42 | baseBranch: string;
|
43 | config?: IReleaseOptions;
|
44 | release?: Release;
|
45 | git?: Git;
|
46 | labels?: ILabelDefinitionMap;
|
47 | semVerLabels?: Map<VersionLabel, string>;
|
48 | constructor(args: ArgsType);
|
49 | /**
|
50 | * Load the .autorc from the file system, set up defaults, combine with CLI args
|
51 | * load the extends property, load the plugins and start the git remote interface.
|
52 | */
|
53 | loadConfig(): Promise<void>;
|
54 | /**
|
55 | * Interactive prompt for initializing an .autorc
|
56 | */
|
57 | init(options?: IInitCommandOptions): Promise<void>;
|
58 | /**
|
59 | * Create all of the user's labels on the git remote if the don't already exist
|
60 | *
|
61 | * @param options Options for the createLabels functionality
|
62 | */
|
63 | createLabels(options?: ICreateLabelsCommandOptions): Promise<void>;
|
64 | /**
|
65 | * Get the labels on a specific PR. Defaults to the labels of the last merged PR
|
66 | *
|
67 | * @param options Options for the createLabels functionality
|
68 | */
|
69 | label({ pr }?: ILabelCommandOptions): Promise<void>;
|
70 | /**
|
71 | * Create a status on a PR.
|
72 | *
|
73 | * @param options Options for the pr status functionality
|
74 | */
|
75 | pr({ dryRun, pr, url, ...options }: IPRCommandOptions): Promise<void>;
|
76 | /**
|
77 | * Check that a PR has a SEMVER label. Set a success status on the PR.
|
78 | *
|
79 | * @param options Options for the pr check functionality
|
80 | */
|
81 | prCheck({ dryRun, pr, url, ...options }: IPRCheckCommandOptions): Promise<void>;
|
82 | /**
|
83 | * Comment on a PR. Only one comment will be present on the PR, Older comments are removed.
|
84 | * You can use the "context" option to multiple comments on a PR.
|
85 | *
|
86 | * @param options Options for the comment functionality
|
87 | */
|
88 | comment({ message, pr, context, dryRun }: ICommentCommandOptions): Promise<void>;
|
89 | /**
|
90 | * Update the body of a PR with a message. Only one message will be present in the PR,
|
91 | * Older messages are removed. You can use the "context" option to multiple message
|
92 | * in a PR body.
|
93 | *
|
94 | * @param options Options
|
95 | */
|
96 | prBody({ message, pr, context, dryRun }: ICommentCommandOptions): Promise<void>;
|
97 | /**
|
98 | * Calculate the version bump for the current state of the repository.
|
99 | */
|
100 | version(): Promise<void>;
|
101 | /**
|
102 | * Calculate the the changelog and commit it.
|
103 | */
|
104 | changelog(options?: IChangelogOptions): Promise<void>;
|
105 | /**
|
106 | * Make a release to the git remote with the changes.
|
107 | */
|
108 | runRelease(options: IReleaseCommandOptions): Promise<void>;
|
109 | canary(options?: ICanaryCommandOptions): Promise<{
|
110 | newVersion: string;
|
111 | commitsInRelease: IExtendedCommit[];
|
112 | } | undefined>;
|
113 | |
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | shipit(options?: IShipItCommandOptions): Promise<void>;
|
122 | getCurrentVersion(lastRelease: string): Promise<string>;
|
123 | private publishLatest;
|
124 | private getPrNumber;
|
125 | private startGit;
|
126 | private getVersion;
|
127 | private makeChangelog;
|
128 | private makeRelease;
|
129 | private readonly prefixRelease;
|
130 | private createErrorMessage;
|
131 | |
132 |
|
133 |
|
134 | private setGitUser;
|
135 | private getRepo;
|
136 | |
137 |
|
138 |
|
139 | private loadPlugins;
|
140 | }
|
141 | export {};
|