Skip to content

Commit

Permalink
feat(adapter): Split breaking changes into separate question (#44)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Breaking changes now automatically include the "BREAKING CHANGE: " prefix.

closes #17
  • Loading branch information
markdalgleish authored and jimthedev committed Feb 21, 2017
1 parent 042eadc commit 2d78e1d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions engine.js
Expand Up @@ -5,6 +5,12 @@ var map = require('lodash.map');
var longest = require('longest');
var rightPad = require('right-pad');

var filter = function(array) {
return array.filter(function(x) {
return x;
});
};

// This can be any kind of SystemJS compatible module.
// We use Commonjs here, but ES6 or AMD would do just
// fine.
Expand Down Expand Up @@ -62,8 +68,12 @@ module.exports = function (options) {
message: 'Provide a longer description of the change:\n'
}, {
type: 'input',
name: 'footer',
message: 'List any breaking changes or issues closed by this change:\n'
name: 'breaking',
message: 'List any breaking changes:\n'
}, {
type: 'input',
name: 'issues',
message: 'List any issues closed by this change:\n'
}
]).then(function(answers) {

Expand All @@ -85,7 +95,15 @@ module.exports = function (options) {

// Wrap these lines at 100 characters
var body = wrap(answers.body, wrapOptions);
var footer = wrap(answers.footer, wrapOptions);

// Apply breaking change prefix, removing it if already present
var breaking = answers.breaking.trim();
breaking = breaking ? 'BREAKING CHANGE: ' + breaking.replace(/^BREAKING CHANGE: /, '') : '';
breaking = wrap(breaking, wrapOptions);

var issues = wrap(answers.issues, wrapOptions);

var footer = filter([ breaking, issues ]).join('\n\n');

commit(head + '\n\n' + body + '\n\n' + footer);
});
Expand Down

0 comments on commit 2d78e1d

Please sign in to comment.