gulp-conventional-changelog
Version:
Generate a changelog using conventional-changelog.
128 lines (95 loc) • 3.62 kB
Markdown
> Generate a changelog using [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)
*Issues with the output should be reported on the `conventional-changelog` [issue tracker](https://github.com/conventional-changelog/conventional-changelog/issues).*
Checkout the [gulp official recipe](https://github.com/gulpjs/gulp/blob/master/docs/recipes/automate-release-workflow.md) to automate releases with gulp and gulp-conventional-changelog.
```
$ npm install --save-dev gulp-conventional-changelog
```
```js
import gulp from 'gulp';
import conventionalChangelog from 'gulp-conventional-changelog';
gulp.task('changelog', function () {
return gulp.src('CHANGELOG.md')
.pipe(conventionalChangelog({
// conventional-changelog options go here
preset: 'angular'
}, {
// context goes here
}, {
// git-raw-commits options go here
}, {
// conventional-commits-parser options go here
}, {
// conventional-changelog-writer options go here
}))
.pipe(gulp.dest('./'));
});
```
```js
gulp.task('changelog', function () {
return gulp.src('CHANGELOG.md', {
buffer: false
})
.pipe(conventionalChangelog({
preset: 'angular'
}))
.pipe(gulp.dest('./'));
});
```
```js
gulp.task('changelog', function () {
return gulp.src('CHANGELOG.md')
.pipe(conventionalChangelog({
preset: 'angular'
}))
.pipe(gulp.dest('./'));
});
```
**Note:** If your `options.releaseCount` is `0` (regenerate all changelog from previous releases) you can just use [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) directly or not to read the file at all.
```js
import gulp from 'gulp';
import conventionalChangelog from 'conventional-changelog';
import fs from 'fs';
gulp.task('default', function () {
return conventionalChangelog({
preset: 'angular',
releaseCount: 0
})
.pipe(fs.createWriteStream('CHANGELOG.md'));
});
```
Or
```js
import gulp from 'gulp';
import conventionalChangelog from 'gulp-conventional-changelog';
gulp.task('default', function () {
return gulp.src('CHANGELOG.md', {
read: false
})
.pipe(conventionalChangelog({
preset: 'angular',
releaseCount: 0
}))
.pipe(gulp.dest('./'));
});
```
See the [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) docs.
There are some changes:
If the cli contains flag `--verbose` it is `fancyLog`.
MIT © [Steve Mao](https://github.com/stevemao)
[]: https://badge.fury.io/js/gulp-conventional-changelog.svg
[]: https://npmjs.org/package/gulp-conventional-changelog
[]: https://travis-ci.org/conventional-changelog/gulp-conventional-changelog.svg?branch=master
[]: https://travis-ci.org/conventional-changelog/gulp-conventional-changelog
[]: https://david-dm.org/conventional-changelog/gulp-conventional-changelog.svg?theme=shields.io
[]: https://david-dm.org/conventional-changelog/gulp-conventional-changelog
[]: https://coveralls.io/repos/github/conventional-changelog/conventional-changelog/badge.svg?branch=master
[]: https://coveralls.io/github/conventional-changelog/conventional-changelog?branch=master