From 0ad1215a92e16aa36f3969e6116f68f4aa854cba Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Thu, 23 Jun 2016 16:23:15 -0700 Subject: [PATCH] build(changelog): remove old changelog script and add gulp task --- gulpfile.js | 17 ++++++++++++++++ scripts/publish/changelog.js | 39 ------------------------------------ 2 files changed, 17 insertions(+), 39 deletions(-) delete mode 100755 scripts/publish/changelog.js diff --git a/gulpfile.js b/gulpfile.js index f7ef9661b4..121c8245c6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -113,6 +113,23 @@ gulp.task('serve', () => { }); +gulp.task('changelog', () => { + const conventionalChangelog = require('gulp-conventional-changelog'); + + return gulp.src('CHANGELOG.md') + .pipe(conventionalChangelog({ + preset: 'angular', + releaseCount: 1 + }, { + // Conventional Changelog Context + // We have to manually set version number so it doesn't get prefixed with `v` + // See https://github.com/conventional-changelog/conventional-changelog-core/issues/10 + currentTag: require('./package.json').version + })) + .pipe(gulp.dest('./')); +}); + + function tsc(projectPath, done) { let child_process = require('child_process'); diff --git a/scripts/publish/changelog.js b/scripts/publish/changelog.js deleted file mode 100755 index 2118549745..0000000000 --- a/scripts/publish/changelog.js +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -/** - * Just a small command-line wrapper around the conventional-changelog npm module - * (https://www.npmjs.com/package/conventional-changelog), which also prepends - * changes to CHANGELOG.md. - * - * Appends CHANGELOG.md with the changes between tag and HEAD. - * NOTE: only `fix`, `feat`, `perf` and `revert` commits are used - * see: https://github.com/conventional-changelog/conventional-changelog/blob/v0.2.1/presets/angular.js#L24 - */ - -var fs = require('fs'); -var cl = require('conventional-changelog'); -const exec = require('child_process').exec; - -var changelogStream = fs.createWriteStream('CHANGELOG-delta.md'); - -if (process.argv.length < 3) { - console.log('Usage: ./scripts/publish/changelog.js '); - process.exit(-1); -} - -var config = { - preset: 'angular', - releaseCount: 1, -}; - -var prependDelta = function() { - exec('cat CHANGELOG-delta.md CHANGELOG.md > CHANGELOG-new.md;' + - 'mv CHANGELOG-new.md CHANGELOG.md;' + - 'rm CHANGELOG-delta.md'); -} - -cl(config, null, {from: process.argv[2]}).on('error', function(err) { - console.error('Failed to generate changelog: ' + err); - }).pipe(changelogStream).on('close', prependDelta);