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

Changelog title #21

Closed
stalniy opened this issue May 30, 2018 · 7 comments
Closed

Changelog title #21

stalniy opened this issue May 30, 2018 · 7 comments

Comments

@stalniy
Copy link
Contributor

stalniy commented May 30, 2018

Issue:

In my Changelog.md I have title but each new version logs are just added on the top of it. Thus title moves at the middle of the file

Expected:

I'd like my title to be always on top

Possible solutions:

Check if the first line of the file starts from # and if it's, add notes under title

@pvdlg
Copy link
Member

pvdlg commented May 30, 2018

The problem is there is not really a standard to format changelogs. Detecting if the first line start with # can be very error prone if there is no title for the changelog file, the first line will be the first line of the last release, which can starts with # (or really anything as the format is completely customizable).

For info this how conventional-changelog do it: https://github.com/conventional-changelog/standard-version/blob/master/lib/lifecycles/changelog.js#L20. It's not great either as it works only for a specific title.

Ideally what we need would be:

  • A specification of changelog file format (with title, separator etc...)
  • An external project that provides an API to generate and change a changelog file

@stalniy
Copy link
Contributor Author

stalniy commented May 31, 2018

We could check that the first line starts with # (space after #) + add additional option something like hasTitle. That would be a good first step

@stalniy
Copy link
Contributor Author

stalniy commented May 31, 2018

Or option may look like this

title: { lines: 3, startsWith: #  }

Or just pass in the whole title (similar to how we can pass commit message for git plugin)

title: ‘# My Awesome title'

@stalniy
Copy link
Contributor Author

stalniy commented May 31, 2018

The plugin will look for the title at the beginning of file, basically calling content.trim().startsWith(options.title) if exists we can just slice out the title length options.title + content.slice(options.title.length)

I can work on PR if you like this

@stalniy
Copy link
Contributor Author

stalniy commented Jun 21, 2018

any updates?

@pvdlg
Copy link
Member

pvdlg commented Jun 24, 2018

Sorry for the late response. We could add the changelogTitle option as you suggested.
You would need all cases though:

  • a CHANGELOG.md exists with a title and some content
  • a CHANGELOG.md exists with a title only
  • a CHANGELOG.md exists with content but no title => Not sure what the proper way to handle that, probably add the title to the file?
  • a CHANGELOG.md doesn't exists => Creates it with the title

stalniy added a commit to stalniy/changelog that referenced this issue Jun 25, 2018
stalniy added a commit to stalniy/changelog that referenced this issue Jun 25, 2018
stalniy added a commit to stalniy/changelog that referenced this issue Jun 26, 2018
stalniy added a commit to stalniy/changelog that referenced this issue Jun 26, 2018
@pvdlg pvdlg closed this as completed in #24 Jun 26, 2018
@semantic-release-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants