diff --git a/README.md b/README.md index a509f93..b745199 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ Suitable for large teams working with multiple projects with their own commit sc * Run `cp ./node_modules/cz-customizable/cz-config-EXAMPLE.js ./.cz-config.js` in a project root directory to get a template. -**Notes:** -* you should commit your `.cz-config.js` file to your git. +**Notes:** +* you should commit your `.cz-config.js` file to your git. * if you don't provide a config file, this adapter will use the contents of the default file `node_modules/cz-customizable/cz-config-EXAMPLE.js` @@ -41,7 +41,7 @@ Hopefully this will help you to have consistent commit messages and have a fully Here are the options you can set in your `.cz-config.js`: * scopes: {Array of Strings}: Specify the scopes for your particular project. Eg.: for some banking system: ["acccounts", "payments"]. For another travelling application: ["bookings", "search", "profile"] -* scopeOverrides: {Object where key contains a Array of String}: Use this when you want to override scopes for a specific commit type. Example bellow specify scopes when type is `fix`: +* scopeOverrides: {Object where key contains a Array of String}: Use this when you want to override scopes for a specific commit type. Example bellow specify scopes when type is `fix`: ``` scopeOverrides: { fix: [ @@ -87,4 +87,5 @@ Please refer to the [Contributor Guidelines](https://github.com/angular/angular. + Leonardo Correa diff --git a/index.js b/index.js index af2b1dc..f9f1a0d 100644 --- a/index.js +++ b/index.js @@ -77,7 +77,7 @@ function buildCommit(answers) { result += '\n\n' + 'BREAKING CHANGE:\n' + breaking; } if (footer) { - result += '\n\n' + footer; + result += '\n\nISSUES CLOSED: ' + footer; } return escapeSpecialChars(result); @@ -99,13 +99,13 @@ module.exports = { { type: 'list', name: 'type', - message: '\nSelect the type of change that you\'re committing:', + message: 'Select the type of change that you\'re committing:', choices: config.types }, { type: 'list', name: 'scope', - message: '\nDenote the SCOPE of this change (optional):\n', + message: '\nDenote the SCOPE of this change (optional):', choices: function(answers) { var scopes = []; if (config.scopeOverrides[answers.type]) { @@ -140,7 +140,7 @@ module.exports = { { type: 'input', name: 'scope', - message: '\nDenote the SCOPE of this change:\n', + message: 'Denote the SCOPE of this change:', when: function(answers) { return answers.scope === 'custom'; } @@ -148,7 +148,7 @@ module.exports = { { type: 'input', name: 'subject', - message: '\nWrite a SHORT, IMPERATIVE tense description of the change:\n', + message: 'Write a SHORT, IMPERATIVE tense description of the change:\n', validate: function(value) { return !!value; }, @@ -159,12 +159,12 @@ module.exports = { { type: 'input', name: 'body', - message: '\nProvide a LONGER description of the change (optional). Use "|" to break new line:\n' + message: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n' }, { type: 'input', name: 'breaking', - message: '\nList any BREAKING CHANGES (optional):\n', + message: 'List any BREAKING CHANGES (optional):\n', when: function(answers) { if (config.allowBreakingChanges) { return config.allowBreakingChanges.indexOf(answers.type.toLowerCase()) >= 0; @@ -176,7 +176,7 @@ module.exports = { { type: 'input', name: 'footer', - message: '\nList any ISSUES CLOSED by this change (optional):\n', + message: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n', when: isNotWip }, { diff --git a/spec/czCustomizableSpec.js b/spec/czCustomizableSpec.js index e28d98b..a7b7ca9 100644 --- a/spec/czCustomizableSpec.js +++ b/spec/czCustomizableSpec.js @@ -133,7 +133,7 @@ describe('cz-customizable', function() { }; commitAnswers(answers); - expect(commit).toHaveBeenCalledWith('feat(myScope): create a new cool feature\n\n-line1\n-line2\n\nBREAKING CHANGE:\nbreaking\n\nmy footer'); + expect(commit).toHaveBeenCalledWith('feat(myScope): create a new cool feature\n\n-line1\n-line2\n\nBREAKING CHANGE:\nbreaking\n\nISSUES CLOSED: my footer'); }); it('should call commit() function with commit message with the minimal required fields', function() { @@ -207,13 +207,16 @@ describe('cz-customizable', function() { var chars_100 = '0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789'; + // this string will be prepend: "ISSUES CLOSED: " = 15 chars + var footerChars_100 = '0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-0123456789-012345'; + var answers = { confirmCommit: 'yes', type: 'feat', scope: 'myScope', subject: chars_100, body: chars_100 + ' body-second-line', - footer: chars_100 + ' footer-second-line' + footer: footerChars_100 + ' footer-second-line' }; commitAnswers(answers); @@ -229,7 +232,7 @@ describe('cz-customizable', function() { //it should wrap footer var footer = commit.mostRecentCall.args[0].split('\n\n')[2]; - expect(footer).toEqual(chars_100 + '\nfooter-second-line'); + expect(footer).toEqual('ISSUES CLOSED: ' + footerChars_100 + '\nfooter-second-line'); });