cz-conventional-changelog 3.0.2 → 3.2.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
@@ -17,25 +17,33 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
17
17
  {
18
18
  // ... default values
19
19
  "config": {
20
- "commitizen": {
20
+ "commitizen": {
21
21
  "path": "./node_modules/cz-conventional-changelog",
22
22
  "maxHeaderWidth": 100,
23
23
  "maxLineWidth": 100,
24
24
  "defaultType": "",
25
- "defaultScope": "",
25
+ "defaultScope": "",
26
26
  "defaultSubject": "",
27
27
  "defaultBody": "",
28
- "defaultIssues": ""
28
+ "defaultIssues": "",
29
+ "types": {
30
+ ...
31
+ "feat": {
32
+ "description": "A new feature",
33
+ "title": "Features"
34
+ },
35
+ ...
36
+ }
29
37
  }
30
38
  }
31
- // ...
39
+ // ...
32
40
  }
33
- ```
41
+ ```
34
42
  ### Environment variables
35
43
 
36
44
  The following environment varibles can be used to override any default configuration or package.json based configuration.
37
45
 
38
- * CZ_TYPE = defaultType
46
+ * CZ_TYPE = defaultType
39
47
  * CZ_SCOPE = defaultScope
40
48
  * CZ_SUBJECT = defaultSubject
41
49
  * CZ_BODY = defaultBody
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) {
@@ -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
  });
@@ -83,7 +82,9 @@ module.exports = function(options) {
83
82
  'What is the scope of this change (e.g. component or file name): (press enter to skip)',
84
83
  default: options.defaultScope,
85
84
  filter: function(value) {
86
- return value.trim().toLowerCase();
85
+ return options.disableScopeLowerCase
86
+ ? value.trim()
87
+ : value.trim().toLowerCase();
87
88
  }
88
89
  },
89
90
  {
package/engine.test.js CHANGED
@@ -18,7 +18,6 @@ var defaultOptions = {
18
18
  var type = 'func';
19
19
  var scope = 'everything';
20
20
  var subject = 'testing123';
21
- var subject2 = 'after the fall, I was gone';
22
21
  var longBody =
23
22
  'a a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a' +
24
23
  'a a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a' +
@@ -85,6 +84,23 @@ describe('commit message', function() {
85
84
  })
86
85
  ).to.equal(`${type}(${scope}): ${subject}\n\n${body}`);
87
86
  });
87
+ it('header and body w/ uppercase scope', function() {
88
+ var upperCaseScope = scope.toLocaleUpperCase();
89
+ expect(
90
+ commitMessage(
91
+ {
92
+ type,
93
+ scope: upperCaseScope,
94
+ subject,
95
+ body
96
+ },
97
+ {
98
+ ...defaultOptions,
99
+ disableScopeLowerCase: true
100
+ }
101
+ )
102
+ ).to.equal(`${type}(${upperCaseScope}): ${subject}\n\n${body}`);
103
+ });
88
104
  it('header, body and issues w/ out scope', function() {
89
105
  expect(
90
106
  commitMessage({
@@ -298,6 +314,9 @@ describe('defaults', function() {
298
314
  )
299
315
  ).to.equal(issues);
300
316
  });
317
+ it('disableScopeLowerCase default', function() {
318
+ expect(questionDefault('disableScopeLowerCase')).to.be.undefined;
319
+ });
301
320
  });
302
321
 
303
322
  describe('prompts', function() {
package/index.js CHANGED
@@ -4,14 +4,16 @@ 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,
13
13
  defaultBody: process.env.CZ_BODY || config.defaultBody,
14
14
  defaultIssues: process.env.CZ_ISSUES || config.defaultIssues,
15
+ disableScopeLowerCase:
16
+ process.env.DISABLE_SCOPE_LOWERCASE || config.disableScopeLowerCase,
15
17
  maxHeaderWidth:
16
18
  (process.env.CZ_MAX_HEADER_WIDTH &&
17
19
  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.0.2",
3
+ "version": "3.2.0",
4
4
  "description": "Commitizen adapter following the conventional-changelog format.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,10 +23,9 @@
23
23
  "dependencies": {
24
24
  "chalk": "^2.4.1",
25
25
  "commitizen": "^4.0.3",
26
- "conventional-commit-types": "^2.0.0",
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": {