-
Notifications
You must be signed in to change notification settings - Fork 495
/
index.ts
175 lines (151 loc) 路 4.81 KB
/
index.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// NB: Bolt check uses a different dependnecy set to every other package.
// You need think before you use this.
const DEPENDENCY_TYPES = [
"dependencies",
"devDependencies",
"peerDependencies",
"optionalDependencies",
] as const;
export type VersionType = "major" | "minor" | "patch" | "none";
export type DependencyType = typeof DEPENDENCY_TYPES[number];
export type AccessType = "public" | "restricted";
export type Release = { name: string; type: VersionType };
// This is a release that has been modified to include all relevant information
// about releasing - it is calculated and doesn't make sense as an artefact
export type ComprehensiveRelease = {
name: string;
type: VersionType;
oldVersion: string;
newVersion: string;
changesets: string[];
};
export type Changeset = {
summary: string;
releases: Array<Release>;
};
export type NewChangeset = Changeset & {
id: string;
};
export type ReleasePlan = {
changesets: NewChangeset[];
releases: ComprehensiveRelease[];
preState: PreState | undefined;
};
export type PackageJSON = {
name: string;
version: string;
dependencies?: { [key: string]: string };
peerDependencies?: { [key: string]: string };
devDependencies?: { [key: string]: string };
optionalDependencies?: { [key: string]: string };
resolutions?: { [key: string]: string };
private?: boolean;
publishConfig?: {
access?: AccessType;
directory?: string;
registry?: string;
};
};
export type PackageGroup = ReadonlyArray<string>;
export type Fixed = ReadonlyArray<PackageGroup>;
export type Linked = ReadonlyArray<PackageGroup>;
export interface PrivatePackages {
version: boolean;
tag: boolean;
}
export type Config = {
changelog: false | readonly [string, any];
commit: false | readonly [string, any];
useMergeCommits: boolean;
fixed: Fixed;
linked: Linked;
access: AccessType;
baseBranch: string;
changedFilePatterns: readonly string[];
/** Features enabled for Private packages */
privatePackages: PrivatePackages;
/** The minimum bump type to trigger automatic update of internal dependencies that are part of the same release */
updateInternalDependencies: "patch" | "minor";
ignore: ReadonlyArray<string>;
/** This is supposed to be used with pnpm's `link-workspace-packages: false` and Berry's `enableTransparentWorkspaces: false` */
bumpVersionsWithWorkspaceProtocolOnly?: boolean;
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: Omit<
Required<ExperimentalOptions>,
"useCalculatedVersionForSnapshots"
>;
snapshot: {
useCalculatedVersion: boolean;
prereleaseTemplate: string | null;
};
};
export type WrittenConfig = {
changelog?: false | readonly [string, any] | string;
commit?: boolean | readonly [string, any] | string;
useMergeCommits?: boolean;
fixed?: Fixed;
linked?: Linked;
access?: AccessType;
baseBranch?: string;
changedFilePatterns?: readonly string[];
/** Opt in to tracking non-npm / private packages */
privatePackages?:
| false
| {
version?: boolean;
tag?: boolean;
};
/** The minimum bump type to trigger automatic update of internal dependencies that are part of the same release */
updateInternalDependencies?: "patch" | "minor";
ignore?: ReadonlyArray<string>;
bumpVersionsWithWorkspaceProtocolOnly?: boolean;
snapshot?: {
useCalculatedVersion?: boolean;
prereleaseTemplate?: string;
};
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH?: ExperimentalOptions;
};
export type ExperimentalOptions = {
onlyUpdatePeerDependentsWhenOutOfRange?: boolean;
updateInternalDependents?: "always" | "out-of-range";
/** @deprecated Since snapshot feature is now stable, you should migrate to use "snapshot.useCalculatedVersion". */
useCalculatedVersionForSnapshots?: boolean;
};
export type NewChangesetWithCommit = NewChangeset & { commit?: string };
export type ModCompWithPackage = ComprehensiveRelease & {
packageJson: PackageJSON;
dir: string;
};
export type GetReleaseLine = (
changeset: NewChangesetWithCommit,
type: VersionType,
changelogOpts: null | Record<string, any>
) => Promise<string>;
export type GetDependencyReleaseLine = (
changesets: NewChangesetWithCommit[],
dependenciesUpdated: ModCompWithPackage[],
changelogOpts: any
) => Promise<string>;
export type ChangelogFunctions = {
getReleaseLine: GetReleaseLine;
getDependencyReleaseLine: GetDependencyReleaseLine;
};
export type GetAddMessage = (
changeset: Changeset,
commitOptions: any
) => Promise<string>;
export type GetVersionMessage = (
releasePlan: ReleasePlan,
commitOptions: any
) => Promise<string>;
export type CommitFunctions = {
getAddMessage?: GetAddMessage;
getVersionMessage?: GetVersionMessage;
};
export type PreState = {
mode: "pre" | "exit";
tag: string;
initialVersions: {
[pkgName: string]: string;
};
changesets: string[];
};