From d5edc748d295b5c4b9f41688d00bc03bde9c5654 Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Wed, 8 Jul 2015 14:55:03 -0700 Subject: [PATCH] chore(changelog): add support for to and from flags in changelog.js This commit adds support for "--to=SHA" and "--from=SHA" when running the script at scripts/publish/changelog.js to override defaults. Fixes #2913 --- scripts/publish/changelog.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/publish/changelog.js b/scripts/publish/changelog.js index 98ccafa89a..3c03123f98 100755 --- a/scripts/publish/changelog.js +++ b/scripts/publish/changelog.js @@ -2,8 +2,24 @@ '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. + * + * By default, this script will generate changes from relevant commits between the + * most recent tag and HEAD. The `from` and `to` flags may be provided to control the range of + * commits to process. + * + * Manually specify begin and end + * $ ./changelog.js --from=e987ac40343d89d47b7b6cc1c5932fd55b30e18a --to=3f7ebde037d92f8d93c6a40c0d73f840cac08287 + * Run with default (latest tag...head) + * $ ./changelog.js + */ + var fs = require('fs'); var cl = require('conventional-changelog'); +var args = require('minimist')(process.argv.slice(2)); var changelogFile = 'CHANGELOG.md'; @@ -13,6 +29,14 @@ var config = { version: require('../../package.json').version }; +if (args.from) { + config.from = args.from; +} + +if (args.to) { + config.to = args.to; +} + cl(config, function(err, log) { if (err) { console.error('Failed to generate changelog: ' + err);