Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const releaseCount = options.firstRelease ? 0 : options.releaseCount;
const outputError = err => {
if (options.verbose) {
consoleError(grey(err.stack));
} else {
consoleError(error(err.toString()));
}
process.exit(1); // eslint-disable-line no-process-exit
};
const changelogStream = standardChangelog(options, undefined, {}).on(
'error',
outputError
);
standardChangelog.createIfMissing(infile);
let readStream = null;
if (releaseCount !== 0) {
readStream = fs.createReadStream(infile).on('error', outputError);
} else {
readStream = new Readable();
readStream.push(null);
}
if (options.append) {
changelogStream
.pipe(
fs.createWriteStream(options.outfile, {
flags: 'a',
})
)