build: fix changelog generation
This commit is contained in:
parent
5cfed911ae
commit
b6f42b2f45
3 changed files with 6 additions and 65 deletions
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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`);
|
||||
|
|
Loading…
Reference in a new issue