tegami 0.1.5 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { c as TegamiPlugin } from "../types-BXk2fMqa.js";
1
+ import { s as TegamiPlugin } from "../types-CurHqnWl.js";
2
2
 
3
3
  //#region src/plugins/git.d.ts
4
4
  interface GitPluginOptions {
@@ -9,12 +9,15 @@ import { x } from "tinyexec";
9
9
  */
10
10
  function git(options = {}) {
11
11
  const { createTags = true, pushTags = isCI() } = options;
12
- function resolveGitTag(context, result) {
13
- const { graph } = context;
14
- const pkg = graph.get(result.id);
15
- const group = pkg && graph.getPackageGroup(pkg.id);
16
- if (group?.options.syncGitTag) return `${group.name}@${result.version}`;
17
- return `${result.name}@${result.version}`;
12
+ function getPendingTags(plan) {
13
+ const pendingTags = /* @__PURE__ */ new Set();
14
+ if ((plan.options.dryRun ?? false) || !createTags) return pendingTags;
15
+ for (const pkg of plan.packages.values()) {
16
+ if (pkg.publishResult.type !== "published") continue;
17
+ const tag = pkg.git?.tag;
18
+ if (tag) pendingTags.add(tag);
19
+ }
20
+ return pendingTags;
18
21
  }
19
22
  return {
20
23
  name: "git",
@@ -35,39 +38,48 @@ function git(options = {}) {
35
38
  if (result.exitCode !== 0) throw execFailure("Failed to configure git user for GitHub Actions.", result);
36
39
  }
37
40
  } },
38
- async afterPublishAll(result) {
39
- const { cwd, publishOptions: { dryRun = false } } = this;
40
- if (dryRun || !createTags || result.state === "skipped") return result;
41
- const pendingTags = /* @__PURE__ */ new Set();
42
- for (const pkg of result.packages) {
43
- if (pkg.state !== "success") continue;
44
- pkg.gitTag = resolveGitTag(this, pkg);
45
- pendingTags.add(pkg.gitTag);
41
+ initPublishPlan({ plan }) {
42
+ const { graph } = this;
43
+ for (const [id, packagePlan] of plan.packages) {
44
+ const pkg = graph.get(id);
45
+ const group = pkg && graph.getPackageGroup(pkg.id);
46
+ let tag;
47
+ if (group?.options.syncGitTag) tag = `${group.name}@${pkg.version}`;
48
+ else tag = `${pkg.name}@${pkg.version}`;
49
+ packagePlan.git = { tag };
46
50
  }
51
+ },
52
+ async resolvePlanStatus({ plan }) {
53
+ const pendingTags = getPendingTags(plan);
54
+ if (pendingTags.size === 0) return;
47
55
  try {
48
- const createdTags = [];
49
- await Promise.all(Array.from(pendingTags).map(async (tag) => {
50
- if (await gitTagExists(cwd, tag)) return;
51
- const gitOut = await x("git", ["tag", tag], { nodeOptions: { cwd } });
52
- if (gitOut.exitCode !== 0) throw execFailure(`Failed to create Git tag "${tag}" for release`, gitOut);
53
- createdTags.push(tag);
56
+ await Promise.all(Array.from(pendingTags, async (tag) => {
57
+ if (!await gitTagExists(this.cwd, tag)) throw "pending";
54
58
  }));
55
- if (pushTags && createdTags.length > 0) {
56
- const gitOut = await x("git", [
57
- "push",
58
- "origin",
59
- ...createdTags
60
- ], { nodeOptions: { cwd } });
61
- if (gitOut.exitCode !== 0) throw execFailure(`Failed to push Git tags to origin: ${createdTags.join(", ")}`, gitOut);
62
- }
63
- } catch (error) {
64
- return {
65
- ...result,
66
- state: "failed",
67
- error: error instanceof Error ? error.message : String(error)
68
- };
59
+ } catch (e) {
60
+ if (e === "pending") return "pending";
61
+ throw e;
62
+ }
63
+ },
64
+ async afterPublishAll({ plan }) {
65
+ const { cwd } = this;
66
+ const createdTags = [];
67
+ const pendingTags = getPendingTags(plan);
68
+ if (pendingTags.size === 0) return;
69
+ await Promise.all(Array.from(pendingTags, async (tag) => {
70
+ if (await gitTagExists(cwd, tag)) return;
71
+ const gitOut = await x("git", ["tag", tag], { nodeOptions: { cwd } });
72
+ if (gitOut.exitCode !== 0) throw execFailure(`Failed to create Git tag "${tag}" for release`, gitOut);
73
+ createdTags.push(tag);
74
+ }));
75
+ if (pushTags && createdTags.length > 0) {
76
+ const gitOut = await x("git", [
77
+ "push",
78
+ "origin",
79
+ ...createdTags
80
+ ], { nodeOptions: { cwd } });
81
+ if (gitOut.exitCode !== 0) throw execFailure(`Failed to push Git tags to origin: ${createdTags.join(", ")}`, gitOut);
69
82
  }
70
- return result;
71
83
  }
72
84
  };
73
85
  }
@@ -1,4 +1,4 @@
1
- import { S as PackagePublishResult, T as TegamiContext, c as TegamiPlugin, k as DraftPlan, t as Awaitable } from "../types-BXk2fMqa.js";
1
+ import { D as WorkspacePackage, O as Draft, S as PublishPlan, s as TegamiPlugin, t as Awaitable, w as TegamiContext } from "../types-CurHqnWl.js";
2
2
  import { GitPluginOptions } from "./git.js";
3
3
 
4
4
  //#region src/plugins/github.d.ts
@@ -35,6 +35,10 @@ interface VersionPullRequestOptions {
35
35
  * @default "main"
36
36
  */
37
37
  base?: string;
38
+ /** Override details for "Version Packages" PR. */
39
+ create?: (this: TegamiContext, opts: {
40
+ draft: Draft;
41
+ }) => Awaitable<VersionPullRequest>;
38
42
  }
39
43
  /** Options for creating GitHub releases after a successful publish. */
40
44
  interface GitHubPluginOptions extends GitPluginOptions {
@@ -43,25 +47,34 @@ interface GitHubPluginOptions extends GitPluginOptions {
43
47
  /** Optional GitHub token for Git & GitHub operations. */
44
48
  token?: string;
45
49
  /**
46
- * Create GitHub release immediately after successful publish, without waiting for others.
50
+ * Create GitHub release for published packages.
47
51
  *
48
- * @default false
52
+ * @default true
49
53
  */
50
- eagerRelease?: boolean;
51
- /** Override release details for a single package, return `false` to skip. */
52
- onCreateRelease?: (this: TegamiContext, result: PackagePublishResult) => Awaitable<GithubRelease | false>;
53
- /** Override release details when multiple packages share a git tag, return `false` to skip. */
54
- onCreateGroupedRelease?: (this: TegamiContext, packages: PackagePublishResult[]) => Awaitable<GithubRelease | false>;
55
- /** Override details for "Version Packages" PR. */
56
- onCreateVersionPullRequest?: (this: TegamiContext, publishPlan: DraftPlan) => Awaitable<VersionPullRequest | false>;
57
- cli?: {
54
+ release?: boolean | {
58
55
  /**
59
- * Open a version pull request after versioning.
60
- * Defaults to enabled in CI and disabled locally.
61
- * Set to `true` to always create the pull request.
56
+ * Create GitHub release immediately after successful publish, without waiting for others.
57
+ *
58
+ * @default false
62
59
  */
63
- versionPr?: boolean | VersionPullRequestOptions;
60
+ eager?: boolean; /** Override release details for a single package. */
61
+ create?: (this: TegamiContext, opts: {
62
+ tag: string;
63
+ pkg: WorkspacePackage;
64
+ plan: PublishPlan;
65
+ }) => Awaitable<GithubRelease>; /** Override release details when multiple packages share a git tag. */
66
+ createGrouped?: (this: TegamiContext, opts: {
67
+ tag: string;
68
+ packages: WorkspacePackage[];
69
+ plan: PublishPlan;
70
+ }) => Awaitable<GithubRelease>;
64
71
  };
72
+ /**
73
+ * (CLI only) Open a version pull request after versioning.
74
+ *
75
+ * Defaults to enabled in CI and disabled locally.
76
+ */
77
+ versionPr?: VersionPullRequestOptions | false;
65
78
  }
66
79
  /** Create GitHub releases for successfully published packages after the whole plan succeeds. */
67
80
  declare function github(options?: GitHubPluginOptions): TegamiPlugin[];
@@ -1,5 +1,6 @@
1
1
  import { i as formatPackageVersion, r as formatNpmDistTag } from "../semver-C4vJ4SK8.js";
2
2
  import { a as isCI, n as execFailure } from "../error-DNy8R5ue.js";
3
+ import { a as findOpenPullRequest, l as updatePullRequest, n as createPullRequest, r as createRelease, s as releaseExistsByTag } from "../api-D-jf_8xY.js";
3
4
  import { git } from "./git.js";
4
5
  import { join, relative } from "node:path";
5
6
  import { x } from "tinyexec";
@@ -7,53 +8,27 @@ import { prerelease } from "semver";
7
8
  //#region src/plugins/github.ts
8
9
  /** Create GitHub releases for successfully published packages after the whole plan succeeds. */
9
10
  function github(options = {}) {
10
- const { eagerRelease = false, onCreateGroupedRelease, onCreateRelease, onCreateVersionPullRequest, cli: cliOptions = {} } = options;
11
- async function runGithubRelease(gitTag, title, notes, prerelease, repo) {
12
- const args = [
13
- "release",
14
- "create",
15
- gitTag,
16
- "--title",
17
- title,
18
- "--notes",
19
- notes
20
- ];
21
- if (repo) args.push("--repo", repo);
22
- if (prerelease) args.push("--prerelease");
23
- const result = await x("gh", args);
24
- if (result.exitCode !== 0) throw execFailure(`Failed to create GitHub release for ${gitTag}.`, result);
25
- }
26
- async function createRelease(context, pkg) {
27
- if (!pkg.gitTag || pkg.state === "failed") return;
28
- const release = await onCreateRelease?.call(context, pkg) ?? {};
29
- if (release === false) return;
30
- await runGithubRelease(pkg.gitTag, release.title ?? defaultTitle(pkg), release.notes ?? await defaultNotes(context, pkg), release.prerelease ?? prerelease(pkg.version) !== null, context.github?.repo);
31
- }
32
- async function createGroupedRelease(context, packages) {
33
- const primary = packages[0];
34
- if (!primary?.gitTag) return;
35
- if (packages.some((member) => member.state === "failed")) return;
36
- const release = await onCreateGroupedRelease?.call(context, packages) ?? {};
37
- if (release === false) return;
38
- await runGithubRelease(primary.gitTag, release.title ?? defaultGroupedTitle(packages), release.notes ?? await defaultGroupedNotes(context, packages), release.prerelease ?? packages.some((pkg) => prerelease(pkg.version) !== null), context.github?.repo);
11
+ const { release: releaseOptions = true } = options;
12
+ let renderer;
13
+ function getRenderer(context) {
14
+ return renderer ??= createChangelogRenderer(context);
39
15
  }
40
16
  function resolvePROptions() {
41
- const setting = cliOptions.versionPr ?? isCI();
42
- if (setting === false) return [false];
43
- if (setting === true) return [true, {}];
44
- if (setting.forceCreate || isCI()) return [true, setting];
17
+ const config = options.versionPr ?? {};
18
+ if (config === false) return [false];
19
+ if (config.forceCreate || isCI()) return [true, config];
45
20
  return [false];
46
21
  }
47
22
  function defaultVersionPRBody(draft, context) {
48
23
  const packageLines = [];
49
24
  for (const pkg of context.graph.getPackages()) {
50
- const packagePlan = draft.getPackagePlan(pkg.id);
51
- if (!packagePlan) continue;
25
+ const packageDraft = draft.getPackageDraft(pkg.id);
26
+ if (!packageDraft) continue;
52
27
  const originalVersion = cliOriginalPackageVersions.get(pkg.id) ?? pkg.version;
53
28
  if (originalVersion === pkg.version) continue;
54
- const publishTxt = packagePlan.publish ? "" : " (no publish)";
55
- const distTagTxt = formatNpmDistTag(packagePlan.npm?.distTag);
56
- packageLines.push(`- ${pkg.name}@${originalVersion} → ${pkg.name}@${pkg.version}${distTagTxt}${publishTxt}`);
29
+ let line = `- **${pkg.name}**: ${originalVersion} ${pkg.version}`;
30
+ line += formatNpmDistTag(packageDraft.npm?.distTag);
31
+ packageLines.push(line);
57
32
  }
58
33
  const changelogLines = [];
59
34
  for (const entry of draft.getChangelogs()) {
@@ -83,6 +58,74 @@ function github(options = {}) {
83
58
  token: options.token ?? process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN
84
59
  };
85
60
  },
61
+ async resolvePlanStatus({ plan }) {
62
+ const { repo, token } = this.github;
63
+ if (!repo || !token || releaseOptions === false) return;
64
+ const tags = groupPackagesByTag(this, plan);
65
+ try {
66
+ await Promise.all(Array.from(tags.keys(), async (tag) => {
67
+ if (!await releaseExistsByTag(repo, tag, token)) throw "pending";
68
+ }));
69
+ } catch (e) {
70
+ if (e === "pending") return "pending";
71
+ throw e;
72
+ }
73
+ },
74
+ async afterPublishAll({ plan }) {
75
+ const { repo, token } = this.github;
76
+ if (!repo || !token || releaseOptions === false) return;
77
+ const { eager = false, create, createGrouped } = releaseOptions === true ? {} : releaseOptions;
78
+ if (!eager) {
79
+ for (const pkg of plan.packages.values()) if (pkg.publishResult.type === "failed") return;
80
+ }
81
+ await Promise.all(Array.from(groupPackagesByTag(this, plan), async ([tag, packages]) => {
82
+ let hasFailed = false;
83
+ let hasPublished = false;
84
+ for (const member of packages) switch (plan.packages.get(member.id).publishResult.type) {
85
+ case "published":
86
+ hasPublished = true;
87
+ break;
88
+ case "failed":
89
+ hasFailed = true;
90
+ break;
91
+ }
92
+ if (hasFailed || !hasPublished) return;
93
+ if (await releaseExistsByTag(repo, tag, token)) return;
94
+ let release;
95
+ if (packages.length > 1) {
96
+ const overrides = await createGrouped?.call(this, {
97
+ tag,
98
+ packages,
99
+ plan
100
+ }) ?? {};
101
+ release = {
102
+ title: overrides.title ?? tag,
103
+ notes: overrides.notes ?? await defaultGroupedNotes(getRenderer(this), plan, packages),
104
+ prerelease: overrides.prerelease ?? packages.some((pkg) => prerelease(pkg.version) !== null)
105
+ };
106
+ } else {
107
+ const pkg = packages[0];
108
+ const overrides = await create?.call(this, {
109
+ tag,
110
+ pkg,
111
+ plan
112
+ }) ?? {};
113
+ const packagePlan = plan.packages.get(pkg.id);
114
+ release = {
115
+ title: overrides.title ?? formatPackageVersion(pkg.name, pkg.version, packagePlan?.npm?.distTag),
116
+ notes: overrides.notes ?? await defaultNotes(getRenderer(this), pkg, packagePlan),
117
+ prerelease: overrides.prerelease ?? prerelease(pkg.version) !== null
118
+ };
119
+ }
120
+ await createRelease(repo, {
121
+ tag,
122
+ title: release.title,
123
+ notes: release.notes,
124
+ prerelease: release.prerelease,
125
+ token
126
+ });
127
+ }));
128
+ },
86
129
  cli: {
87
130
  async init() {
88
131
  if (!isCI()) return;
@@ -96,17 +139,16 @@ function github(options = {}) {
96
139
  ], { nodeOptions: { cwd: this.cwd } });
97
140
  if (result.exitCode !== 0) throw execFailure("Failed to configure git remote for GitHub Actions.", result);
98
141
  },
99
- publishPlanCreated() {
142
+ draftCreated() {
100
143
  for (const pkg of this.graph.getPackages()) cliOriginalPackageVersions.set(pkg.id, pkg.version);
101
144
  },
102
- async publishPlanApplied(draft) {
145
+ async draftApplied(draft) {
103
146
  const { cwd } = this;
104
147
  const [enabled, config] = resolvePROptions();
105
- const repo = this.github?.repo;
106
148
  if (!enabled || !await hasGitChanges(cwd)) return;
149
+ const repo = this.github?.repo;
107
150
  const { branch = "tegami/version-packages", base = "main" } = config;
108
- const basePR = await onCreateVersionPullRequest?.call(this, draft);
109
- if (basePR === false) return;
151
+ const basePR = await config.create?.call(this, { draft });
110
152
  const pr = {
111
153
  title: basePR?.title ?? "Version Packages",
112
154
  body: basePR?.body ?? defaultVersionPRBody(draft, this)
@@ -134,124 +176,98 @@ function github(options = {}) {
134
176
  branch
135
177
  ], gitOptions);
136
178
  if (result.exitCode !== 0) throw execFailure("Failed to push the version branch to origin. Ensure `origin` is configured and you have push access.", result);
137
- const openPr = await findOpenPullRequest(branch, repo);
179
+ const token = this.github?.token;
180
+ if (!repo) return;
181
+ const openPr = await findOpenPullRequest(repo, branch, token);
138
182
  if (openPr !== void 0) {
139
- const editArgs = [
140
- "pr",
141
- "edit",
142
- String(openPr),
143
- "--title",
144
- pr.title,
145
- "--body",
146
- pr.body
147
- ];
148
- if (repo) editArgs.push("--repo", repo);
149
- const editResult = await x("gh", editArgs);
150
- if (editResult.exitCode !== 0) throw execFailure("Failed to update the version pull request.", editResult);
183
+ await updatePullRequest(repo, openPr, {
184
+ title: pr.title,
185
+ body: pr.body,
186
+ token
187
+ });
151
188
  return;
152
189
  }
153
- const args = [
154
- "pr",
155
- "create",
156
- "--title",
157
- pr.title,
158
- "--body",
159
- pr.body,
160
- "--head",
161
- branch,
162
- "--base",
163
- base
164
- ];
165
- if (repo) args.push("--repo", repo);
166
- const prResult = await x("gh", args);
167
- if (prResult.exitCode !== 0) throw execFailure("Failed to create the version pull request.", prResult);
190
+ await createPullRequest(repo, {
191
+ title: pr.title,
192
+ body: pr.body,
193
+ head: branch,
194
+ base,
195
+ token
196
+ });
168
197
  }
169
- },
170
- async afterPublishAll(result) {
171
- if (!eagerRelease && result.state === "failed") return;
172
- if (result.state === "skipped") return;
173
- for (const packages of groupPackagesByGitTag(result.packages).values()) if (packages.length > 1) await createGroupedRelease(this, packages);
174
- else await createRelease(this, packages[0]);
175
198
  }
176
199
  }];
177
200
  }
178
- async function hasGitChanges(cwd) {
179
- return (await x("git", ["status", "--porcelain"], { nodeOptions: { cwd } })).stdout.trim().length > 0;
180
- }
181
- async function findOpenPullRequest(branch, repo) {
182
- const args = [
183
- "pr",
184
- "list",
185
- "--head",
186
- branch,
187
- "--state",
188
- "open",
189
- "--json",
190
- "number"
191
- ];
192
- if (repo) args.push("--repo", repo);
193
- const result = await x("gh", args);
194
- if (result.exitCode !== 0) throw execFailure("Failed to check for an existing version pull request.", result);
195
- return JSON.parse(result.stdout)[0]?.number;
196
- }
197
- function groupPackagesByGitTag(packages) {
201
+ function groupPackagesByTag({ graph }, plan) {
198
202
  const groups = /* @__PURE__ */ new Map();
199
- for (const pkg of packages) {
200
- if (!pkg.gitTag) continue;
201
- const group = groups.get(pkg.gitTag);
203
+ for (const [id, packagePlan] of plan.packages) {
204
+ const pkg = graph.get(id);
205
+ const tag = packagePlan.git?.tag;
206
+ if (!tag) continue;
207
+ const group = groups.get(tag);
202
208
  if (group) group.push(pkg);
203
- else groups.set(pkg.gitTag, [pkg]);
209
+ else groups.set(tag, [pkg]);
204
210
  }
205
211
  return groups;
206
212
  }
207
- function defaultTitle(pkg) {
208
- return formatPackageVersion(pkg.name, pkg.version, pkg.npm?.distTag);
209
- }
210
- function defaultGroupedTitle(packages) {
211
- const primary = packages[0];
212
- const distTag = packages.every((pkg) => pkg.npm?.distTag === primary.npm?.distTag) ? primary.npm?.distTag : void 0;
213
- return formatPackageVersion(primary.gitTag.slice(0, primary.gitTag.lastIndexOf("@")), primary.version, distTag);
214
- }
215
- function formatCommitLink(commit, repo) {
216
- const short = commit.slice(0, 7);
217
- if (!repo) return `\`${short}\``;
218
- return `[${short}](https://github.com/${repo}/commit/${commit})`;
219
- }
220
- async function resolveChangelogEntryCommit(context, filename) {
221
- const result = await x("git", [
222
- "log",
223
- "--diff-filter=A",
224
- "-1",
225
- "--format=%H",
226
- "--",
227
- relative(context.cwd, join(context.changelogDir, filename))
228
- ], { nodeOptions: { cwd: context.cwd } });
229
- if (result.exitCode !== 0) return;
230
- return result.stdout.trim() || void 0;
213
+ async function hasGitChanges(cwd) {
214
+ return (await x("git", ["status", "--porcelain"], { nodeOptions: { cwd } })).stdout.trim().length > 0;
231
215
  }
232
- async function renderChangelogEntryNotes(context, entry) {
233
- const repo = context.github?.repo;
234
- const commit = await resolveChangelogEntryCommit(context, entry.filename);
235
- const commitSuffix = commit ? ` (${formatCommitLink(commit, repo)})` : "";
236
- const lines = [];
237
- for (const section of entry.sections) {
238
- lines.push(`### ${section.title}${commitSuffix}`, "");
239
- if (section.content) lines.push(section.content, "");
216
+ function createChangelogRenderer(context) {
217
+ const cache = /* @__PURE__ */ new Map();
218
+ async function resolveFileCommit(filename) {
219
+ const result = await x("git", [
220
+ "log",
221
+ "--diff-filter=A",
222
+ "-1",
223
+ "--format=%H",
224
+ "--",
225
+ relative(context.cwd, join(context.changelogDir, filename))
226
+ ], { nodeOptions: { cwd: context.cwd } });
227
+ if (result.exitCode !== 0) return;
228
+ return result.stdout.trim() || void 0;
229
+ }
230
+ function formatCommitLink(commit) {
231
+ const short = commit.slice(0, 7);
232
+ const repo = context.github?.repo;
233
+ if (!repo) return `\`${short}\``;
234
+ return `[${short}](https://github.com/${repo}/commit/${commit})`;
240
235
  }
241
- return lines.join("\n").trim();
236
+ return async (entry) => {
237
+ let commitPromise = cache.get(entry.filename);
238
+ if (!commitPromise) {
239
+ commitPromise = resolveFileCommit(entry.filename);
240
+ cache.set(entry.filename, commitPromise);
241
+ }
242
+ const commit = await commitPromise;
243
+ const commitSuffix = commit ? ` (${formatCommitLink(commit)})` : "";
244
+ const lines = [];
245
+ for (const section of entry.sections) {
246
+ lines.push(`### ${section.title}${commitSuffix}`, "");
247
+ if (section.content) lines.push(section.content, "");
248
+ }
249
+ return lines.join("\n").trim();
250
+ };
242
251
  }
243
- async function defaultNotes(context, pkg) {
244
- if (pkg.changelogs.length > 0) return (await Promise.all(pkg.changelogs.map(async (entry) => renderChangelogEntryNotes(context, entry)))).join("\n\n");
245
- return `Published ${formatPackageVersion(pkg.name, pkg.version, pkg.npm?.distTag)}.`;
252
+ async function defaultNotes(renderer, pkg, packagePlan) {
253
+ if (packagePlan && packagePlan.changelogs.length > 0) return (await Promise.all(packagePlan.changelogs.map(renderer))).join("\n\n");
254
+ return `Published ${formatPackageVersion(pkg.name, pkg.version, packagePlan?.npm?.distTag)}.`;
246
255
  }
247
- async function defaultGroupedNotes(context, packages) {
256
+ async function defaultGroupedNotes(renderer, plan, packages) {
248
257
  const changelogs = /* @__PURE__ */ new Map();
249
- for (const pkg of packages) for (const entry of pkg.changelogs) changelogs.set(entry.id, entry);
250
- const sections = [packages.map((pkg) => `- ${formatPackageVersion(pkg.name, pkg.version, pkg.npm?.distTag)}`).join("\n")];
258
+ for (const pkg of packages) {
259
+ const packagePlan = plan.packages.get(pkg.id);
260
+ if (!packagePlan) continue;
261
+ for (const entry of packagePlan.changelogs) changelogs.set(entry.id, entry);
262
+ }
263
+ const sections = [packages.map((pkg) => {
264
+ const packagePlan = plan.packages.get(pkg.id);
265
+ return `- ${formatPackageVersion(pkg.name, pkg.version, packagePlan?.npm?.distTag)}`;
266
+ }).join("\n")];
251
267
  if (changelogs.size > 0) {
252
- const notes = await Promise.all(Array.from(changelogs.values()).map((entry) => renderChangelogEntryNotes(context, entry)));
268
+ const notes = await Promise.all(Array.from(changelogs.values(), renderer));
253
269
  sections.push("", notes.join("\n\n"));
254
- } else sections.push("", `Published ${packages[0].gitTag}.`);
270
+ }
255
271
  return sections.join("\n");
256
272
  }
257
273
  //#endregion
@@ -1,2 +1,2 @@
1
- import { d as CargoPluginOptions, f as CargoRegistryClient, p as cargo, u as CargoPackage } from "../types-BXk2fMqa.js";
2
- export { CargoPackage, CargoPluginOptions, CargoRegistryClient, cargo };
1
+ import { d as cargo, l as CargoPackage, u as CargoPluginOptions } from "../types-CurHqnWl.js";
2
+ export { CargoPackage, CargoPluginOptions, cargo };