-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
[Bug] Fix Flex not installing recipes while it is being upgraded #978
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fabpot
requested changes
May 29, 2023
Is it only for 2.x or also for 1.x? |
Also in 1.x. My mistake - I updated the branch target - thanks for catching that. |
This should be ready to go |
fabpot
approved these changes
Oct 22, 2023
fabpot
force-pushed
the
allow-recipes-on-upgrade
branch
from
October 22, 2023 17:59
5e4ad92
to
62f7874
Compare
Thank you @weaverryan. |
fabpot
added a commit
that referenced
this pull request
Oct 22, 2023
This PR was squashed before being merged into the 1.x branch. Discussion ---------- AssetMapper: upgrade packages when needed Hi! The scenario: * User installs `symfony/ux-autocomplete`. Flex adds `tom-select` at version `2.2.3` to `importmap.php` * 3 months later, user upgrades `symfony/ux-autocomplete`. The new version now requires `tom-select` at `^2.5`. If we do nothing, the user's `tom-select` is out of date and the user won't even know about it. The `^2.5` constraint is defined in the `symfony/ux-autocomplete` [package.json file](https://github.com/symfony/ux/blob/97fe2cd62e70e329b85570e0b797833882930754/src/Autocomplete/assets/package.json#L23), but nothing enforces that or notifies the user. With this small change, during a composer update/require, we look at the dependencies of all UX packages and compare them against the version in `importmap.php`. If they do not match, the package is upgraded to a version that matches. <img width="995" alt="Screenshot 2023-10-22 at 1 45 41 PM" src="https://github.com/symfony/flex/assets/121003/286e58b0-d73d-4d7a-bc19-f748b18f489b"> We're not creating a fully-fledge package management by any means, but we don't need to. With a few notifications and things like this, we can keep the user's dependencies in sync with each other. Unrelated: don't forget about that really cool other PR #978 ;) Cheers! Commits ------- 5214615 AssetMapper: upgrade packages when needed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #977
Here's the lifecycle:
A) Packages are installed/updated and
Flex::recordOperations()
is called.B) Composer sees that
symfony/flex
is updated and unloads the plugin and reloads it under a newSymfony\Flex\Flex_composer_tmp0
class. This results in theFlex::$operations
property being lost.C) And so, no recipes are installed.
This PR "stashes" the operations directly on
Symfony/Flex/Flex
where we then read them later. Tested locally. Amazing, it seems to work perfectly.Also, backports #976 to 1.x - my fault for making the PR on the wrong branch.
Cheers!