本文整理汇总了TypeScript中conventional-changelog类的典型用法代码示例。如果您正苦于以下问题:TypeScript conventional-changelog类的具体用法?TypeScript conventional-changelog怎么用?TypeScript conventional-changelog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了conventional-changelog类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: task
task('release.prepareChangelog', () => {
const changelog = require('gulp-conventional-changelog');
return src(`${PROJECT_ROOT}/CHANGELOG.md`)
.pipe(changelog({
preset: 'angular'
}))
.pipe(dest(`${PROJECT_ROOT}`));
});
示例2: changelog
task('release.publishGithubRelease', (done: Function) => {
const packageJSON = require('../../../package.json');
const github = new GithubApi({
version: '3.0.0'
});
github.authenticate({
type: 'oauth',
token: process.env.GH_TOKEN
});
return changelog({
preset: 'angular'
})
.pipe(obj(function(file, enc, cb) {
github.releases.createRelease({
owner: 'ionic-team',
repo: 'ionic',
target_commitish: 'master',
tag_name: 'v' + packageJSON.version,
name: packageJSON.version,
body: file.toString(),
prerelease: false
}, done);
}));
});
示例3: async
return new Promise<string>( async( resolve: ( changelogContent: string ) => void, reject: ( error: Error ) => void ) => {
// Read in changelog template files
const changelogChunks: Array<string> = [];
// Header information
changelogChunks.push( '# Changelog\n\n' ); // Title
changelogChunks.push( `Also see the **[release page](${ repositoryUrl }/releases)**.\n` ); // Sub-title (Github-specific)
// Generate changelog
const changelogStream: stream.Readable = conventionalChangelog( { // package.json file has to be updated before
pkg: {
path: path.resolve( process.cwd(), 'package.json' )
},
preset: 'angular',
releaseCount: 0 // Regenerate the whole thing every time
}, {
linkCompare: false // We use a custom link
}, {}, {}, {
commitGroupsSort: changelogCommitGroupsSort,
commitPartial: changelogTemplates.commitTemplate,
footerPartial: changelogTemplates.footerTemplate,
headerPartial: changelogTemplates.headerTemplate,
mainTemplate: changelogTemplates.mainTemplate,
transform: changelogTransformer( repositoryUrl ) // Custom transform (shows all commit types)
} );
// Handle errors
changelogStream.on( 'error', ( error: Error ) => {
reject( new Error( `An error occured while generating the changelog. [${ error.message }]` ) );
return;
} );
// Handle incoming data
changelogStream.on( 'data', ( dataChunk: string ) => {
changelogChunks.push( dataChunk );
} );
// Handle finish
changelogStream.on( 'end', () => {
// Footer information
changelogChunks.push( '\n<br>\n\n---\n\n<sup>*Changelog generated automatically by [automatic-release](https://github.com/dominique-mueller/automatic-release).*</sup>\n' );
// Create the full changelog
const changelog: string = changelogChunks.join( '' );
resolve( changelog );
} );
} );