import { type Logger } from "webappwiz/log"; import { type Fs, type Ps } from "webappwiz/system"; import { type Timer, type WallClock } from "webappwiz/time"; import { type Artifact } from "./artifact/artifact.js"; import type { Git } from "./git/git.js"; import type { Step, StepStage } from "./step.js"; import { type TrustOptions } from "./trust.js"; import { type Bump } from "./version.js"; import type { Workspace } from "./workspace/workspace.js"; /** What a release goes out through; the real system by default. */ export interface ReleaseOptions { /** * How far to move the version; `patch` by default. A RELEASE file left by a * run that died overrides it: that version is finished first. */ bump?: Bump; /** The packages the release stamps; the manifest workspace here by default. */ workspace?: Workspace; /** The repository the release commits; the workspace root's by default. */ git?: Git; log?: Logger; fs?: Fs; ps?: Ps; timer?: Timer; wallClock?: WallClock; prompt?: (message: string) => string | null; /** Go ahead without asking, for a run whose caller has already approved it. */ yes?: boolean; } /** Where `Release.status()` reads the workspace version from; the real system by default. */ export interface StatusOptions { /** The workspace whose version the artifacts are held against. */ workspace?: Workspace; fs?: Fs; ps?: Ps; } /** One artifact's live version, as `Release.status()` reads it. */ export interface DeployedArtifact { name: string; /** The workspace packages the artifact publishes, if any. */ packages: readonly string[]; /** What is live now; `undefined` when nothing is out yet. */ deployed: string | undefined; } /** The workspace's version beside what each artifact has live. */ export interface ReleaseStatus { /** The version the workspace stands at, which the last release stamped. */ version: string; /** Every artifact that can say what it has live, in release order. */ artifacts: DeployedArtifact[]; } /** * Everything a release ships, ready to go out at one version. `releases` * composes these; `release()` runs the whole flow as declared steps: preflight, * version, artifacts in stage order, and any steps the caller added. * * ```ts * await releases.lockstep(releases.npm("@scope/foo"), releases.git()).release(); * ``` * * A release that dies partway leaves a RELEASE file behind, and the next * `release()` finishes that version instead of bumping past it: every step * that landed is skipped, so nothing goes out twice. */ export declare class Release { /** Every artifact, in the order they will run: publish, then tag, then notes. */ readonly artifacts: readonly Artifact[]; /** Steps the caller declared beside the artifacts. */ readonly steps: readonly Step[]; constructor(artifacts: readonly Artifact[], steps?: readonly Step[]); /** The workspace packages this publishes, gathered from every artifact. */ get packages(): readonly string[]; /** * What every artifact that can say has live, beside the workspace's own * version, so a caller can show which lags. Artifacts with no `deployed`, * such as a build, are left out. */ status(opts?: StatusOptions): Promise; /** Releases everything, asking first. Run it again after a failure. */ release(opts?: ReleaseOptions): Promise; /** * Has each registry trust the CI job that `publish()` runs in, as npm's * trusted publisher entry for each package: the one setup publishing * without a token or 2FA takes. Every artifact is tried, and the ones that * failed are named together at the end. */ trust(opts?: TrustOptions): Promise; /** * Publishes what the declaration names that the registry lacks, at the * version the workspace already stands at, from a checkout of a release * commit. It is the half of a release a CI job npm trusts can do: only the * build and publish stages run, each registry in its trusted mode, so * nothing is stamped, tagged, approved or noted. A version the registry * already has is skipped, so a rerun publishes nothing it did. */ publish(opts?: PublishOptions): Promise; /** Every step a release runs, in order, as both `release()` and `plan()` read it. */ private declare; /** * What `release()` would run, in order, without running any of it. Reads the * workspace and a RELEASE file left by a run that died, and nothing else, so * the version and the step ids are the ones the run's events will carry. */ plan(opts?: PlanOptions): Promise; } /** What status calls an artifact that names itself nothing. */ export declare function statusName(artifact: Artifact): string; /** Where `Release.plan()` reads from; the real system by default. */ export interface PlanOptions { /** How far the version would move; `patch` by default. */ bump?: Bump; workspace?: Workspace; git?: Git; log?: Logger; fs?: Fs; ps?: Ps; } /** What `Release.publish()` publishes through; the real system by default. */ export interface PublishOptions { /** The packages to publish, at the version the workspace stands at. */ workspace?: Workspace; log?: Logger; fs?: Fs; ps?: Ps; timer?: Timer; wallClock?: WallClock; } /** One step of a release, as `Release.plan()` lists it. */ export interface PlannedStep { /** The id this step's run-time events carry. */ id: string; name: string; stage: StepStage; /** The workspace packages the step publishes, if any. */ packages: string[]; /** The artifact the step belongs to, when it came from one. */ artifact?: string; deadlineMs: number; } /** Every step a release would run, in order. `schema` grows with the shape. */ export interface ReleasePlan { schema: 1; /** The version the release would go out at. */ version: string; /** Whether a RELEASE file from a run that died fixed that version. */ resuming: boolean; steps: PlannedStep[]; }