diff --git a/tools/changelog.mjs b/tools/changelog.mjs index 1336934..7bcf61c 100644 --- a/tools/changelog.mjs +++ b/tools/changelog.mjs @@ -1,67 +1,8 @@ -import conventionalChangelogCore from 'conventional-changelog-core'; -import conventionalChangelogPreset from 'conventional-changelog-conventionalcommits'; +import { getChangelog } from './changelog/util.js'; import fs from 'node:fs'; -const config = conventionalChangelogPreset({ - types: [ - { - type: 'feat', - section: 'Features', - }, - { - type: 'fix', - section: 'Bug Fixes', - }, - { - type: 'perf', - section: 'Performance Improvements', - }, - { - type: 'revert', - section: 'Reverts', - }, - { - type: 'docs', - section: 'Documentation', - }, - { - type: 'style', - section: 'Styles', - }, - { - type: 'refactor', - section: 'Code Refactoring', - }, - { - type: 'test', - section: 'Tests', - }, - { - type: 'build', - section: 'Build System', - }, - { - type: 'ci', - section: 'Continuous Integration', - }, - { - type: 'chore', - section: 'Miscellaneous Chores', - }, - ], -}); - const file = process.argv[3] ? fs.createWriteStream(process.argv[3]) : process.stdout; -conventionalChangelogCore( - { - config, - releaseCount: 2, - }, - { version: process.argv[2], linkCompare: false }, - undefined, - undefined, - { headerPartial: '' }, -).pipe(file); +getChangelog().pipe(file); diff --git a/tools/changelog/util.js b/tools/changelog/util.js index 6883d54..f4ff41f 100644 --- a/tools/changelog/util.js +++ b/tools/changelog/util.js @@ -56,11 +56,11 @@ export const config = conventionalChangelogPreset({ /** * - * @param {string} version - * @param {boolean} onTag + * @param {string|undefined} version + * @param {boolean|undefined} onTag * @returns */ -export function getChangelog(version, onTag) { +export function getChangelog(version = undefined, onTag = false) { return conventionalChangelogCore( { config, diff --git a/tools/forgejo-release.js b/tools/forgejo-release.js index fe0f9bc..c67c2b8 100644 --- a/tools/forgejo-release.js +++ b/tools/forgejo-release.js @@ -68,7 +68,7 @@ class GiteaReleaseCommand extends Command { return 1; } - const stream = getChangelog(tag, true).setEncoding('utf8'); + const stream = getChangelog(undefined, false).setEncoding('utf8'); const changes = (await stream.toArray()).join(''); this.context.stdout.write(`Creating release ${tag}.\n`);