cz-conventional-changelog 3.2.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,8 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
21
21
  "config": {
22
22
  "commitizen": {
23
23
  "path": "./node_modules/cz-conventional-changelog",
24
+ "disableScopeLowerCase": false,
25
+ "disableSubjectLowerCase": false,
24
26
  "maxHeaderWidth": 100,
25
27
  "maxLineWidth": 100,
26
28
  "defaultType": "",
@@ -41,6 +43,7 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
41
43
  // ...
42
44
  }
43
45
  ```
46
+
44
47
  ### Environment variables
45
48
 
46
49
  The following environment varibles can be used to override any default configuration or package.json based configuration.
@@ -55,4 +58,3 @@ The following environment varibles can be used to override any default configura
55
58
  ### Commitlint
56
59
 
57
60
  If using the [commitlint](https://github.com/conventional-changelog/commitlint) js library, the "maxHeaderWidth" configuration property will default to the configuration of the "header-max-length" rule instead of the hard coded value of 100. This can be ovewritten by setting the 'maxHeaderWidth' configuration in package.json or the CZ_MAX_HEADER_WIDTH environment variable.
58
-
package/engine.js CHANGED
@@ -21,9 +21,9 @@ var maxSummaryLength = function(options, answers) {
21
21
  return options.maxHeaderWidth - headerLength(answers);
22
22
  };
23
23
 
24
- var filterSubject = function(subject) {
24
+ var filterSubject = function(subject, disableSubjectLowerCase) {
25
25
  subject = subject.trim();
26
- if (subject.charAt(0).toLowerCase() !== subject.charAt(0)) {
26
+ if (!disableSubjectLowerCase && subject.charAt(0).toLowerCase() !== subject.charAt(0)) {
27
27
  subject =
28
28
  subject.charAt(0).toLowerCase() + subject.slice(1, subject.length);
29
29
  }
@@ -99,7 +99,7 @@ module.exports = function(options) {
99
99
  },
100
100
  default: options.defaultSubject,
101
101
  validate: function(subject, answers) {
102
- var filteredSubject = filterSubject(subject);
102
+ var filteredSubject = filterSubject(subject, options.disableSubjectLowerCase);
103
103
  return filteredSubject.length == 0
104
104
  ? 'subject is required'
105
105
  : filteredSubject.length <= maxSummaryLength(options, answers)
@@ -111,7 +111,7 @@ module.exports = function(options) {
111
111
  ' characters.';
112
112
  },
113
113
  transformer: function(subject, answers) {
114
- var filteredSubject = filterSubject(subject);
114
+ var filteredSubject = filterSubject(subject, options.disableSubjectLowerCase);
115
115
  var color =
116
116
  filteredSubject.length <= maxSummaryLength(options, answers)
117
117
  ? chalk.green
@@ -119,7 +119,7 @@ module.exports = function(options) {
119
119
  return color('(' + filteredSubject.length + ') ' + subject);
120
120
  },
121
121
  filter: function(subject) {
122
- return filterSubject(subject);
122
+ return filterSubject(subject, options.disableSubjectLowerCase);
123
123
  }
124
124
  },
125
125
  {
package/engine.test.js CHANGED
@@ -101,6 +101,23 @@ describe('commit message', function() {
101
101
  )
102
102
  ).to.equal(`${type}(${upperCaseScope}): ${subject}\n\n${body}`);
103
103
  });
104
+ it('header and body w/ uppercase subject', function() {
105
+ var upperCaseSubject = subject.toLocaleUpperCase();
106
+ expect(
107
+ commitMessage(
108
+ {
109
+ type,
110
+ scope,
111
+ subject: upperCaseSubject,
112
+ body
113
+ },
114
+ {
115
+ ...defaultOptions,
116
+ disableSubjectLowerCase: true
117
+ }
118
+ )
119
+ ).to.equal(`${type}(${scope}): ${upperCaseSubject}\n\n${body}`);
120
+ });
104
121
  it('header, body and issues w/ out scope', function() {
105
122
  expect(
106
123
  commitMessage({
@@ -317,6 +334,9 @@ describe('defaults', function() {
317
334
  it('disableScopeLowerCase default', function() {
318
335
  expect(questionDefault('disableScopeLowerCase')).to.be.undefined;
319
336
  });
337
+ it('disableSubjectLowerCase default', function() {
338
+ expect(questionDefault('disableSubjectLowerCase')).to.be.undefined;
339
+ });
320
340
  });
321
341
 
322
342
  describe('prompts', function() {
package/index.js CHANGED
@@ -14,6 +14,8 @@ var options = {
14
14
  defaultIssues: process.env.CZ_ISSUES || config.defaultIssues,
15
15
  disableScopeLowerCase:
16
16
  process.env.DISABLE_SCOPE_LOWERCASE || config.disableScopeLowerCase,
17
+ disableSubjectLowerCase:
18
+ process.env.DISABLE_SUBJECT_LOWERCASE || config.disableSubjectLowerCase,
17
19
  maxHeaderWidth:
18
20
  (process.env.CZ_MAX_HEADER_WIDTH &&
19
21
  parseInt(process.env.CZ_MAX_HEADER_WIDTH)) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cz-conventional-changelog",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "Commitizen adapter following the conventional-changelog format.",
5
5
  "main": "index.js",
6
6
  "scripts": {