Skip to content

Commit

Permalink
feat(chore): new changelog wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lubber-de committed Jan 30, 2025
1 parent 61ae439 commit 7bb85dc
Showing 1 changed file with 47 additions and 48 deletions.
95 changes: 47 additions & 48 deletions changelog-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,59 +43,58 @@ module.exports = function (Handlebars) {
});


Handlebars.registerHelper('commit-list-dependencies', function (context, options) {
Handlebars.registerHelper('commit-list-heading-only', (context, options) => {
const { exclude, message, subject, heading } = options.hash;
let changelogDeps = {};
Handlebars.registerHelper('commit-list-heading-only', (context, options) => {
const { exclude, message, subject, heading } = options.hash;
let changelogDeps = {};

if (!context || context.length === 0 || !heading) {
return '';
}
if (!context || context.length === 0 || !heading) {
return '';
}

const list = context
.filter(item => {
const commit = item.commit || item;
if (exclude) {
const pattern = new RegExp(exclude, 'm')
if (pattern.test(commit.message)) {
return false;
}
}
if (message) {
const pattern = new RegExp(message, 'm');
return pattern.test(commit.message);
}
if (subject) {
const pattern = new RegExp(subject);
return pattern.test(commit.subject);
}
return true;
}) /*
.map(item => {
let subjectDetails = item.subject.match(/build\(deps.*\): bump (.*) from.*to (.*)/),
depPackage = subjectDetails[1],
depVersion = subjectDetails[2],
existingVersion = changelogDeps[depPackage] || '0.0.0',
returnValue = 'abc '
;
if (semver.gt(depVersion, existingVersion)) {
changelogDeps[depPackage] = existingVersion;
returnValue = depPackage + ' to ' + depPackage;
const list = context
.filter(item => {
const commit = item.commit || item;
if (exclude) {
const pattern = new RegExp(exclude, 'm')
if (pattern.test(commit.message)) {
return false;
}
})*/
.map(item => options.fn(item))
.join('')
;
}
if (message) {
const pattern = new RegExp(message, 'm');
return pattern.test(commit.message);
}
if (subject) {
const pattern = new RegExp(subject);
return pattern.test(commit.subject);
}
return true;
}) /*
.map(item => {
let subjectDetails = item.subject.match(/build\(deps.*\): bump (.*) from.*to (.*)/),
depPackage = subjectDetails[1],
depVersion = subjectDetails[2],
existingVersion = changelogDeps[depPackage] || '0.0.0',
returnValue = 'abc '
;
if (semver.gt(depVersion, existingVersion)) {
changelogDeps[depPackage] = existingVersion;
returnValue = depPackage + ' to ' + depPackage;
}
})*/
.map(item => options.fn(item))
.join('')
;

if (!list) {
return '';
}
if (!list) {
return '';
}

if (!heading) {
return list;
}
if (!heading) {
return list;
}

return `${heading}\n\n${list}`;
return `${heading}\n\n${list}`;

//build\(deps.*\): bump (.*) from.*to (.*)

Expand All @@ -112,4 +111,4 @@ module.exports = function (Handlebars) {
}
return returnValue;
})
}
};

0 comments on commit 7bb85dc

Please sign in to comment.