github-changes
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -72,2 +72,12 @@ #!/usr/bin/env node | ||
}) | ||
.option('title', { | ||
abbr: 't' | ||
, help: 'title to appear in the top of the changelog' | ||
, default: 'Change Log' | ||
}) | ||
.option('date-format', { | ||
abbr: 'm' | ||
, help: 'date format' | ||
, default: '(YYYY/MM/DD HH:mm Z)' | ||
}) | ||
.option('verbose', { | ||
@@ -110,2 +120,6 @@ abbr: 'v' | ||
}) | ||
.option('reverse-changes', { | ||
help: 'reverse the order of changes within a release (show oldest first)' | ||
, flag: true | ||
}) | ||
// TODO | ||
@@ -138,4 +152,2 @@ // .option('template', { | ||
configName : 'changelog' | ||
, note: 'github-changes-1234' | ||
, userAgent: 'github-changes-1234' | ||
, scopes : ['user', 'public_repo', 'repo'] | ||
@@ -236,2 +248,3 @@ }; | ||
var getAllCommits = function() { | ||
var progress = 0; | ||
opts.verbose && console.log('fetching commits'); | ||
@@ -249,2 +262,5 @@ return new Promise(function(resolve, reject){ | ||
}).on('data', function(data){ | ||
if (++progress % 100 == 0) { | ||
opts.verbose && console.log('fetched %d commits', progress) | ||
} | ||
commitsBySha[data.sha] = data; | ||
@@ -282,3 +298,3 @@ commits = commits.concat(data); | ||
var currentTagName = ''; | ||
var output = "## Change Log\n"; | ||
var output = "## " + opts.title + "\n"; | ||
data.forEach(function(pr){ | ||
@@ -292,3 +308,3 @@ if (pr.tag === null) { | ||
output+= "\n### " + pr.tag.name | ||
output+= " (" + pr.tag.date.utc().format("YYYY/MM/DD HH:mm Z") + ")"; | ||
output+= " " + pr.tag.date.utc().format(opts['date-format']); | ||
output+= "\n"; | ||
@@ -301,3 +317,3 @@ } | ||
// output += " " + moment(pr.merged_at).utc().format("YYYY/MM/DD HH:mm Z"); | ||
// output += " " + moment(pr.merged_at).utc().format(opts['date-format']); | ||
output += "\n"; | ||
@@ -339,3 +355,3 @@ }); | ||
var currentTagName = ''; | ||
var output = "## Change Log\n"; | ||
var output = "## " + opts.title + "\n"; | ||
data.forEach(function(commit){ | ||
@@ -367,3 +383,3 @@ var isMerge = (commit.parents.length > 1); | ||
output+= "\n### " + commit.tag.name | ||
output+= " (" + commit.tag.date.utc().format("YYYY/MM/DD HH:mm Z") + ")"; | ||
output+= " " + commit.tag.date.utc().format(opts['date-format']); | ||
output+= "\n"; | ||
@@ -412,3 +428,3 @@ } | ||
// output += " " + moment(commit.commit.committer.date).utc().format("YYYY/MM/DD HH:mm Z"); | ||
// output += " " + moment(commit.commit.committer.date).utc().format(opts['date-format']); | ||
output += "\n"; | ||
@@ -454,7 +470,10 @@ }); | ||
.then(function(data){ | ||
// order by tag date then commit date DESC | ||
// order by commit date DESC by default / ASC if --reverse-changes given | ||
var compareSign = (opts['reverse-changes']) ? -1 : 1; | ||
// order by tag date then commit date | ||
if (!opts['order-semver'] && opts.data === 'commits') { | ||
data = data.sort(function(a,b){ | ||
var tagCompare = (a.tagDate - b.tagDate); | ||
return (tagCompare) ? tagCompare : (moment(b.commit.committer.date) - moment(a.commit.committer.date)); | ||
return (tagCompare) ? tagCompare : compareSign * (moment(a.commit.committer.date) - moment(b.commit.committer.date)); | ||
}).reverse(); | ||
@@ -465,3 +484,3 @@ return data; | ||
var tagCompare = (a.tagDate - b.tagDate); | ||
return (tagCompare) ? tagCompare : (moment(b.merged_at) - moment(a.merged_at)); | ||
return (tagCompare) ? tagCompare : compareSign * (moment(a.merged_at) - moment(b.merged_at)); | ||
}).reverse(); | ||
@@ -471,3 +490,3 @@ return data; | ||
// order by semver then commit date DESC | ||
// order by semver then commit date | ||
data = data.sort(function(a,b){ | ||
@@ -479,3 +498,3 @@ var tagCompare = 0; | ||
else tagCompare = semver.compare(a.tag.name, b.tag.name); | ||
return (tagCompare) ? tagCompare : (moment(b.commit.committer.date) - moment(a.commit.committer.date)); | ||
return (tagCompare) ? tagCompare : compareSign * (moment(a.commit.committer.date) - moment(b.commit.committer.date)); | ||
}).reverse(); | ||
@@ -482,0 +501,0 @@ return data; |
## Change Log | ||
### v0.0.13 (2014/10/26 23:34 +00:00) | ||
### v0.0.14 (2014/11/06 02:45 +00:00) | ||
- [#45](https://github.com/lalitkapoor/github-changes/pull/45) Add option to allow specifying the changelog title (@fixe) | ||
- [#46](https://github.com/lalitkapoor/github-changes/pull/46) Add option to allow specifying the date format (@fixe) | ||
- [#41](https://github.com/lalitkapoor/github-changes/pull/41) Aesthetic fixes (@nylen) | ||
### v0.0.13 (2014/10/26 23:25 +00:00) | ||
- [#42](https://github.com/lalitkapoor/github-changes/pull/42) Fetch 100 tags per page (only 1 page for now) (@nylen) | ||
@@ -5,0 +10,0 @@ |
{ | ||
"name": "github-changes", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "generate changelog for github repos", | ||
@@ -5,0 +5,0 @@ "main": "./bin/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28250
468