本文整理匯總了TypeScript中conventional-changelog.default方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript conventional-changelog.default方法的具體用法?TypeScript conventional-changelog.default怎麽用?TypeScript conventional-changelog.default使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類conventional-changelog
的用法示例。
在下文中一共展示了conventional-changelog.default方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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);
}));
});
示例2: src
task('release.prepareChangelog', () => {
const changelog = require('gulp-conventional-changelog');
return src(`${PROJECT_ROOT}/CHANGELOG.md`)
.pipe(changelog({
preset: 'angular'
}))
.pipe(dest(`${PROJECT_ROOT}`));
});
示例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 );
} );
} );