Skip to content

Generate root changelog in fixed mode - #1078

Merged
evocateur merged 2 commits into
lerna:masterfrom
ZauberNerd:root-changelog-fixed-mode
Oct 27, 2017
Merged

evocateur merged 2 commits into
lerna:masterfrom
ZauberNerd:root-changelog-fixed-mode

Conversation

@ZauberNerd

Copy link
Copy Markdown
Contributor

Description

The integration of conventional-changelog into lerna (via the --conventional-commits flag) currently generates one CHANGELOG.md file per package.

This is fine as long as lerna is configured in "independent mode", but when using lerna in "fixed mode" it might be desirable to additionally generate a consolidated CHANGELOG.md in the root directory of the repository.
This "root changelog" contains changes for all packages, while the per package changelogs only list changes affecting their package.

Motivation and Context

Based on the discussion in #1015

How Has This Been Tested?

  • Added unit tests for changelog generation
  • Updated unit tests for publish command
  • locally tested this in a repository
  • updated integration tests, activated them, compared snapshots and deactivated them
    • they were deactivated before, because the changelog contains dates and commit sha ids that are not stable across multiple runs. I therefore deactivated these tests again until a viable solution can be found (maybe a custom snapshot serializer to modify the files beforehand and remove all unstable values from it).

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.

When using lerna in fixed mode it would be desireable to have lerna
generate a consolidated changelog.md file in the root directory that
contains changes for all packages.

This commit adds said feature, so that, when executing
`lerna publish --conventional-commits` it will generate one changelog
per package and also one consolidated changelog in the root of the
repository.
The changelog generation in independent mode stays the same (it
generates one changelog per package).

Fixes: lerna#1015
@ZauberNerd
ZauberNerd force-pushed the root-changelog-fixed-mode branch from fc92b83 to e7c880a Compare October 16, 2017 22:16

@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.

Thanks @ZauberNerd!

const args = [
CHANGELOG_CLI,
"-p", "angular",
"--context", path.resolve(__dirname, "..", "lib", "ConventionalChangelogContext.js"),

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.

Hah, awesome!

});

if (this.options.conventionalCommits) {
if (!this.repository.isIndependent()) {

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 probably would have combined this into one compound conditional (this.options.conventionalCommits && !this.repository.isIndependent()), but I am okay with this.

// TODO: make interesting git history for meaningful snapshots
test.skip("--conventional-commits", async () => {
const cwd = await initFixture("PublishCommand/independent");
// TODO: stabilize timestamp and commit sha of changelog output

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.

Thanks for the additions here, I hope we can stop skipping these tests soon...

@evocateur
evocateur merged commit 567d05c into lerna:master Oct 27, 2017
evocateur added a commit to mitchhentges/lerna that referenced this pull request Oct 27, 2017
* master:
  Generate root changelog in fixed mode (lerna#1078)
  Republish prereleased packages during subsequent non-prerelease publish (lerna#1077)
  fix: fail when --hoist and --yarn are used together (lerna#1063)
  Improve "import" edgecases + (i18n fixes + git tweaks) (lerna#1059)
  Warn about two or more packages having the same npm package.json name (lerna#1081)
@ZauberNerd
ZauberNerd deleted the root-changelog-fixed-mode branch October 28, 2017 13:23
@lock

lock Bot commented Dec 27, 2018

Copy link
Copy Markdown

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants