build: fix changelog generation

This commit is contained in:
Michael Kriese 2024-11-01 16:10:12 +01:00
parent 00df9b574c
commit 9eae9d2a6e
No known key found for this signature in database
GPG key ID: F8D7748549A5986A
4 changed files with 18 additions and 12 deletions

View file

@ -1,8 +1,12 @@
import { getChangelog } from './changelog/util.js';
import fs from 'node:fs';
const file = process.argv[3]
? fs.createWriteStream(process.argv[3])
: process.stdout;
const stream = getChangelog(!!process.argv[2]).setEncoding('utf8');
getChangelog(process.argv[2], !!process.argv[2]).pipe(file);
const changes = (await stream.toArray()).join('');
if (!changes.length) {
console.error('No changelog found');
process.exit(1);
}
process.stdout.write(changes);