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

fix(run-lifecycle): lifecycle events should run to completion in series #275

Merged
merged 2 commits into from Jul 27, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Jul 26, 2022

Description

As per original Lerna PR 3262

During the difficult migration from npm-lifecycle to @npmcli/run-script (because of lack of details from npm) we missed the fact (because it is undocumented) that npm-lifecycle actually maintains a queue for lifecycle processes and so even though they are eagerly invoked they will complete in series.

This PR adds back some equivalent behavior to the new usage with @npmcli/run-script by utilizing the existing p-queue library that lerna depends upon.

It also enables a streaming/process inheritance based approach for the "let lerna publish do all the things case".

Motivation and Context

As per original Lerna PR

PS. This issue was discovered as a result of troubleshooting why it was that ionic needed to downgrade from v4 to v5 here: ionic-team/ionic-framework#25497

The reason this issue doesn't affect everyone in the same way as them is because ionic are running their whole build process via publish lifecycle scripts, instead of as a separate step before running publish (which is the more common pattern)

How Has This Been Tested?

Types of changes

  • Chore (change that has absolutely no effect on users)
  • 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 added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #275 (7abbf0e) into main (fb1852d) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
+ Coverage   93.84%   93.85%   +0.01%     
==========================================
  Files         142      142              
  Lines        4105     4110       +5     
  Branches      848      850       +2     
==========================================
+ Hits         3852     3857       +5     
  Misses        253      253              
Impacted Files Coverage Δ
packages/core/src/utils/run-lifecycle.ts 100.00% <100.00%> (ø)
packages/publish/src/lib/npm-publish.ts 100.00% <100.00%> (ø)
packages/publish/src/lib/pack-directory.ts 97.30% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb1852d...7abbf0e. Read the comment docs.

- also convert spec file to TypeScript
@ghiscoding ghiscoding merged commit 8e45a1e into main Jul 27, 2022
@ghiscoding ghiscoding deleted the bugfix/lifecycle-updates branch July 27, 2022 19:02
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.

None yet

1 participant