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