@williamthorsen/release-kit 10.4.4 → 10.6.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/.meta/changelog.json +1502 -0
- package/.readyup/kits/default.js +120 -4
- package/.readyup/kits/npm-auto-publish.js +11 -3
- package/.readyup/manifest.json +16 -11
- package/CHANGELOG.md +57 -0
- package/README.md +64 -4
- package/dist/esm/assertCleanWorkingTree.d.ts +5 -0
- package/dist/esm/buildChangelogEntries.d.ts +22 -0
- package/dist/esm/buildChangelogEntries.js +5 -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 -2
- package/dist/esm/changelogJsonUtils.js +0 -13
- package/dist/esm/changelogOverrides.d.ts +143 -0
- package/dist/esm/changelogOverrides.js +8 -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/extractMigration.d.ts +14 -0
- package/dist/esm/extractMigration.js +18 -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/packsPath.d.ts +15 -0
- package/dist/esm/packsPath.js +47 -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/releasePrepare.js +0 -3
- package/dist/esm/releasePrepareMono.d.ts +8 -0
- package/dist/esm/releasePrepareMono.js +0 -4
- 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/reportPrepare.js +4 -2
- 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 +37 -1
- package/dist/esm/runGitCliff.js +4 -10
- 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 +302 -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 +12 -11
|
@@ -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>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports whether npm would place `path` in the published tarball, given a package.json `files` value.
|
|
3
|
+
*
|
|
4
|
+
* An absent or malformed `files` value packs everything, so it reports `true`; an empty array packs nothing
|
|
5
|
+
* beyond the files npm always includes, so it reports `false`. An entry naming an ancestor directory covers
|
|
6
|
+
* everything beneath it, which is how `files: ["dist/*"]` ships `dist/esm/index.js`, so every ancestor prefix
|
|
7
|
+
* of `path` is tested rather than `path` alone.
|
|
8
|
+
*
|
|
9
|
+
* Two approximations of npm's packing rules remain, both failing toward a silent pass: a negation entry
|
|
10
|
+
* (`!dist/*.map`) never counts toward inclusion, because gitignore-style ordered negation is not modeled; and a
|
|
11
|
+
* repo controlling its tarball through `.npmignore` alone declares no `files` field, so it reports `true`
|
|
12
|
+
* without the ignore file being read. For a check that warns about an omission, a missed report costs less than
|
|
13
|
+
* a false one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function packsPath(filesField: unknown, path: string): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export function packsPath(filesField, path) {
|
|
2
|
+
if (!isStringArray(filesField))
|
|
3
|
+
return true;
|
|
4
|
+
const prefixes = listAncestorPrefixes(path);
|
|
5
|
+
return filesField.some((entry) => {
|
|
6
|
+
const pattern = compileEntry(entry);
|
|
7
|
+
return pattern !== undefined && prefixes.some((prefix) => pattern.test(prefix));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
const GLOB_TOKEN_PATTERN = /\*\*\/|\*\*|\*|\?|[^*?]+/g;
|
|
11
|
+
function compileEntry(entry) {
|
|
12
|
+
if (entry.startsWith('!'))
|
|
13
|
+
return undefined;
|
|
14
|
+
const normalized = entry.replace(/^\.?\//, '').replace(/\/+$/, '');
|
|
15
|
+
if (normalized === '')
|
|
16
|
+
return undefined;
|
|
17
|
+
return new RegExp(`^${translateGlob(normalized)}$`);
|
|
18
|
+
}
|
|
19
|
+
function isStringArray(value) {
|
|
20
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === 'string');
|
|
21
|
+
}
|
|
22
|
+
function listAncestorPrefixes(path) {
|
|
23
|
+
const segments = path.split('/');
|
|
24
|
+
return segments.map((_segment, index) => segments.slice(0, index + 1).join('/'));
|
|
25
|
+
}
|
|
26
|
+
function translateGlob(pattern) {
|
|
27
|
+
let source = '';
|
|
28
|
+
for (const [token] of pattern.matchAll(GLOB_TOKEN_PATTERN)) {
|
|
29
|
+
switch (token) {
|
|
30
|
+
case '**/':
|
|
31
|
+
source += String.raw `(?:[^/]*\/)*`;
|
|
32
|
+
break;
|
|
33
|
+
case '**':
|
|
34
|
+
source += '.*';
|
|
35
|
+
break;
|
|
36
|
+
case '*':
|
|
37
|
+
source += '[^/]*';
|
|
38
|
+
break;
|
|
39
|
+
case '?':
|
|
40
|
+
source += '[^/]';
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
source += RegExp.escape(token);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return source;
|
|
47
|
+
}
|
|
@@ -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[];
|