diff --git a/changelog.md b/changelog.md index f276839..92cb462 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2024-06-23 - 1.9.120 - fix(mod_commit) +Handle edge case for empty version details in changelog formatting + +- Added check for the length of the recommendedNextVersionDetails array +- Ensure no extra newline in changelog if there are no version details + + ## 2024-06-23 - 1.9.119 - fix(dependencies) Update @git.zone/tsdoc to v1.3.8 diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index b02e701..8631667 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/cli', - version: '1.9.119', + version: '1.9.120', description: 'A CLI toolbelt to streamline local development cycles by using various gitzone utilities.' } diff --git a/ts/mod_commit/index.ts b/ts/mod_commit/index.ts index 2da0c09..ed92db1 100644 --- a/ts/mod_commit/index.ts +++ b/ts/mod_commit/index.ts @@ -74,7 +74,11 @@ export const run = async (argvArg: any) => { changelog = changelog.replaceAll('{{nextVersion}}', (await commitInfo.getNextPlannedVersion()).versionString); changelog = changelog.replaceAll('{{nextVersionScope}}', `${await answerBucket.getAnswerFor('commitType')}(${await answerBucket.getAnswerFor('commitScope')})`); changelog = changelog.replaceAll('{{nextVersionMessage}}', nextCommitObject.recommendedNextVersionMessage); - changelog = changelog.replaceAll('{{nextVersionDetails}}', '- ' + nextCommitObject.recommendedNextVersionDetails.join('\n- ')); + if (nextCommitObject.recommendedNextVersionDetails?.length > 0) { + changelog = changelog.replaceAll('{{nextVersionDetails}}', '- ' + nextCommitObject.recommendedNextVersionDetails.join('\n- ')); + } else { + changelog = changelog.replaceAll('\n\n{{nextVersionDetails}}', ''); + } await plugins.smartfile.memory.toFs(changelog, plugins.path.join(paths.cwd, `changelog.md`));