changelog_output
Advanced tools
Comparing version 1.0.5 to 1.0.6
39
cli.js
@@ -99,7 +99,8 @@ #!/usr/bin/env node | ||
function getCommitsFromVersion(data) { | ||
const versionRegex = /\d.\d.\d/g | ||
const versionRegex = /\[(\d.\d.\d)\]/g | ||
const versions = data.match(versionRegex) | ||
// RegExp for \s\S needs additional slash as being stripped | ||
version = versions[0] | ||
const allCommitsRegex = RegExp(versions[0] + '([\\s\\S]*?)' + versions[1], 'gm') | ||
const version0 = versions[0].replace('[', 'v').replace(']', '') | ||
const version1 = versions[1].replace('[', 'v').replace(']', '') | ||
const allCommitsRegex = RegExp(version0 + '([\\s\\S]*?)' + version1, 'gm') | ||
const allCommits = data.match(allCommitsRegex) | ||
@@ -110,21 +111,19 @@ const commitRegex = /\*\*([\s\S]*?)\n/g | ||
for (let i = 0; i < allCommits.length; i++) { | ||
const match = allCommits[i].match(commitRegex) | ||
const match = allCommits[0].match(commitRegex) | ||
if (match && match.length > 0) { | ||
for (let m = 0; m < match.length; m++) { | ||
const issue = match[m] | ||
currentCharCount = currentCharCount + issue.length | ||
if (match && match.length > 0) { | ||
for (let m = 0; m < match.length; m++) { | ||
const issue = match[m] | ||
currentCharCount = currentCharCount + issue.length | ||
if (currentCharCount > slackCharSafeLimit) { | ||
++issueCount | ||
currentCharCount = 0 | ||
} | ||
if (issues[issueCount]) { | ||
issues[issueCount].push(issue) | ||
} else { | ||
issues.push([]) | ||
issues[issueCount].push(issue) | ||
} | ||
if (currentCharCount > slackCharSafeLimit) { | ||
++issueCount | ||
currentCharCount = 0 | ||
} | ||
if (issues[issueCount]) { | ||
issues[issueCount].push(issue) | ||
} else { | ||
issues.push([]) | ||
issues[issueCount].push(issue) | ||
} | ||
} | ||
@@ -195,2 +194,4 @@ } | ||
console.warn('Output data', blocks) | ||
if (slackPath) { | ||
@@ -197,0 +198,0 @@ axios({ |
{ | ||
"name": "changelog_output", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8844