Skip to content

Commit adca4da

Browse files
author
Finn Winchester
committed
Add jiraNumber as optional parameter.
1 parent 413601f commit adca4da

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ and then add the following to package.json:
4444
Like commitizen, you can specify the configuration of cz-conventional-changelog-for-jira through the package.json's `config.commitizen` key, or with environment variables.
4545

4646
| Environment variable | package.json | Default | Description |
47-
| -------------------- | --------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47+
|----------------------|-----------------|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
4848
| CZ_JIRA_MODE | jiraMode | true | If this is set to true, CZ will ask for a Jira issue and put it in the commit head. If set to false CZ will ask for the issue in the end, and can be used for GitHub. |
4949
| CZ_MAX_HEADER_WIDTH | maxHeaderWidth | 72 | This limits how long a commit message head can be. |
5050
| CZ_MIN_HEADER_WIDTH | minHeaderWidth | 2 | This limits how short a commit message can be. |
@@ -61,10 +61,11 @@ Like commitizen, you can specify the configuration of cz-conventional-changelog-
6161
| CZ_BODY | defaultBody | undefined | A default body. |
6262
| CZ_ISSUES | defaultIssues | undefined | A default issue. |
6363
| CZ_JIRA_OPTIONAL | jiraOptional | false | If this is set to true, you can leave the JIRA field blank. |
64-
| CZ_JIRA_PREFIX | jiraPrefix | "DAZ" | If this is set it will be displayed as the default JIRA ticket prefix |
64+
| CZ_JIRA_PREFIX | jiraPrefix | "DAZ" | If this is set it will be displayed as the default JIRA ticket prefix |
65+
| CZ_JIRA_NUMBER | jiraNumber | "12345" | If this is set it will be displayed as the default JIRA ticket number |
6566
| CZ_JIRA_LOCATION | jiraLocation | "pre-description" | Changes position of JIRA ID. Options: `pre-type`, `pre-description`, `post-description`, `post-body` |
66-
| CZ_JIRA_PREPEND | jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-1234` |
67-
| CZ_JIRA_APPEND | jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-1234]` |
67+
| CZ_JIRA_PREPEND | jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-12345` |
68+
| CZ_JIRA_APPEND | jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-12345]` |
6869
| CZ_EXCLAMATION_MARK | exclamationMark | false | On breaking changes, adds an exclamation mark (!) after the scope, e.g.: `type(scope)!: break stuff`. When activated, reduces the effective allowed header length by 1. |
6970

7071
### Jira Location Options
@@ -149,7 +150,7 @@ This example would:
149150
List of all supported configurable options when using the _configurable_ approach:
150151

151152
| Key | Default | Description |
152-
| --------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
153+
| --------------- |-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
153154
| jiraMode | true | If this is set to true, CZ will ask for a Jira issue and put it in the commit head. If set to false CZ will ask for the issue in the end, and can be used for GitHub. |
154155
| maxHeaderWidth | 72 | This limits how long a commit message head can be. |
155156
| minHeaderWidth | 2 | This limits how short a commit message can be. |
@@ -161,6 +162,7 @@ List of all supported configurable options when using the _configurable_ approac
161162
| defaultBody | undefined | A default body. |
162163
| defaultIssues | undefined | A default issue. |
163164
| jiraPrefix | 'DAZ' | The default JIRA ticket prefix that will be displayed. |
165+
| jiraNumber | '12345' | The default JIRA number that will be displayed. |
164166
| types | ./types.js | A list (JS Object) of supported commit types. |
165167
| scopes | undefined | A list (JS Array) of scopes that will be available for selection. Note that adding this will change the scope field from Inquirer 'input' to 'list'. |
166168
| customScope | false | If this is set to true, users are given an option to provide custom scope aside the ones predefined in 'scopes' array. In this case a new option named 'custom' appears in the list and once chosen a prompt appears to provide custom scope |

defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
minHeaderWidth: 2,
1313
maxLineWidth: 100,
1414
jiraPrefix: 'DAZ',
15+
jiraNumber: '12345',
1516
jiraOptional: false,
1617
jiraLocation: 'pre-description',
1718
jiraPrepend: '',

engine.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ module.exports = function(options) {
133133
message:
134134
'Enter JIRA issue (' +
135135
getFromOptionsOrDefaults('jiraPrefix') +
136-
'-12345)' +
136+
'-' +
137+
getFromOptionsOrDefaults('jiraNumber') +
138+
')' +
137139
(options.jiraOptional ? ' (optional)' : '') +
138140
':',
139141
when: options.jiraMode,

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ const options = {
7676
),
7777
jiraPrefix:
7878
process.env.CZ_JIRA_PREFIX || config.jiraPrefix || defaults.jiraPrefix,
79+
jiraNumber:
80+
process.env.CZ_JIRA_NUMBER || config.jiraNumber || defaults.jiraNumber,
7981
jiraLocation:
8082
process.env.CZ_JIRA_LOCATION ||
8183
config.jiraLocation ||

0 commit comments

Comments
 (0)