conventional-changelog-conventionalcommits
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.1.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@4.0.0...conventional-changelog-conventionalcommits@4.1.0) (2019-07-29) | ||
### Bug Fixes | ||
* **preset, conventionalcommits:** Ensure proper substitutions for the conventionalcommit preset by using commit context for values where possible. ([#463](https://github.com/conventional-changelog/conventional-changelog/issues/463)) ([0b7ed0b](https://github.com/conventional-changelog/conventional-changelog/commit/0b7ed0b)) | ||
### Features | ||
* **preset, conventionalcommits:** add handling of issue prefixes ([#498](https://github.com/conventional-changelog/conventional-changelog/issues/498)) ([85c17bb](https://github.com/conventional-changelog/conventional-changelog/commit/85c17bb)) | ||
# [4.0.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-conventionalcommits@3.0.2...conventional-changelog-conventionalcommits@4.0.0) (2019-05-18) | ||
@@ -8,0 +24,0 @@ |
{ | ||
"name": "conventional-changelog-conventionalcommits", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "conventional-changelog conventionalcommits.org preset", | ||
@@ -40,3 +40,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "38f5508191f8afc1a8503d1fd24e2de6d05b8738" | ||
"gitHead": "dadbbf8b1acbe4b3a8f345633bde3f4a4ad0bea4" | ||
} |
@@ -9,19 +9,27 @@ 'use strict' | ||
/** | ||
* Handlebar partials for various property substitutions based on commit context. | ||
*/ | ||
const owner = '{{#if this.owner}}{{~this.owner}}{{else}}{{~@root.owner}}{{/if}}' | ||
const host = '{{~@root.host}}' | ||
const repository = '{{#if this.repository}}{{~this.repository}}{{else}}{{~@root.repository}}{{/if}}' | ||
module.exports = function (config) { | ||
config = defaultConfig(config) | ||
const commitUrlFormat = expandTemplate(config.commitUrlFormat, { | ||
host: '{{~@root.host}}', | ||
owner: '{{~@root.owner}}', | ||
repository: '{{~@root.repository}}' | ||
host, | ||
owner, | ||
repository | ||
}) | ||
const compareUrlFormat = expandTemplate(config.compareUrlFormat, { | ||
host: '{{~@root.host}}', | ||
owner: '{{~@root.owner}}', | ||
repository: '{{~@root.repository}}' | ||
host, | ||
owner, | ||
repository | ||
}) | ||
const issueUrlFormat = expandTemplate(config.issueUrlFormat, { | ||
host: '{{~@root.host}}', | ||
owner: '{{~@root.owner}}', | ||
repository: '{{~@root.repository}}', | ||
id: '{{this.issue}}' | ||
host, | ||
owner, | ||
repository, | ||
id: '{{this.issue}}', | ||
prefix: '{{this.prefix}}' | ||
}) | ||
@@ -89,4 +97,8 @@ | ||
// Issue URLs. | ||
commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => { | ||
issues.push(issue) | ||
config.issuePrefixes.join('|') | ||
let issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([0-9]+)' | ||
let re = new RegExp(issueRegEx, 'g') | ||
commit.subject = commit.subject.replace(re, (_, prefix, issue) => { | ||
issues.push(prefix + issue) | ||
const url = expandTemplate(config.issueUrlFormat, { | ||
@@ -96,5 +108,6 @@ host: context.host, | ||
repository: context.repository, | ||
id: issue | ||
id: issue, | ||
prefix: prefix | ||
}) | ||
return `[#${issue}](${url})` | ||
return `[${prefix}${issue}](${url})` | ||
}) | ||
@@ -121,3 +134,3 @@ // User URLs. | ||
commit.references = commit.references.filter(reference => { | ||
if (issues.indexOf(reference.issue) === -1) { | ||
if (issues.indexOf(reference.prefix + reference.issue) === -1) { | ||
return true | ||
@@ -163,2 +176,3 @@ } | ||
'{{host}}/{{user}}' | ||
config.issuePrefixes = config.issuePrefixes || ['#'] | ||
@@ -165,0 +179,0 @@ return config |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18555
249