Skip to content

Republish prereleased packages during subsequent non-prerelease publish - #1077

Merged
evocateur merged 3 commits into
lerna:masterfrom
spudly:master
Oct 27, 2017
Merged

evocateur merged 3 commits into
lerna:masterfrom
spudly:master

Conversation

@spudly

@spudly spudly commented Oct 16, 2017 •

Copy link
Copy Markdown
Contributor

Description

When you publish with --cd-version pre-*, and then publish with --cd-version major/minor/patch, some of your packages will still have prerelease version numbers, which is not desirable.

When you're finished with all your changes, all your packages should have non-prerelease version numbers.

This change updates the code to make it release both changed and prereleased versions if the version increment is a non-prerelease increment.

Motivation and Context

Fixes #567

I manage a lerna monorepo with ~150 packages. Our current strategy for getting rid of prerelease version numbers is to run lerna publish --force-publish=*. Because of this, we often get stuck in merge hell when merging feature branches, because that updates every package's package.json file. Making this change means having conflicts in only a few package.json files instead of hundreds.

How Has This Been Tested?

Added a few unit tests and verified that they passed without breaking other unit tests.

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.

@spudly

spudly commented Oct 16, 2017

Copy link
Copy Markdown
Contributor Author

I'll add another commit to update the docs in a few...

@spudly

spudly commented Oct 19, 2017

Copy link
Copy Markdown
Contributor Author

Ready for review.

Also, I should note that I'm not 100% sure whether this should be a breaking change or not. For me, it feels like a new feature (sorely needed by me), but technically it is changing the default behavior, so I checked the "major" box.

@evocateur

Copy link
Copy Markdown
Member

Thanks @spudly, this looks great!

I would even argue that this is a bugfix, because this really is what we should have been doing all along. I mean, who wouldn't want this behaviour? If one uses prereleases at all, this is definitely an improvement.

@evocateur evocateur changed the title republish prereleased packages during non-prerelease version increments Republish prereleased packages during subsequent non-prerelease publish Oct 27, 2017
@evocateur
evocateur merged commit d72caa1 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)
@spudly

spudly commented Oct 28, 2017

Copy link
Copy Markdown
Contributor Author

🎉

@spudly

spudly commented Oct 31, 2017

Copy link
Copy Markdown
Contributor Author

Any plans to release a new version soon? I'd really love to start using this!

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

force publish for prereleased packages

2 participants