cz-conventional-changelog 3.1.0 → 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/.travis.yml CHANGED
@@ -17,3 +17,4 @@ jobs:
17
17
  branches:
18
18
  only:
19
19
  - master
20
+ - /^greenkeeper/.*$/
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # cz-conventional-changelog
2
2
 
3
+ [![Greenkeeper badge](https://badges.greenkeeper.io/commitizen/cz-conventional-changelog.svg)](https://greenkeeper.io/)
4
+
3
5
  Status:
4
6
  [![npm version](https://img.shields.io/npm/v/cz-conventional-changelog.svg?style=flat-square)](https://www.npmjs.org/package/cz-conventional-changelog)
5
7
  [![npm downloads](https://img.shields.io/npm/dm/cz-conventional-changelog.svg?style=flat-square)](http://npm-stat.com/charts.html?package=cz-conventional-changelog&from=2015-08-01)
@@ -17,25 +19,36 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
17
19
  {
18
20
  // ... default values
19
21
  "config": {
20
- "commitizen": {
22
+ "commitizen": {
21
23
  "path": "./node_modules/cz-conventional-changelog",
24
+ "disableScopeLowerCase": false,
25
+ "disableSubjectLowerCase": false,
22
26
  "maxHeaderWidth": 100,
23
27
  "maxLineWidth": 100,
24
28
  "defaultType": "",
25
- "defaultScope": "",
29
+ "defaultScope": "",
26
30
  "defaultSubject": "",
27
31
  "defaultBody": "",
28
- "defaultIssues": ""
32
+ "defaultIssues": "",
33
+ "types": {
34
+ ...
35
+ "feat": {
36
+ "description": "A new feature",
37
+ "title": "Features"
38
+ },
39
+ ...
40
+ }
29
41
  }
30
42
  }
31
- // ...
43
+ // ...
32
44
  }
33
- ```
45
+ ```
46
+
34
47
  ### Environment variables
35
48
 
36
49
  The following environment varibles can be used to override any default configuration or package.json based configuration.
37
50
 
38
- * CZ_TYPE = defaultType
51
+ * CZ_TYPE = defaultType
39
52
  * CZ_SCOPE = defaultScope
40
53
  * CZ_SUBJECT = defaultSubject
41
54
  * CZ_BODY = defaultBody
@@ -45,4 +58,3 @@ The following environment varibles can be used to override any default configura
45
58
  ### Commitlint
46
59
 
47
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.
48
-
package/engine.js CHANGED
@@ -3,7 +3,6 @@
3
3
  var wrap = require('word-wrap');
4
4
  var map = require('lodash.map');
5
5
  var longest = require('longest');
6
- var rightPad = require('right-pad');
7
6
  var chalk = require('chalk');
8
7
 
9
8
  var filter = function(array) {
@@ -22,9 +21,9 @@ var maxSummaryLength = function(options, answers) {
22
21
  return options.maxHeaderWidth - headerLength(answers);
23
22
  };
24
23
 
25
- var filterSubject = function(subject) {
24
+ var filterSubject = function(subject, disableSubjectLowerCase) {
26
25
  subject = subject.trim();
27
- if (subject.charAt(0).toLowerCase() !== subject.charAt(0)) {
26
+ if (!disableSubjectLowerCase && subject.charAt(0).toLowerCase() !== subject.charAt(0)) {
28
27
  subject =
29
28
  subject.charAt(0).toLowerCase() + subject.slice(1, subject.length);
30
29
  }
@@ -43,7 +42,7 @@ module.exports = function(options) {
43
42
  var length = longest(Object.keys(types)).length + 1;
44
43
  var choices = map(types, function(type, key) {
45
44
  return {
46
- name: rightPad(key + ':', length) + ' ' + type.description,
45
+ name: (key + ':').padEnd(length) + ' ' + type.description,
47
46
  value: key
48
47
  };
49
48
  });
@@ -100,7 +99,7 @@ module.exports = function(options) {
100
99
  },
101
100
  default: options.defaultSubject,
102
101
  validate: function(subject, answers) {
103
- var filteredSubject = filterSubject(subject);
102
+ var filteredSubject = filterSubject(subject, options.disableSubjectLowerCase);
104
103
  return filteredSubject.length == 0
105
104
  ? 'subject is required'
106
105
  : filteredSubject.length <= maxSummaryLength(options, answers)
@@ -112,7 +111,7 @@ module.exports = function(options) {
112
111
  ' characters.';
113
112
  },
114
113
  transformer: function(subject, answers) {
115
- var filteredSubject = filterSubject(subject);
114
+ var filteredSubject = filterSubject(subject, options.disableSubjectLowerCase);
116
115
  var color =
117
116
  filteredSubject.length <= maxSummaryLength(options, answers)
118
117
  ? chalk.green
@@ -120,7 +119,7 @@ module.exports = function(options) {
120
119
  return color('(' + filteredSubject.length + ') ' + subject);
121
120
  },
122
121
  filter: function(subject) {
123
- return filterSubject(subject);
122
+ return filterSubject(subject, options.disableSubjectLowerCase);
124
123
  }
125
124
  },
126
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
@@ -4,9 +4,9 @@ var engine = require('./engine');
4
4
  var conventionalCommitTypes = require('conventional-commit-types');
5
5
  var configLoader = require('commitizen').configLoader;
6
6
 
7
- var config = configLoader.load();
7
+ var config = configLoader.load() || {};
8
8
  var options = {
9
- types: conventionalCommitTypes.types,
9
+ types: config.types || conventionalCommitTypes.types,
10
10
  defaultType: process.env.CZ_TYPE || config.defaultType,
11
11
  defaultScope: process.env.CZ_SCOPE || config.defaultScope,
12
12
  defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,
@@ -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.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Commitizen adapter following the conventional-changelog format.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,6 @@
26
26
  "conventional-commit-types": "^3.0.0",
27
27
  "lodash.map": "^4.5.1",
28
28
  "longest": "^2.0.1",
29
- "right-pad": "^1.0.1",
30
29
  "word-wrap": "^1.0.3"
31
30
  },
32
31
  "devDependencies": {
package/renovate.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ],
5
+ "packageRules": [
6
+ {
7
+ "updateTypes": ["major"]
8
+ }
9
+ ],
10
+ "automerge": false,
11
+ "assigneesFromCodeOwners": true,
12
+ "assigneesSampleSize": 2,
13
+ "bumpVersion": "minor",
14
+ "commitBodyTable": true,
15
+ "rangeStrategy": "pin",
16
+ "labels": [
17
+ "maintenance", "renovate"
18
+ ]
19
+ }