@williamthorsen/release-kit 10.4.3 → 10.5.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/.readyup/kits/default.js +10 -3
- package/.readyup/kits/npm-auto-publish.js +11 -3
- package/.readyup/manifest.json +11 -11
- package/CHANGELOG.md +38 -0
- package/README.md +10 -2
- package/dist/esm/assertCleanWorkingTree.d.ts +5 -0
- package/dist/esm/buildChangelogEntries.d.ts +22 -0
- package/dist/esm/buildDependencyGraph.d.ts +16 -0
- package/dist/esm/buildEmptyReleaseEntry.d.ts +8 -0
- package/dist/esm/buildReleaseSummary.d.ts +10 -0
- package/dist/esm/buildSyntheticChangelogEntry.d.ts +6 -0
- package/dist/esm/bumpVersion.d.ts +8 -0
- package/dist/esm/changelogJsonFile.d.ts +11 -0
- package/dist/esm/changelogJsonUtils.d.ts +16 -0
- package/dist/esm/changelogOverrides.d.ts +143 -0
- package/dist/esm/checkWorkTypesDrift.d.ts +25 -0
- package/dist/esm/collectPolicyViolations.d.ts +9 -0
- package/dist/esm/commitCommand.d.ts +6 -0
- package/dist/esm/compareVersions.d.ts +7 -0
- package/dist/esm/createGithubRelease.d.ts +30 -0
- package/dist/esm/createGithubReleaseCommand.d.ts +7 -0
- package/dist/esm/createTags.d.ts +5 -0
- package/dist/esm/decideRelease.d.ts +37 -0
- package/dist/esm/defaults.d.ts +25 -0
- package/dist/esm/defineConfig.d.ts +9 -0
- package/dist/esm/deleteFileIfExists.d.ts +1 -0
- package/dist/esm/deriveWorkspaceConfig.d.ts +9 -0
- package/dist/esm/detectPackageManager.d.ts +6 -0
- package/dist/esm/detectUndeclaredTagPrefixes.d.ts +18 -0
- package/dist/esm/determineBumpFromCommits.d.ts +5 -0
- package/dist/esm/determineBumpType.d.ts +12 -0
- package/dist/esm/discoverWorkspaces.d.ts +12 -0
- package/dist/esm/format.d.ts +3 -0
- package/dist/esm/formatPrivateSkip.d.ts +6 -0
- package/dist/esm/generateChangelogs.d.ts +25 -0
- package/dist/esm/getCommitsSinceTarget.d.ts +16 -0
- package/dist/esm/hasPrettierConfig.d.ts +6 -0
- package/dist/esm/help/prepareHelp.d.ts +6 -0
- package/dist/esm/init/checks.d.ts +4 -0
- package/dist/esm/init/detectRepoType.d.ts +7 -0
- package/dist/esm/init/initCommand.d.ts +6 -0
- package/dist/esm/init/parseJsonRecord.d.ts +4 -0
- package/dist/esm/init/scaffold.d.ts +3 -1
- package/dist/esm/init/templates.d.ts +13 -0
- package/dist/esm/injectReleaseNotesIntoReadme.d.ts +39 -0
- package/dist/esm/injectSection.d.ts +6 -0
- package/dist/esm/loadConfig.d.ts +46 -0
- package/dist/esm/loadValidatedConfig.d.ts +8 -0
- package/dist/esm/parseCommitMessage.d.ts +42 -0
- package/dist/esm/parseRequestedTags.d.ts +7 -0
- package/dist/esm/planReleaseNotesPreviews.d.ts +20 -0
- package/dist/esm/planVersionBump.d.ts +12 -0
- package/dist/esm/prepareCommand.d.ts +10 -0
- package/dist/esm/previewTagPrefixes.d.ts +21 -1
- package/dist/esm/propagateBumps.d.ts +15 -0
- package/dist/esm/publish.d.ts +1 -0
- package/dist/esm/publishCommand.d.ts +4 -0
- package/dist/esm/pushCommand.d.ts +4 -0
- package/dist/esm/pushRelease.d.ts +6 -0
- package/dist/esm/readCurrentVersion.d.ts +1 -0
- package/dist/esm/releaseFiles.d.ts +22 -0
- package/dist/esm/releasePlan.d.ts +23 -0
- package/dist/esm/releasePrepare.d.ts +40 -0
- package/dist/esm/releasePrepareMono.d.ts +8 -0
- package/dist/esm/releasePrepareProject.d.ts +42 -0
- package/dist/esm/renderChangelogMarkdown.d.ts +17 -0
- package/dist/esm/renderReleaseNotes.d.ts +25 -0
- package/dist/esm/reportPrepare.d.ts +14 -0
- package/dist/esm/resolveCliffConfigPath.d.ts +10 -0
- package/dist/esm/resolveCommandTags.d.ts +13 -1
- package/dist/esm/resolveReleaseNotesConfig.d.ts +14 -0
- package/dist/esm/resolveReleaseTags.d.ts +22 -0
- package/dist/esm/runGitCliff.d.ts +43 -0
- package/dist/esm/showTagPrefixesCommand.d.ts +11 -0
- package/dist/esm/stripScope.d.ts +7 -0
- package/dist/esm/sync-labels/generateCommand.d.ts +17 -0
- package/dist/esm/sync-labels/initCommand.d.ts +9 -0
- package/dist/esm/sync-labels/presets.d.ts +6 -0
- package/dist/esm/sync-labels/resolveLabels.d.ts +10 -0
- package/dist/esm/sync-labels/retiredConfig.d.ts +8 -0
- package/dist/esm/sync-labels/syncCommand.d.ts +6 -0
- package/dist/esm/sync-labels/templates.d.ts +14 -0
- package/dist/esm/sync-labels/types.d.ts +4 -0
- package/dist/esm/syncWorkTypes.d.ts +18 -0
- package/dist/esm/tagCommand.d.ts +1 -0
- package/dist/esm/typeGuards.d.ts +2 -0
- package/dist/esm/types.d.ts +293 -0
- package/dist/esm/validateConfig.d.ts +14 -1
- package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +21 -0
- package/dist/esm/validateOverridesCommand.d.ts +30 -0
- package/dist/esm/workTypesData.d.ts +27 -0
- package/dist/esm/workTypesUtils.d.ts +17 -0
- package/package.json +8 -8
|
@@ -1,10 +1,52 @@
|
|
|
1
1
|
import type { Commit, ParsedCommit, WorkTypeConfig } from './types.js';
|
|
2
|
+
/** Regex patterns stripped from the start of commit messages before parsing. */
|
|
2
3
|
export declare const COMMIT_PREPROCESSOR_PATTERNS: readonly RegExp[];
|
|
4
|
+
/**
|
|
5
|
+
* Regex source for the pipe-prefixed scope atom (the `web` in `web|feat: ...`).
|
|
6
|
+
*
|
|
7
|
+
* Deliberately permissive: `*` is the sanctioned structural scope for changes spanning every
|
|
8
|
+
* workspace, so the atom admits any run of non-pipe characters rather than word characters.
|
|
9
|
+
* `cliff.toml.template` embeds the same atom in every ticketed commit parser, and
|
|
10
|
+
* `cliffConfigAlignment.unit.test.ts` asserts that parity — exported so neither side can drift.
|
|
11
|
+
*/
|
|
3
12
|
export declare const PIPE_SCOPE_SOURCE = "[^|]+";
|
|
13
|
+
/** Surface where a `!`/`BREAKING CHANGE:` policy violation was detected. */
|
|
4
14
|
export type PolicyViolationSurface = 'prefix' | 'body';
|
|
15
|
+
/**
|
|
16
|
+
* Callback invoked when `parseCommitMessage` detects a `!`-policy violation.
|
|
17
|
+
*
|
|
18
|
+
* Two-tier policy: at write-time (commit-msg hook, OOS for ticket #355), violations are
|
|
19
|
+
* rejected outright; at release-time (this parser), violations are warn-and-continue so
|
|
20
|
+
* legacy log entries don't block releases. Callers (`decideRelease`, `releasePrepareMono`,
|
|
21
|
+
* etc.) collect callback invocations and surface them in the release report.
|
|
22
|
+
*/
|
|
5
23
|
export type PolicyViolationHandler = (commit: Commit, type: string, surface: PolicyViolationSurface) => void;
|
|
24
|
+
/** Optional configuration for `parseCommitMessage` beyond the core inputs. */
|
|
6
25
|
export interface ParseCommitMessageOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Per-type breaking-policy lookup keyed by canonical type name. Missing entries are
|
|
28
|
+
* treated as `'optional'` for backward compatibility with consumers that have not
|
|
29
|
+
* supplied policies.
|
|
30
|
+
*/
|
|
7
31
|
breakingPolicies?: Record<string, 'forbidden' | 'optional' | 'required'>;
|
|
32
|
+
/** Receives policy-violation notifications. See {@link PolicyViolationHandler}. */
|
|
8
33
|
onPolicyViolation?: PolicyViolationHandler;
|
|
9
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse a commit message into structured metadata.
|
|
37
|
+
*
|
|
38
|
+
* Supports three formats:
|
|
39
|
+
* - `type: description`
|
|
40
|
+
* - `scope|type: description` (pipe-prefixed scope)
|
|
41
|
+
* - `type(scope): description` (conventional commit parenthesized scope)
|
|
42
|
+
*
|
|
43
|
+
* Resolves aliases (e.g., `feature` → `feat`) using the provided work-type configs and the
|
|
44
|
+
* canonical aliases list. Resolves scope aliases when a `scopeAliases` map is provided.
|
|
45
|
+
* Detects breaking changes via `type!:` or `BREAKING CHANGE:` in the message.
|
|
46
|
+
*
|
|
47
|
+
* `!`-policy enforcement is **release-time tolerant**: when the resolved type's policy
|
|
48
|
+
* forbids `!`, the marker is dropped from the parse (`breaking: false`) and
|
|
49
|
+
* `onPolicyViolation` is invoked. When the policy requires `!`, a bare type triggers the
|
|
50
|
+
* same warning path. The strict write-time gate (commit-msg hook) is out of scope.
|
|
51
|
+
*/
|
|
10
52
|
export declare function parseCommitMessage(message: string, hash: string, workTypes: Record<string, WorkTypeConfig>, scopeAliases?: Record<string, string>, options?: ParseCommitMessageOptions): ParsedCommit | undefined;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse the comma-separated `--tags` flag value into a list of requested tag names.
|
|
3
|
+
*
|
|
4
|
+
* Empty segments (from `--tags=`, leading/trailing commas, or `--tags=,,`) are dropped. When the
|
|
5
|
+
* resulting list is empty, returns `undefined` so the caller treats it as "no filter" — the same
|
|
6
|
+
* behavior as omitting `--tags` entirely.
|
|
7
|
+
*/
|
|
1
8
|
export declare function parseRequestedTags(flagValue: string | undefined): string[] | undefined;
|
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import type { PlannedWrite } from './releasePlan.js';
|
|
2
2
|
import type { ChangelogEntry } from './types.js';
|
|
3
|
+
/** Options for `planReleaseNotesPreviews`. */
|
|
3
4
|
export interface PlanReleaseNotesPreviewsOptions {
|
|
5
|
+
/** Workspace root directory beneath which `docs/` is created. */
|
|
4
6
|
workspacePath: string;
|
|
7
|
+
/** Full release tag (e.g., `release-kit-v1.0.0`); used to extract the version for filenames. */
|
|
5
8
|
tag: string;
|
|
9
|
+
/** The workspace's changelog entries as the release will leave them, merged but not yet written. */
|
|
6
10
|
entries: readonly ChangelogEntry[];
|
|
11
|
+
/** Section titles in priority order, typically derived from `resolveWorkTypes(config.workTypes)`. */
|
|
7
12
|
sectionOrder: string[];
|
|
8
13
|
}
|
|
14
|
+
/** Preview files a release will write, alongside the reasons any were left out. */
|
|
9
15
|
export interface ReleaseNotesPreviewsPlan {
|
|
10
16
|
writes: PlannedWrite[];
|
|
11
17
|
warnings: string[];
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Computes the per-workspace release-notes previews under `{workspacePath}/docs/` without
|
|
21
|
+
* writing them:
|
|
22
|
+
*
|
|
23
|
+
* - `docs/README.v{version}.md` — the workspace README with release notes injected at the marker.
|
|
24
|
+
* - `docs/RELEASE_NOTES.v{version}.md` — the standalone release notes for this version.
|
|
25
|
+
*
|
|
26
|
+
* Renders from the entries the release will write rather than from a saved `changelog.json`, so
|
|
27
|
+
* a preview describes the release being prepared rather than the one already on disk.
|
|
28
|
+
*
|
|
29
|
+
* The injected-README preview is omitted (the standalone file is still planned) when the
|
|
30
|
+
* workspace has no readable `README.md`. Both are omitted when the renderer reports no content
|
|
31
|
+
* for this version, with the reason recorded in `warnings`.
|
|
32
|
+
*/
|
|
13
33
|
export declare function planReleaseNotesPreviews(options: PlanReleaseNotesPreviewsOptions): ReleaseNotesPreviewsPlan;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import type { PlannedWrite } from './releasePlan.js';
|
|
2
2
|
import type { ReleaseType } from './types.js';
|
|
3
|
+
/** A version change computed for a workspace's package files but not yet written. */
|
|
3
4
|
export interface VersionBumpPlan {
|
|
4
5
|
currentVersion: string;
|
|
5
6
|
newVersion: string;
|
|
6
7
|
writes: PlannedWrite[];
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Computes the version bump for a workspace's package files without writing them.
|
|
11
|
+
*
|
|
12
|
+
* The current version comes from the first package file, and the new one from the release type.
|
|
13
|
+
* Every file's post-bump content is rendered in full, preserving the fields the file already
|
|
14
|
+
* carries and the two-space indentation with a trailing newline.
|
|
15
|
+
*/
|
|
8
16
|
export declare function planVersionBump(packageFiles: readonly string[], releaseType: ReleaseType): VersionBumpPlan;
|
|
17
|
+
/**
|
|
18
|
+
* Computes an explicit version assignment for a workspace's package files without writing them,
|
|
19
|
+
* bypassing commit-derived bump logic. Backs the `--set-version` flag.
|
|
20
|
+
*/
|
|
9
21
|
export declare function planVersionSet(packageFiles: readonly string[], newVersion: string): VersionBumpPlan;
|
|
@@ -30,6 +30,7 @@ export declare const prepareFlagSchema: {
|
|
|
30
30
|
type: "boolean";
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
/** Parses CLI arguments into structured options. Prints a usage error and exits on invalid input. */
|
|
33
34
|
export declare function parseArgs(argv: string[]): {
|
|
34
35
|
dryRun: boolean;
|
|
35
36
|
force: boolean;
|
|
@@ -39,4 +40,13 @@ export declare function parseArgs(argv: string[]): {
|
|
|
39
40
|
setVersion: string | undefined;
|
|
40
41
|
withReleaseNotes: boolean;
|
|
41
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Orchestrates the CLI `prepare` command.
|
|
45
|
+
*
|
|
46
|
+
* 1. Discovers workspaces from `pnpm-workspace.yaml`.
|
|
47
|
+
* 2. Loads and validates `.config/release-kit.config.ts` (if present).
|
|
48
|
+
* 3. Merges discovered defaults with user config.
|
|
49
|
+
* 4. Delegates to `releasePrepare` or `releasePrepareMono` to compute the release plan.
|
|
50
|
+
* 5. Applies the plan, runs the format command, and prints the result via `reportPrepare`.
|
|
51
|
+
*/
|
|
42
52
|
export declare function prepareCommand(argv: string[]): Promise<void>;
|
|
@@ -1,30 +1,50 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type UndeclaredTagPrefix } from './detectUndeclaredTagPrefixes.js';
|
|
2
|
+
/** One workspace's preview row in the tag-prefix preview. */
|
|
2
3
|
export interface TagPrefixPreviewRow {
|
|
4
|
+
/** Workspace-relative directory path (e.g., `packages/core`). */
|
|
3
5
|
workspacePath: string;
|
|
6
|
+
/** Directory basename (e.g., `core`). */
|
|
4
7
|
dir: string;
|
|
8
|
+
/** The derived tag prefix, or `null` when derivation failed. */
|
|
5
9
|
derivedPrefix: string | null;
|
|
10
|
+
/** Human-readable reason derivation failed, or `null` when it succeeded. */
|
|
6
11
|
derivationError: string | null;
|
|
12
|
+
/** Count of tags matching the derived prefix; `0` when derivation failed or no tags exist. */
|
|
7
13
|
derivedTagCount: number;
|
|
14
|
+
/** One entry per declared legacy prefix, with its current tag count. */
|
|
8
15
|
legacyEntries: LegacyTagPrefixEntry[];
|
|
9
16
|
}
|
|
17
|
+
/** A single declared legacy prefix and its tag count. */
|
|
10
18
|
export interface LegacyTagPrefixEntry {
|
|
11
19
|
prefix: string;
|
|
12
20
|
tagCount: number;
|
|
13
21
|
}
|
|
22
|
+
/** A declared retired package plus its current tag count. */
|
|
14
23
|
export interface RetiredPackagePreviewEntry {
|
|
15
24
|
name: string;
|
|
16
25
|
tagPrefix: string;
|
|
17
26
|
successor?: string;
|
|
18
27
|
tagCount: number;
|
|
19
28
|
}
|
|
29
|
+
/** A tag-prefix collision between two or more workspaces. */
|
|
20
30
|
export interface TagPrefixCollision {
|
|
21
31
|
tagPrefix: string;
|
|
22
32
|
workspacePaths: string[];
|
|
23
33
|
}
|
|
34
|
+
/** Aggregate preview of tag-prefix state across all workspaces. */
|
|
24
35
|
export interface TagPrefixPreview {
|
|
25
36
|
workspaces: TagPrefixPreviewRow[];
|
|
26
37
|
collisions: TagPrefixCollision[];
|
|
27
38
|
undeclaredCandidates: UndeclaredTagPrefix[];
|
|
28
39
|
retiredPackages: RetiredPackagePreviewEntry[];
|
|
29
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Build a structured preview of tag-prefix state for every discovered workspace.
|
|
43
|
+
*
|
|
44
|
+
* Discovers workspaces via `discoverWorkspaces()`, derives each workspace's tag prefix
|
|
45
|
+
* via `deriveWorkspaceConfig()`, and records the derivation error on failure rather than aborting.
|
|
46
|
+
* Loads `.config/release-kit.config.ts` to surface declared legacy prefixes per workspace,
|
|
47
|
+
* scans local git tags for undeclared candidate prefixes via `detectUndeclaredTagPrefixes`,
|
|
48
|
+
* and reports collisions across successfully-derived prefixes.
|
|
49
|
+
*/
|
|
30
50
|
export declare function previewTagPrefixes(): Promise<TagPrefixPreview>;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import type { DependencyGraph } from './buildDependencyGraph.js';
|
|
2
2
|
import type { PropagationSource, ReleaseType } from './types.js';
|
|
3
|
+
/** Entry in the full release set produced by propagation. */
|
|
3
4
|
export interface ReleaseEntry {
|
|
4
5
|
releaseType: ReleaseType;
|
|
6
|
+
/** Present when this workspace was bumped (wholly or partly) due to a dependency update. */
|
|
5
7
|
propagatedFrom?: PropagationSource[];
|
|
8
|
+
/**
|
|
9
|
+
* Explicit new version override used for propagation metadata.
|
|
10
|
+
* When set, dependents see this value in their `propagatedFrom.newVersion` entry instead of a version computed from
|
|
11
|
+
* `releaseType`. Used by the `--set-version` CLI path so propagation reflects the overridden version.
|
|
12
|
+
*/
|
|
6
13
|
newVersionOverride?: string;
|
|
7
14
|
}
|
|
15
|
+
/** Map from workspace `dir` to its current version string (read from package.json). */
|
|
8
16
|
export type CurrentVersions = Map<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Walk upward through the dependency graph via BFS, adding `patch` bumps for dependents
|
|
19
|
+
* not already in the release set with a higher bump.
|
|
20
|
+
*
|
|
21
|
+
* Returns the full release set (direct + propagated). Direct entries that also have a
|
|
22
|
+
* propagated dependency get `propagatedFrom` metadata without changing their bump type.
|
|
23
|
+
*/
|
|
9
24
|
export declare function propagateBumps(directBumps: Map<string, ReleaseEntry>, graph: DependencyGraph, currentVersions: CurrentVersions): Map<string, ReleaseEntry>;
|
package/dist/esm/publish.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export interface PublishOptions {
|
|
|
4
4
|
dryRun: boolean;
|
|
5
5
|
provenance: boolean;
|
|
6
6
|
}
|
|
7
|
+
/** Publish a single package by running `{pm} publish` from its workspace directory. */
|
|
7
8
|
export declare function publishPackage(resolvedTag: ResolvedTag, packageManager: PackageManager, options: PublishOptions): void;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrate the CLI `publish` command: parse flags, discover workspaces, resolve tags from HEAD,
|
|
3
|
+
* detect the package manager, validate `--tags`, and publish each tag with inject/restore lifecycle.
|
|
4
|
+
*/
|
|
1
5
|
export declare function publishCommand(argv: string[]): Promise<void>;
|
|
@@ -8,4 +8,10 @@ export interface PushStep {
|
|
|
8
8
|
ref: string;
|
|
9
9
|
command: readonly [string, ...string[]];
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Push the release commit and each tag individually so that GitHub Actions fires
|
|
13
|
+
* a separate workflow run per tag.
|
|
14
|
+
*
|
|
15
|
+
* Returns the list of push steps that were executed (or would be executed in dry-run mode).
|
|
16
|
+
*/
|
|
11
17
|
export declare function pushRelease(resolvedTags: ResolvedTag[], options?: PushReleaseOptions): PushStep[];
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File written by the release preparation step, containing one tag per line.
|
|
3
|
+
*
|
|
4
|
+
* Relative to the project root so it works identically in CI and local runs. The reusable
|
|
5
|
+
* release workflow reads it at this path, so the path and the line-delimited format are a
|
|
6
|
+
* published contract rather than an internal detail.
|
|
7
|
+
*/
|
|
1
8
|
export declare const RELEASE_TAGS_FILE = "tmp/.release-tags";
|
|
9
|
+
/**
|
|
10
|
+
* File written by the release preparation step, containing the commit body summary.
|
|
11
|
+
* Relative to the project root so it works identically in CI and local runs.
|
|
12
|
+
*/
|
|
2
13
|
export declare const RELEASE_SUMMARY_FILE = "tmp/.release-summary";
|
|
14
|
+
/** Resolves the tags file against the current working directory, for use in diagnostics. */
|
|
3
15
|
export declare function resolveReleaseTagsPath(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Reads the tag names written by `prepare`, one per line, discarding blank lines.
|
|
18
|
+
*
|
|
19
|
+
* Both consumers — `commit` and `tag` — share this reader so their diagnostics cannot drift.
|
|
20
|
+
* Failure messages name the path as resolved against `process.cwd()`, which is what separates
|
|
21
|
+
* a genuinely absent file from one the command looked for under a different worktree, and
|
|
22
|
+
* they preserve the underlying errno instead of reporting every failure as a missing file.
|
|
23
|
+
*
|
|
24
|
+
* An empty or blank file yields an empty array; callers decide whether that is an error.
|
|
25
|
+
*/
|
|
4
26
|
export declare function readReleaseTags(): string[];
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import type { PrepareResult } from './types.js';
|
|
2
|
+
/** One file a release will write, carried as its complete intended content. */
|
|
2
3
|
export interface PlannedWrite {
|
|
3
4
|
path: string;
|
|
4
5
|
content: string;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* A release computed in full but not yet written.
|
|
9
|
+
*
|
|
10
|
+
* Holding every intended file up front is what lets `prepare` fail during computation without
|
|
11
|
+
* leaving anything on disk. {@link applyReleasePlan} is the only step that mutates the tree, so
|
|
12
|
+
* a dry run is this same plan with the apply step skipped rather than a separate code path.
|
|
13
|
+
*
|
|
14
|
+
* Extends the reporting view with the two fields only the apply step needs, so `reportPrepare`
|
|
15
|
+
* can render a plan without knowing about file content.
|
|
16
|
+
*/
|
|
6
17
|
export interface ReleasePlan extends PrepareResult {
|
|
7
18
|
writes: readonly PlannedWrite[];
|
|
19
|
+
/** Body of the release commit message, written alongside the tags file. */
|
|
8
20
|
summary: string;
|
|
9
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Writes every file a plan describes: content files first, then the summary, then the tags file.
|
|
24
|
+
*
|
|
25
|
+
* The tags file goes last so its presence means the whole plan landed. Both `release-kit commit`
|
|
26
|
+
* and the reusable release workflow read it as the signal that a release is ready to commit, so
|
|
27
|
+
* writing it earlier would let a failure produce a tree that claims to be releasable.
|
|
28
|
+
*
|
|
29
|
+
* Returns the paths written, in order.
|
|
30
|
+
*
|
|
31
|
+
* @throws If any write fails, naming what reached disk and what did not.
|
|
32
|
+
*/
|
|
10
33
|
export declare function applyReleasePlan(plan: ReleasePlan): string[];
|
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
import type { ReleasePlan } from './releasePlan.js';
|
|
2
2
|
import type { ReleaseConfig, ReleaseType } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for the release preparation workflow.
|
|
5
|
+
*
|
|
6
|
+
* Carries no dry-run flag: preparation only ever computes a plan, and whether that plan is
|
|
7
|
+
* applied is the caller's decision.
|
|
8
|
+
*/
|
|
3
9
|
export interface ReleasePrepareOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Release even when no commits or no bump-worthy commits exist since the last tag
|
|
12
|
+
* (monorepo only). Orthogonal to `bumpOverride`: when `bumpOverride` is not given,
|
|
13
|
+
* the release falls back to `patch`.
|
|
14
|
+
*/
|
|
4
15
|
force?: boolean;
|
|
16
|
+
/** Override the bump type instead of determining it from commits. */
|
|
5
17
|
bumpOverride?: ReleaseType;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit target version (canonical `N.N.N`) that bypasses commit-derived bump logic.
|
|
20
|
+
* Mutually exclusive with `bumpOverride`. In monorepo mode the caller must narrow
|
|
21
|
+
* `config.workspaces` to a single workspace before invoking.
|
|
22
|
+
*/
|
|
6
23
|
setVersion?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Workspace directories the run was narrowed to by `--only` (monorepo only), with
|
|
26
|
+
* `config.workspaces` already filtered to match. Present only for a narrowed run, which
|
|
27
|
+
* skips the project release: the project tier rolls up every contributing workspace, and
|
|
28
|
+
* the narrowing has changed which workspaces those are.
|
|
29
|
+
*/
|
|
7
30
|
only?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* If true, write per-workspace release-notes previews under `{workspacePath}/docs/`
|
|
33
|
+
* (`README.v{version}.md` and `RELEASE_NOTES.v{version}.md`) after each workspace's
|
|
34
|
+
* `changelog.json` is produced. Requires `config.changelogJson.enabled`; when disabled,
|
|
35
|
+
* a warning is recorded on the plan and no previews are generated.
|
|
36
|
+
*/
|
|
8
37
|
withReleaseNotes?: boolean;
|
|
9
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Orchestrate the release preparation workflow for a single package.
|
|
41
|
+
*
|
|
42
|
+
* 1. Gets commits since the last tag.
|
|
43
|
+
* 2. Determines the bump type from commits (or uses the override).
|
|
44
|
+
* 3. Bumps all configured package.json version fields.
|
|
45
|
+
* 4. Generates changelogs via git-cliff.
|
|
46
|
+
* 5. Runs the optional format command.
|
|
47
|
+
*
|
|
48
|
+
* Returns a structured `PrepareResult` with all data needed for presentation.
|
|
49
|
+
*/
|
|
10
50
|
export declare function releasePrepare(config: ReleaseConfig, options: ReleasePrepareOptions): ReleasePlan;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { ReleasePlan } from './releasePlan.js';
|
|
2
2
|
import type { ReleasePrepareOptions } from './releasePrepare.js';
|
|
3
3
|
import type { MonorepoReleaseConfig } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Orchestrate release preparation for a monorepo with multiple workspaces.
|
|
6
|
+
*
|
|
7
|
+
* Phase 1: Determine direct bumps from commits for each workspace.
|
|
8
|
+
* Phase 2: Build the dependency graph and propagate bumps to dependents.
|
|
9
|
+
* Phase 2b: Topologically sort the full release set.
|
|
10
|
+
* Phase 3: Execute bumps and generate changelogs in dependency order.
|
|
11
|
+
*/
|
|
4
12
|
export declare function releasePrepareMono(config: MonorepoReleaseConfig, options: ReleasePrepareOptions): ReleasePlan;
|
|
@@ -1,15 +1,57 @@
|
|
|
1
1
|
import type { PlannedWrite } from './releasePlan.js';
|
|
2
2
|
import type { ReleasePrepareOptions } from './releasePrepare.js';
|
|
3
3
|
import type { ChangelogOverride, MonorepoReleaseConfig, ProjectPrepareResult } from './types.js';
|
|
4
|
+
/** Inputs to the project-release stage. */
|
|
4
5
|
export interface ReleasePrepareProjectArgs {
|
|
6
|
+
/** Resolved monorepo config; `config.project` must be defined when this function is called. */
|
|
5
7
|
config: MonorepoReleaseConfig;
|
|
6
8
|
options: ReleasePrepareOptions;
|
|
9
|
+
/** Mutated in-place to append project-level files (root package.json, root CHANGELOG.md, root changelog.json). */
|
|
7
10
|
modifiedFiles: string[];
|
|
11
|
+
/** Mutated in-place to append every file this stage intends to write. */
|
|
8
12
|
writes: PlannedWrite[];
|
|
13
|
+
/** Mutated in-place to append the project tag. */
|
|
9
14
|
tags: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Mutated in-place to surface warnings this stage raises that are not override-specific
|
|
17
|
+
* (currently the release-notes previews' skip reasons). Defaults to a discardable sink.
|
|
18
|
+
*/
|
|
10
19
|
warnings?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Root-tier editorial overrides loaded once at the top of the prepare run. Defaults to an
|
|
22
|
+
* empty map when omitted (no overrides applied). The project changelog applies only the
|
|
23
|
+
* root-tier file — per-workspace files describe per-workspace editorial intent and have no
|
|
24
|
+
* meaning at the aggregated project tier.
|
|
25
|
+
*/
|
|
11
26
|
rootOverrides?: Map<string, ChangelogOverride>;
|
|
27
|
+
/**
|
|
28
|
+
* Mutated in-place to surface override warnings (currently empty by design — stale-key
|
|
29
|
+
* warnings are emitted by the orchestrator after aggregating across batches). Defaults to
|
|
30
|
+
* a discardable sink when omitted.
|
|
31
|
+
*/
|
|
12
32
|
overrideWarnings?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Mutated in-place: every root-tier override key matched in this stage is added so the
|
|
35
|
+
* orchestrator can dedupe stale-key warnings across the run. Defaults to a discardable
|
|
36
|
+
* sink when omitted.
|
|
37
|
+
*/
|
|
13
38
|
globalMatchedRootKeys?: Set<string>;
|
|
14
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Run the project-level release stage.
|
|
42
|
+
*
|
|
43
|
+
* Mirrors the per-workspace pipeline shape — find baseline tag → derive bump → bump version →
|
|
44
|
+
* regenerate CHANGELOG → optionally emit changelog.json and release-notes previews — but
|
|
45
|
+
* targets the root `package.json` and the root `CHANGELOG.md`. Contributing paths come from
|
|
46
|
+
* the resolved `project.paths`, which defaults to the union of every (already-filtered)
|
|
47
|
+
* workspace's `paths`.
|
|
48
|
+
*
|
|
49
|
+
* Returns a structured `{ status: 'skipped', skipReason, ... }` result when neither
|
|
50
|
+
* commits nor `--force` provide a release signal. The caller should attach the returned
|
|
51
|
+
* result to `PrepareResult.project`. `undefined` is returned only when there is no
|
|
52
|
+
* configured `project` block — handled at the call site, not here.
|
|
53
|
+
*
|
|
54
|
+
* Caller contract: `prepareCommand` rejects `--only` upstream when a project block is
|
|
55
|
+
* configured, so this orchestrator never has to reason about workspace-narrowing flags.
|
|
56
|
+
*/
|
|
15
57
|
export declare function releasePrepareProject(args: ReleasePrepareProjectArgs): ProjectPrepareResult;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { ChangelogEntry } from './types.js';
|
|
2
|
+
/** Options for `renderChangelogMarkdown`. */
|
|
2
3
|
export interface RenderChangelogMarkdownOptions {
|
|
4
|
+
/** Section titles in canonical order; passed through to `renderReleaseNotesMulti`. */
|
|
3
5
|
sectionOrder?: string[];
|
|
4
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Render `ChangelogEntry[]` into a complete `CHANGELOG.md`-shaped string.
|
|
9
|
+
*
|
|
10
|
+
* Format:
|
|
11
|
+
* `# Changelog`
|
|
12
|
+
* blank line
|
|
13
|
+
* `All notable changes …`
|
|
14
|
+
* blank line
|
|
15
|
+
* per-entry sections (delegated to `renderReleaseNotesMulti`)
|
|
16
|
+
* blank line
|
|
17
|
+
* footer comment
|
|
18
|
+
*
|
|
19
|
+
* Entries are rendered in the order provided; the caller sorts (typically newest-first via
|
|
20
|
+
* `changelogJsonFile`'s SemVer-aware comparator).
|
|
21
|
+
*/
|
|
5
22
|
export declare function renderChangelogMarkdown(entries: ChangelogEntry[], options?: RenderChangelogMarkdownOptions): string;
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import type { ChangelogAudience, ChangelogEntry, ChangelogSection } from './types.js';
|
|
2
|
+
/** Options for rendering a single changelog entry to markdown. */
|
|
2
3
|
export interface RenderOptions {
|
|
4
|
+
/** Predicate to filter sections. When absent, all sections are included. */
|
|
3
5
|
filter?: (section: ChangelogSection) => boolean;
|
|
6
|
+
/** Whether to include the version/date heading. Defaults to `true`. */
|
|
4
7
|
includeHeading?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Section titles in desired priority order. Known titles are emitted first in this order;
|
|
10
|
+
* titles not listed preserve their relative position after known ones. When absent, section
|
|
11
|
+
* order is preserved from the entry.
|
|
12
|
+
*/
|
|
5
13
|
sectionOrder?: string[];
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a predicate that matches sections visible to the given audience.
|
|
17
|
+
*
|
|
18
|
+
* `"all"` matches only sections with `audience: "all"` (public-facing).
|
|
19
|
+
* `"dev"` matches all sections (developers see everything).
|
|
20
|
+
*/
|
|
7
21
|
export declare function matchesAudience(audience: ChangelogAudience): (section: ChangelogSection) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Render a single `ChangelogEntry` to markdown.
|
|
24
|
+
*
|
|
25
|
+
* Output format mirrors the existing CHANGELOG.md style: an H2 version heading followed by
|
|
26
|
+
* H3 section headings with bulleted items.
|
|
27
|
+
*/
|
|
8
28
|
export declare function renderReleaseNotesSingle(entry: ChangelogEntry, options?: RenderOptions): string;
|
|
29
|
+
/**
|
|
30
|
+
* Render multiple `ChangelogEntry` values to a single markdown document.
|
|
31
|
+
*
|
|
32
|
+
* Entries are rendered in the order provided; the caller is responsible for sorting.
|
|
33
|
+
*/
|
|
9
34
|
export declare function renderReleaseNotesMulti(entries: ChangelogEntry[], options?: RenderOptions): string;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { PrepareResult } from './types.js';
|
|
2
|
+
/** How the plan was carried out, which decides the tense the report is rendered in. */
|
|
2
3
|
export interface ReportPrepareOptions {
|
|
4
|
+
/** True when the plan was written to disk; false for a dry run. */
|
|
3
5
|
applied: boolean;
|
|
6
|
+
/** The format command's failure message, when it ran and failed. */
|
|
4
7
|
formatError?: string;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Format a release plan into styled terminal output.
|
|
11
|
+
*
|
|
12
|
+
* Pure function: accepts structured data, returns a string. Never writes to stdout.
|
|
13
|
+
* Single-workspace mode (no `name` field) renders flat output; multi-workspace mode
|
|
14
|
+
* renders section headers per workspace, an optional project section, and a tag summary
|
|
15
|
+
* at the end.
|
|
16
|
+
*
|
|
17
|
+
* Whether the plan was applied is a property of the render, not of the plan: the same plan
|
|
18
|
+
* produces the dry-run report and the applied report.
|
|
19
|
+
*/
|
|
6
20
|
export declare function reportPrepare(plan: PrepareResult, options: ReportPrepareOptions): string;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the git-cliff configuration file path.
|
|
3
|
+
*
|
|
4
|
+
* Checks candidates in order: explicit `cliffConfigPath` -> `.config/git-cliff.toml` ->
|
|
5
|
+
* `cliff.toml` -> bundled `cliff.toml.template`. Returns the first path that exists,
|
|
6
|
+
* or throws if even the bundled template cannot be found.
|
|
7
|
+
*
|
|
8
|
+
* When an explicit `cliffConfigPath` is provided, it is returned as-is without checking
|
|
9
|
+
* existence, preserving current behavior (git-cliff reports the error if the file is missing).
|
|
10
|
+
*/
|
|
1
11
|
export declare function resolveCliffConfigPath(cliffConfigPath: string | undefined, metaUrl: string): string;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ResolvedTag } from './resolveReleaseTags.js';
|
|
2
|
+
/**
|
|
3
|
+
* Discover workspaces, resolve release tags from HEAD, validate `--tags` names against the
|
|
4
|
+
* full resolved tag names (e.g., `nmr-core-v1.3.0`), and return the filtered tag list.
|
|
5
|
+
* Works in both single-package and monorepo modes. Exits with an error message on any validation
|
|
6
|
+
* failure — including `deriveWorkspaceConfig()` throws for workspaces missing a `package.json` `name` field.
|
|
7
|
+
*
|
|
8
|
+
* In both modes `deriveWorkspaceConfig` is called so `WorkspaceConfig.isPublishable` (read
|
|
9
|
+
* from `package.json#private`) propagates onto each `ResolvedTag`. Single-package mode now
|
|
10
|
+
* derives `./package.json`'s workspace config too — consumers that previously relied on
|
|
11
|
+
* single-package mode skipping the derive step need a `name` field on `./package.json`,
|
|
12
|
+
* but in practice every npm/pnpm package already has one.
|
|
13
|
+
*/
|
|
2
14
|
export declare function resolveCommandTags(tags: string[] | undefined): Promise<ResolvedTag[]>;
|
|
@@ -2,12 +2,26 @@ import type { ReleaseNotesConfig } from './types.js';
|
|
|
2
2
|
export interface ResolvedReleaseNotesConfig {
|
|
3
3
|
releaseNotes: ReleaseNotesConfig;
|
|
4
4
|
changelogJsonOutputPath: string;
|
|
5
|
+
/** Section titles in priority order, derived from the merged workTypes record. */
|
|
5
6
|
sectionOrder: string[];
|
|
6
7
|
}
|
|
7
8
|
export interface ResolveReleaseNotesConfigOptions {
|
|
9
|
+
/**
|
|
10
|
+
* When `true`, a `loadConfig()` rejection causes `process.exit(1)` rather than a fallback to
|
|
11
|
+
* defaults. Use from CLI commands whose entire behavior depends on the resolved config (e.g.
|
|
12
|
+
* `create-github-release`), so a corrupt or unreadable config cannot silently send the command
|
|
13
|
+
* to the wrong changelog path.
|
|
14
|
+
*/
|
|
8
15
|
strictLoad?: boolean;
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Load and validate the release-kit config.
|
|
19
|
+
*
|
|
20
|
+
* By default, falls back to defaults when `loadConfig()` rejects (legacy publish behavior).
|
|
21
|
+
* When `strictLoad` is `true`, a load failure prints an error and calls `process.exit(1)`.
|
|
22
|
+
*/
|
|
10
23
|
export declare function resolveReleaseNotesConfig(options?: ResolveReleaseNotesConfigOptions): Promise<ResolvedReleaseNotesConfig>;
|
|
24
|
+
/** Extract section headers in declaration order from a merged workTypes record. */
|
|
11
25
|
export declare function deriveSectionOrder(workTypes: Record<string, {
|
|
12
26
|
header: string;
|
|
13
27
|
}>): string[];
|
|
@@ -3,12 +3,34 @@ export interface ResolvedTag {
|
|
|
3
3
|
tag: string;
|
|
4
4
|
dir: string;
|
|
5
5
|
workspacePath: string;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the workspace this tag belongs to can be published to a registry. Propagated
|
|
8
|
+
* from the matched `WorkspaceConfig.isPublishable` (monorepo) or from the single-package
|
|
9
|
+
* workspace config (single-package mode). Consumed by `release-kit publish` to filter the
|
|
10
|
+
* tag set; other commands ignore it.
|
|
11
|
+
*/
|
|
6
12
|
isPublishable: boolean;
|
|
7
13
|
}
|
|
14
|
+
/** Discriminated argument to `resolveReleaseTags`: exactly one of the two keys is meaningful. */
|
|
8
15
|
type ResolveReleaseTagsArgs = {
|
|
9
16
|
workspaces: readonly WorkspaceConfig[];
|
|
10
17
|
} | {
|
|
11
18
|
singleWorkspace: WorkspaceConfig;
|
|
12
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Resolve release tags pointing at HEAD into publishable package descriptors.
|
|
22
|
+
*
|
|
23
|
+
* Pass `{ workspaces }` for monorepo mode: each tag is matched against the workspace
|
|
24
|
+
* whose `tagPrefix` it starts with, and that workspace's `isPublishable` propagates onto
|
|
25
|
+
* the `ResolvedTag`. Because `tagPrefix` is derived from `deriveWorkspaceConfig()` (the
|
|
26
|
+
* same source that produced the tag), encoding and decoding stay colocated.
|
|
27
|
+
*
|
|
28
|
+
* Pass `{ singleWorkspace }` for single-package mode: tags like `v1.2.3` are matched and
|
|
29
|
+
* each carries the workspace's `isPublishable` bit derived from `./package.json#private`.
|
|
30
|
+
*
|
|
31
|
+
* The no-arg form is a test-isolation convenience for unit tests that exercise tag
|
|
32
|
+
* matching without needing `isPublishable` propagation; resolved tags default to
|
|
33
|
+
* `isPublishable: true`. Production callers should pass one of the named forms.
|
|
34
|
+
*/
|
|
13
35
|
export declare function resolveReleaseTags(args?: ResolveReleaseTagsArgs): ResolvedTag[];
|
|
14
36
|
export {};
|