Skip to content

feat(prompt): add confirmation fields + edit for clarity #58

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
merged 4 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
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
28 changes: 22 additions & 6 deletions engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,39 @@ module.exports = function (options) {
}, {
type: 'input',
name: 'scope',
message: 'Denote the scope of this change ($location, $browser, $compile, etc.):\n'
message: 'What is the scope of this change (e.g. component or file name)? (press enter to skip)\n'
}, {
type: 'input',
name: 'subject',
message: 'Write a short, imperative tense description of the change:\n'
}, {
type: 'input',
name: 'body',
message: 'Provide a longer description of the change:\n'
message: 'Provide a longer description of the change: (press enter to skip)\n'
}, {
type: 'confirm',
name: 'isBreaking',
message: 'Are there any breaking changes?',
default: false
}, {
type: 'input',
name: 'breaking',
message: 'List any breaking changes:\n'
message: 'Describe the breaking changes:\n',
when: function(answers) {
return answers.isBreaking;
}
}, {
type: 'confirm',
name: 'isIssueAffected',
message: 'Does this change affect any open issues?',
default: false
}, {
type: 'input',
name: 'issues',
message: 'List any issues closed by this change:\n'
message: 'Add issue references (e.g. "fix #123", "re #123".):\n',
when: function(answers) {
return answers.isIssueAffected;
}
}
]).then(function(answers) {

Expand All @@ -97,11 +113,11 @@ module.exports = function (options) {
var body = wrap(answers.body, wrapOptions);

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

var issues = wrap(answers.issues, wrapOptions);
var issues = answers.issues ? wrap(answers.issues, wrapOptions) : '';

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

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"commitizen": "2.9.6",
"semantic-release": "^6.3.2"
},
"czConfig": {
"path": "./"
"config": {
"commitizen" : {
"path": "./index.js"
}
}
}