当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript conventional-changelog.default函数代码示例

本文整理汇总了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);
}
开发者ID:dahang,项目名称:angular-cli,代码行数:13,代码来源:changelog.ts

示例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());
    });
  });
}
开发者ID:Nodarii,项目名称:material2,代码行数:27,代码来源:changelog.ts


注:本文中的conventional-changelog.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。