Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* custom parser * clear logic for format, parse * rename bin scripts. `ezchangelogStream`.
- Loading branch information
Showing
13 changed files
with
283 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
git log "$@" --no-merges | ezchangelogStream | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
exports.parse = require('./lib/parse') | ||
exports.format = require('./lib/format') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var thr = require('through2') | ||
|
||
module.exports = function () { | ||
return thr.obj(function (ci, _, next) { | ||
if (ci.tag) { | ||
this.push(formatTag(ci)) | ||
} else { | ||
this.push(formatMsg(ci)) | ||
} | ||
next(null, '\n\n') | ||
}) | ||
} | ||
|
||
function formatTag(ci) { | ||
return '## ' + linkify(ci.tag, ci.url) + | ||
' (' + formatDate(ci.committer.date) + ')' | ||
} | ||
|
||
function formatMsg(ci) { | ||
return '* [ ' + formatDate(ci.committer.date) + | ||
' ' + linkify(ci.commit.short, ci.url) + ' ] ' + | ||
ci.subject.trim() + (ci.body ? '\n' + ci.body : '') | ||
} | ||
|
||
function formatDate(d) { | ||
return d.toISOString().slice(0, 10) | ||
} | ||
|
||
function linkify(text, href) { | ||
return href && '[' + text + '](' + href + ')' || text | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var split = require('split2') | ||
var combine = require('stream-combiner2') | ||
var thr = require('through2') | ||
|
||
module.exports = function (opts) { | ||
opts = opts || {} | ||
var parser = typeof opts.parser === 'function' | ||
? opts.parser | ||
: require('./parser') | ||
|
||
return combine.obj(split(), group(), parser(opts)) | ||
} | ||
|
||
function group() { | ||
var ci | ||
var COMMIT_LINE = /^commit \w{40}$/ | ||
return thr.obj(function (buf, _, next) { | ||
var line = buf.toString('utf8') | ||
if (COMMIT_LINE.test(line)) { | ||
if (ci) { | ||
this.push(ci) | ||
} | ||
ci = { raws: [ line ] } | ||
} else if (ci) { | ||
ci.raws.push(line) | ||
} | ||
next() | ||
}, function (done) { | ||
if (ci) { | ||
this.push(ci) | ||
} | ||
done() | ||
}) | ||
} |
Oops, something went wrong.