Skip to content

Feat/changelog preview - #2555

Closed
rishabhgupta wants to merge 4 commits into
lerna:mainfrom
rishabhgupta:feat/changelog-preview
Closed

rishabhgupta wants to merge 4 commits into
lerna:mainfrom
rishabhgupta:feat/changelog-preview

Conversation

@rishabhgupta

Copy link
Copy Markdown

Description

Adds a way to preview and modify the generated changelog file when using conventional commits.

When the version command is run with --changelog-preview option, once the change log is written it will open in VIM where the user can preview and make changes to the log file. Once the user exists out of vim the file is committed. This will happen for every change log generated.

Motivation and Context

At times you want to preview or make changes to the generated change log. For eg:

  1. Correct a spelling or a grammatical error in a commit message.
  2. Remove certain commit messages from the log.
  3. Add additional documentation links (styleguidist or storybooks) with the change log.

ISSUE: #1094

How Has This Been Tested?

Switched to forked copy and verified the publish and version command on existing lerna repo.

My changes shouldn't be affecting any other areas than publish and version commands.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@evocateur evocateur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had envisioned this as more akin to --dry-run rather than "edit in place" for each changelog. Anything that needed to be customized later could just as easily be done in a subsequent commit, and anything worth automating should be achievable within a changelog preset.

- [`--sign-git-tag`](#--sign-git-tag)
- [`--yes`](#--yes)
- [`--tag-version-prefix`](#--tag-version-prefix)
- [`--changelog-preview`](#--changelog-preview)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and its target block) should be alphabetized after --changelog-preset.

alias: "yes",
type: "boolean",
},
"changelog-preview": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be alphabetized after the changelog-preset key (yes, behind conventional-changelog, ordering is... challenging)

// if change log preview option is passed open the file in vim before commiting
if (changelogPreview) {
return new Promise((resolve, reject) => {
const vim = spawn("vim", [changelogFileLoc], { stdio: "inherit" });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit specific, what if I don't like vim, and prefer code instead? What if my platform doesn't have vim? (i mean, yeah, "don't use --changelog-preview" is a reasonable answer to the latter question)

@evocateur

Copy link
Copy Markdown
Member

I'm not sure motivation #2 is valid, if the conventional commit addressed something, isn't removing it violating the spirit of the convention? (It's not a law, sure, and I'm not your dad, but it just feels weird to explicitly endorse by virtue of accepting this feature)

@rishabhgupta

Copy link
Copy Markdown
Author

@evocateur if we need to preview the change log, cant we just run lerna version --conventional-commits --no-git-tag-version this will show the changelog file which will be generated right? or am i missing something here?

@evocateur
evocateur changed the base branch from master to main November 8, 2020 00:40
@JamesHenry

Copy link
Copy Markdown
Member

Hi @rishabhgupta 👋

Thank you very much for taking the initiative to contribute this PR!

You may or may not know that lerna is now under the stewardship of Nrwl (announcement here #3121), a company with a long history of not just producing valuable open-source software (OSS), but also backing others (at the time of writing, Nrwl has donated over $50,000 to OSS it hasn't created, see https://opencollective.com/nx for full details).

Quite simply, Nrwl ❤️ OSS, and is committed to making lerna the best it can be. We use it ourselves.

We hope you will continue to be a part of this community as we look to take things forward from here!

Please see #3140 for more details on our plans for 2022.

In this case of this PR, because there has been no activity on it for over 2 years, we are going to close it for now. If you would like to discuss the possibility of adding new features to lerna, please kindly open a new issue (or upvote and comment on an existing one) so we can cover all the details: https://github.com/lerna/lerna/issues/new/choose

Many thanks again 🙏

@JamesHenry JamesHenry closed this Jun 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants