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.
Problem/Motivation
There now exists an official endpoint for drupal modules and themes. Core can ship with this endpoint specified in it's root composer.json, enabling users to composer require drupal/rules
to install the rules module, using this endpoint.
Proposed resolution
Patch the composer.json to add the repository specification
Remaining tasks
The composer endpoints are targeted at being declared beta on July 6th. This can probably be comitted sometime after that
User interface changes
None
API changes
This adds our repository as a package endpoint, and thus adds features that werent there before.
Data model changes
none
Comment | File | Size | Author |
---|---|---|---|
#35 | 2758737-35.patch | 20.88 KB | cilefen |
#27 | 2758737-27.patch | 1.46 KB | webflo |
#22 | 2758737-21.patch | 1.64 KB | ndf |
#15 | 2758737-15.patch | 2.33 KB | Mixologic |
#12 | 2758737-12.patch | 1.63 KB | Mixologic |
Comments
Comment #2
MixologicHere is the patch, added with:
composer config repositories.drupal composer https://packages.drupal.org/8
Comment #3
MixologicComment #4
Fabianx CreditAttribution: Fabianx as a volunteer commentedLooks good to me.
Comment #6
Mile23Patch still applies.
After application I did this:
This added phpunit_example as a dependency and gave me this change to composer.json:
...but Composer then ended up satisfying this dependency by adding the whole drupal/examples project. I think this is the right way to do it.
Comment #7
xjmThat fail looks actually related? Queuing a retest.
Comment #9
XanoI can't do it now, but somebody needs to run
composer update --lock
after this patch has been applied, and include the result.Comment #10
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedHere you go :)
Comment #11
Mile23+1 on #9.
And RTBC on #10 except for one thing:
Let's add an explanation to extra->_readme in composer.json so it says "This file specifies the packages.drupal.org repository. You can read more about this repository here: https://www.drupal.org/node/2718229"
Comment #12
MixologicHere's a patch with some commenting. I added the word 'composer' in there before one of the repositories lest people think that has something to do with git.
Comment #13
MixologicComment #15
MixologicI forgot to re-run
composer update --lock
so the hashes didnt match.When I did re-run it, it changed the references from 1.0.0 to commit hashes for psr-log, which is odd. Odd that they were in the lock file as a tag in the first place, as it is the *only* reference in the lock file like that. Though it looks like it was a throwback all the way back to #1894002: Update vendor libraries and pin them to specific versions in composer.json, so probably okay. The commit hash matches the tag, so we're not actually changing anything there.
Comment #16
Mile23Sigh. Patch doesn't apply.
Comment #17
Mile23Comment #19
ndf CreditAttribution: ndf at Dx Experts for Media.Monks commentedYou can add the drupal endpoint with
$ composer config repositories.drupal composer https://packages.drupal.org/8
as #2 already said.Using the method from this issue a couple things happen that I am not sure if that is good/recommended:
$ composer require ...
the top composer.json will be changed.Compared to https://github.com/drupal-composer/drupal-project this method is less sophisticated.
But it does work well!
Comment #20
bojanz CreditAttribution: bojanz at Centarro commentedCore doesn't own the root composer.json, the project does. This file is meant to be changed, just like htaccess for example.
Not in 8.3.x:
Comment #21
ndf CreditAttribution: ndf at Dx Experts for Media.Monks commentedThanks Bojanz. Missed those changes in 8.3.x !
Regarding to the ownership of the root composer.json > did not know it was meant to be changed.
Comment #22
ndf CreditAttribution: ndf at Dx Experts for Media.Monks commentedRerolled against 8.x-3.x
2 things are different then #15
1. hash + content-hash (sure)
2. no further changes in composer.lock
Comment #23
Mile23There's some ambiguity about the composer facade respecting the 'type' property of Drupal projects: #2802009: Provide support for libraries and other non-drupal extensions (modules, themes etc)
Specifically Coder, which is a Drupal project but also a library and not a module. We want to include it as a dev requirement for core: #2744463: Add phpcs, coder 8.2.8 as --dev requirements for drupal/core
I just added the facade as per #2
composer config repositories.drupal composer https://packages.drupal.org/8
And then added Coder:
composer require --dev drupal/coder 8.2.8
..and everything ended up where it should, but I'm not sure that isn't by accident, since #2802009: Provide support for libraries and other non-drupal extensions (modules, themes etc) is still open.
Comment #24
MixologicIts by accident that it works, because you are requiring
drupal/coder 8.2.8
- which happens to be grandfathered in at packagist.org as well.So basically composer is able to get metadata about coder from both sources, so for now it works. Where we get into trouble is if you were to use the *recommended* versioning of
composer require drupal/coder 2.8.0
to install coder. Then it has no idea that its a drupal library because we do not preserve composer.json for anything that doesnt have an .info/info.yml file, and assumes it to be a drupal module.Since coder is a special case, yet has a workaround, Im inclined to say this wont have a drastic impact on libraries that exist on d.o.
Comment #26
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #27
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedComment #28
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedI think version number drupal/coder is not a concern anymore, it has been added as dev-dependency in #2744463: Add phpcs, coder 8.2.8 as --dev requirements for drupal/core.
Comment #29
bojanz CreditAttribution: bojanz at Centarro commentedOkay, let's go.
We def wants this in 8.3.x as well, should be completely non-disruptive.
Comment #30
tstoecklerAwesome, let's get this in.
Edit: Ahh, damn, @bojanz was quicker ;-)
Comment #31
anish.a CreditAttribution: anish.a commentedComment #32
Mile23So eventually, as per #24, we'll need to change the requirement to drupal/coder 2.*.0, but not before the issue of d.o projects being libraries is resolved in #2802009: Provide support for libraries and other non-drupal extensions (modules, themes etc) and elsewhere.
Comment #33
alexpottCommitted 475e305 and pushed to 8.4.x. Thanks!
We need a new patch for 8.3.x
Comment #35
cilefen CreditAttribution: cilefen commentedThe hash key and the date format change in composer.lock because this is
composer update --lock
with the current version of composer.Comment #36
Mile23Made a follow-up: #2851279: Update version requirements for drupal/coder to best practices
Comment #37
cilefen CreditAttribution: cilefen commentedIs there an issue open for updating the composer merge plugin config to parse contrib module dependencies?
Comment #38
bojanz CreditAttribution: bojanz at Centarro commented@cilefen
There is an old issue, but I don't remember if it was still open, cause it doesn't make a lot of sense. If you need to run Composer anyway, then use it to download the whole module.
Comment #39
Mixologicahh.. sweet.
+++
Comment #40
cilefen CreditAttribution: cilefen commentedI found it.
Comment #41
jibranPatch is green.
Comment #42
alexpottCommitted 1d1daa8 and pushed to 8.3.x. Thanks!
Comment #44
alexpottCommitted 1d1daa8 and pushed to 8.3.x. Thanks!
Comment #45
cilefen CreditAttribution: cilefen commented