Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Requiring fixed versions in composer.json should be avoided. Always use the ^ parameter with it instead to allow people to use future versions or dev versions as necessary. With the current versions, it was not possible to upgrade paragraphs to a dev version in my project.
The PR fixes the problem and allows me to do
composer require drupal/paragraphs=1.x-dev
PR: https://github.com/BurdaMagazinOrg/thunder-distribution/pull/176
Comments
Comment #2
fagoad chrfritsch:
>We have to use fixed versions for projects where we ship some patches
I see, still I don't think this works out. When I have a project based on thunder, I should be able to upgrade to next version. If the patch does not apply any more, well I did the upgrade and I have to take care of it. But with the current situation, composer just denies my to change the version at all! Even if there is a new stable release which has all patches added, there is no way to use it.
However, I do not know whether it's even possible to change the patches in the project as they are part of the install profile as well? If composer-patches does not allow that, I'd recommend dropping patch files and using forks instead of patches. Forks are just special versions which can override as needed on the project level.
If of interested, you can find an example on how to do that in http://www.slideshare.net/nuppla/efficient-development-workflows-with-co....
Comment #3
fagoComment #4
daniel.bosenAnother possibility for you to require a different version of paragraphs would be to require the version you need as the version the thunder composer file has a fix on e.g. (in your composer.json):
When using forks instead of patches, I see the problem, that we would also have to rename the project. We would have to rename drupal/paragraphs to burdamagazinorg/paragraphs and register that fork on pacvkagegist, but then you would not be able to update at all, or am I missing something?
Of course we would love to use no patches at all, but that is easier said then done...
Comment #5
fagoRight that works. It will a bit confusing when you are mapping future releases like 1.3 to 1.0 though.
That works fine without renaming things. E.g. you can fork a package like that:
If the package has no composer.json committed like most drupal modules, you'd have to add it via type "package" to the repositories instead.
Comment #6
daniel.bosenBut repositories defined in our distribution repository would have to be replicated in the root composer file of the project using thunder, so this would still not work so good.
Comment #7
fagoTrue, I agree this is not a good solution either then. Looks like forking the thunder-distribution is the only solution to make overriding patches possible then. Maybe best composer-patches would be improved to allow re-defining patches in the root composer project file (in my tests this did not work out).
Still, this does not really require to depend on fixed versions, does it? If I'd update the version to another release, it would just try to apply the same patches again, what seems fine to me. If the patch does not apply, composer-patches will have to fail and show an error anyway.
Comment #8
daniel.bosenNot quiet true, composer will show a warning, but it will not fail. If the patch has been applied meanwhile, this would be fine, otherwise it would possibly introduce regressions.
We try to deliver the distribution without those kind of problems, that is why we decided to provide patches for fixed versions only. But we will think about changing this policy.
Comment #9
fagohm, I see. That's an issue with composer patches then. If it fails to do its work, it should fail. Any possibility of ending up with the wrong code would be an issue obviously. So I guess this means we'd need to improve composer-patches before being able to do that.
I see - that's great. But then, for building projects on top of it should be possible to upgrade modules, add patches etc., such that you can solve any possible upcoming issues in your project.
Comment #10
daniel.bosen