Skip to content

Commit ebf45ab

Browse files
committed
chore: here we go again
1 parent 7b3f6a4 commit ebf45ab

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/index.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,21 @@ async function getDependencyReleaseLine(
164164

165165
// Function to get the credits section
166166
function getCreditsSection(): string {
167-
if (allAuthors.size === 0) return "";
167+
console.log(
168+
`[Debug] Generating credits section with ${allAuthors.size} authors`
169+
);
170+
if (allAuthors.size === 0) {
171+
console.log(`[Debug] No authors to credit, skipping credits section`);
172+
return "";
173+
}
168174

169175
const authors = Array.from(allAuthors).sort();
170176
const authorLinks = authors.map((author) => `@${author}`);
171177

172-
if (authorLinks.length === 0) return "";
178+
if (authorLinks.length === 0) {
179+
console.log(`[Debug] No author links to credit, skipping credits section`);
180+
return "";
181+
}
173182

174183
let credits = "\n\n**Credits**\n";
175184
if (authorLinks.length === 1) {
@@ -183,8 +192,10 @@ function getCreditsSection(): string {
183192
)}, and ${lastAuthor} for helping!`;
184193
}
185194

195+
console.log(`[Debug] Generated credits section: ${credits}`);
186196
// Clear the authors set for the next changelog
187197
allAuthors.clear();
198+
console.log(`[Debug] Cleared authors set for next changelog`);
188199

189200
return credits;
190201
}
@@ -195,23 +206,36 @@ const wrappedGetReleaseLine: ChangelogFunctions["getReleaseLine"] = async (
195206
type,
196207
opts
197208
) => {
209+
console.log(
210+
`[Debug] Processing release line for type: ${type}, isLast: ${opts?.isLast}`
211+
);
212+
console.log(`[Debug] Current authors: ${Array.from(allAuthors).join(", ")}`);
198213
const result = await getReleaseLine(changeset as ChangesetWithPR, type, opts);
199214
// Add credits section only if this is the last changeset and we have authors
200215
if (opts?.isLast && allAuthors.size > 0) {
216+
console.log(`[Debug] Adding credits section for ${type} changes`);
201217
return result + getCreditsSection();
202218
}
203219
return result;
204220
};
205221

206222
const wrappedGetDependencyReleaseLine: ChangelogFunctions["getDependencyReleaseLine"] =
207223
async (changesets, dependencies, opts) => {
224+
console.log(
225+
`[Debug] Processing dependency release line, isLast: ${opts?.isLast}`
226+
);
227+
console.log(`[Debug] Number of changesets: ${changesets.length}`);
228+
console.log(
229+
`[Debug] Current authors: ${Array.from(allAuthors).join(", ")}`
230+
);
208231
const result = await getDependencyReleaseLine(
209232
changesets,
210233
dependencies,
211234
opts
212235
);
213-
// Add credits section only if this is the last entry, there are no regular changesets, and we have authors
214-
if (opts?.isLast && changesets.length === 0 && allAuthors.size > 0) {
236+
// Add credits section only if this is the last entry and we have authors
237+
if (opts?.isLast && allAuthors.size > 0) {
238+
console.log(`[Debug] Adding credits section for dependency changes`);
215239
return result + getCreditsSection();
216240
}
217241
return result;

0 commit comments

Comments
 (0)