Skip to content

Commit

Permalink
fix: support prepend changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Sep 23, 2024
1 parent b2f3138 commit 2fd5e05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions projects/release-it-config/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/* eslint-disable no-template-curly-in-string */
const rootPackage = require(require('node:path').resolve(process.cwd(), 'package.json'));
const path = require('node:path').resolve(
process.cwd(),
'node_modules/@taiga-ui/auto-changelog-config',
);

const changelog = `npx auto-changelog -c ${path}/index.json --handlebars-setup ${path}/setup.js`;
const prependEnabled = rootPackage['auto-changelog']?.prepend ?? false;
const template = rootPackage['auto-changelog']?.template ?? 'templates/changelog.hbs';
const prepend = prependEnabled ? '--prepend --starting-version v${version}' : '';

/* eslint-disable no-template-curly-in-string */
module.exports = {
git: {
addUntrackedFiles: true,
Expand All @@ -29,7 +33,7 @@ module.exports = {
'after:bump': [
'git tag v${version} > /dev/null', // for include last tag inside CHANGELOG
'echo "new version is v${version}"',
`${changelog} --template ${path}/templates/changelog.hbs -p > /dev/null`,
`${changelog} ${prepend} --template ${path}/${template} -p > /dev/null`,
'npx prettier CHANGELOG.md --write > /dev/null',
'git fetch --prune --prune-tags origin', // cleanup git workspace
'git add CHANGELOG.md',
Expand Down

0 comments on commit 2fd5e05

Please sign in to comment.