diff --git a/changelog.md b/changelog.md index 435bed2..06513a4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## 2024-06-24 - 1.3.12 - fix(aidocs) +Fix changelog generation by handling leading newlines + +- Fixed handling of leading newlines in the changelog to ensure proper formatting. + ## 2024-06-23 - 1.3.11 - fix(core) Fixed new changelog formatting issue to retain consistent spacing. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 570f4e2..77792e5 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tsdoc', - version: '1.3.11', + version: '1.3.12', description: 'An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.' } diff --git a/ts/aidocs_classes/commit.ts b/ts/aidocs_classes/commit.ts index ebfb31e..62b9ceb 100644 --- a/ts/aidocs_classes/commit.ts +++ b/ts/aidocs_classes/commit.ts @@ -27,7 +27,10 @@ export class Commit { smartgitInstance, this.projectDir ); - const diffStringArray = await gitRepo.getUncommittedDiff(['pnpm-lock.yaml', 'package-lock.json']); + const diffStringArray = await gitRepo.getUncommittedDiff([ + 'pnpm-lock.yaml', + 'package-lock.json', + ]); const projectContext = new ProjectContext(this.projectDir); let contextString = await projectContext.update(); contextString = ` @@ -116,6 +119,9 @@ ${JSON.stringify(commitMessages, null, 2)} } let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', ''); + if (oldChangelog.startsWith('\n')) { + oldChangelog = oldChangelog.replace('\n', ''); + } let newDateString = new plugins.smarttime.ExtendedDate().exportToHyphedSortableDate(); let newChangelog = `# Changelog\n\n${`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}} {{nextVersionMessage}}