Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front-matter is removed from CHANGELOG when running commit-and-tag-version #106

Closed
TimKnight-DWP opened this issue Oct 19, 2023 · 3 comments · Fixed by #108
Closed

Front-matter is removed from CHANGELOG when running commit-and-tag-version #106

TimKnight-DWP opened this issue Oct 19, 2023 · 3 comments · Fixed by #108
Labels
bug Something isn't working

Comments

@TimKnight-DWP
Copy link

TimKnight-DWP commented Oct 19, 2023

Describe the bug
When I run npx commit-and-tag-version any front matter on my changelog is removed

My existing changelog has some front matter:

---
status: new
---

# Changelog

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [4.13.0](https://gitlab.com/.../compare/4.12.3...4.13.0) (2023-10-18)

### Features

Current behavior

# Changelog

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [4.13.2](https://gitlab.com/.../compare/4.13.0...4.13.2) (2023-10-19)

Front matter is removed

Expected behavior
Front matter should be maintained, so that we can attach fuller metadata to our changelogs

Environment

  • commit-and-tag-version version(s): Latest
  • Node/npm version: npm 18
  • OS: Mac OS

Possible Solution

I am unsure where to start looking through the code, I presume it is something in the parse/write process, where the front matter gets stripped off before or after the new commit history is added

@TimKnight-DWP TimKnight-DWP added the bug Something isn't working label Oct 19, 2023
@TimothyJones
Copy link
Member

Thanks for the report! It’s after midnight where I am, but just a quick note to say that I think the part of the code you’re looking for is in lib/lifecycles/changelog.js

@TimKnight-DWP
Copy link
Author

@TimothyJones appreciate the response! but get some sleep 😉

TimKnight-DWP added a commit to TimKnight-DWP/commit-and-tag-version that referenced this issue Oct 23, 2023
fixes absolute-version#106

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
@TimKnight-DWP
Copy link
Author

@TimothyJones PR raised, happy to squash prior to merge in #108

TimothyJones pushed a commit that referenced this issue Oct 31, 2023
* chore: add failing test for retaining frontmatter

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* fix: preserve frontmatter when updating changelog

fixes #106

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* chore: add tests for upgrade path from standard-version

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* fix: preserve front matter when swapping from standard-version

- Matches based off # Changelog title position rather than new header position

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* chore: run linting

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* chore: refactoring, extract functions

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* chore: front matter usually on separate lines to title

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

* chore: apply eslint . --fix

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>

---------

Signed-off-by: Tim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants