yireo / magento2-replace-bundled

Magento 2 meta-package to replace all optional third-party modules bundled with the core
44 stars 22 forks source link

Magento 2.4.0 Version contraint problem #15

Closed jruhlender closed 3 years ago

jruhlender commented 4 years ago

Module version 4.1.0 (branch: magento-2.4.1) has magento-ce dependency set to ">=2.4.1 <2.4.2". Because the module will most likely be required in projects with "^4.0" composer tries to install 4.1.0 and fails with magento 2.4.0.

Could be resolved in 2 ways:

jissereitsma commented 4 years ago

I feel really dumb by asking this. But shouldn't composer simply download the various versions of this package, see that version 4.0 is compatible with Magento 2.4.0, version 4.1 is compatible with Magento 2.4.1, and then pick 4.0 if you are running Magento 2.4.1? Assuming of course that the composer requirements for 4.0 would be >=2.4.0 <2.4.1 and the requirements for 4.1 would be >=2.4.1 <2.4.2. I feel that I'm missing some point of composer why this is failing repeatedly.

jruhlender commented 4 years ago

Composer is not that smart. If you install the package, the version in the composer.json is "^4.0". That means according to https://semver.org/ : take any version between 4.0.0 and below 5.0.0. Your 4.1.0 is in that range. The version for m2.4.1 should be 5.0.0 (major version bump) so that composer update on a m2.4.0 stays on 4.0.3 and every user has to update by hand to 5.0.0 if the magento version is updated to 2.4.1. 2nd option: if both your versions 4.0.3 and 4.1.0 could be used for m2.4.0 and m2.4.1 you just need to update the version constraint to include both magento versions at the same time in a version 4.2.0 or 4.1.1, depending if you take the change as update or bugfix.

jissereitsma commented 4 years ago

Thanks for explaining. What a lot of people seem to forget is that composer replacements are optional for composer. If you are replacing A with B but you don't even have A installed, the composer replacements will just sit there and do nothing. Because of this, I think the current release pattern of using a major 4.X is fine for the entire Magento 2.4 branch. It's just that 4.1 (which will be linked to both 2.4.0 and 2.4.1) might include additional packages that are not available in 2.4.0 - but that's fine.

Semantic versioning would say that I would need to wait with releasing an actual 4.1 release if actually new features are added. But the version of this meta-package is not meant for that: It is meant to co-relate version 4.1 to Magento version 2.4.1.

In short, I'm going to pick up on this a little bit differently: The change made earlier to the magento-2.4.0 branch is going to be rolled back to only support Magento 2.4.0 (which is identical to the current 4.0 release already made). Next, the new branch magento-2.4.1 will be modified to support both Magento 2.4.0 and 2.4.1 and next a release 4.1 will be made with that change.

This should make sure that we are ready for the release of Magento 2.4.1 later today.

jruhlender commented 4 years ago

Sounds good and even makes sense according to semver because the actual code works for both magento versions. Glad I could help :-)

jissereitsma commented 4 years ago

I'll keep this issue open for now, until we have actually upgraded to 2.4.1 and confirmed all is fine ;)

hans2103 commented 3 years ago

@jissereitsma any updates on this one?

jissereitsma commented 3 years ago

The current branch has this fixed already: https://github.com/yireo/magento2-replace-bundled/blob/magento-2.4.1/composer.json#L5 I'm closing this issue because of that. If you are asking for the updates, because of a specific issue you are running into, could you post that issue?