Skip to content

Commit d5edc74

Browse files
committed
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 angular#2913
1 parent 718fa35 commit d5edc74

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

scripts/publish/changelog.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
'use strict';
44

5+
/**
6+
* Just a small command-line wrapper around the conventional-changelog npm module
7+
* (https://www.npmjs.com/package/conventional-changelog), which also prepends
8+
* changes to CHANGELOG.md.
9+
*
10+
* By default, this script will generate changes from relevant commits between the
11+
* most recent tag and HEAD. The `from` and `to` flags may be provided to control the range of
12+
* commits to process.
13+
*
14+
* Manually specify begin and end
15+
* $ ./changelog.js --from=e987ac40343d89d47b7b6cc1c5932fd55b30e18a --to=3f7ebde037d92f8d93c6a40c0d73f840cac08287
16+
* Run with default (latest tag...head)
17+
* $ ./changelog.js
18+
*/
19+
520
var fs = require('fs');
621
var cl = require('conventional-changelog');
22+
var args = require('minimist')(process.argv.slice(2));
723

824
var changelogFile = 'CHANGELOG.md';
925

@@ -13,6 +29,14 @@ var config = {
1329
version: require('../../package.json').version
1430
};
1531

32+
if (args.from) {
33+
config.from = args.from;
34+
}
35+
36+
if (args.to) {
37+
config.to = args.to;
38+
}
39+
1640
cl(config, function(err, log) {
1741
if (err) {
1842
console.error('Failed to generate changelog: ' + err);

0 commit comments

Comments
 (0)