Files
redocly-cli/.changeset/format.js
2023-08-07 11:40:21 +02:00

23 lines
673 B
JavaScript

const getReleaseLine = async (changeset, _type) => {
const [firstLine, ...futureLines] = changeset.summary.split('\n').map((l) => l.trimRight());
let returnVal = `- ${firstLine}`;
if (futureLines.length > 0) {
returnVal += `\n${futureLines.map((l) => ` ${l}`).join('\n')}`;
}
return returnVal;
};
const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => {
if (dependenciesUpdated.length === 0) return '';
return `- Updated ${dependenciesUpdated[0].name} to v${dependenciesUpdated[0].newVersion}.`;
};
const defaultChangelogFunctions = {
getReleaseLine,
getDependencyReleaseLine,
};
module.exports = defaultChangelogFunctions;