You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: implement subject feedback, scope filtering, subject filtering and config through package.json
cz-conventional-changelog can now have its values (specifically all the defaults and maxLineWidth)
through the config.commitizen key in the package.json file. The scope now automatically becomes
lowercase (as is required for conventional changelogs) and is prompted on the same line (as it is
always short and doesn't need an additional line). The subject question now indicates the total
number of characters that are allowed based upon the maxLineWidth configuration (or 100 as it is now
by default), the length of the type, and scope. Validation prevents entering more than the allowed
number of characters with feedback of the number of characters entered. Subject will always have a
lowercase first letter and strip any trailing dots (as is required by the conventional changelog
standard). 'commitizen' and 'semantic-release' have been updated to the most recent versions
(because of current vunderabilites) and the .travisci file has been updated to reflect newer node
versions.
Part of the [commitizen](https://github.com/commitizen/cz-cli) family. Prompts for [conventional changelog](https://github.com/conventional-changelog/conventional-changelog) standard.
9
+
10
+
## Configuration
11
+
12
+
Like commitizen, you specify the configuration of cz-conventional-changelog through the package.json's `config.commitizen` key.
// This can be any kind of SystemJS compatible module.
15
34
// We use Commonjs here, but ES6 or AMD would do just
16
35
// fine.
@@ -26,6 +45,7 @@ module.exports = function (options) {
26
45
};
27
46
});
28
47
48
+
29
49
return{
30
50
// When a user runs `git cz`, prompter will
31
51
// be executed. We pass you cz, which currently
@@ -39,7 +59,7 @@ module.exports = function (options) {
39
59
// By default, we'll de-indent your commit
40
60
// template and will keep empty lines.
41
61
prompter: function(cz,commit){
42
-
console.log('\nLine 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.\n');
62
+
console.log('\nLine 1 will have the maximum length of '+options.maxHeaderWidth+' characters (enforced). All other lines will be wrapped after '+options.maxLineWidth+' characters.\n');
43
63
44
64
// Let's ask some questions of the user
45
65
// so that we can populate our commit
@@ -58,13 +78,32 @@ module.exports = function (options) {
58
78
},{
59
79
type: 'input',
60
80
name: 'scope',
61
-
message: 'What is the scope of this change (e.g. component or file name)? (press enter to skip)\n',
62
-
default: options.defaultScope
81
+
message: 'What is the scope of this change (e.g. component or file name): (press enter to skip)',
82
+
default: options.defaultScope,
83
+
filter: function(value){
84
+
returnvalue.trim().toLowerCase();
85
+
}
63
86
},{
64
87
type: 'input',
65
88
name: 'subject',
66
-
message: 'Write a short, imperative tense description of the change:\n',
67
-
default: options.defaultSubject
89
+
message: function(answers){
90
+
return'Write a short, imperative tense description of the change (max '+maxSummaryLength(options,answers)+' chars):\n'
91
+
},
92
+
default: options.defaultSubject,
93
+
validate: function(subject,answers){
94
+
varfilteredSubject=filterSubject(subject)
95
+
returnfilteredSubject.length==0 ? 'Subject is required' :
'Subject length must be less than or equal to '+maxSummaryLength(options,answers)+' characters. Current length is '+filteredSubject.length+' characters.';
0 commit comments