Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ and then add the following to package.json:
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.

| Environment variable | package.json | Default | Description |
| -------------------- | --------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|----------------------|-----------------|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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. |
| CZ_MAX_HEADER_WIDTH | maxHeaderWidth | 72 | This limits how long a commit message head can be. |
| CZ_MIN_HEADER_WIDTH | minHeaderWidth | 2 | This limits how short a commit message can be. |
Expand All @@ -61,46 +61,47 @@ Like commitizen, you can specify the configuration of cz-conventional-changelog-
| CZ_BODY | defaultBody | undefined | A default body. |
| CZ_ISSUES | defaultIssues | undefined | A default issue. |
| CZ_JIRA_OPTIONAL | jiraOptional | false | If this is set to true, you can leave the JIRA field blank. |
| CZ_JIRA_PREFIX | jiraPrefix | "DAZ" | If this is set it will be displayed as the default JIRA ticket prefix |
| CZ_JIRA_PREFIX | jiraPrefix | "DAZ" | If this is set it will be displayed as the default JIRA ticket prefix |
| CZ_JIRA_NUMBER | jiraNumber | "12345" | If this is set it will be displayed as the default JIRA ticket number |
| CZ_JIRA_LOCATION | jiraLocation | "pre-description" | Changes position of JIRA ID. Options: `pre-type`, `pre-description`, `post-description`, `post-body` |
| CZ_JIRA_PREPEND | jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-1234` |
| CZ_JIRA_APPEND | jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-1234]` |
| CZ_JIRA_PREPEND | jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-12345` |
| CZ_JIRA_APPEND | jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-12345]` |
| 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. |

### Jira Location Options

pre-type:

```text
JIRA-1234 type(scope): commit subject
DAZ-12345 type(scope): commit subject
```

pre-description:

```text
type(scope): JIRA-1234 commit subject
type(scope): DAZ-12345 commit subject
```

post-description:

```text
type(scope): commit subject JIRA-1234
type(scope): commit subject DAZ-12345
```

post-body:

```text
type(scope): commit subject

JIRA-1234
DAZ-12345
```

```text
type(scope): commit subject

this is a commit body

JIRA-1234
DAZ-12345
```

## Dynamic Configuration
Expand Down Expand Up @@ -149,7 +150,7 @@ This example would:
List of all supported configurable options when using the _configurable_ approach:

| Key | Default | Description |
| --------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --------------- |-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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. |
| maxHeaderWidth | 72 | This limits how long a commit message head can be. |
| minHeaderWidth | 2 | This limits how short a commit message can be. |
Expand All @@ -161,13 +162,14 @@ List of all supported configurable options when using the _configurable_ approac
| defaultBody | undefined | A default body. |
| defaultIssues | undefined | A default issue. |
| jiraPrefix | 'DAZ' | The default JIRA ticket prefix that will be displayed. |
| jiraNumber | '12345' | The default JIRA ticket number that will be displayed. |
| types | ./types.js | A list (JS Object) of supported commit types. |
| 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'. |
| 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 |
| jiraOptional | false | If this is set to true, you can leave the JIRA field blank. |
| jiraLocation | "pre-description" | Changes position of JIRA ID. Options: `pre-type`, `pre-description`, `post-description`, `post-body` |
| jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-1234` |
| jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-1234]` |
| jiraPrepend | "" | Prepends JIRA ID with an optional decorator. e.g.: `[DAZ-12345` |
| jiraAppend | "" | Appends JIRA ID with an optional decorator. e.g.: `DAZ-12345]` |
| 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. |

### Commitlint
Expand Down
1 change: 1 addition & 0 deletions defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
minHeaderWidth: 2,
maxLineWidth: 100,
jiraPrefix: 'DAZ',
jiraNumber: '12345',
jiraOptional: false,
jiraLocation: 'pre-description',
jiraPrepend: '',
Expand Down
4 changes: 3 additions & 1 deletion engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ module.exports = function(options) {
message:
'Enter JIRA issue (' +
getFromOptionsOrDefaults('jiraPrefix') +
'-12345)' +
'-' +
getFromOptionsOrDefaults('jiraNumber') +
')' +
(options.jiraOptional ? ' (optional)' : '') +
':',
when: options.jiraMode,
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ const options = {
),
jiraPrefix:
process.env.CZ_JIRA_PREFIX || config.jiraPrefix || defaults.jiraPrefix,
jiraNumber:
process.env.CZ_JIRA_NUMBER || config.jiraNumber || defaults.jiraNumber,
jiraLocation:
process.env.CZ_JIRA_LOCATION ||
config.jiraLocation ||
Expand Down