git commit -m 'Issue #2337283 by hussainweb, Mile23, alexpott, dawehner, naveenvalecha, aditya_anurag, rakesh.gectcr: [meta] Add a composer.json file to every component (module, later)'
Problem/Motivation
Our extensions are based upon .info.yml
files which works fine and I don't see a reason to change that (at least for now and this issue).
On the other hand though those doesn't provide any metadata you could use in order to use composer properly.
Contrib established now a policy (or people pushed it quite hard) to add composer.json files to every module:
- https://github.com/webflo/micro/blob/8.x/composer.json
- https://github.com/larowlan/default_content/blob/8.x/composer.json
- http://cgit.drupalcode.org/page_manager/tree/composer.json
With that and some other tricks you can use composer to build your Drupal together with the modules (this is not about the dependencies of each module) (see https://blog.erdfisch.de/node/412)
We should probably start with the Drupal\Component namespace.
Components in the Drupal\Component namespace with composer.json files:
Plugin
ProxyBuilder
Utility
Plugin
is broken, being non-valid JSON.
Utility
is an interesting case because it contains a number of different one-file classes. Other components such as Bridge and DateTime also contain only one class. We should probably move the Utility classes to their own namespace.
Proposed resolution
Add a composer.json to every module in core. This tells people that they should do that as well. On top of that the composer.json format
provides a lot of additional metadata you can use, like the maintainers, which would be a great replacement for MAINTAINERS.txt because the information
is much more in context.
Remaining tasks
- Add composer.json files to the various components, fix existing ones which are broken.
- Make sure they pass coding standards and have accurate information.
- Figure out a way to test whether the composer.json files are actually meaningful.
User interface changes
API changes
Possibly changing the names of some namespaces.
Beta phase evaluation
Unfrozen changes | Unfrozen because it only adds metadata to the project. |
---|---|
Disruption | Minimal disruption to core. |