rylease 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -851
- package/dist/cli.mjs +1 -375
- package/dist/index-BGDTM9bX.d.cts +1672 -0
- package/dist/index-BGDTM9bX.d.cts.map +1 -0
- package/dist/index-CDKUm2-t.d.mts +1671 -0
- package/dist/index-CDKUm2-t.d.mts.map +1 -0
- package/dist/index.cjs +35 -4991
- package/dist/index.d.cts +2 -1572
- package/dist/index.d.mts +2 -1571
- package/dist/index.mjs +1 -4928
- package/dist/internal.cjs +239 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +50 -0
- package/dist/internal.d.cts.map +1 -0
- package/dist/internal.d.mts +50 -0
- package/dist/internal.d.mts.map +1 -0
- package/dist/internal.mjs +232 -0
- package/dist/internal.mjs.map +1 -0
- package/dist/src-BtTYwep4.cjs +6004 -0
- package/dist/src-BtTYwep4.cjs.map +1 -0
- package/dist/src-dp4Eayux.mjs +5758 -0
- package/dist/src-dp4Eayux.mjs.map +1 -0
- package/package.json +17 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,1672 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import * as core from "zod/v4/core";
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/core/options.d.ts
|
|
5
|
+
/** A step's options: a zod shape, from `zod` or `zod/mini`. */
|
|
6
|
+
type OptionsShape = core.$ZodShape;
|
|
7
|
+
/** What a step accepts: options with a default may be left out. */
|
|
8
|
+
type OptionsInput<S extends OptionsShape> = core.$InferObjectInput<S, Empty>;
|
|
9
|
+
/** What a step's `run` receives: every default applied. */
|
|
10
|
+
type OptionsValue<S extends OptionsShape> = core.$InferObjectOutput<S, Empty>;
|
|
11
|
+
/** An object type with no properties. */
|
|
12
|
+
type Empty = Record<never, never>;
|
|
13
|
+
/** Options that don't match a step's schema; the message lists every problem. */
|
|
14
|
+
declare class OptionsError extends Error {
|
|
15
|
+
readonly issues: readonly string[];
|
|
16
|
+
constructor(issues: readonly string[]);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates options against a shape, applying defaults. Unknown keys are
|
|
20
|
+
* rejected. Each problem is reported with `path` prepended, e.g.
|
|
21
|
+
* `conventional/determine-kind.types.docs: Invalid option: ...`.
|
|
22
|
+
*/
|
|
23
|
+
declare function parseOptions<S extends OptionsShape>(shape: S, value: unknown, path: string): OptionsValue<S>;
|
|
24
|
+
declare function joinPath(path: string, keys?: readonly PropertyKey[]): string;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/cargo/workspaces.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* The crates of a Cargo workspace, as components named after them, each
|
|
29
|
+
* depending on the workspace crates it lists as dependencies.
|
|
30
|
+
*/
|
|
31
|
+
declare const cargoWorkspaces: Factory<"components", "cargo/workspaces", {
|
|
32
|
+
private: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
|
+
}, ComponentSource>;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/components/dart/workspaces.d.ts
|
|
37
|
+
/**
|
|
38
|
+
* The packages of a pub workspace, or a Melos one, as components named after
|
|
39
|
+
* them, each depending on the workspace packages it lists as dependencies.
|
|
40
|
+
* The root is one too when it has a `version`, e.g. a Flutter app whose
|
|
41
|
+
* packages live beside it.
|
|
42
|
+
*/
|
|
43
|
+
declare const dartWorkspaces: Factory<"components", "dart/workspaces", {
|
|
44
|
+
private: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
46
|
+
}, ComponentSource>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/npm/workspaces.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* The packages of an npm, Yarn or pnpm workspace, as components named after
|
|
51
|
+
* them, each depending on the workspace packages it lists as dependencies.
|
|
52
|
+
*/
|
|
53
|
+
declare const npmWorkspaces: Factory<"components", "npm/workspaces", {
|
|
54
|
+
private: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
56
|
+
}, ComponentSource>;
|
|
57
|
+
declare namespace index_d_exports$4 {
|
|
58
|
+
export { cargoWorkspaces, dartWorkspaces, npmWorkspaces };
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/core/factory.d.ts
|
|
62
|
+
/** What a factory makes: a step, preset, scheme, history or component source. */
|
|
63
|
+
type FactoryKind = "step" | "preset" | "scheme" | "history" | "components";
|
|
64
|
+
/**
|
|
65
|
+
* Something configured with options declared as a zod shape, the same way in
|
|
66
|
+
* TypeScript as in a workflow file; the options argument is optional when
|
|
67
|
+
* every option is.
|
|
68
|
+
*/
|
|
69
|
+
interface Factory<K extends FactoryKind, N extends string, S extends OptionsShape, R> {
|
|
70
|
+
(...options: Empty extends OptionsInput<S> ? [options?: OptionsInput<S>] : [options: OptionsInput<S>]): R;
|
|
71
|
+
readonly kind: K;
|
|
72
|
+
readonly name: N;
|
|
73
|
+
readonly description: string | undefined;
|
|
74
|
+
readonly options: S;
|
|
75
|
+
}
|
|
76
|
+
/** Any factory of a kind, whatever its name or options. */
|
|
77
|
+
interface AnyFactory<K extends FactoryKind = FactoryKind, R = unknown> {
|
|
78
|
+
(options?: any): R;
|
|
79
|
+
readonly kind: K;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly description: string | undefined;
|
|
82
|
+
readonly options: OptionsShape;
|
|
83
|
+
}
|
|
84
|
+
interface FactoryDefinition<N extends string, S extends OptionsShape, R> {
|
|
85
|
+
/** Identifies it in reports and in workflow files, e.g. `calver`. */
|
|
86
|
+
name: N;
|
|
87
|
+
/** One line on what it does, for generated docs. */
|
|
88
|
+
description?: string;
|
|
89
|
+
/** A zod shape; use `.default()` for optional options and `.describe()` to document them. */
|
|
90
|
+
options?: S;
|
|
91
|
+
create: (options: OptionsValue<S>) => R;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/core/history.d.ts
|
|
95
|
+
/** Where a component's previous release is found: tags, a file, ... */
|
|
96
|
+
interface History {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
find(input: HistoryInput): Promise<Found | undefined>;
|
|
99
|
+
/**
|
|
100
|
+
* The highest counter of a channel's versions of a target, among every
|
|
101
|
+
* release, not only those on HEAD, so channel versions never collide.
|
|
102
|
+
*/
|
|
103
|
+
count?(input: HistoryInput & {
|
|
104
|
+
target: string;
|
|
105
|
+
}): Promise<number>;
|
|
106
|
+
/** Whether a release's tag exists already. */
|
|
107
|
+
exists?(input: HistoryInput & {
|
|
108
|
+
releaseTag: string;
|
|
109
|
+
}): Promise<boolean>;
|
|
110
|
+
}
|
|
111
|
+
interface HistoryInput {
|
|
112
|
+
env: Environment;
|
|
113
|
+
component: ComponentInfo;
|
|
114
|
+
scheme: Scheme;
|
|
115
|
+
/** The component's tag template, with `{name}` filled in, e.g. `v{version}`. */
|
|
116
|
+
tag: string;
|
|
117
|
+
/** The channel being released on; without one, only stable releases count. */
|
|
118
|
+
channel?: ResolvedChannel | undefined;
|
|
119
|
+
/** Every channel, to tell their versions from stable ones. */
|
|
120
|
+
channels: readonly ResolvedChannel[];
|
|
121
|
+
}
|
|
122
|
+
/** The previous release; `undefined` from `find` when there's none. */
|
|
123
|
+
interface Found {
|
|
124
|
+
/** Absent when the release's version isn't one of the scheme's. */
|
|
125
|
+
version?: string;
|
|
126
|
+
/** Its commit; without one, changes are collected from all history. */
|
|
127
|
+
ref?: string;
|
|
128
|
+
tag?: string;
|
|
129
|
+
/** e.g. `v1.4.0 at abc1234, nearest on HEAD`. */
|
|
130
|
+
reason: string;
|
|
131
|
+
/**
|
|
132
|
+
* On a channel, the nearest stable release, when `version` is a channel
|
|
133
|
+
* version; new versions are bumped from it.
|
|
134
|
+
*/
|
|
135
|
+
stable?: {
|
|
136
|
+
version: string;
|
|
137
|
+
ref?: string;
|
|
138
|
+
tag?: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* A release that's been prepared but not released, e.g. by a merged
|
|
142
|
+
* release pull request: only its `release` steps run.
|
|
143
|
+
*/
|
|
144
|
+
pending?: Pending;
|
|
145
|
+
}
|
|
146
|
+
/** A prepared release, as a history finds it. */
|
|
147
|
+
interface Pending {
|
|
148
|
+
version: string;
|
|
149
|
+
notes?: string;
|
|
150
|
+
kind?: ReleaseKind;
|
|
151
|
+
previousVersion?: string;
|
|
152
|
+
/** e.g. `prepared in #12`. */
|
|
153
|
+
reason: string;
|
|
154
|
+
}
|
|
155
|
+
/** Defines where previous releases are found, with options as a zod shape. */
|
|
156
|
+
declare function defineHistory<const N extends string, S extends OptionsShape>(definition: FactoryDefinition<N, S, History>): Factory<"history", N, S, History>;
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/core/types.d.ts
|
|
159
|
+
/** Every phase, in the order the engine runs its steps. */
|
|
160
|
+
declare const PHASES: readonly ["read-changes", "determine-kind", "determine-notes", "write", "stage", "release"];
|
|
161
|
+
type Phase = (typeof PHASES)[number];
|
|
162
|
+
/**
|
|
163
|
+
* How much a release changes, whatever the version scheme: the scheme decides
|
|
164
|
+
* what each kind bumps, e.g. semver's `MAJOR.minor.patch`.
|
|
165
|
+
*/
|
|
166
|
+
declare const KINDS: readonly ["breaking", "feature", "fix", "none"];
|
|
167
|
+
type Kind = (typeof KINDS)[number];
|
|
168
|
+
/** A kind that actually produces a release; `none` releases nothing. */
|
|
169
|
+
type ReleaseKind = Exclude<Kind, "none">;
|
|
170
|
+
/** A single, source-agnostic change (a commit section, an issue, a PR, ...). */
|
|
171
|
+
interface Change {
|
|
172
|
+
title?: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
/** Where this change came from, e.g. `commit aefc3af`. */
|
|
175
|
+
reason: string;
|
|
176
|
+
/** Where to read more, e.g. `{ label: "aefc3af", url: ".../commit/aefc3af..." }`. */
|
|
177
|
+
link?: {
|
|
178
|
+
label: string;
|
|
179
|
+
url: string;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* How the source categorized it, e.g. a pull request's labels, or the
|
|
183
|
+
* `### Fixed` section of a changelog.
|
|
184
|
+
*/
|
|
185
|
+
labels?: string[];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A versioned unit, as steps see it: one package, a Go module, a Docker
|
|
189
|
+
* image, or several packages released together under one version.
|
|
190
|
+
*/
|
|
191
|
+
interface ComponentInfo {
|
|
192
|
+
name: string;
|
|
193
|
+
/** Its directory, relative to `env.cwd`; `.` for the whole project. */
|
|
194
|
+
path: string;
|
|
195
|
+
/** Components it depends on, by name; they're released first. */
|
|
196
|
+
dependsOn: readonly string[];
|
|
197
|
+
/**
|
|
198
|
+
* Pathspecs for git: its directory, without the directories of components
|
|
199
|
+
* inside it. Empty when every path counts.
|
|
200
|
+
*/
|
|
201
|
+
pathspec: readonly string[];
|
|
202
|
+
}
|
|
203
|
+
interface ChangesOutput {
|
|
204
|
+
changes: Change[];
|
|
205
|
+
/** e.g. `6 changes in 4 commits since 1a2b3c4`. */
|
|
206
|
+
reason: string;
|
|
207
|
+
}
|
|
208
|
+
interface KindOutput {
|
|
209
|
+
kind: Kind;
|
|
210
|
+
/**
|
|
211
|
+
* Releases exactly this version instead of bumping by the kind, e.g. from
|
|
212
|
+
* a `Release-As:` footer. It must be valid in the scheme, and later than
|
|
213
|
+
* the previous version.
|
|
214
|
+
*/
|
|
215
|
+
version?: string;
|
|
216
|
+
/** e.g. `'feat!' in title (commit aefc3af)`. */
|
|
217
|
+
reason: string;
|
|
218
|
+
}
|
|
219
|
+
interface NotesOutput {
|
|
220
|
+
notes: string;
|
|
221
|
+
/** e.g. `feature release, 3 features, 1 fix`. */
|
|
222
|
+
reason: string;
|
|
223
|
+
}
|
|
224
|
+
interface ReleaseOutput {
|
|
225
|
+
output: unknown;
|
|
226
|
+
/** Files the step changed (or would change in a dry run), relative to `cwd`. */
|
|
227
|
+
files?: string[];
|
|
228
|
+
/** e.g. `wrote 1.3.0 to package.json`. */
|
|
229
|
+
reason: string;
|
|
230
|
+
}
|
|
231
|
+
/** What `write` and `stage` steps return. */
|
|
232
|
+
interface WriteOutput extends ReleaseOutput {
|
|
233
|
+
/**
|
|
234
|
+
* Leaves the release to later, e.g. once a release pull request merges:
|
|
235
|
+
* every `release` step is skipped with this reason, and the run is
|
|
236
|
+
* `pending`.
|
|
237
|
+
*/
|
|
238
|
+
defer?: string;
|
|
239
|
+
}
|
|
240
|
+
/** What the steps of each phase must return. */
|
|
241
|
+
interface StepOutputs {
|
|
242
|
+
"read-changes": ChangesOutput;
|
|
243
|
+
"determine-kind": KindOutput;
|
|
244
|
+
"determine-notes": NotesOutput;
|
|
245
|
+
write: WriteOutput;
|
|
246
|
+
stage: WriteOutput;
|
|
247
|
+
release: ReleaseOutput;
|
|
248
|
+
}
|
|
249
|
+
/** The output of a prior `write`, `stage` or `release` step, as later ones see it. */
|
|
250
|
+
interface ReleaseResult {
|
|
251
|
+
name: string;
|
|
252
|
+
output: unknown;
|
|
253
|
+
files: readonly string[];
|
|
254
|
+
}
|
|
255
|
+
/** Where a component's release starts from; found before any step runs. */
|
|
256
|
+
interface Previous {
|
|
257
|
+
component: ComponentInfo;
|
|
258
|
+
/** Absent on a first release, or when the scheme changed since the last one. */
|
|
259
|
+
previousVersion?: string;
|
|
260
|
+
/** The commit of the previous release; changes are collected since it. */
|
|
261
|
+
previousRef?: string;
|
|
262
|
+
/** The tag of the previous release, when it was found by its tag. */
|
|
263
|
+
previousTag?: string;
|
|
264
|
+
}
|
|
265
|
+
/** The release being made, from `determine-notes` on. */
|
|
266
|
+
interface Next {
|
|
267
|
+
kind: ReleaseKind;
|
|
268
|
+
version: string;
|
|
269
|
+
/** The release's tag, e.g. `v1.2.0`. */
|
|
270
|
+
tag: string;
|
|
271
|
+
/**
|
|
272
|
+
* Values for `{placeholders}` in templates: `version`, `tag`, `name`, and
|
|
273
|
+
* the scheme's own, e.g. semver's `major`, `minor` and `patch`.
|
|
274
|
+
*/
|
|
275
|
+
placeholders: Readonly<Record<string, string>>;
|
|
276
|
+
/** The components it depends on that are released along with it. */
|
|
277
|
+
dependencies: readonly Dependency[];
|
|
278
|
+
}
|
|
279
|
+
/** A dependency released along with a component. */
|
|
280
|
+
interface Dependency {
|
|
281
|
+
name: string;
|
|
282
|
+
version: string;
|
|
283
|
+
previousVersion?: string;
|
|
284
|
+
kind: ReleaseKind;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* What a step receives for one component, by phase. Values from earlier phases
|
|
288
|
+
* are always present; the value of a step's own phase is only present when
|
|
289
|
+
* an earlier step of the same phase already ran.
|
|
290
|
+
*/
|
|
291
|
+
interface StepResults {
|
|
292
|
+
"read-changes": Previous & {
|
|
293
|
+
changes?: Change[];
|
|
294
|
+
};
|
|
295
|
+
"determine-kind": Previous & {
|
|
296
|
+
changes: Change[];
|
|
297
|
+
kind?: Kind;
|
|
298
|
+
};
|
|
299
|
+
"determine-notes": Previous & Next & {
|
|
300
|
+
changes: Change[];
|
|
301
|
+
notes?: string;
|
|
302
|
+
};
|
|
303
|
+
write: Previous & Next & {
|
|
304
|
+
changes: Change[];
|
|
305
|
+
notes: string;
|
|
306
|
+
releases: readonly ReleaseResult[];
|
|
307
|
+
};
|
|
308
|
+
stage: StepResults["write"];
|
|
309
|
+
release: StepResults["write"];
|
|
310
|
+
}
|
|
311
|
+
interface Environment {
|
|
312
|
+
/** Root directory of the project being released. */
|
|
313
|
+
cwd: string;
|
|
314
|
+
/** Current branch name. */
|
|
315
|
+
branch: string;
|
|
316
|
+
/** When set, steps must not cause side effects. */
|
|
317
|
+
dryRun: boolean;
|
|
318
|
+
/** The channel being released on; absent for a stable release. */
|
|
319
|
+
channel?: RunChannel;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* How a step runs: once per component (`each`, the default), or once with
|
|
323
|
+
* every component (`all`), e.g. to commit or push their releases together.
|
|
324
|
+
*/
|
|
325
|
+
type Scope = "each" | "all";
|
|
326
|
+
type StepStatus = "ok" | "skipped" | "failed";
|
|
327
|
+
/** What the engine itself records: the previous version, and the next. */
|
|
328
|
+
type EnginePhase = "read-version" | "determine-version";
|
|
329
|
+
/** The audit record of a single step, or of the engine's own work. */
|
|
330
|
+
interface StepRecord {
|
|
331
|
+
phase: Phase | EnginePhase;
|
|
332
|
+
name: string;
|
|
333
|
+
/** The component it ran for; absent for `all` steps. */
|
|
334
|
+
component?: string;
|
|
335
|
+
status: StepStatus;
|
|
336
|
+
durationMs: number;
|
|
337
|
+
reason: string;
|
|
338
|
+
output?: unknown;
|
|
339
|
+
error?: unknown;
|
|
340
|
+
}
|
|
341
|
+
interface Shared<Ctx> {
|
|
342
|
+
env: Environment;
|
|
343
|
+
/** User-defined state shared by every step. Never used by bundled steps. */
|
|
344
|
+
context: Ctx;
|
|
345
|
+
/** Records of every step that ran before this one. */
|
|
346
|
+
history: readonly StepRecord[];
|
|
347
|
+
}
|
|
348
|
+
/** What a step receives, for one component. */
|
|
349
|
+
type StepInput<T extends Phase, Ctx = unknown, N extends Fact = never> = Narrow<StepResults[T], N> & Shared<Ctx>;
|
|
350
|
+
/** What an `all` step receives: every component that's still releasing. */
|
|
351
|
+
type AllStepInput<T extends Phase, Ctx = unknown, N extends Fact = never> = {
|
|
352
|
+
components: readonly Narrow<StepResults[T], N>[];
|
|
353
|
+
} & Shared<Ctx>;
|
|
354
|
+
/** What a step returns, for one component. */
|
|
355
|
+
type StepOutput<T extends Phase, P extends Fact = never> = ProvidedOutput<StepOutputs[T], P>;
|
|
356
|
+
/**
|
|
357
|
+
* What an `all` step returns: in `write`, `stage` and `release`, one result for all of them;
|
|
358
|
+
* otherwise a result per component, by name, leaving out those it doesn't
|
|
359
|
+
* change.
|
|
360
|
+
*/
|
|
361
|
+
type AllStepOutput<T extends Phase, P extends Fact = never> = T extends "release" ? ReleaseOutput : T extends "write" | "stage" ? WriteOutput : {
|
|
362
|
+
results: Partial<Record<string, StepOutput<T, P>>>;
|
|
363
|
+
reason: string;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Whether a step runs, decided just before it would, from what it would
|
|
367
|
+
* receive. `source` describes it in reports, e.g. the expression it came from.
|
|
368
|
+
*/
|
|
369
|
+
interface StepCondition<I> {
|
|
370
|
+
(input: I): boolean;
|
|
371
|
+
readonly source?: string;
|
|
372
|
+
}
|
|
373
|
+
interface StepBase<T extends Phase> {
|
|
374
|
+
phase: T;
|
|
375
|
+
name: string;
|
|
376
|
+
/** Facts the step relies on, e.g. `changes.labels`; checked before anything runs. */
|
|
377
|
+
needs?: readonly Fact[];
|
|
378
|
+
/** Facts the step guarantees, e.g. that every change has `labels`; checked on its output. */
|
|
379
|
+
provides?: readonly Fact[];
|
|
380
|
+
/** The preset that made the step, with the scheme and history it provides. */
|
|
381
|
+
preset?: StepPreset;
|
|
382
|
+
}
|
|
383
|
+
/** A preset, as the steps it makes carry it. */
|
|
384
|
+
interface StepPreset {
|
|
385
|
+
name: string;
|
|
386
|
+
scheme?: Scheme;
|
|
387
|
+
history?: History | readonly History[];
|
|
388
|
+
}
|
|
389
|
+
interface EachStepDefinition<T extends Phase, Ctx = unknown> extends StepBase<T> {
|
|
390
|
+
scope?: "each";
|
|
391
|
+
/** When set, the step only runs if this returns true; otherwise it's skipped. */
|
|
392
|
+
if?: StepCondition<StepInput<T, Ctx>>;
|
|
393
|
+
run: (input: StepInput<T, Ctx>) => StepOutputs[T] | Promise<StepOutputs[T]>;
|
|
394
|
+
}
|
|
395
|
+
interface AllStepDefinition<T extends Phase, Ctx = unknown> extends StepBase<T> {
|
|
396
|
+
scope: "all";
|
|
397
|
+
/** When set, the step only runs if this returns true; otherwise it's skipped. */
|
|
398
|
+
if?: StepCondition<AllStepInput<T, Ctx>>;
|
|
399
|
+
run: (input: AllStepInput<T, Ctx>) => AllStepOutput<T> | Promise<AllStepOutput<T>>;
|
|
400
|
+
}
|
|
401
|
+
type StepDefinition<T extends Phase, Ctx = unknown> = EachStepDefinition<T, Ctx> | AllStepDefinition<T, Ctx>;
|
|
402
|
+
/** Any step, discriminated by `phase` and `scope`. */
|
|
403
|
+
type Step<Ctx = unknown> = { [T in Phase]: StepDefinition<T, Ctx>; }[Phase];
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/core/facts.d.ts
|
|
406
|
+
/**
|
|
407
|
+
* What can be known about a release before it's made, beyond its shape: what
|
|
408
|
+
* steps declare they `need`, and what steps and schemes declare they
|
|
409
|
+
* `provide`. Add your own by declaration merging:
|
|
410
|
+
*
|
|
411
|
+
* ```ts
|
|
412
|
+
* declare module "rylease" {
|
|
413
|
+
* interface Facts { "changes.jira": true }
|
|
414
|
+
* }
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
interface Facts {
|
|
418
|
+
/** Every change has a `title`. */
|
|
419
|
+
"changes.title": true;
|
|
420
|
+
/** Every change has a `description`. */
|
|
421
|
+
"changes.description": true;
|
|
422
|
+
/** Every change has `labels`, if only `[]`. */
|
|
423
|
+
"changes.labels": true;
|
|
424
|
+
/** Every change has a `link`. */
|
|
425
|
+
"changes.link": true;
|
|
426
|
+
/** There's a previous version, in the release's scheme. */
|
|
427
|
+
previousVersion: true;
|
|
428
|
+
/** Versions are semantic versions, e.g. as npm requires. */
|
|
429
|
+
"version.semver": true;
|
|
430
|
+
}
|
|
431
|
+
type Fact = Extract<keyof Facts, string>;
|
|
432
|
+
type ChangeField<N> = N extends `changes.${infer K}` ? Extract<K, keyof Change> : never;
|
|
433
|
+
/** A change that's known to have the given fields. */
|
|
434
|
+
type ChangeWith<K extends keyof Change> = Change & { [P in K]-?: Exclude<Change[P], undefined>; };
|
|
435
|
+
/** A step's input, with what its `needs` guarantee. */
|
|
436
|
+
type Narrow<R, N extends Fact> = [N] extends [never] ? R : Omit<R, ([ChangeField<N>] extends [never] ? never : "changes") | ("previousVersion" extends N ? "previousVersion" : never)> & ([ChangeField<N>] extends [never] ? unknown : {
|
|
437
|
+
changes: ChangeWith<ChangeField<N>>[];
|
|
438
|
+
}) & ("previousVersion" extends N ? {
|
|
439
|
+
previousVersion: string;
|
|
440
|
+
} : unknown);
|
|
441
|
+
/** A step's output, with what its `provides` promise. */
|
|
442
|
+
type ProvidedOutput<O, P extends Fact> = [ChangeField<P>] extends [never] ? O : O extends {
|
|
443
|
+
changes: Change[];
|
|
444
|
+
} ? Omit<O, "changes"> & {
|
|
445
|
+
changes: ChangeWith<ChangeField<P>>[];
|
|
446
|
+
} : O;
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/core/scheme.d.ts
|
|
449
|
+
/**
|
|
450
|
+
* A version scheme: the one place that knows what a version looks like. It
|
|
451
|
+
* recognizes and orders versions, works out the next, and names their parts
|
|
452
|
+
* for templates. Everything else treats versions as plain text.
|
|
453
|
+
*/
|
|
454
|
+
interface Scheme {
|
|
455
|
+
/** Describes it in reports, e.g. `semver` or `calver YYYY.MM.MICRO`. */
|
|
456
|
+
readonly name: string;
|
|
457
|
+
/** Facts that hold for every version it makes, e.g. `version.semver`. */
|
|
458
|
+
readonly traits?: readonly Fact[];
|
|
459
|
+
/** Whether a version is one of this scheme's, strictly. */
|
|
460
|
+
matches(version: string): boolean;
|
|
461
|
+
/** Orders two of its versions. */
|
|
462
|
+
compare(a: string, b: string): number;
|
|
463
|
+
/**
|
|
464
|
+
* The next version: after `previous` by `kind`, or the first one without
|
|
465
|
+
* a previous version, e.g. on a first release.
|
|
466
|
+
*/
|
|
467
|
+
bump(input: BumpInput): {
|
|
468
|
+
version: string;
|
|
469
|
+
reason: string;
|
|
470
|
+
};
|
|
471
|
+
/** `{placeholders}` for templates, e.g. `{ major: "1", minor: "2", patch: "3" }`. */
|
|
472
|
+
fields?(version: string): Record<string, string>;
|
|
473
|
+
/**
|
|
474
|
+
* How channel versions are written, by channel type, e.g.
|
|
475
|
+
* `{ prerelease: "{version}rc{n}" }`; by default `{version}-{channel}.{n}`
|
|
476
|
+
* and `{version}+{channel}.{n}`.
|
|
477
|
+
*/
|
|
478
|
+
readonly formats?: {
|
|
479
|
+
readonly prerelease?: string;
|
|
480
|
+
readonly build?: string;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
interface BumpInput {
|
|
484
|
+
/** Absent on a first release, or when the scheme changed since the last one. */
|
|
485
|
+
previous?: string;
|
|
486
|
+
kind: ReleaseKind;
|
|
487
|
+
branch: string;
|
|
488
|
+
date: Date;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Defines a version scheme whose options are declared as a zod shape. The
|
|
492
|
+
* result is a factory, like a step's: `calver({ format: "YY.MINOR.MICRO" })`.
|
|
493
|
+
*/
|
|
494
|
+
declare function defineScheme<const N extends string, S extends OptionsShape>(definition: FactoryDefinition<N, S, Scheme>): Factory<"scheme", N, S, Scheme>;
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/core/channels.d.ts
|
|
497
|
+
/**
|
|
498
|
+
* A release channel: versions that wrap the scheme's own in a format with a
|
|
499
|
+
* counter, e.g. `2.0.0-next.1`. A `prerelease` comes before the version it
|
|
500
|
+
* leads up to; a `build` comes after the version it numbers builds of.
|
|
501
|
+
*/
|
|
502
|
+
interface Channel {
|
|
503
|
+
/** Branches that release on this channel, as globs, e.g. `beta/*`. */
|
|
504
|
+
branches?: readonly string[];
|
|
505
|
+
/** Defaults to `prerelease`. */
|
|
506
|
+
type?: ChannelType;
|
|
507
|
+
/**
|
|
508
|
+
* How its versions are written: `{version}` is the target version, `{n}`
|
|
509
|
+
* the counter and `{channel}` the channel's name. Defaults to the
|
|
510
|
+
* scheme's, or `{version}-{channel}.{n}` for a prerelease and
|
|
511
|
+
* `{version}+{channel}.{n}` for a build.
|
|
512
|
+
*/
|
|
513
|
+
format?: string;
|
|
514
|
+
}
|
|
515
|
+
type ChannelType = "prerelease" | "build";
|
|
516
|
+
/** The channel a run releases on. */
|
|
517
|
+
interface RunChannel {
|
|
518
|
+
name: string;
|
|
519
|
+
type: ChannelType;
|
|
520
|
+
}
|
|
521
|
+
/** A channel, with its format worked out for a scheme. */
|
|
522
|
+
interface ResolvedChannel extends RunChannel {
|
|
523
|
+
format: string;
|
|
524
|
+
}
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/core/components.d.ts
|
|
527
|
+
/** A versioned unit of the project; see {@link ComponentInfo}. */
|
|
528
|
+
interface Component {
|
|
529
|
+
name: string;
|
|
530
|
+
/** Its directory, relative to the project. Defaults to `.`. */
|
|
531
|
+
path?: string;
|
|
532
|
+
/** Components it depends on, by name. */
|
|
533
|
+
dependsOn?: readonly string[];
|
|
534
|
+
/** Overrides the release's scheme. */
|
|
535
|
+
scheme?: Scheme;
|
|
536
|
+
/** Overrides the release's tag template. */
|
|
537
|
+
tag?: string;
|
|
538
|
+
/** Overrides where the release finds previous versions. */
|
|
539
|
+
history?: History;
|
|
540
|
+
}
|
|
541
|
+
/** Finds a project's components, e.g. the packages of a workspace. */
|
|
542
|
+
interface ComponentSource {
|
|
543
|
+
readonly name: string;
|
|
544
|
+
resolve(env: Environment): Promise<Component[]>;
|
|
545
|
+
}
|
|
546
|
+
/** Defines a source of components, with options as a zod shape. */
|
|
547
|
+
declare function defineComponents<const N extends string, S extends OptionsShape>(definition: FactoryDefinition<N, S, ComponentSource>): Factory<"components", N, S, ComponentSource>;
|
|
548
|
+
/** A component with everything worked out. */
|
|
549
|
+
interface ResolvedComponent {
|
|
550
|
+
info: ComponentInfo;
|
|
551
|
+
scheme: Scheme;
|
|
552
|
+
history: History;
|
|
553
|
+
/** The tag template, with `{name}` filled in. */
|
|
554
|
+
tag: string;
|
|
555
|
+
}
|
|
556
|
+
interface Defaults {
|
|
557
|
+
scheme: Scheme;
|
|
558
|
+
history: History;
|
|
559
|
+
/** Defaults to `v{version}` for one component, `{name}@{version}` for more. */
|
|
560
|
+
tag: string | undefined;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Checks components and fills in their defaults, ordered so that each comes
|
|
564
|
+
* after the components it depends on.
|
|
565
|
+
*/
|
|
566
|
+
declare function resolveComponents(components: readonly Component[], defaults: Defaults): ResolvedComponent[];
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/core/reporter.d.ts
|
|
569
|
+
/** Receives progress from the engine; every hook is optional. */
|
|
570
|
+
interface Reporter {
|
|
571
|
+
start?(env: Environment,
|
|
572
|
+
/** Every step, and the engine's own rows: `read-version` and `determine-version`. */
|
|
573
|
+
steps: readonly {
|
|
574
|
+
phase: Phase | EnginePhase;
|
|
575
|
+
name: string;
|
|
576
|
+
}[], components: readonly ComponentInfo[]): void;
|
|
577
|
+
step?(record: StepRecord): void;
|
|
578
|
+
finish?(report: ReleaseReport): void;
|
|
579
|
+
}
|
|
580
|
+
interface PrettyReporterOptions {
|
|
581
|
+
/** Defaults to writing to stdout. */
|
|
582
|
+
write?: (text: string) => void;
|
|
583
|
+
/** Defaults to `true` on a TTY unless `NO_COLOR` is set. */
|
|
584
|
+
color?: boolean;
|
|
585
|
+
}
|
|
586
|
+
/** Aligned, colored output: one row per step with phase, name, duration and reason. */
|
|
587
|
+
declare function prettyReporter(options?: PrettyReporterOptions): Reporter;
|
|
588
|
+
declare function defaultReporter(): Reporter;
|
|
589
|
+
declare function formatDuration(ms: number): string;
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/core/engine.d.ts
|
|
592
|
+
interface RunOptions {
|
|
593
|
+
/** Defaults to `process.cwd()`. */
|
|
594
|
+
cwd?: string;
|
|
595
|
+
/** Defaults to the CI's branch (GitHub Actions or GitLab CI), or the checked-out one. */
|
|
596
|
+
branch?: string;
|
|
597
|
+
/** Defaults to `false`. */
|
|
598
|
+
dryRun?: boolean;
|
|
599
|
+
/** Defaults to pretty output on stdout; pass `null` for silence. */
|
|
600
|
+
reporter?: Reporter | null;
|
|
601
|
+
/**
|
|
602
|
+
* Releases that have already been worked out, e.g. by an earlier job: only
|
|
603
|
+
* the `release` steps run, for these versions, and every other step is
|
|
604
|
+
* skipped. With several components, each names its own.
|
|
605
|
+
*/
|
|
606
|
+
release?: GivenRelease | readonly GivenRelease[];
|
|
607
|
+
/**
|
|
608
|
+
* The channel to release on, e.g. `nightly`. Defaults to the first whose
|
|
609
|
+
* branches match, or a stable release.
|
|
610
|
+
*/
|
|
611
|
+
channel?: string;
|
|
612
|
+
}
|
|
613
|
+
interface GivenRelease {
|
|
614
|
+
version: string;
|
|
615
|
+
/** Defaults to none. */
|
|
616
|
+
notes?: string;
|
|
617
|
+
/** Defaults to the version itself. */
|
|
618
|
+
previousVersion?: string;
|
|
619
|
+
/** Defaults to the difference between the versions, or `fix`. */
|
|
620
|
+
kind?: ReleaseKind;
|
|
621
|
+
/** The component it's for; needed when there are several. */
|
|
622
|
+
component?: string;
|
|
623
|
+
}
|
|
624
|
+
/** How a release is made: its steps, and how versions are found and made. */
|
|
625
|
+
interface ReleaseSetup<Ctx> {
|
|
626
|
+
steps: readonly Step<Ctx>[];
|
|
627
|
+
context: Ctx;
|
|
628
|
+
scheme: Scheme;
|
|
629
|
+
/** Defaults to `v{version}` for one component, `{name}@{version}` for several. */
|
|
630
|
+
tag?: string | undefined;
|
|
631
|
+
/** Where previous releases are found; the first that finds one wins. */
|
|
632
|
+
history: History | readonly History[];
|
|
633
|
+
/** Defaults to one component, the whole project. */
|
|
634
|
+
components?: readonly Component[] | ComponentSource | undefined;
|
|
635
|
+
/** Prerelease and build channels, by name. Defaults to none. */
|
|
636
|
+
channels?: Readonly<Record<string, Channel>> | undefined;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* `pending` when a `write` step left the release to later, e.g. to a
|
|
640
|
+
* release pull request.
|
|
641
|
+
*/
|
|
642
|
+
type ReleaseStatus = "released" | "pending" | "unchanged" | "failed";
|
|
643
|
+
interface ComponentReport {
|
|
644
|
+
name: string;
|
|
645
|
+
path: string;
|
|
646
|
+
status: ReleaseStatus;
|
|
647
|
+
previousVersion?: string;
|
|
648
|
+
previousRef?: string;
|
|
649
|
+
previousTag?: string;
|
|
650
|
+
kind?: Kind;
|
|
651
|
+
version?: string;
|
|
652
|
+
tag?: string;
|
|
653
|
+
notes?: string;
|
|
654
|
+
/** The components it depends on that were released along with it. */
|
|
655
|
+
dependencies: Dependency[];
|
|
656
|
+
releases: ReleaseResult[];
|
|
657
|
+
}
|
|
658
|
+
interface ReleaseReport {
|
|
659
|
+
env: Environment;
|
|
660
|
+
status: ReleaseStatus;
|
|
661
|
+
records: StepRecord[];
|
|
662
|
+
/** Every component, dependencies first. */
|
|
663
|
+
components: ComponentReport[];
|
|
664
|
+
/** With one component, its values, for convenience. */
|
|
665
|
+
previousVersion?: string;
|
|
666
|
+
previousRef?: string;
|
|
667
|
+
kind?: Kind;
|
|
668
|
+
version?: string;
|
|
669
|
+
notes?: string;
|
|
670
|
+
/** With one component, the results of its `write`, `stage` and `release` steps. */
|
|
671
|
+
releases: ReleaseResult[];
|
|
672
|
+
/** Why the release was left to later, when it's `pending`. */
|
|
673
|
+
deferred?: string;
|
|
674
|
+
error?: unknown;
|
|
675
|
+
}
|
|
676
|
+
declare class ReleaseError extends Error {
|
|
677
|
+
readonly report: ReleaseReport;
|
|
678
|
+
constructor(message: string, report: ReleaseReport, options?: ErrorOptions);
|
|
679
|
+
}
|
|
680
|
+
/** Stable sort of steps by phase; steps of the same phase keep their order. */
|
|
681
|
+
declare function sortSteps<S extends {
|
|
682
|
+
phase: Phase;
|
|
683
|
+
}>(steps: readonly S[]): S[];
|
|
684
|
+
declare function runRelease<Ctx>(setup: ReleaseSetup<Ctx>, options?: RunOptions): Promise<ReleaseReport>;
|
|
685
|
+
declare function errorMessage(error: unknown): string;
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/core/define.d.ts
|
|
688
|
+
type ReleaseConfig<Context> = {
|
|
689
|
+
/** Steps to run; they're ordered by phase, keeping their order within a phase. */
|
|
690
|
+
steps: readonly Step<Context>[];
|
|
691
|
+
/**
|
|
692
|
+
* How versions look, are ordered and bumped, e.g. `semver()`. Needed
|
|
693
|
+
* unless a preset among `steps` provides one, as `conventional` does.
|
|
694
|
+
*/
|
|
695
|
+
scheme?: Scheme;
|
|
696
|
+
/**
|
|
697
|
+
* Each release's tag; `{version}` and `{name}` (the component's) are
|
|
698
|
+
* filled in. Defaults to `v{version}`, or `{name}@{version}` with several
|
|
699
|
+
* components.
|
|
700
|
+
*/
|
|
701
|
+
tag?: string;
|
|
702
|
+
/**
|
|
703
|
+
* Where previous releases are found, e.g. `gitTags()`; with several, the
|
|
704
|
+
* first that finds one wins. Needed unless a preset among `steps`
|
|
705
|
+
* provides one, as every built-in preset does.
|
|
706
|
+
*/
|
|
707
|
+
history?: History | readonly History[];
|
|
708
|
+
/**
|
|
709
|
+
* What's versioned and released: a list, or a source such as
|
|
710
|
+
* `npmWorkspaces()`. Defaults to the whole project, as one component.
|
|
711
|
+
*/
|
|
712
|
+
components?: readonly Component[] | ComponentSource;
|
|
713
|
+
/**
|
|
714
|
+
* Prerelease and build channels, by name, e.g.
|
|
715
|
+
* `{ next: { branches: ["next"] } }` for `2.0.0-next.1`. A run releases
|
|
716
|
+
* on the first whose branches match, or the one it's given.
|
|
717
|
+
*/
|
|
718
|
+
channels?: Readonly<Record<string, Channel>>;
|
|
719
|
+
} & (undefined extends Context ? {
|
|
720
|
+
/** Shared, mutable state passed to every step. */
|
|
721
|
+
context?: Context;
|
|
722
|
+
} : {
|
|
723
|
+
/** Shared, mutable state passed to every step. */
|
|
724
|
+
context: Context;
|
|
725
|
+
});
|
|
726
|
+
interface Release<Context> {
|
|
727
|
+
readonly steps: readonly Step<Context>[];
|
|
728
|
+
/** Its own scheme, or its preset's. */
|
|
729
|
+
readonly scheme: Scheme;
|
|
730
|
+
/** Its own history, or its preset's. */
|
|
731
|
+
readonly history: History | readonly History[];
|
|
732
|
+
run(options?: RunOptions): Promise<ReleaseReport>;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Defines a release pipeline. Pass a custom context type to type the `context`
|
|
736
|
+
* every step receives: `defineRelease<{ slackTs?: string }>({ context: {}, steps })`.
|
|
737
|
+
* Its `scheme` and `history` are its own, or else the preset's its steps come from.
|
|
738
|
+
*/
|
|
739
|
+
declare function defineRelease<Context = undefined>(config: ReleaseConfig<Context>): Release<Context>;
|
|
740
|
+
/** The step a factory makes, by scope. */
|
|
741
|
+
type ScopedStep<T extends Phase, Sc extends Scope> = Sc extends "all" ? AllStepDefinition<T> : EachStepDefinition<T>;
|
|
742
|
+
interface StepFactoryDefinition<T extends Phase, N extends string, S extends OptionsShape, Sc extends Scope, Needs extends Fact, Provides extends Fact> {
|
|
743
|
+
/** Its phase; a function works it out from its options, e.g. a `phase` option. */
|
|
744
|
+
phase: T | ((options: OptionsValue<S>) => T);
|
|
745
|
+
/** Identifies the step in reports and in workflow `steps`, e.g. `git/commit`. */
|
|
746
|
+
name: N;
|
|
747
|
+
/** One line on what the step does, for generated docs. */
|
|
748
|
+
description?: string;
|
|
749
|
+
/** Runs once per component (`each`, the default) or once with all of them (`all`). */
|
|
750
|
+
scope?: Sc;
|
|
751
|
+
/**
|
|
752
|
+
* Facts it relies on, e.g. `changes.labels`; its input is typed
|
|
753
|
+
* accordingly. A function works them out from its options, e.g. by format.
|
|
754
|
+
*/
|
|
755
|
+
needs?: readonly Needs[] | ((options: OptionsValue<S>) => readonly Fact[]);
|
|
756
|
+
/** Facts it guarantees, e.g. that every change has `labels`. */
|
|
757
|
+
provides?: readonly Provides[];
|
|
758
|
+
/** A zod shape; use `.default()` for optional options and `.describe()` to document them. */
|
|
759
|
+
options?: S;
|
|
760
|
+
run: (input: (Sc extends "all" ? AllStepInput<T, unknown, Needs> : StepInput<T, unknown, Needs>) & {
|
|
761
|
+
options: OptionsValue<S>;
|
|
762
|
+
}) => Sc extends "all" ? AllStepOutput<T, Provides> | Promise<AllStepOutput<T, Provides>> : StepOutput<T, Provides> | Promise<StepOutput<T, Provides>>;
|
|
763
|
+
}
|
|
764
|
+
/** Creates a configured step; the options argument is optional when every option is. */
|
|
765
|
+
interface StepFactory<T extends Phase = Phase, N extends string = string, S extends OptionsShape = OptionsShape, Sc extends Scope = Scope> extends Factory<"step", N, S, ScopedStep<T, Sc>> {
|
|
766
|
+
/** Its phase, or a function of its options that works it out. */
|
|
767
|
+
readonly phase: T | ((options: OptionsValue<S>) => T);
|
|
768
|
+
readonly scope: Sc;
|
|
769
|
+
readonly needs: readonly Fact[];
|
|
770
|
+
readonly provides: readonly Fact[];
|
|
771
|
+
}
|
|
772
|
+
/** Any step factory, whatever its phase, name or options. */
|
|
773
|
+
interface AnyStepFactory extends AnyFactory<"step", Step> {
|
|
774
|
+
readonly phase: Phase | ((options: never) => Phase);
|
|
775
|
+
readonly scope: Scope;
|
|
776
|
+
readonly needs: readonly Fact[];
|
|
777
|
+
readonly provides: readonly Fact[];
|
|
778
|
+
}
|
|
779
|
+
/** What a factory accepts, e.g. `FactoryOptions<typeof gitCommit>`. */
|
|
780
|
+
type FactoryOptions<F extends {
|
|
781
|
+
options: OptionsShape;
|
|
782
|
+
}> = OptionsInput<F["options"]>;
|
|
783
|
+
/**
|
|
784
|
+
* Defines a reusable step whose options are declared as a zod shape. The
|
|
785
|
+
* result is a factory: call it with options to get a step. Its options are
|
|
786
|
+
* validated on every call, so they're just as safe when they come from a
|
|
787
|
+
* workflow file.
|
|
788
|
+
*
|
|
789
|
+
* ```ts
|
|
790
|
+
* export const header = defineStep({
|
|
791
|
+
* phase: "determine-notes",
|
|
792
|
+
* name: "header",
|
|
793
|
+
* options: { text: z.string().default("Released by rylease") },
|
|
794
|
+
* run: ({ notes, options }) => ({ notes: `> ${options.text}\n\n${notes}`, reason: "added header" }),
|
|
795
|
+
* });
|
|
796
|
+
* header({ text: "Hi" });
|
|
797
|
+
* ```
|
|
798
|
+
*/
|
|
799
|
+
declare function defineStep<T extends Phase, const N extends string, S extends OptionsShape = Empty, Sc extends Scope = "each", const Needs extends Fact = never, const Provides extends Fact = never>(definition: StepFactoryDefinition<T, N, S, Sc, Needs, Provides>): StepFactory<T, N, S, Sc>;
|
|
800
|
+
/** Options for each step of a preset, by name; `false` leaves a step out. */
|
|
801
|
+
type PresetOptions<F extends readonly AnyStepFactory[]> = { [K in F[number] as K["name"]]?: FactoryOptions<K> | false; };
|
|
802
|
+
/** A preset's own options for its steps, by name. */
|
|
803
|
+
type PresetDefaults<F extends readonly AnyStepFactory[]> = { [K in F[number] as K["name"]]?: FactoryOptions<K>; };
|
|
804
|
+
/** A named list of step factories that's configured, and used, as one. */
|
|
805
|
+
interface Preset<N extends string = string, F extends readonly AnyStepFactory[] = readonly AnyStepFactory[]> {
|
|
806
|
+
(options?: PresetOptions<F>): Step[];
|
|
807
|
+
readonly kind: "preset";
|
|
808
|
+
readonly name: N;
|
|
809
|
+
readonly description: string | undefined;
|
|
810
|
+
readonly steps: F;
|
|
811
|
+
readonly defaults: PresetDefaults<F>;
|
|
812
|
+
/** Makes the scheme of releases made with it, unless they set their own. */
|
|
813
|
+
readonly scheme: (() => Scheme) | undefined;
|
|
814
|
+
/** Makes the history of releases made with it, unless they set their own. */
|
|
815
|
+
readonly history: (() => History | readonly History[]) | undefined;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Bundles step factories under one name. Calling the preset creates every
|
|
819
|
+
* step, passing each its options by name:
|
|
820
|
+
* `conventional({ "github/create-release": false, "conventional/determine-kind": { fallback: "none" } })`.
|
|
821
|
+
* `defaults` sets the preset's own options per step, under the caller's;
|
|
822
|
+
* `scheme` and `history` make the release's, unless it sets its own, e.g.
|
|
823
|
+
* `history: gitTags` for a preset that tags its releases.
|
|
824
|
+
*/
|
|
825
|
+
declare function definePreset<const N extends string, const F extends readonly AnyStepFactory[]>(definition: {
|
|
826
|
+
name: N;
|
|
827
|
+
description?: string;
|
|
828
|
+
steps: F;
|
|
829
|
+
defaults?: PresetDefaults<F>;
|
|
830
|
+
scheme?: () => Scheme;
|
|
831
|
+
history?: () => History | readonly History[];
|
|
832
|
+
}): Preset<N, F>;
|
|
833
|
+
/** What a step's condition receives. */
|
|
834
|
+
type ConditionInput<S> = S extends {
|
|
835
|
+
run: (input: infer I) => unknown;
|
|
836
|
+
} ? I : never;
|
|
837
|
+
/**
|
|
838
|
+
* Makes a step run only when `condition` holds, on top of any condition it
|
|
839
|
+
* already has: `when(steps.npmPublish(), ({ env }) => !env.dryRun)`.
|
|
840
|
+
*/
|
|
841
|
+
declare function when<S extends Step<never>>(step: S, condition: StepCondition<ConditionInput<S>>): S;
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/config/workflow.d.ts
|
|
844
|
+
/** What a workflow gives, already parsed from YAML. */
|
|
845
|
+
interface WorkflowInput {
|
|
846
|
+
steps: unknown;
|
|
847
|
+
scheme?: unknown;
|
|
848
|
+
tag?: unknown;
|
|
849
|
+
history?: unknown;
|
|
850
|
+
components?: unknown;
|
|
851
|
+
channels?: unknown;
|
|
852
|
+
}
|
|
853
|
+
/** A release defined in a workflow, ready for `defineRelease`. */
|
|
854
|
+
type WorkflowRelease = Omit<ReleaseConfig<undefined>, "context">;
|
|
855
|
+
/**
|
|
856
|
+
* Turns a workflow's inputs into a release: its `steps`, and how versions are
|
|
857
|
+
* made (`scheme`), tagged (`tag`), found (`history`), and of what
|
|
858
|
+
* (`components`). Each of those but `tag` names what it `uses` and passes
|
|
859
|
+
* it options `with`, or is just a name:
|
|
860
|
+
*
|
|
861
|
+
* ```yaml
|
|
862
|
+
* scheme: { uses: calver, with: { format: YY.MINOR.MICRO } }
|
|
863
|
+
* components: npm/workspaces
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
declare function resolveWorkflow(input: WorkflowInput, options: WorkflowOptions): Promise<WorkflowRelease>;
|
|
867
|
+
interface WorkflowOptions {
|
|
868
|
+
/** Paths and packages are resolved from here. */
|
|
869
|
+
cwd: string;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Turns workflow `steps` (already parsed from YAML) into steps. Each entry
|
|
873
|
+
* names what it `uses`, passes it options `with`, and may run only `if` an
|
|
874
|
+
* expression holds:
|
|
875
|
+
*
|
|
876
|
+
* ```yaml
|
|
877
|
+
* - uses: conventional # a bundled preset or step
|
|
878
|
+
* with:
|
|
879
|
+
* github/create-release: false
|
|
880
|
+
* - uses: ./release/announce.ts # a file's default export
|
|
881
|
+
* if: "!dryRun && kind != 'patch'"
|
|
882
|
+
* with:
|
|
883
|
+
* channel: "#releases"
|
|
884
|
+
* - uses: some-package#slackNotes # a package's named export
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
declare function resolveWorkflowSteps(entries: unknown, options: WorkflowOptions): Promise<Step[]>;
|
|
888
|
+
//#endregion
|
|
889
|
+
//#region src/core/expression.d.ts
|
|
890
|
+
/**
|
|
891
|
+
* What an `if:` expression can read: the release so far, as the step itself
|
|
892
|
+
* would receive it.
|
|
893
|
+
*/
|
|
894
|
+
interface ExpressionContext {
|
|
895
|
+
dryRun: boolean;
|
|
896
|
+
branch: string;
|
|
897
|
+
cwd: string;
|
|
898
|
+
/** The channel being released on, or `null` for a stable release. */
|
|
899
|
+
channel: string | null;
|
|
900
|
+
/** Whether the release is on a prerelease channel. */
|
|
901
|
+
prerelease: boolean;
|
|
902
|
+
/** The component the step runs for: `{ name, path }`; absent for `all` steps. */
|
|
903
|
+
component?: {
|
|
904
|
+
name: string;
|
|
905
|
+
path: string;
|
|
906
|
+
};
|
|
907
|
+
/** For `all` steps: every component being released, with its values. */
|
|
908
|
+
components?: readonly unknown[];
|
|
909
|
+
previousVersion?: string;
|
|
910
|
+
previousRef?: string;
|
|
911
|
+
previousTag?: string;
|
|
912
|
+
changes?: readonly unknown[];
|
|
913
|
+
kind?: string;
|
|
914
|
+
version?: string;
|
|
915
|
+
tag?: string;
|
|
916
|
+
notes?: string;
|
|
917
|
+
/** The components it depends on released along with it: `{ name, version, … }`. */
|
|
918
|
+
dependencies?: readonly unknown[];
|
|
919
|
+
/** The steps that ran before, by name: `{ phase, status, reason, output }`. */
|
|
920
|
+
steps: Record<string, unknown>;
|
|
921
|
+
}
|
|
922
|
+
/** What an expression reads, from what a step receives: for one component, or all. */
|
|
923
|
+
declare function expressionContext(input: unknown): ExpressionContext;
|
|
924
|
+
type Node = (context: ExpressionContext) => unknown;
|
|
925
|
+
/**
|
|
926
|
+
* Compiles an `if:` expression, in the style of GitHub's: literals (`true`,
|
|
927
|
+
* `'text'`, `1`, `null`), names from {@link ExpressionContext} with `.x` and
|
|
928
|
+
* `['x']` access, `!`, `==`, `!=`, `<`, `<=`, `>`, `>=`, `&&`, `||`,
|
|
929
|
+
* parentheses, and `contains`, `startsWith` and `endsWith`.
|
|
930
|
+
*/
|
|
931
|
+
declare function compileExpression(source: string): Node;
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region src/core/summary.d.ts
|
|
934
|
+
/**
|
|
935
|
+
* The report as Markdown, for GitHub's job summary: what happened, a row per
|
|
936
|
+
* step, and the release notes.
|
|
937
|
+
*/
|
|
938
|
+
declare function markdownSummary(report: ReleaseReport): string;
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/histories/fs/version-file.d.ts
|
|
941
|
+
/**
|
|
942
|
+
* Finds the previous release in the project's version file: the version in
|
|
943
|
+
* it, released at the commit that set it. For projects that kept their
|
|
944
|
+
* version in a file before tagging releases, like `package.json` or a
|
|
945
|
+
* `VERSION` file.
|
|
946
|
+
*/
|
|
947
|
+
declare const fsVersionFile: Factory<"history", "fs/version-file", {
|
|
948
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
949
|
+
cargo: "cargo";
|
|
950
|
+
dart: "dart";
|
|
951
|
+
dotnet: "dotnet";
|
|
952
|
+
gradle: "gradle";
|
|
953
|
+
helm: "helm";
|
|
954
|
+
maven: "maven";
|
|
955
|
+
npm: "npm";
|
|
956
|
+
pattern: "pattern";
|
|
957
|
+
plain: "plain";
|
|
958
|
+
python: "python";
|
|
959
|
+
ruby: "ruby";
|
|
960
|
+
}>>;
|
|
961
|
+
path: z.ZodOptional<z.ZodString>;
|
|
962
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
963
|
+
}, History>;
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/histories/git/git-tags.d.ts
|
|
966
|
+
/**
|
|
967
|
+
* Finds the previous release by its tag: the nearest on HEAD. Of the release
|
|
968
|
+
* tags merged into HEAD, only those that no other one comes after count, so
|
|
969
|
+
* a `1.x` branch finds its own latest release, not `main`'s; of those, the
|
|
970
|
+
* highest version in the scheme wins. When the scheme changed since, the
|
|
971
|
+
* nearest release still marks where changes start, but there's no previous
|
|
972
|
+
* version to bump: the release is the scheme's first.
|
|
973
|
+
*
|
|
974
|
+
* A stable release only counts stable releases. On a channel, its own
|
|
975
|
+
* releases count too, and the nearest stable release is what's bumped.
|
|
976
|
+
*/
|
|
977
|
+
declare const gitTags: Factory<"history", "git/tags", Readonly<{
|
|
978
|
+
[k: string]: import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
979
|
+
}>, History>;
|
|
980
|
+
//#endregion
|
|
981
|
+
//#region src/histories/github/release-pr.d.ts
|
|
982
|
+
/**
|
|
983
|
+
* Finds a release that a merged release pull request proposed: when HEAD is
|
|
984
|
+
* its merge, the release steps run for the versions it proposed, with its
|
|
985
|
+
* notes. Components it doesn't name, or whose tag exists already, are found
|
|
986
|
+
* by their tags, as with `git/tags`.
|
|
987
|
+
*/
|
|
988
|
+
declare const githubReleasePr: Factory<"history", "github/release-pr", {
|
|
989
|
+
label: z.ZodDefault<z.ZodString>;
|
|
990
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
991
|
+
token: z.ZodOptional<z.ZodString>;
|
|
992
|
+
}, History>;
|
|
993
|
+
declare namespace index_d_exports$3 {
|
|
994
|
+
export { fsVersionFile, gitTags, githubReleasePr };
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/presets/change-files.d.ts
|
|
998
|
+
/**
|
|
999
|
+
* Change files in `.changes/` → notes by kind → the changelog written and
|
|
1000
|
+
* the change files deleted, committed and tagged → GitHub release. Each
|
|
1001
|
+
* file names the components it changes and how much, so a monorepo's
|
|
1002
|
+
* releases don't depend on commit messages. Add files with `rylease add`.
|
|
1003
|
+
* Releases are found by their tags; set the release's `scheme`.
|
|
1004
|
+
*/
|
|
1005
|
+
declare const changeFiles: Preset<"change-files", readonly [StepFactory<"read-changes", "change-files/read", {
|
|
1006
|
+
directory: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1007
|
+
}, "all">, StepFactory<"determine-kind", "labels/determine-kind", {
|
|
1008
|
+
kinds: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
1009
|
+
breaking: "breaking";
|
|
1010
|
+
feature: "feature";
|
|
1011
|
+
fix: "fix";
|
|
1012
|
+
none: "none";
|
|
1013
|
+
}>>>;
|
|
1014
|
+
fallback: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1015
|
+
breaking: "breaking";
|
|
1016
|
+
feature: "feature";
|
|
1017
|
+
fix: "fix";
|
|
1018
|
+
none: "none";
|
|
1019
|
+
}>>;
|
|
1020
|
+
}, "each">, StepFactory<"determine-notes", "labels/determine-notes", {
|
|
1021
|
+
sections: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
1022
|
+
title: import("zod").ZodString;
|
|
1023
|
+
labels: import("zod").ZodArray<import("zod").ZodString>;
|
|
1024
|
+
}, import("zod/v4/core").$strict>>>;
|
|
1025
|
+
other: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1026
|
+
exclude: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1027
|
+
descriptions: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1028
|
+
links: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1029
|
+
dependencies: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1030
|
+
}, "each">, StepFactory<"write", "change-files/clean", {
|
|
1031
|
+
directory: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1032
|
+
channels: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1033
|
+
}, "all">, StepFactory<"write", "fs/write-changes", {
|
|
1034
|
+
path: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1035
|
+
heading: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1036
|
+
mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1037
|
+
append: "append";
|
|
1038
|
+
prepend: "prepend";
|
|
1039
|
+
replace: "replace";
|
|
1040
|
+
}>>;
|
|
1041
|
+
channels: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1042
|
+
}, "each">, StepFactory<"stage", "git/commit", {
|
|
1043
|
+
files: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1044
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1045
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1046
|
+
}, "all">, StepFactory<"release", "git/create-tag", {
|
|
1047
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1048
|
+
move: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1049
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1050
|
+
}, "all">, StepFactory<"release", "github/create-release", {
|
|
1051
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1052
|
+
draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1053
|
+
prerelease: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"auto">]>>;
|
|
1054
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1055
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1056
|
+
}, "each">]>;
|
|
1057
|
+
//#endregion
|
|
1058
|
+
//#region src/presets/conventional.d.ts
|
|
1059
|
+
/**
|
|
1060
|
+
* Conventional commits since the previous release → git tag → GitHub
|
|
1061
|
+
* release, versioned by semver and found by its tags. Nothing specific to a
|
|
1062
|
+
* language or ecosystem; add steps like `fs/write-version`,
|
|
1063
|
+
* `fs/write-changes` and `git/commit` for that. The tag is pushed, with the
|
|
1064
|
+
* branch, to `origin`.
|
|
1065
|
+
*/
|
|
1066
|
+
declare const conventional: Preset<"conventional", readonly [StepFactory<"read-changes", "conventional/read-commits", Empty, "each">, StepFactory<"determine-kind", "conventional/determine-kind", {
|
|
1067
|
+
types: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
1068
|
+
breaking: "breaking";
|
|
1069
|
+
feature: "feature";
|
|
1070
|
+
fix: "fix";
|
|
1071
|
+
none: "none";
|
|
1072
|
+
}>>>;
|
|
1073
|
+
fallback: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1074
|
+
breaking: "breaking";
|
|
1075
|
+
feature: "feature";
|
|
1076
|
+
fix: "fix";
|
|
1077
|
+
none: "none";
|
|
1078
|
+
}>>;
|
|
1079
|
+
}, "each">, StepFactory<"determine-notes", "conventional/determine-notes", {
|
|
1080
|
+
sections: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
1081
|
+
title: import("zod").ZodString;
|
|
1082
|
+
types: import("zod").ZodArray<import("zod").ZodString>;
|
|
1083
|
+
}, import("zod/v4/core").$strict>>>;
|
|
1084
|
+
breaking: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1085
|
+
other: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1086
|
+
links: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1087
|
+
dependencies: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1088
|
+
}, "each">, StepFactory<"release", "git/create-tag", {
|
|
1089
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1090
|
+
move: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1091
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1092
|
+
}, "all">, StepFactory<"release", "github/create-release", {
|
|
1093
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1094
|
+
draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1095
|
+
prerelease: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"auto">]>>;
|
|
1096
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1097
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1098
|
+
}, "each">]>;
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/presets/conventional-pr.d.ts
|
|
1101
|
+
/**
|
|
1102
|
+
* Conventional commits → the changelog written and proposed in a release
|
|
1103
|
+
* pull request, kept up to date with each push; merging it tags the release
|
|
1104
|
+
* and creates its GitHub release. Versioned by semver; its history,
|
|
1105
|
+
* `github/release-pr`, is how the run on the merge finds what the pull
|
|
1106
|
+
* request proposed.
|
|
1107
|
+
*/
|
|
1108
|
+
declare const conventionalPr: Preset<"conventional-pr", readonly [StepFactory<"read-changes", "conventional/read-commits", Empty, "each">, StepFactory<"determine-kind", "conventional/determine-kind", {
|
|
1109
|
+
types: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
1110
|
+
breaking: "breaking";
|
|
1111
|
+
feature: "feature";
|
|
1112
|
+
fix: "fix";
|
|
1113
|
+
none: "none";
|
|
1114
|
+
}>>>;
|
|
1115
|
+
fallback: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1116
|
+
breaking: "breaking";
|
|
1117
|
+
feature: "feature";
|
|
1118
|
+
fix: "fix";
|
|
1119
|
+
none: "none";
|
|
1120
|
+
}>>;
|
|
1121
|
+
}, "each">, StepFactory<"determine-notes", "conventional/determine-notes", {
|
|
1122
|
+
sections: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
1123
|
+
title: import("zod").ZodString;
|
|
1124
|
+
types: import("zod").ZodArray<import("zod").ZodString>;
|
|
1125
|
+
}, import("zod/v4/core").$strict>>>;
|
|
1126
|
+
breaking: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1127
|
+
other: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1128
|
+
links: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1129
|
+
dependencies: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1130
|
+
}, "each">, StepFactory<"write", "fs/write-changes", {
|
|
1131
|
+
path: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1132
|
+
heading: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1133
|
+
mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1134
|
+
append: "append";
|
|
1135
|
+
prepend: "prepend";
|
|
1136
|
+
replace: "replace";
|
|
1137
|
+
}>>;
|
|
1138
|
+
channels: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1139
|
+
}, "each">, StepFactory<"stage", "github/open-release-pr", {
|
|
1140
|
+
branch: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1141
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1142
|
+
labels: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1143
|
+
remote: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1144
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1145
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1146
|
+
}, "all">, StepFactory<"release", "git/create-tag", {
|
|
1147
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1148
|
+
move: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1149
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1150
|
+
}, "all">, StepFactory<"release", "github/create-release", {
|
|
1151
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1152
|
+
draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1153
|
+
prerelease: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"auto">]>>;
|
|
1154
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1155
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1156
|
+
}, "each">]>;
|
|
1157
|
+
//#endregion
|
|
1158
|
+
//#region src/presets/keep-a-changelog.d.ts
|
|
1159
|
+
/**
|
|
1160
|
+
* `## [Unreleased]` in CHANGELOG.md → the changelog released, committed and
|
|
1161
|
+
* tagged → GitHub release. Each entry's kind comes from its section:
|
|
1162
|
+
* `Removed` is breaking, `Added`, `Changed` and `Deprecated` features, and
|
|
1163
|
+
* the rest fixes. Releases are found by their tags; set the release's
|
|
1164
|
+
* `scheme`, e.g. `semver()`, or `calver()` to date them.
|
|
1165
|
+
*/
|
|
1166
|
+
declare const keepAChangelog: Preset<"keep-a-changelog", readonly [StepFactory<"read-changes", "keep-a-changelog/read-unreleased", {
|
|
1167
|
+
path: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1168
|
+
}, "each">, StepFactory<"determine-kind", "labels/determine-kind", {
|
|
1169
|
+
kinds: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodEnum<{
|
|
1170
|
+
breaking: "breaking";
|
|
1171
|
+
feature: "feature";
|
|
1172
|
+
fix: "fix";
|
|
1173
|
+
none: "none";
|
|
1174
|
+
}>>>;
|
|
1175
|
+
fallback: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
1176
|
+
breaking: "breaking";
|
|
1177
|
+
feature: "feature";
|
|
1178
|
+
fix: "fix";
|
|
1179
|
+
none: "none";
|
|
1180
|
+
}>>;
|
|
1181
|
+
}, "each">, StepFactory<"determine-notes", "labels/determine-notes", {
|
|
1182
|
+
sections: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
1183
|
+
title: import("zod").ZodString;
|
|
1184
|
+
labels: import("zod").ZodArray<import("zod").ZodString>;
|
|
1185
|
+
}, import("zod/v4/core").$strict>>>;
|
|
1186
|
+
other: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1187
|
+
exclude: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1188
|
+
descriptions: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1189
|
+
links: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1190
|
+
dependencies: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1191
|
+
}, "each">, StepFactory<"write", "keep-a-changelog/write-release", {
|
|
1192
|
+
path: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1193
|
+
heading: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1194
|
+
channels: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1195
|
+
}, "each">, StepFactory<"stage", "git/commit", {
|
|
1196
|
+
files: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1197
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1198
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1199
|
+
}, "all">, StepFactory<"release", "git/create-tag", {
|
|
1200
|
+
message: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1201
|
+
move: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
1202
|
+
push: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodLiteral<false>]>>;
|
|
1203
|
+
}, "all">, StepFactory<"release", "github/create-release", {
|
|
1204
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1205
|
+
draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1206
|
+
prerelease: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"auto">]>>;
|
|
1207
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1208
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1209
|
+
}, "each">]>;
|
|
1210
|
+
declare namespace index_d_exports$2 {
|
|
1211
|
+
export { changeFiles, conventional, conventionalPr, keepAChangelog };
|
|
1212
|
+
}
|
|
1213
|
+
//#endregion
|
|
1214
|
+
//#region src/schemes/calver.d.ts
|
|
1215
|
+
/**
|
|
1216
|
+
* Calendar versioning, as on calver.org: the format's date tokens come from
|
|
1217
|
+
* the release date, and its counters (`MAJOR`, `MINOR`, `MICRO`) number the
|
|
1218
|
+
* releases within the same period. A counter is bumped by the kind it stands
|
|
1219
|
+
* for (`breaking`, `feature`, `fix`), or by a higher kind when the format has
|
|
1220
|
+
* no counter for that; the counters after it start again from 0, as do all of
|
|
1221
|
+
* them in a new period.
|
|
1222
|
+
*/
|
|
1223
|
+
declare const calver: Factory<"scheme", "calver", {
|
|
1224
|
+
format: z.ZodDefault<z.ZodString>;
|
|
1225
|
+
timezone: z.ZodDefault<z.ZodString>;
|
|
1226
|
+
}, Scheme>;
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/schemes/semver.d.ts
|
|
1229
|
+
/** A strict semantic version. */
|
|
1230
|
+
interface Semver {
|
|
1231
|
+
major: number;
|
|
1232
|
+
minor: number;
|
|
1233
|
+
patch: number;
|
|
1234
|
+
prerelease?: string;
|
|
1235
|
+
build?: string;
|
|
1236
|
+
}
|
|
1237
|
+
/** Whether a version is valid semver: `MAJOR.MINOR.PATCH`, without leading zeros. */
|
|
1238
|
+
declare function isSemver(version: string): boolean;
|
|
1239
|
+
declare function parseSemver(version: string): Semver;
|
|
1240
|
+
declare function formatSemver(version: Semver): string;
|
|
1241
|
+
/** Bumps a version: `breaking` → major, `feature` → minor, `fix` → patch. */
|
|
1242
|
+
declare function bumpSemver(version: Semver, kind: ReleaseKind): Semver;
|
|
1243
|
+
/**
|
|
1244
|
+
* `MAJOR.minor.patch`: breaking changes bump the major number, features the
|
|
1245
|
+
* minor and fixes the patch. Before 1.0.0, bumps shift down a level by
|
|
1246
|
+
* default (`0.MAJOR.minorOrPatch`).
|
|
1247
|
+
*/
|
|
1248
|
+
declare const semver: Factory<"scheme", "semver", {
|
|
1249
|
+
shiftPreMajor: z.ZodDefault<z.ZodBoolean>;
|
|
1250
|
+
initial: z.ZodDefault<z.ZodString>;
|
|
1251
|
+
}, Scheme>;
|
|
1252
|
+
declare namespace index_d_exports$1 {
|
|
1253
|
+
export { Semver, bumpSemver, calver, formatSemver, isSemver, parseSemver, semver };
|
|
1254
|
+
}
|
|
1255
|
+
//#endregion
|
|
1256
|
+
//#region src/steps/cargo/publish.d.ts
|
|
1257
|
+
/**
|
|
1258
|
+
* Publishes the crate to crates.io, or another registry, after earlier steps
|
|
1259
|
+
* wrote the new version to `Cargo.toml`. Cargo verifies the crate builds
|
|
1260
|
+
* first, and waits for it to be available, so dependents publish after it.
|
|
1261
|
+
*/
|
|
1262
|
+
declare const cargoPublish: StepFactory<"release", "cargo/publish", {
|
|
1263
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1264
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
1265
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1266
|
+
}, "each">;
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region src/steps/change-files/clean.d.ts
|
|
1269
|
+
/**
|
|
1270
|
+
* Deletes the change files a release consumed, those naming a component
|
|
1271
|
+
* that's released, and reports them for `git/commit` to commit their
|
|
1272
|
+
* deletion. Releases on a channel leave them for the stable release.
|
|
1273
|
+
*/
|
|
1274
|
+
declare const changeFilesClean: StepFactory<"write", "change-files/clean", {
|
|
1275
|
+
directory: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1276
|
+
channels: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1277
|
+
}, "all">;
|
|
1278
|
+
//#endregion
|
|
1279
|
+
//#region src/steps/change-files/read.d.ts
|
|
1280
|
+
/**
|
|
1281
|
+
* Collects the change files in `.changes/`: each says what changed, and
|
|
1282
|
+
* how much for each component it names. A change's label is its kind, for
|
|
1283
|
+
* `labels/determine-kind` and `labels/determine-notes`.
|
|
1284
|
+
*/
|
|
1285
|
+
declare const changeFilesRead: StepFactory<"read-changes", "change-files/read", {
|
|
1286
|
+
directory: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1287
|
+
}, "all">;
|
|
1288
|
+
//#endregion
|
|
1289
|
+
//#region src/steps/components/dependents.d.ts
|
|
1290
|
+
/**
|
|
1291
|
+
* Releases the components that depend on a released component, so their
|
|
1292
|
+
* releases pick up the new version, e.g. with `fs/write-version` updating
|
|
1293
|
+
* their dependency on it. Dependents of dependents follow.
|
|
1294
|
+
*/
|
|
1295
|
+
declare const componentsDependents: StepFactory<"determine-kind", "components/dependents", {
|
|
1296
|
+
kind: z.ZodDefault<z.ZodEnum<{
|
|
1297
|
+
breaking: "breaking";
|
|
1298
|
+
feature: "feature";
|
|
1299
|
+
fix: "fix";
|
|
1300
|
+
}>>;
|
|
1301
|
+
on: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
1302
|
+
breaking: "breaking";
|
|
1303
|
+
feature: "feature";
|
|
1304
|
+
fix: "fix";
|
|
1305
|
+
}>>>;
|
|
1306
|
+
}, "all">;
|
|
1307
|
+
//#endregion
|
|
1308
|
+
//#region src/steps/conventional/determine-kind.d.ts
|
|
1309
|
+
/**
|
|
1310
|
+
* `!` or `BREAKING` → breaking; otherwise each change's kind comes from its
|
|
1311
|
+
* conventional type, and the highest kind wins.
|
|
1312
|
+
*/
|
|
1313
|
+
declare const conventionalDetermineKind: StepFactory<"determine-kind", "conventional/determine-kind", {
|
|
1314
|
+
types: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1315
|
+
breaking: "breaking";
|
|
1316
|
+
feature: "feature";
|
|
1317
|
+
fix: "fix";
|
|
1318
|
+
none: "none";
|
|
1319
|
+
}>>>;
|
|
1320
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
1321
|
+
breaking: "breaking";
|
|
1322
|
+
feature: "feature";
|
|
1323
|
+
fix: "fix";
|
|
1324
|
+
none: "none";
|
|
1325
|
+
}>>;
|
|
1326
|
+
}, "each">;
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/steps/conventional/determine-notes.d.ts
|
|
1329
|
+
/**
|
|
1330
|
+
* A `### Title` section for breaking changes, then one per group of
|
|
1331
|
+
* conventional types, then the rest.
|
|
1332
|
+
*/
|
|
1333
|
+
declare const conventionalBuildNotes: StepFactory<"determine-notes", "conventional/determine-notes", {
|
|
1334
|
+
sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1335
|
+
title: z.ZodString;
|
|
1336
|
+
types: z.ZodArray<z.ZodString>;
|
|
1337
|
+
}, z.core.$strict>>>;
|
|
1338
|
+
breaking: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1339
|
+
other: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1340
|
+
links: z.ZodDefault<z.ZodBoolean>;
|
|
1341
|
+
dependencies: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1342
|
+
}, "each">;
|
|
1343
|
+
//#endregion
|
|
1344
|
+
//#region src/steps/conventional/read-commits.d.ts
|
|
1345
|
+
/**
|
|
1346
|
+
* Collects every conventional section (`feat: ...`, `fix(x)!: ...`) in the
|
|
1347
|
+
* commits since the previous release, or in all history without one. Only
|
|
1348
|
+
* commits touching the component count; for the whole project, when the
|
|
1349
|
+
* working directory is a subdirectory of the repository, only those touching
|
|
1350
|
+
* it. Each change links to its commit when the repository is known: on
|
|
1351
|
+
* GitHub, or in GitLab CI, on GitLab.
|
|
1352
|
+
*/
|
|
1353
|
+
declare const conventionalReadCommits: StepFactory<"read-changes", "conventional/read-commits", Empty, "each">;
|
|
1354
|
+
//#endregion
|
|
1355
|
+
//#region src/steps/dart/publish.d.ts
|
|
1356
|
+
/**
|
|
1357
|
+
* Publishes the package to pub.dev, or the server in its `publish_to`, after
|
|
1358
|
+
* earlier steps wrote the new version to `pubspec.yaml`.
|
|
1359
|
+
*/
|
|
1360
|
+
declare const dartPublish: StepFactory<"release", "dart/publish", {
|
|
1361
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1362
|
+
client: z.ZodOptional<z.ZodEnum<{
|
|
1363
|
+
dart: "dart";
|
|
1364
|
+
flutter: "flutter";
|
|
1365
|
+
}>>;
|
|
1366
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1367
|
+
}, "each">;
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region src/steps/dotnet/publish.d.ts
|
|
1370
|
+
/**
|
|
1371
|
+
* Pushes the component's packed NuGet packages to nuget.org, or another
|
|
1372
|
+
* source: pack them first, e.g. with `dotnet pack -c Release`. Only the
|
|
1373
|
+
* packages of the version being released are pushed, their symbols with them.
|
|
1374
|
+
*/
|
|
1375
|
+
declare const dotnetPublish: StepFactory<"release", "dotnet/publish", {
|
|
1376
|
+
files: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1377
|
+
allowNoMatch: z.ZodDefault<z.ZodBoolean>;
|
|
1378
|
+
source: z.ZodDefault<z.ZodString>;
|
|
1379
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1380
|
+
}, "each">;
|
|
1381
|
+
//#endregion
|
|
1382
|
+
//#region src/steps/exec/command.d.ts
|
|
1383
|
+
/**
|
|
1384
|
+
* Runs a command for each component in the phase it's given: in `write`,
|
|
1385
|
+
* e.g. `cargo update --workspace` to update a lockfile; in `release`, e.g.
|
|
1386
|
+
* `cargo publish` or `docker push app:{version}`.
|
|
1387
|
+
*/
|
|
1388
|
+
declare const execCommand: StepFactory<"release" | "stage" | "write", "exec/command", {
|
|
1389
|
+
phase: z.ZodEnum<{
|
|
1390
|
+
release: "release";
|
|
1391
|
+
stage: "stage";
|
|
1392
|
+
write: "write";
|
|
1393
|
+
}>;
|
|
1394
|
+
command: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
1395
|
+
dryRun: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1396
|
+
cwd: z.ZodDefault<z.ZodString>;
|
|
1397
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1398
|
+
files: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1399
|
+
}, "each">;
|
|
1400
|
+
//#endregion
|
|
1401
|
+
//#region src/steps/fs/write-changes.d.ts
|
|
1402
|
+
/** Writes release notes to a file, creating it if needed. */
|
|
1403
|
+
declare const fsWriteChanges: StepFactory<"write", "fs/write-changes", {
|
|
1404
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1405
|
+
heading: z.ZodDefault<z.ZodString>;
|
|
1406
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
1407
|
+
append: "append";
|
|
1408
|
+
prepend: "prepend";
|
|
1409
|
+
replace: "replace";
|
|
1410
|
+
}>>;
|
|
1411
|
+
channels: z.ZodDefault<z.ZodBoolean>;
|
|
1412
|
+
}, "each">;
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region src/steps/fs/write-version.d.ts
|
|
1415
|
+
/**
|
|
1416
|
+
* Writes each component's new version to its version file, in the project's
|
|
1417
|
+
* own format, keeping everything else as it was. With the `npm`, `cargo` and
|
|
1418
|
+
* `dart` formats, dependencies on the other components released with it are
|
|
1419
|
+
* pointed at their new versions too, keeping each range's operator.
|
|
1420
|
+
*/
|
|
1421
|
+
declare const fsWriteVersion: StepFactory<"write", "fs/write-version", {
|
|
1422
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
1423
|
+
cargo: "cargo";
|
|
1424
|
+
dart: "dart";
|
|
1425
|
+
dotnet: "dotnet";
|
|
1426
|
+
gradle: "gradle";
|
|
1427
|
+
helm: "helm";
|
|
1428
|
+
maven: "maven";
|
|
1429
|
+
npm: "npm";
|
|
1430
|
+
pattern: "pattern";
|
|
1431
|
+
plain: "plain";
|
|
1432
|
+
python: "python";
|
|
1433
|
+
ruby: "ruby";
|
|
1434
|
+
}>>;
|
|
1435
|
+
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1436
|
+
allowNoMatch: z.ZodDefault<z.ZodBoolean>;
|
|
1437
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
1438
|
+
}, "all">;
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/steps/git/commit.d.ts
|
|
1441
|
+
/**
|
|
1442
|
+
* Commits the files that earlier `release` steps changed, for every
|
|
1443
|
+
* component, in one commit. Without this the version bump never lands.
|
|
1444
|
+
* Pushing is off by default, so `git/create-tag` can push the commit and its
|
|
1445
|
+
* tags together.
|
|
1446
|
+
*/
|
|
1447
|
+
declare const gitCommit: StepFactory<"stage", "git/commit", {
|
|
1448
|
+
files: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1449
|
+
message: z.ZodDefault<z.ZodString>;
|
|
1450
|
+
push: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1451
|
+
}, "all">;
|
|
1452
|
+
//#endregion
|
|
1453
|
+
//#region src/steps/git/create-tag.d.ts
|
|
1454
|
+
/**
|
|
1455
|
+
* Tags HEAD with every component's release, moves any floating tags to it,
|
|
1456
|
+
* and pushes them along with the current branch in one atomic push, so a
|
|
1457
|
+
* commit from `git/commit` and its tags land together or not at all.
|
|
1458
|
+
*/
|
|
1459
|
+
declare const gitCreateTag: StepFactory<"release", "git/create-tag", {
|
|
1460
|
+
message: z.ZodDefault<z.ZodString>;
|
|
1461
|
+
move: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1462
|
+
push: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1463
|
+
}, "all">;
|
|
1464
|
+
//#endregion
|
|
1465
|
+
//#region src/steps/github/create-release.d.ts
|
|
1466
|
+
/**
|
|
1467
|
+
* Creates a GitHub release for the version, with the notes as its body, or
|
|
1468
|
+
* finds the one another job already created.
|
|
1469
|
+
*/
|
|
1470
|
+
declare const githubCreateRelease: StepFactory<"release", "github/create-release", {
|
|
1471
|
+
title: import("zod").ZodDefault<import("zod").ZodString>;
|
|
1472
|
+
draft: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
1473
|
+
prerelease: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodLiteral<"auto">]>>;
|
|
1474
|
+
repo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1475
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1476
|
+
}, "each">;
|
|
1477
|
+
//#endregion
|
|
1478
|
+
//#region src/steps/github/open-release-pr.d.ts
|
|
1479
|
+
/**
|
|
1480
|
+
* Proposes the release as a pull request instead of releasing it: commits
|
|
1481
|
+
* what earlier `write` steps changed to a release branch, and opens a pull
|
|
1482
|
+
* request for it, or updates the one that's open. The release steps wait
|
|
1483
|
+
* until it merges; then the `github/release-pr` history finds it, and they
|
|
1484
|
+
* run for what it proposed.
|
|
1485
|
+
*/
|
|
1486
|
+
declare const githubOpenReleasePr: StepFactory<"stage", "github/open-release-pr", {
|
|
1487
|
+
branch: z.ZodDefault<z.ZodString>;
|
|
1488
|
+
title: z.ZodDefault<z.ZodString>;
|
|
1489
|
+
labels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1490
|
+
remote: z.ZodDefault<z.ZodString>;
|
|
1491
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1492
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1493
|
+
}, "all">;
|
|
1494
|
+
//#endregion
|
|
1495
|
+
//#region src/steps/github/read-pull-requests.d.ts
|
|
1496
|
+
/**
|
|
1497
|
+
* Collects the pull requests merged into the branch through the commits
|
|
1498
|
+
* touching the component since the previous release, or in all history
|
|
1499
|
+
* without one, each with its labels. Commits that weren't merged through a
|
|
1500
|
+
* pull request aren't counted.
|
|
1501
|
+
*/
|
|
1502
|
+
declare const githubReadPullRequests: StepFactory<"read-changes", "github/read-pull-requests", {
|
|
1503
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1504
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1505
|
+
}, "each">;
|
|
1506
|
+
//#endregion
|
|
1507
|
+
//#region src/steps/github/upload-artifact.d.ts
|
|
1508
|
+
/**
|
|
1509
|
+
* Keeps files as an artifact of the workflow run; with `dryRunArtifact`, in
|
|
1510
|
+
* dry runs too, e.g. to keep what a dry run built.
|
|
1511
|
+
*/
|
|
1512
|
+
declare const githubUploadArtifact: StepFactory<"release", "github/upload-artifact", {
|
|
1513
|
+
name: z.ZodString;
|
|
1514
|
+
files: z.ZodArray<z.ZodString>;
|
|
1515
|
+
allowNoMatch: z.ZodDefault<z.ZodBoolean>;
|
|
1516
|
+
dryRunArtifact: z.ZodDefault<z.ZodBoolean>;
|
|
1517
|
+
retentionDays: z.ZodOptional<z.ZodNumber>;
|
|
1518
|
+
}, "each">;
|
|
1519
|
+
//#endregion
|
|
1520
|
+
//#region src/steps/github/upload-release-assets.d.ts
|
|
1521
|
+
/**
|
|
1522
|
+
* Uploads files to the version's GitHub release, creating the release if no
|
|
1523
|
+
* other step or job has yet, so that jobs building different files can each
|
|
1524
|
+
* upload their own.
|
|
1525
|
+
*/
|
|
1526
|
+
declare const githubUploadReleaseAssets: StepFactory<"release", "github/upload-release-assets", {
|
|
1527
|
+
title: z.ZodDefault<z.ZodString>;
|
|
1528
|
+
draft: z.ZodDefault<z.ZodBoolean>;
|
|
1529
|
+
prerelease: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"auto">]>>;
|
|
1530
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1531
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1532
|
+
files: z.ZodArray<z.ZodString>;
|
|
1533
|
+
allowNoMatch: z.ZodDefault<z.ZodBoolean>;
|
|
1534
|
+
clobber: z.ZodDefault<z.ZodBoolean>;
|
|
1535
|
+
dryRunArtifact: z.ZodDefault<z.ZodBoolean>;
|
|
1536
|
+
artifactName: z.ZodOptional<z.ZodString>;
|
|
1537
|
+
}, "each">;
|
|
1538
|
+
//#endregion
|
|
1539
|
+
//#region src/steps/gitlab/create-release.d.ts
|
|
1540
|
+
/**
|
|
1541
|
+
* Creates a GitLab release for the version, with the notes as its
|
|
1542
|
+
* description, or finds the one another job already created. In GitLab CI,
|
|
1543
|
+
* the project, API and job token come from the job's environment.
|
|
1544
|
+
*/
|
|
1545
|
+
declare const gitlabCreateRelease: StepFactory<"release", "gitlab/create-release", {
|
|
1546
|
+
title: z.ZodDefault<z.ZodString>;
|
|
1547
|
+
project: z.ZodOptional<z.ZodString>;
|
|
1548
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1549
|
+
}, "each">;
|
|
1550
|
+
//#endregion
|
|
1551
|
+
//#region src/steps/keep-a-changelog/read-unreleased.d.ts
|
|
1552
|
+
/**
|
|
1553
|
+
* Collects the entries of the `## [Unreleased]` section of a changelog kept as
|
|
1554
|
+
* on keepachangelog.com: each top-level bullet is a change, labeled with its
|
|
1555
|
+
* `### Added`, `### Fixed` … heading, and the lines under it its description.
|
|
1556
|
+
*/
|
|
1557
|
+
declare const keepAChangelogReadUnreleased: StepFactory<"read-changes", "keep-a-changelog/read-unreleased", {
|
|
1558
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1559
|
+
}, "each">;
|
|
1560
|
+
//#endregion
|
|
1561
|
+
//#region src/steps/keep-a-changelog/write-release.d.ts
|
|
1562
|
+
/**
|
|
1563
|
+
* Releases the `## [Unreleased]` section of a Keep a Changelog file: its
|
|
1564
|
+
* entries move under a heading for the version, and an empty
|
|
1565
|
+
* `## [Unreleased]` takes its place. A `[unreleased]: …/compare/v1.0.0...HEAD`
|
|
1566
|
+
* link moves on to the new tag, and the version gets its own compare link.
|
|
1567
|
+
*/
|
|
1568
|
+
declare const keepAChangelogWriteRelease: StepFactory<"write", "keep-a-changelog/write-release", {
|
|
1569
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1570
|
+
heading: z.ZodDefault<z.ZodString>;
|
|
1571
|
+
channels: z.ZodDefault<z.ZodBoolean>;
|
|
1572
|
+
}, "each">;
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region src/steps/labels/determine-kind.d.ts
|
|
1575
|
+
/**
|
|
1576
|
+
* Each change's kind comes from its labels, e.g. a pull request's: the
|
|
1577
|
+
* highest of them, or `fallback` when none is mapped. The highest kind wins.
|
|
1578
|
+
*/
|
|
1579
|
+
declare const labelsDetermineKind: StepFactory<"determine-kind", "labels/determine-kind", {
|
|
1580
|
+
kinds: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1581
|
+
breaking: "breaking";
|
|
1582
|
+
feature: "feature";
|
|
1583
|
+
fix: "fix";
|
|
1584
|
+
none: "none";
|
|
1585
|
+
}>>>;
|
|
1586
|
+
fallback: z.ZodDefault<z.ZodEnum<{
|
|
1587
|
+
breaking: "breaking";
|
|
1588
|
+
feature: "feature";
|
|
1589
|
+
fix: "fix";
|
|
1590
|
+
none: "none";
|
|
1591
|
+
}>>;
|
|
1592
|
+
}, "each">;
|
|
1593
|
+
//#endregion
|
|
1594
|
+
//#region src/steps/labels/determine-notes.d.ts
|
|
1595
|
+
/**
|
|
1596
|
+
* A `### Title` section per group of labels, like GitHub's own release notes
|
|
1597
|
+
* categories, then the rest.
|
|
1598
|
+
*/
|
|
1599
|
+
declare const labelsBuildNotes: StepFactory<"determine-notes", "labels/determine-notes", {
|
|
1600
|
+
sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1601
|
+
title: z.ZodString;
|
|
1602
|
+
labels: z.ZodArray<z.ZodString>;
|
|
1603
|
+
}, z.core.$strict>>>;
|
|
1604
|
+
other: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1605
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1606
|
+
descriptions: z.ZodDefault<z.ZodBoolean>;
|
|
1607
|
+
links: z.ZodDefault<z.ZodBoolean>;
|
|
1608
|
+
dependencies: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
1609
|
+
}, "each">;
|
|
1610
|
+
//#endregion
|
|
1611
|
+
//#region src/steps/npm/publish.d.ts
|
|
1612
|
+
/**
|
|
1613
|
+
* Publishes the package to npm, after earlier steps wrote the new version to
|
|
1614
|
+
* `package.json`. Lifecycle scripts like `prepublishOnly` run as usual.
|
|
1615
|
+
*/
|
|
1616
|
+
declare const npmPublish: StepFactory<"release", "npm/publish", {
|
|
1617
|
+
path: z.ZodDefault<z.ZodString>;
|
|
1618
|
+
client: z.ZodOptional<z.ZodEnum<{
|
|
1619
|
+
npm: "npm";
|
|
1620
|
+
pnpm: "pnpm";
|
|
1621
|
+
}>>;
|
|
1622
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
1623
|
+
access: z.ZodOptional<z.ZodEnum<{
|
|
1624
|
+
public: "public";
|
|
1625
|
+
restricted: "restricted";
|
|
1626
|
+
}>>;
|
|
1627
|
+
provenance: z.ZodDefault<z.ZodBoolean>;
|
|
1628
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
1629
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1630
|
+
}, "each">;
|
|
1631
|
+
//#endregion
|
|
1632
|
+
//#region src/steps/python/publish.d.ts
|
|
1633
|
+
/**
|
|
1634
|
+
* Uploads the component's built distributions to PyPI, or another index:
|
|
1635
|
+
* build them first, e.g. with `uv build`. Only the files of the version
|
|
1636
|
+
* being released are uploaded.
|
|
1637
|
+
*/
|
|
1638
|
+
declare const pythonPublish: StepFactory<"release", "python/publish", {
|
|
1639
|
+
files: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
1640
|
+
allowNoMatch: z.ZodDefault<z.ZodBoolean>;
|
|
1641
|
+
client: z.ZodDefault<z.ZodEnum<{
|
|
1642
|
+
twine: "twine";
|
|
1643
|
+
uv: "uv";
|
|
1644
|
+
}>>;
|
|
1645
|
+
registry: z.ZodDefault<z.ZodString>;
|
|
1646
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1647
|
+
}, "each">;
|
|
1648
|
+
//#endregion
|
|
1649
|
+
//#region src/steps/ruby/publish.d.ts
|
|
1650
|
+
/**
|
|
1651
|
+
* Packs the component's gem from its gemspec and pushes it to RubyGems, or
|
|
1652
|
+
* another host, after earlier steps wrote the new version to it.
|
|
1653
|
+
*/
|
|
1654
|
+
declare const rubyPublish: StepFactory<"release", "ruby/publish", {
|
|
1655
|
+
gemspec: z.ZodOptional<z.ZodString>;
|
|
1656
|
+
host: z.ZodDefault<z.ZodString>;
|
|
1657
|
+
token: z.ZodOptional<z.ZodString>;
|
|
1658
|
+
}, "each">;
|
|
1659
|
+
declare namespace index_d_exports {
|
|
1660
|
+
export { cargoPublish, changeFilesClean, changeFilesRead, componentsDependents, conventionalBuildNotes, conventionalDetermineKind, conventionalReadCommits, dartPublish, dotnetPublish, execCommand, fsWriteChanges, fsWriteVersion, gitCommit, gitCreateTag, githubCreateRelease, githubOpenReleasePr, githubReadPullRequests, githubUploadArtifact, githubUploadReleaseAssets, gitlabCreateRelease, keepAChangelogReadUnreleased, keepAChangelogWriteRelease, labelsBuildNotes, labelsDetermineKind, npmPublish, pythonPublish, rubyPublish };
|
|
1661
|
+
}
|
|
1662
|
+
//#endregion
|
|
1663
|
+
//#region src/utils/git.d.ts
|
|
1664
|
+
/** Runs `git` in `cwd` and resolves with its trimmed stdout. */
|
|
1665
|
+
declare function git(cwd: string, ...args: string[]): Promise<string>;
|
|
1666
|
+
/** Like {@link git}, but resolves with `undefined` instead of rejecting. */
|
|
1667
|
+
declare function tryGit(cwd: string, ...args: string[]): Promise<string | undefined>;
|
|
1668
|
+
/** `GITHUB_REPOSITORY`, or `owner/repo` from the `origin` remote. */
|
|
1669
|
+
declare function detectRepo(cwd: string): Promise<string | undefined>;
|
|
1670
|
+
//#endregion
|
|
1671
|
+
export { Channel as $, OptionsShape as $t, defineStep as A, Step as At, runRelease as B, WriteOutput as Bt, Release as C, PHASES as Ct, StepFactoryDefinition as D, ReleaseOutput as Dt, StepFactory as E, ReleaseKind as Et, ReleaseReport as F, StepOutputs as Ft, formatDuration as G, defineHistory as Gt, PrettyReporterOptions as H, History as Ht, ReleaseSetup as I, StepPreset as It, ComponentSource as J, FactoryKind as Jt, prettyReporter as K, AnyFactory as Kt, ReleaseStatus as L, StepRecord as Lt, ComponentReport as M, StepDefinition as Mt, GivenRelease as N, StepInput as Nt, definePreset as O, ReleaseResult as Ot, ReleaseError as P, StepOutput as Pt, resolveComponents as Q, OptionsInput as Qt, RunOptions as R, StepResults as Rt, PresetOptions as S, NotesOutput as St, ScopedStep as T, Previous as Tt, Reporter as U, HistoryInput as Ut, sortSteps as V, Found as Vt, defaultReporter as W, Pending as Wt, ResolvedComponent as X, Empty as Xt, Defaults as Y, index_d_exports$4 as Yt, defineComponents as Z, OptionsError as Zt, AnyStepFactory as _, Environment as _t, index_d_exports$1 as a, ChangeWith as at, Preset as b, KindOutput as bt, markdownSummary as c, AllStepDefinition as ct, expressionContext as d, Change as dt, OptionsValue as en, ChannelType as et, WorkflowInput as f, ChangesOutput as ft, resolveWorkflowSteps as g, EnginePhase as gt, resolveWorkflow as h, EachStepDefinition as ht, index_d_exports as i, defineScheme as it, when as j, StepCondition as jt, defineRelease as k, Scope as kt, ExpressionContext as l, AllStepInput as lt, WorkflowRelease as m, Dependency as mt, git as n, parseOptions as nn, BumpInput as nt, index_d_exports$2 as o, Fact as ot, WorkflowOptions as p, ComponentInfo as pt, Component as q, Factory as qt, tryGit as r, z as rn, Scheme as rt, index_d_exports$3 as s, Facts as st, detectRepo as t, joinPath as tn, RunChannel as tt, compileExpression as u, AllStepOutput as ut, ConditionInput as v, KINDS as vt, ReleaseConfig as w, Phase as wt, PresetDefaults as x, Next as xt, FactoryOptions as y, Kind as yt, errorMessage as z, StepStatus as zt };
|
|
1672
|
+
//# sourceMappingURL=index-BGDTM9bX.d.cts.map
|