Skip to content

feat(adapter): Split breaking changes into separate question #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions engine.js
Original file line number Diff line number Diff line change
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: /, '') : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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