relacher 0.0.5 → 0.0.6

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.
@@ -5,10 +5,13 @@ import { type VcsProvider } from './vcs';
5
5
  * Builds the multi-line commit message showcasing version bumps, included commits,
6
6
  * cascade triggers, and first-release indicators.
7
7
  */
8
- export declare function generateCommitMessage(reports: DependencyUpdateReport[]): string | null;
8
+ export declare function generateCommitMessage(reports: DependencyUpdateReport[], options?: {
9
+ commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
10
+ }): string | null;
9
11
  /**
10
12
  * Applies calculated updates to files on disk, stages, commits, and tags using the VcsProvider from context.
11
13
  */
12
14
  export declare function run(prepared: PreparedUpdate, options: {
13
15
  cwd: string;
16
+ commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
14
17
  }): Effect.Effect<void, Error, VcsProvider>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relacher",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Scriptable release orchestration library for monorepos",
5
5
  "type": "module",
6
6
  "private": false,
package/src/run.ts CHANGED
@@ -11,14 +11,29 @@ import { VcsProviderService, type VcsProvider } from './vcs';
11
11
  * Builds the multi-line commit message showcasing version bumps, included commits,
12
12
  * cascade triggers, and first-release indicators.
13
13
  */
14
- export function generateCommitMessage(reports: DependencyUpdateReport[]): string | null {
14
+ export function generateCommitMessage(
15
+ reports: DependencyUpdateReport[],
16
+ options?: {
17
+ commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
18
+ },
19
+ ): string | null {
15
20
  const activeReports = reports.filter((r) => r.bump !== 'skip');
16
21
  if (activeReports.length === 0) {
17
22
  return null;
18
23
  }
19
24
 
25
+ const bumps: Record<string, string> = {};
26
+ for (const r of activeReports) {
27
+ bumps[r.name] = r.newVersion;
28
+ }
29
+
20
30
  const tagList = activeReports.map((r) => `${r.name}-v${r.newVersion}`).join(', ');
21
- let commitMessage = `chore: release ${tagList}\n\n`;
31
+ const defaultTitle = `release: ${tagList}`;
32
+ const commitTitle = options?.commitTitle
33
+ ? options.commitTitle(defaultTitle, bumps)
34
+ : defaultTitle;
35
+
36
+ let commitMessage = `${commitTitle}\n\n`;
22
37
 
23
38
  for (const report of activeReports) {
24
39
  const firstReleaseBadge = report.isFirstRelease ? ' (first release)' : '';
@@ -51,7 +66,10 @@ export function generateCommitMessage(reports: DependencyUpdateReport[]): string
51
66
  */
52
67
  export function run(
53
68
  prepared: PreparedUpdate,
54
- options: { cwd: string },
69
+ options: {
70
+ cwd: string;
71
+ commitTitle?: (defaultTitle: string, bumps: Record<string, string>) => string;
72
+ },
55
73
  ): Effect.Effect<void, Error, VcsProvider> {
56
74
  return Effect.gen(function*() {
57
75
  const vcs = yield* VcsProviderService;
@@ -97,7 +115,9 @@ export function run(
97
115
  updateLockfile(cwd, reports);
98
116
 
99
117
  // 3. Build multi-line commit message
100
- const commitMessage = generateCommitMessage(reports);
118
+ const commitMessage = generateCommitMessage(reports, {
119
+ commitTitle: options.commitTitle,
120
+ });
101
121
  if (!commitMessage) {
102
122
  return;
103
123
  }