本文整理汇总了TypeScript中conventional-changelog.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: changelog
export default function changelog(args: string[], _opts: any, logger: Logger): void {
if (args.length == 0) {
logger.fatal('publish changelog <start-tag>');
return;
}
cl(config, null, {from: args[0]})
.on('error', function (err: Error) {
logger.error('Failed to generate changelog: ' + err);
})
.pipe(changelogStream)
.on('close', prependDelta);
}
示例2: Promise
export async function prependChangelogFromLatestTag(changelogPath: string, releaseName: string) {
const outputStream: Readable = conventionalChangelog(
/* core options */ {preset: 'angular'},
/* context options */ {title: releaseName},
/* raw-commits options */ null,
/* commit parser options */ null,
/* writer options */ createChangelogWriterOptions(changelogPath));
// Stream for reading the existing changelog. This is necessary because we want to
// actually prepend the new changelog to the existing one.
const previousChangelogStream = createReadStream(changelogPath);
return new Promise((resolve, reject) => {
// Sequentially merge the changelog output and the previous changelog stream, so that
// the new changelog section comes before the existing versions. Afterwards, pipe into the
// changelog file, so that the changes are reflected on file system.
const mergedCompleteChangelog = merge2(outputStream, previousChangelogStream);
// Wait for the previous changelog to be completely read because otherwise we would
// read and write from the same source which causes the content to be thrown off.
previousChangelogStream.on('end', () => {
mergedCompleteChangelog.pipe(createWriteStream(changelogPath))
.once('error', (error: any) => reject(error))
.once('finish', () => resolve());
});
});
}