@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,24 +1,54 @@
|
|
|
1
|
+
/** Options for creating a GitHub Release. */
|
|
1
2
|
export interface CreateGithubReleaseOptions {
|
|
2
3
|
tag: string;
|
|
3
4
|
changelogJsonPath: string;
|
|
4
5
|
dryRun: boolean;
|
|
6
|
+
/** Section titles in priority order. When omitted, entry order is preserved. */
|
|
5
7
|
sectionOrder?: string[];
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Discriminated reason a single tag was skipped.
|
|
11
|
+
*
|
|
12
|
+
* `'no-entry'` is the umbrella for all "data missing" sub-cases (changelog file not found,
|
|
13
|
+
* JSON unparseable, version not in changelog) — distinguishing them programmatically adds no
|
|
14
|
+
* value to the consumer, while the existing `console.warn` messages already discriminate them
|
|
15
|
+
* for human diagnostics.
|
|
16
|
+
*/
|
|
7
17
|
export type CreateReleaseSkipReason = 'no-entry' | 'no-audience-content' | 'empty-body';
|
|
18
|
+
/** Discriminated outcome of attempting to create a single GitHub Release. */
|
|
8
19
|
export type CreateReleaseResult = {
|
|
9
20
|
status: 'created';
|
|
10
21
|
} | {
|
|
11
22
|
status: 'skipped';
|
|
12
23
|
reason: CreateReleaseSkipReason;
|
|
13
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Create a GitHub Release from changelog.json using the `gh` CLI.
|
|
27
|
+
*
|
|
28
|
+
* Reads the changelog JSON, finds the entry matching the tag's version, renders all-audience
|
|
29
|
+
* release notes, and creates the release. Returns a discriminated `{status: 'skipped', reason}`
|
|
30
|
+
* (with a warning) when the changelog entry is missing, the entry has no all-audience content,
|
|
31
|
+
* or the rendered body is empty. Throws when the `gh` CLI invocation itself fails so callers
|
|
32
|
+
* can surface the failure rather than exit 0 silently.
|
|
33
|
+
*/
|
|
14
34
|
export declare function createGithubRelease(options: CreateGithubReleaseOptions): CreateReleaseResult;
|
|
35
|
+
/** Outcome of a `createGithubReleases` invocation. */
|
|
15
36
|
export interface CreateGithubReleasesOutcome {
|
|
37
|
+
/** Tags for which a Release was created (or would be, under `--dry-run`). */
|
|
16
38
|
created: string[];
|
|
39
|
+
/** Tags that were skipped, paired with the discriminated reason for each skip. */
|
|
17
40
|
skipped: Array<{
|
|
18
41
|
tag: string;
|
|
19
42
|
reason: CreateReleaseSkipReason;
|
|
20
43
|
}>;
|
|
21
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Create GitHub Releases for each provided tag.
|
|
47
|
+
*
|
|
48
|
+
* Per-tag soft-fails (missing changelog entry, no all-audience content, empty rendered body) are
|
|
49
|
+
* recorded in `skipped` with their discriminated reason and do not throw. Hard failures from the
|
|
50
|
+
* `gh` CLI itself throw and short-circuit the loop so callers can surface them.
|
|
51
|
+
*/
|
|
22
52
|
export declare function createGithubReleases(tags: Array<{
|
|
23
53
|
tag: string;
|
|
24
54
|
workspacePath: string;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrate the CLI `create-github-release` command: Create GitHub Releases from changelog.json
|
|
3
|
+
* for tags on HEAD (or a comma-separated `--tags` subset), without requiring npm publish.
|
|
4
|
+
*
|
|
5
|
+
* Private/unpublishable workspaces are skipped with a warning and never get a Release, matching
|
|
6
|
+
* `release-kit publish`; an all-private tag set is a clean no-op.
|
|
7
|
+
*/
|
|
1
8
|
export declare function createGithubReleaseCommand(argv: string[]): Promise<void>;
|
package/dist/esm/createTags.d.ts
CHANGED
|
@@ -2,4 +2,9 @@ export interface CreateTagsOptions {
|
|
|
2
2
|
dryRun: boolean;
|
|
3
3
|
noGitChecks: boolean;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Read tag names from the tags file produced by `prepare` and create annotated git tags.
|
|
7
|
+
*
|
|
8
|
+
* Returns the list of tag names that were created (or would be created in dry-run mode).
|
|
9
|
+
*/
|
|
5
10
|
export declare function createTags(options: CreateTagsOptions): string[];
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
import { type PolicyViolationHandler } from './parseCommitMessage.js';
|
|
2
2
|
import type { Commit, ReleaseType, VersionPatterns, WorkTypeConfig } from './types.js';
|
|
3
|
+
/** Inputs to the unified release decision used by both pipelines. */
|
|
3
4
|
export interface DecideReleaseArgs {
|
|
4
5
|
commits: readonly Commit[];
|
|
6
|
+
/** True when `--force` was passed; treats absence of a natural bump as patch. Defaults to false. */
|
|
5
7
|
force?: boolean | undefined;
|
|
8
|
+
/** Explicit `--bump=X` override. When set, the level is X regardless of the natural bump. */
|
|
6
9
|
bumpOverride: ReleaseType | undefined;
|
|
7
10
|
workTypes: Record<string, WorkTypeConfig>;
|
|
8
11
|
versionPatterns: VersionPatterns;
|
|
9
12
|
scopeAliases: Record<string, string> | undefined;
|
|
13
|
+
/** Per-canonical-type breaking-policy lookup. When provided, drives `!` policy enforcement in `parseCommitMessage`. */
|
|
10
14
|
breakingPolicies?: Record<string, 'forbidden' | 'optional' | 'required'>;
|
|
15
|
+
/** Receives policy-violation notifications from `parseCommitMessage`. */
|
|
11
16
|
onPolicyViolation?: PolicyViolationHandler;
|
|
17
|
+
/**
|
|
18
|
+
* Skip wordings to use when no commits exist (`noCommits`) or when commits exist but
|
|
19
|
+
* none parse to a bump-worthy work type (`noBumpWorthy`). Both pipelines pass their
|
|
20
|
+
* own pre-rendered wordings (with `{name}` / `since` substitutions already applied).
|
|
21
|
+
*/
|
|
12
22
|
skipReasons: {
|
|
13
23
|
noCommits: string;
|
|
14
24
|
noBumpWorthy: string;
|
|
15
25
|
};
|
|
16
26
|
}
|
|
27
|
+
/** Outcome of `decideRelease`: either release at a chosen level or skip with a reason. */
|
|
17
28
|
export type DecideReleaseResult = {
|
|
18
29
|
outcome: 'release';
|
|
19
30
|
releaseType: ReleaseType;
|
|
@@ -25,4 +36,30 @@ export type DecideReleaseResult = {
|
|
|
25
36
|
parsedCommitCount: number;
|
|
26
37
|
unparseableCommits: Commit[] | undefined;
|
|
27
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Apply the unified release-decision algorithm shared by both `releasePrepareProject`
|
|
41
|
+
* and the per-workspace path in `releasePrepareMono`.
|
|
42
|
+
*
|
|
43
|
+
* Algorithm:
|
|
44
|
+
* shouldRelease = naturalBump !== undefined OR force === true
|
|
45
|
+
* releaseLevel = bumpOverride ?? naturalBump ?? 'patch'
|
|
46
|
+
*
|
|
47
|
+
* "natural bump" is the raw output of `determineBumpType` over the parsed commits — it
|
|
48
|
+
* is `undefined` when no commits exist or when none of the parsed commits map to a
|
|
49
|
+
* bump-worthy work type. Note that this differs from `determineBumpFromCommits`, which
|
|
50
|
+
* applies a patch floor whenever any commits exist; the patch floor is intentionally
|
|
51
|
+
* not applied here so that `--bump=X` and `--force` remain orthogonal (the floor is
|
|
52
|
+
* applied only when `--force` is set, by virtue of the `naturalBump ?? 'patch'`
|
|
53
|
+
* fallback in the release-level expression above).
|
|
54
|
+
*
|
|
55
|
+
* `parsedCommitCount` and `unparseableCommits` are returned in both branches so callers
|
|
56
|
+
* can surface diagnostic data uniformly regardless of skip/release outcome.
|
|
57
|
+
*
|
|
58
|
+
* Scope: this is the canonical algorithm for the orthogonal-flag model in the
|
|
59
|
+
* monorepo path (`releasePrepareProject` + per-workspace `determineDirectBumps`). The
|
|
60
|
+
* single-package executor (`releasePrepare`) deliberately retains
|
|
61
|
+
* `determineBumpFromCommits` and the legacy patch-floor semantics; `prepareCommand`
|
|
62
|
+
* rejects `--force` without `--bump` in single-package mode to surface that gap. A
|
|
63
|
+
* future ticket can unify the single-package path; see #313's external plan.
|
|
64
|
+
*/
|
|
28
65
|
export declare function decideRelease(args: DecideReleaseArgs): DecideReleaseResult;
|
package/dist/esm/defaults.d.ts
CHANGED
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import type { ChangelogJsonConfig, ReleaseNotesConfig, VersionPatterns, WorkTypeConfig } from './types.js';
|
|
2
|
+
/** Re-export the runtime taxonomy so consumers don't have to depend on `workTypesData.ts` directly. */
|
|
2
3
|
export type { WorkTypesData } from './workTypesData.js';
|
|
3
4
|
export { WORK_TYPES_DATA } from './workTypesData.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compose the rendered section heading for a work-type entry as `${emoji} ${label}`.
|
|
7
|
+
*
|
|
8
|
+
* Single-sourced here so callers (DEFAULT_WORK_TYPES derivation, devOnlySections
|
|
9
|
+
* derivation, cliff-template drift comparison) cannot disagree on the composition rule.
|
|
10
|
+
*/
|
|
4
11
|
export declare function composeHeader(entry: {
|
|
5
12
|
emoji: string;
|
|
6
13
|
label: string;
|
|
7
14
|
}): string;
|
|
15
|
+
/**
|
|
16
|
+
* Default work types ordered by canonical priority.
|
|
17
|
+
*
|
|
18
|
+
* Derived from `work-types.json` (the canonical SSOT, mirrored at runtime by
|
|
19
|
+
* `workTypesData.ts`). To change the taxonomy, edit `work-types.json` and update
|
|
20
|
+
* `workTypesData.ts` to match — a drift test enforces lockstep.
|
|
21
|
+
*/
|
|
8
22
|
export declare const DEFAULT_WORK_TYPES: Record<string, WorkTypeConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Per-canonical-type breaking-policy lookup derived from the canonical taxonomy.
|
|
25
|
+
*
|
|
26
|
+
* Pass this to `parseCommitMessage` (or an equivalent caller) so the parser knows which
|
|
27
|
+
* types tolerate `!` and which trigger a policy-violation warning. Missing entries default
|
|
28
|
+
* to `'optional'` to preserve back-compat for consumers that supply custom work-types.
|
|
29
|
+
*/
|
|
9
30
|
export declare const DEFAULT_BREAKING_POLICIES: Record<string, 'forbidden' | 'optional' | 'required'>;
|
|
31
|
+
/** Default version bump patterns. */
|
|
10
32
|
export declare const DEFAULT_VERSION_PATTERNS: VersionPatterns;
|
|
33
|
+
/** Default configuration for structured changelog JSON generation. */
|
|
11
34
|
export declare const DEFAULT_CHANGELOG_JSON_CONFIG: ChangelogJsonConfig;
|
|
35
|
+
/** Default configuration for release notes consumption. */
|
|
12
36
|
export declare const DEFAULT_RELEASE_NOTES_CONFIG: ReleaseNotesConfig;
|
|
37
|
+
/** Default tag prefix for project-level releases. */
|
|
13
38
|
export declare const DEFAULT_PROJECT_TAG_PREFIX = "v";
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import type { ReleaseKitConfig } from './types.js';
|
|
2
2
|
export type { LabelSpec, ReleaseKitConfig, RepoLabelsConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Type-safe identity function for configuration files.
|
|
5
|
+
*
|
|
6
|
+
* Usage in `.config/release-kit.config.ts`:
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { defineConfig } from '@williamthorsen/release-kit/config';
|
|
9
|
+
* export default defineConfig({ ... });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
3
12
|
export declare function defineConfig(config: ReleaseKitConfig): ReleaseKitConfig;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { WorkspaceConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Derives a workspace configuration from a workspace-relative path.
|
|
4
|
+
*
|
|
5
|
+
* Reads `package.json` at the workspace path to derive the tag identifier from the
|
|
6
|
+
* package's `name` field (with any leading `@scope/` stripped). The `dir` field remains
|
|
7
|
+
* the basename of the path — it is the stable internal identifier used for `--only`,
|
|
8
|
+
* config overrides, and dependency-graph lookups. The `tagPrefix` is `${unscopedName}-v`,
|
|
9
|
+
* so tags reflect the package identity rather than the directory layout.
|
|
10
|
+
*/
|
|
2
11
|
export declare function deriveWorkspaceConfig(workspacePath: string): WorkspaceConfig;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'yarn-berry';
|
|
2
|
+
/**
|
|
3
|
+
* Detect the repo's package manager by checking the `packageManager` field in root `package.json`,
|
|
4
|
+
* then falling back to lockfile detection, then defaulting to `npm`.
|
|
5
|
+
*
|
|
6
|
+
* Yarn v2+ is returned as `'yarn-berry'` to distinguish it from Yarn Classic.
|
|
7
|
+
*/
|
|
2
8
|
export declare function detectPackageManager(): PackageManager;
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
/** A candidate tag prefix found in the repo that is not in the known-prefix set. */
|
|
1
2
|
export interface UndeclaredTagPrefix {
|
|
3
|
+
/** The extracted prefix, including the trailing `-v` (e.g., `'core-v'`). */
|
|
2
4
|
prefix: string;
|
|
5
|
+
/** Count of tags matching this prefix. */
|
|
3
6
|
tagCount: number;
|
|
7
|
+
/** Up to `EXAMPLE_TAG_LIMIT` example tag names under this prefix. */
|
|
4
8
|
exampleTags: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Heuristic `dir` to suggest when offering a paste-ready config snippet; the prefix with
|
|
11
|
+
* the trailing `-v` stripped. The operator may need to remap this to the actual workspace
|
|
12
|
+
* directory basename.
|
|
13
|
+
*/
|
|
5
14
|
suggestedDir: string;
|
|
6
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Scan local git tags for release-shaped tags whose prefix is not in the known set.
|
|
18
|
+
*
|
|
19
|
+
* Reads only the local tag list; callers expecting to see recently-fetched remote tags
|
|
20
|
+
* should `git fetch --tags` first. Returns an empty array when the repo has no tags
|
|
21
|
+
* or no candidate-shaped tags outside the known set.
|
|
22
|
+
*
|
|
23
|
+
* @param knownPrefixes - Union of derived and declared prefixes across all workspaces.
|
|
24
|
+
*/
|
|
7
25
|
export declare function detectUndeclaredTagPrefixes(knownPrefixes: readonly string[]): UndeclaredTagPrefix[];
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { type PolicyViolationHandler } from './parseCommitMessage.js';
|
|
2
2
|
import type { Commit, ReleaseType, VersionPatterns, WorkTypeConfig } from './types.js';
|
|
3
|
+
/** Aggregate result of parsing commits and determining the bump type. */
|
|
3
4
|
export interface BumpDetermination {
|
|
4
5
|
releaseType: ReleaseType | undefined;
|
|
5
6
|
parsedCommitCount: number;
|
|
6
7
|
unparseableCommits: Commit[] | undefined;
|
|
7
8
|
}
|
|
9
|
+
/** Optional configuration for parser-policy plumbing. */
|
|
8
10
|
export interface DetermineBumpOptions {
|
|
11
|
+
/** Per-canonical-type breaking-policy lookup (drives `!` policy enforcement). */
|
|
9
12
|
breakingPolicies?: Record<string, 'forbidden' | 'optional' | 'required'>;
|
|
13
|
+
/** Receives policy-violation notifications from `parseCommitMessage`. */
|
|
10
14
|
onPolicyViolation?: PolicyViolationHandler;
|
|
11
15
|
}
|
|
16
|
+
/** Parse commits, determine bump type, and apply patch floor when commits exist but none parsed. */
|
|
12
17
|
export declare function determineBumpFromCommits(commits: Commit[], workTypes: Record<string, WorkTypeConfig>, versionPatterns: VersionPatterns, scopeAliases: Record<string, string> | undefined, options?: DetermineBumpOptions): BumpDetermination;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import type { ParsedCommit, ReleaseType, VersionPatterns, WorkTypeConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Determines the overall bump type from a set of parsed commits.
|
|
4
|
+
*
|
|
5
|
+
* Uses `versionPatterns` to decide which commit types trigger major/minor bumps.
|
|
6
|
+
* The `'!'` sentinel in `versionPatterns.major` means "any breaking commit triggers major".
|
|
7
|
+
* Any recognized commit type not listed in major or minor patterns defaults to patch.
|
|
8
|
+
*
|
|
9
|
+
* @param commits - The parsed commits to analyze.
|
|
10
|
+
* @param workTypes - The work type configurations to verify recognized types.
|
|
11
|
+
* @param versionPatterns - Rules for determining major and minor bumps.
|
|
12
|
+
* @returns The determined release type, or undefined if no commits match a known work type.
|
|
13
|
+
*/
|
|
2
14
|
export declare function determineBumpType(commits: readonly ParsedCommit[], workTypes: Record<string, WorkTypeConfig>, versionPatterns: VersionPatterns): ReleaseType | undefined;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads `pnpm-workspace.yaml` and resolves its `packages` globs to discover workspace directories.
|
|
3
|
+
*
|
|
4
|
+
* Returns an array of workspace-relative directory paths (e.g., `['packages/arrays', 'packages/strings']`).
|
|
5
|
+
* Only directories containing a `package.json` are included.
|
|
6
|
+
*
|
|
7
|
+
* Note: The returned paths are full relative paths from the repo root (e.g., `packages/arrays`,
|
|
8
|
+
* `libs/core`). These paths are passed directly to `deriveWorkspaceConfig()`, which uses them for all
|
|
9
|
+
* file path construction and derives the display name via `path.basename()`.
|
|
10
|
+
*
|
|
11
|
+
* @returns The discovered workspace paths, or `undefined` if no workspace config is found.
|
|
12
|
+
*/
|
|
1
13
|
export declare function discoverWorkspaces(): Promise<string[] | undefined>;
|
package/dist/esm/format.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Wrap text in ANSI bold. */
|
|
1
2
|
export declare function bold(text: string): string;
|
|
3
|
+
/** Wrap text in ANSI dim. */
|
|
2
4
|
export declare function dim(text: string): string;
|
|
5
|
+
/** Render a section header for separating workspaces in CLI output. */
|
|
3
6
|
export declare function sectionHeader(name: string): string;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { ResolvedTag } from './resolveReleaseTags.js';
|
|
2
|
+
/**
|
|
3
|
+
* Format the warning emitted when a release tag's workspace is private and therefore skipped.
|
|
4
|
+
*
|
|
5
|
+
* Shared by `release-kit publish` and `release-kit create-github-release` so the skip wording
|
|
6
|
+
* is defined once and stays identical across both commands.
|
|
7
|
+
*/
|
|
2
8
|
export declare function formatPrivateSkip(resolvedTag: Pick<ResolvedTag, 'tag' | 'workspacePath'>): string;
|
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
import type { WorkspaceConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a git-cliff tag pattern from one or more tag prefixes.
|
|
4
|
+
*
|
|
5
|
+
* Single-prefix input preserves the historical `<prefix>[0-9].*` shape. Multi-prefix input
|
|
6
|
+
* returns `(prefix1|prefix2|...)[0-9].*` so git-cliff's regex-based `--tag-pattern` accepts
|
|
7
|
+
* tags under any listed prefix. Each prefix is regex-escaped so metacharacters in operator-
|
|
8
|
+
* supplied legacy prefixes cannot alter the pattern's meaning.
|
|
9
|
+
*
|
|
10
|
+
* @param tagPrefixes - Tag prefixes to match as a union (must contain at least one entry).
|
|
11
|
+
*/
|
|
2
12
|
export declare function buildTagPattern(tagPrefixes: readonly string[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Return the workspace's derived tag prefix followed by each declared legacy-identity tag
|
|
15
|
+
* prefix. Shared by `releasePrepareMono` (the production prepare path) and
|
|
16
|
+
* `validateOverridesCommand` so the two compute byte-equal per-workspace tag-prefix unions.
|
|
17
|
+
*/
|
|
3
18
|
export declare function getAllTagPrefixes(workspace: WorkspaceConfig): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Options for `buildChangelogEntries`-driven flows that consume git-cliff output.
|
|
21
|
+
*
|
|
22
|
+
* The fields here mirror the subset of git-cliff CLI options that the in-package pipeline
|
|
23
|
+
* still passes through (tag-pattern union, include-path filtering for monorepo workspaces).
|
|
24
|
+
* `generateChangelog` and `generateChangelogs` (the prior cliff `--output` invokers) are
|
|
25
|
+
* removed; markdown rendering is now handled by `renderChangelogMarkdown.ts`.
|
|
26
|
+
*/
|
|
4
27
|
export interface GenerateChangelogOptions {
|
|
28
|
+
/** Tag pattern to match release tags (passed as --tag-pattern to git-cliff). */
|
|
5
29
|
tagPattern?: string;
|
|
30
|
+
/** Paths to include in the changelog (passed as --include-path to git-cliff). */
|
|
6
31
|
includePaths?: string[];
|
|
7
32
|
}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { Commit } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets commits since the latest baseline tag matching any of the given prefixes.
|
|
4
|
+
*
|
|
5
|
+
* Uses `git log` to retrieve commit messages and hashes between the closest reachable
|
|
6
|
+
* baseline tag and HEAD. When no tag matches any prefix, all commits reachable from HEAD
|
|
7
|
+
* are returned.
|
|
8
|
+
*
|
|
9
|
+
* Callers must pass at least one prefix; the single-prefix case is the common one (the
|
|
10
|
+
* workspace's derived prefix). Multiple prefixes are used to include historical tag prefixes
|
|
11
|
+
* from `legacyIdentities`.
|
|
12
|
+
*
|
|
13
|
+
* @param tagPrefixes - Tag prefixes to search as a union (e.g., `['core-v', 'old-core-v']`).
|
|
14
|
+
* @param paths - Optional glob patterns to filter commits by path (appended after `--` in `git log`).
|
|
15
|
+
* Path patterns use POSIX-style forward slashes; Windows compatibility is not guaranteed.
|
|
16
|
+
* @returns An object with the found tag (if any) and the list of commits.
|
|
17
|
+
*/
|
|
2
18
|
export declare function getCommitsSinceTarget(tagPrefixes: readonly string[], paths?: string[]): {
|
|
3
19
|
tag: string | undefined;
|
|
4
20
|
commits: Commit[];
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects whether the repo has a Prettier configuration.
|
|
3
|
+
*
|
|
4
|
+
* Checks for config files in the working directory and for a `"prettier"` key
|
|
5
|
+
* in the root `package.json`. Returns `true` if any indicator is found.
|
|
6
|
+
*/
|
|
1
7
|
export declare function hasPrettierConfig(): boolean;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for the `release-kit prepare` help text. Imported by the bin
|
|
3
|
+
* dispatcher and asserted by the help drift guard test; kept free of import-time side
|
|
4
|
+
* effects so both can load it.
|
|
5
|
+
*/
|
|
1
6
|
export declare const prepareHelpText = "\nUsage: release-kit prepare [options]\n\nRun release preparation with automatic workspace discovery.\n\nOptions:\n --dry-run Run without modifying any files\n --bump=major|minor|patch Override the bump type for all workspaces\n --set-version=X.Y.Z Set an explicit version; bypasses commit-derived bumps. In monorepo\n mode it requires --only, and is rejected when a 'project' block is configured.\n --force Release even when no commits or no bump-worthy commits exist\n since the last tag. In monorepo and project mode, defaults to\n patch when --bump is not given; use --bump=X for a different\n level. In single-package mode, a bare --force is rejected \u2014\n pass --bump=major|minor|patch.\n --no-git-checks, -n Skip the clean-working-tree check\n --only=name1,name2 Only process the named workspaces (comma-separated, monorepo only).\n When a 'project' block is configured, the project release is skipped.\n --with-release-notes Also write per-workspace release-notes previews under <workspacePath>/docs/\n (docs/README.v<version>.md and docs/RELEASE_NOTES.v<version>.md).\n Recommended .gitignore entry: packages/*/docs/*.v*.md (or docs/*.v*.md).\n --help, -h Show this help message\n";
|
|
7
|
+
/** Prints the prepare command's help text. */
|
|
2
8
|
export declare function showPrepareHelp(): void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
/** Result of an eligibility check. */
|
|
1
2
|
export interface CheckResult {
|
|
2
3
|
ok: boolean;
|
|
3
4
|
message?: string;
|
|
4
5
|
}
|
|
6
|
+
/** Verify the current directory is inside a git repository. */
|
|
5
7
|
export declare function isGitRepo(): CheckResult;
|
|
8
|
+
/** Verify that package.json exists in the current directory. */
|
|
6
9
|
export declare function hasPackageJson(): CheckResult;
|
|
10
|
+
/** Verify that the project uses pnpm (has pnpm-lock.yaml or packageManager field). */
|
|
7
11
|
export declare function usesPnpm(): CheckResult;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/** Repo layout type. */
|
|
1
2
|
export type RepoType = 'monorepo' | 'single-package';
|
|
3
|
+
/**
|
|
4
|
+
* Detect whether the current directory is a monorepo or a single-package repo.
|
|
5
|
+
*
|
|
6
|
+
* Returns `'monorepo'` if `pnpm-workspace.yaml` exists or `package.json` has a `workspaces` field.
|
|
7
|
+
* Otherwise returns `'single-package'`.
|
|
8
|
+
*/
|
|
2
9
|
export declare function detectRepoType(): RepoType;
|
|
@@ -3,5 +3,11 @@ interface InitOptions {
|
|
|
3
3
|
force: boolean;
|
|
4
4
|
withConfig: boolean;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Run the `release-kit init` command.
|
|
8
|
+
*
|
|
9
|
+
* Checks eligibility, detects repo type, scaffolds files, and prints next steps.
|
|
10
|
+
* Returns the process exit code (0 for success, 1 for failure).
|
|
11
|
+
*/
|
|
6
12
|
export declare function initCommand({ dryRun, force, withConfig }: InitOptions): number;
|
|
7
13
|
export {};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a JSON string and return the result if it is a plain object (Record<string, unknown>).
|
|
3
|
+
* Returns `undefined` if parsing fails or the result is not a plain object.
|
|
4
|
+
*/
|
|
1
5
|
export declare function parseJsonRecord(raw: string): Record<string, unknown> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WriteResult } from '@williamthorsen/nmr-core';
|
|
2
2
|
import type { RepoType } from './detectRepoType.js';
|
|
3
3
|
interface ScaffoldOptions {
|
|
4
4
|
repoType: RepoType;
|
|
@@ -6,6 +6,8 @@ interface ScaffoldOptions {
|
|
|
6
6
|
overwrite: boolean;
|
|
7
7
|
withConfig: boolean;
|
|
8
8
|
}
|
|
9
|
+
/** Copy the bundled cliff.toml.template to `.config/git-cliff.toml` in the target repo. */
|
|
9
10
|
export declare function copyCliffTemplate(dryRun: boolean, overwrite: boolean): WriteResult;
|
|
11
|
+
/** Scaffold release-kit files for the target repo. Returns a result for each file attempted. */
|
|
10
12
|
export declare function scaffoldFiles({ repoType, dryRun, overwrite, withConfig }: ScaffoldOptions): WriteResult[];
|
|
11
13
|
export {};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { RepoType } from './detectRepoType.js';
|
|
2
|
+
/** Generate the `.config/release-kit.config.ts` starter config with TODOs for customization. */
|
|
2
3
|
export declare function releaseConfigScript(repoType: RepoType): string;
|
|
4
|
+
/**
|
|
5
|
+
* Generate the publish.yaml GitHub Actions entry-point workflow.
|
|
6
|
+
*
|
|
7
|
+
* The `permissions` block is present for explicitness; the reusable workflow declares its own
|
|
8
|
+
* permissions, so GitHub uses those rather than the caller's block.
|
|
9
|
+
*/
|
|
3
10
|
export declare function publishWorkflow(repoType: RepoType): string;
|
|
11
|
+
/**
|
|
12
|
+
* Generate the create-github-release.yaml GitHub Actions caller workflow.
|
|
13
|
+
*
|
|
14
|
+
* Fires on tag push and delegates to the reusable workflow under `contents: write`.
|
|
15
|
+
*/
|
|
4
16
|
export declare function createGithubReleaseWorkflow(repoType: RepoType): string;
|
|
17
|
+
/** Generate the release.yaml GitHub Actions workflow. */
|
|
5
18
|
export declare function releaseWorkflow(repoType: RepoType): string;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { ChangelogEntry } from './types.js';
|
|
2
|
+
/** Rendered artifacts produced by `renderInjectedReadme`. */
|
|
2
3
|
export interface RenderedInjectedReadme {
|
|
4
|
+
/** The README with the release-notes section injected at the marker position. */
|
|
3
5
|
injectedReadme: string;
|
|
6
|
+
/**
|
|
7
|
+
* The standalone release-notes markdown for the target version (trimmed), prefixed with a
|
|
8
|
+
* labeled `## Release notes — v{version} ({date})` heading so the file is self-identifying.
|
|
9
|
+
* The GitHub-release body is rendered separately (without this heading) by `createGithubRelease`.
|
|
10
|
+
*/
|
|
4
11
|
releaseNotesMarkdown: string;
|
|
5
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Discriminated reason no release notes were rendered for a tag.
|
|
15
|
+
*
|
|
16
|
+
* Shares the vocabulary of `CreateReleaseSkipReason` in `createGithubRelease.ts`, which classifies
|
|
17
|
+
* the same two conditions on the GitHub-release path.
|
|
18
|
+
*/
|
|
6
19
|
export type RenderInjectedReadmeSkipReason = 'no-entry' | 'empty-body';
|
|
20
|
+
/** Discriminated outcome of rendering release notes for a tag. */
|
|
7
21
|
export type RenderInjectedReadmeResult = {
|
|
8
22
|
status: 'rendered';
|
|
9
23
|
rendered: RenderedInjectedReadme;
|
|
@@ -12,7 +26,32 @@ export type RenderInjectedReadmeResult = {
|
|
|
12
26
|
reason: RenderInjectedReadmeSkipReason;
|
|
13
27
|
version: string;
|
|
14
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Renders a README with release notes injected at the marker position, and the standalone
|
|
31
|
+
* release-notes markdown, from an already-loaded README string and an in-memory entry set.
|
|
32
|
+
*
|
|
33
|
+
* This is the pure rendering core: it reads nothing, writes nothing, and reports nothing, so a
|
|
34
|
+
* caller holding entries a release has computed but not yet written gets the same result as one
|
|
35
|
+
* rendering from a saved file, and each caller words a skip for its own output.
|
|
36
|
+
*
|
|
37
|
+
* Carries the version on a skip because both callers name it in their message and only this
|
|
38
|
+
* function has derived it from the tag.
|
|
39
|
+
*/
|
|
15
40
|
export declare function renderInjectedReadmeFromEntries(readme: string, entries: readonly ChangelogEntry[], tag: string, sectionOrder?: string[]): RenderInjectedReadmeResult;
|
|
41
|
+
/**
|
|
42
|
+
* Path-taking wrapper over {@link renderInjectedReadmeFromEntries} for callers rendering from a
|
|
43
|
+
* saved `changelog.json`, such as the publish-time injection flow.
|
|
44
|
+
*
|
|
45
|
+
* Adds the two skip conditions that only a file can present: the changelog is missing, or it does
|
|
46
|
+
* not parse. Warns on every skip, its own and the renderer's alike, because the publish path has
|
|
47
|
+
* no other channel for the message.
|
|
48
|
+
*/
|
|
16
49
|
export declare function renderInjectedReadme(readme: string, changelogJsonPath: string, tag: string, sectionOrder?: string[]): RenderedInjectedReadme | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Inject release notes into a README and return the original content for restoration.
|
|
52
|
+
*
|
|
53
|
+
* Returns the original README content, or `undefined` if injection was skipped.
|
|
54
|
+
*/
|
|
17
55
|
export declare function injectReleaseNotesIntoReadme(readmePath: string, changelogJsonPath: string, tag: string, sectionOrder?: string[]): string | undefined;
|
|
56
|
+
/** Find the README file in a workspace directory. */
|
|
18
57
|
export declare function resolveReadmePath(workspacePath: string): string | undefined;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace or insert a delimited section in file content.
|
|
3
|
+
*
|
|
4
|
+
* When markers exist, replaces the content between them. When absent, prepends the section
|
|
5
|
+
* (with markers) at the top of the content. The function is pure — no file I/O.
|
|
6
|
+
*/
|
|
1
7
|
export declare function injectSection(content: string, key: string, injection: string): string;
|
package/dist/esm/loadConfig.d.ts
CHANGED
|
@@ -1,15 +1,61 @@
|
|
|
1
1
|
import type { MonorepoReleaseConfig, ReleaseConfig, ReleaseKitConfig, WorkTypeConfig } from './types.js';
|
|
2
|
+
/** Path of the root `package.json` consulted when validating a `project` block. */
|
|
2
3
|
export declare const ROOT_PACKAGE_JSON_PATH = "package.json";
|
|
4
|
+
/**
|
|
5
|
+
* Read the root `package.json` and return its `version` field.
|
|
6
|
+
*
|
|
7
|
+
* Returns `{ exists: false }` when the file is missing, `{ exists: true, version: undefined }`
|
|
8
|
+
* when the file exists but has no `version` field, and `{ exists: true, version }` when both
|
|
9
|
+
* are present. The caller (`mergeMonorepoConfig`) decides whether the situation is an error.
|
|
10
|
+
*/
|
|
3
11
|
export declare function readRootPackageVersion(): {
|
|
4
12
|
exists: boolean;
|
|
5
13
|
version: string | undefined;
|
|
6
14
|
};
|
|
15
|
+
/** The path where the consumer-facing config file is expected. */
|
|
7
16
|
export declare const CONFIG_FILE_PATH = ".config/release-kit.config.ts";
|
|
17
|
+
/**
|
|
18
|
+
* Loads the config file at `.config/release-kit.config.ts`, returning the raw config object, or `undefined` when the
|
|
19
|
+
* file does not exist. Throws when the file exists but cannot be imported, or exports neither a default nor a named
|
|
20
|
+
* `config`.
|
|
21
|
+
*/
|
|
8
22
|
export declare function loadConfig(): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Information about the root `package.json` passed into `mergeMonorepoConfig` when a
|
|
25
|
+
* `project` block is configured. The async I/O lives in `readRootPackageVersion`; this
|
|
26
|
+
* function stays a pure transformation.
|
|
27
|
+
*/
|
|
9
28
|
export interface RootPackageInfo {
|
|
10
29
|
exists: boolean;
|
|
11
30
|
version: string | undefined;
|
|
12
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves a final monorepo config from discovered workspaces and an optional user config overlay.
|
|
34
|
+
*
|
|
35
|
+
* Merging rules:
|
|
36
|
+
* - `workspaces`: match overlay entries by `dir` against discovered list; `shouldExclude: true`
|
|
37
|
+
* removes the workspace; unlisted packages keep defaults.
|
|
38
|
+
* - `workTypes`: shallow merge — consumer entries override or add to defaults by key.
|
|
39
|
+
* - `versionPatterns`: consumer value replaces defaults entirely.
|
|
40
|
+
* - `formatCommand`, `cliffConfigPath`, `scopeAliases`: consumer value wins.
|
|
41
|
+
* - `project`: present iff `userConfig.project` is declared. Resolves `tagPrefix` to
|
|
42
|
+
* `DEFAULT_PROJECT_TAG_PREFIX` and `paths` to the union of the retained workspaces' `paths`
|
|
43
|
+
* when omitted. Requires `rootPackage` to be passed and to contain a valid `version` field;
|
|
44
|
+
* throws otherwise. The resolved prefix is included in the strict-prefix collision check
|
|
45
|
+
* across all workspace and retired-package prefixes.
|
|
46
|
+
*/
|
|
13
47
|
export declare function mergeMonorepoConfig(discoveredPaths: string[], userConfig: ReleaseKitConfig | undefined, rootPackage?: RootPackageInfo): MonorepoReleaseConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a final single-package config from an optional user config overlay.
|
|
50
|
+
*
|
|
51
|
+
* Rejects a configured `project` block: project-level releases are a monorepo-only feature,
|
|
52
|
+
* since the implicit "all non-excluded workspaces contribute" rule is meaningless in a
|
|
53
|
+
* single-package repo.
|
|
54
|
+
*/
|
|
14
55
|
export declare function mergeSinglePackageConfig(userConfig: ReleaseKitConfig | undefined): ReleaseConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Merge consumer work-type overrides onto `DEFAULT_WORK_TYPES`.
|
|
58
|
+
*
|
|
59
|
+
* Preserves the declaration order of defaults; net-new consumer keys append at the end.
|
|
60
|
+
*/
|
|
15
61
|
export declare function resolveWorkTypes(userWorkTypes?: ReleaseKitConfig['workTypes']): Record<string, WorkTypeConfig>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { ReleaseKitConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Outcome of loading and validating the consumer config file. `missing` is not reported
|
|
4
|
+
* here — whether an absent config file is an error is the caller's call.
|
|
5
|
+
*/
|
|
2
6
|
export type LoadValidatedConfigResult = {
|
|
3
7
|
status: 'invalid';
|
|
4
8
|
} | {
|
|
@@ -7,4 +11,8 @@ export type LoadValidatedConfigResult = {
|
|
|
7
11
|
status: 'ok';
|
|
8
12
|
config: ReleaseKitConfig;
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Load `.config/release-kit.config.ts` and validate it against the shared schema,
|
|
16
|
+
* reporting load failures and validation errors to stderr.
|
|
17
|
+
*/
|
|
10
18
|
export declare function loadValidatedConfig(): Promise<LoadValidatedConfigResult>;
|