@lmc-eu/conventional-changelog-lmc-bitbucket
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "@lmc-eu/conventional-changelog-lmc-bitbucket", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "conventional-changelog LMC preset for BitBucket", | ||
@@ -15,2 +15,5 @@ "keywords": [ | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://jira.int.lmc.cz/browse" | ||
}, | ||
"files": [ | ||
@@ -20,2 +23,5 @@ "src" | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
@@ -25,2 +31,15 @@ "compare-func": "^2.0.0", | ||
}, | ||
"devDependencies": { | ||
"better-than-before": "^1.0.0", | ||
"conventional-changelog-core": "^4.2.0", | ||
"git-dummy-commit": "^1.3.0", | ||
"jest": "^26.4.2", | ||
"jest-extended": "^0.11.5", | ||
"shelljs": "^0.8.4", | ||
"through2": "^4.0.2" | ||
}, | ||
"jest": { | ||
"setupFilesAfterEnv": ["jest-extended"], | ||
"testTimeout": 30000 | ||
}, | ||
"engines": { | ||
@@ -27,0 +46,0 @@ "node": ">=4.x" |
@@ -9,2 +9,3 @@ const compareFunc = require('compare-func'); | ||
headerCorrespondence: ['body', 'type', 'scope', 'subject'], | ||
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'], | ||
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./, | ||
@@ -15,5 +16,11 @@ revertCorrespondence: ['header', 'hash'], | ||
const writerOpts = { | ||
transform: commit => { | ||
const discard = true; | ||
transform: (commit, context) => { | ||
let discard = true; | ||
const issues = []; | ||
commit.notes.forEach(function(note) { | ||
note.title = 'BREAKING CHANGES'; | ||
discard = false; | ||
}); | ||
const transformedCommit = commit; | ||
@@ -55,2 +62,12 @@ | ||
const issueUrl = context.packageData.bugs && context.packageData.bugs.url; | ||
if (typeof transformedCommit.subject === 'string') { | ||
transformedCommit.subject = transformedCommit.subject.replace(/#([a-zA-Z0-9\-]+)/g, function(_, issue) { | ||
issues.push(issue); | ||
return formatIssue(issueUrl, issue); | ||
}); | ||
} | ||
// remove references that already appear in the subject | ||
@@ -63,3 +80,3 @@ transformedCommit.references = commit.references.filter(reference => { | ||
return false; | ||
}); | ||
}).map((reference) => formatIssue(issueUrl, reference.issue)).join(', '); | ||
@@ -91,1 +108,15 @@ return transformedCommit; | ||
}); | ||
/** | ||
* Formats issues using the issueURL as the prefix of the complete issue URL | ||
* @param {string} issueUrl - if the issueURL is falsy, then the issue will be printed as-is. Otherwise, it will be printed as a link | ||
* @param {string} issue - the issue reference (without the # in-front of it) | ||
* @return {string} - Either the issue or a Markdown-formatted link to the issue. | ||
*/ | ||
function formatIssue(issueUrl, issue) { | ||
if (issueUrl) { | ||
return '[#' + issue + '](' + issueUrl + '/' + issue + ')'; | ||
} else { | ||
return '#' + issue; | ||
} | ||
} |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
7578
101
7