forked from intuit/auto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-hooks.ts
76 lines (71 loc) · 3 KB
/
make-hooks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import {
AsyncParallelHook,
AsyncSeriesBailHook,
AsyncSeriesWaterfallHook,
SyncHook,
AsyncSeriesHook,
} from "tapable";
import { IAutoHooks } from "../auto";
import { IChangelogHooks } from "../changelog";
import { ILogParseHooks } from "../log-parse";
import { IReleaseHooks } from "../release";
import { InteractiveInitHooks } from "../init";
/** Make the hooks for "auto" */
export const makeHooks = (): IAutoHooks => ({
beforeRun: new AsyncSeriesHook(["config"]),
modifyConfig: new AsyncSeriesWaterfallHook(["config"]),
validateConfig: new AsyncSeriesBailHook(["name", "options"]),
beforeShipIt: new AsyncSeriesHook(["context"]),
afterChangelog: new AsyncSeriesHook(["context"]),
beforeCommitChangelog: new AsyncSeriesHook(["context"]),
afterShipIt: new AsyncParallelHook(["context"]),
makeRelease: new AsyncSeriesBailHook(["releaseInfo"]),
afterRelease: new AsyncParallelHook(["releaseInfo"]),
onCreateRelease: new SyncHook(["options"]),
onCreateChangelog: new SyncHook(["changelog", "version"]),
onCreateLogParse: new SyncHook(["logParse"]),
getAuthor: new AsyncSeriesBailHook(),
getPreviousVersion: new AsyncSeriesBailHook(),
getRepository: new AsyncSeriesBailHook(),
prCheck: new AsyncSeriesBailHook(["prInformation"]),
beforeVersion: new AsyncSeriesHook(["context"]),
version: new AsyncSeriesHook(["version"]),
afterVersion: new AsyncSeriesHook(["context"]),
publish: new AsyncSeriesHook(["version"]),
afterPublish: new AsyncSeriesHook(),
canary: new AsyncSeriesBailHook(["canaryContext"]),
next: new AsyncSeriesWaterfallHook(["preReleaseVersions", "context"]),
});
/** Make the hooks for "Release" */
export const makeReleaseHooks = (): IReleaseHooks => ({
onCreateChangelog: new SyncHook(["changelog", "version"]),
createChangelogTitle: new AsyncSeriesBailHook([]),
onCreateLogParse: new SyncHook(["logParse"]),
});
/** Make the hooks for "LogParse" */
export const makeLogParseHooks = (): ILogParseHooks => ({
parseCommit: new AsyncSeriesWaterfallHook(["commit"]),
omitCommit: new AsyncSeriesBailHook(["commit"]),
});
/** Make the hooks for "InteractiveInit" */
export const makeInteractiveInitHooks = (): InteractiveInitHooks => ({
writeRcFile: new AsyncSeriesBailHook(["rcFile"]),
getRepo: new AsyncSeriesBailHook([]),
getAuthor: new AsyncSeriesBailHook([]),
createEnv: new AsyncSeriesWaterfallHook(["vars"]),
configurePlugin: new AsyncSeriesBailHook(["pluginName"]),
});
/** Make the hooks for "Changelog" */
export const makeChangelogHooks = (): IChangelogHooks => ({
addToBody: new AsyncSeriesWaterfallHook(["notes", "commits"]),
sortChangelogLines: new AsyncSeriesWaterfallHook(["lines"]),
renderChangelogLine: new AsyncSeriesWaterfallHook(["line", "commit"]),
renderChangelogTitle: new AsyncSeriesBailHook(["commits", "lineRender"]),
renderChangelogAuthor: new AsyncSeriesBailHook([
"author",
"commit",
"options",
]),
renderChangelogAuthorLine: new AsyncSeriesBailHook(["author", "user"]),
omitReleaseNotes: new AsyncSeriesBailHook(["commit"]),
});