Add support for root-level version lifecycle #1149
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change introduces an optional, root-level
postversion
script that can be run when publishing. This happens after all per-packagepostversion
scripts have been called.Motivation and Context
Currently,
postversion
hooks can only be run per-package. It's useful to have apostversion
hook immediately before publishing and after version bumping to rebuild or do anything else which might need to use the updated global version number. In my particular circumstance, I'm using Rollup to build all the packages at the top-level and not relying onlerna run
(for performance and memory reasons). While my circumstance is admittedly somewhat specific, the utility of adding a hook here seems pretty generalized.How Has This Been Tested?
It has been run locally within a project by running
lerna publish --skip-npm
within a project. This triggerspostversion
if it's set in the root-level package.json scripts. It has been run with and without the hook and performs as expected.Types of changes
Checklist: