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.
CreditAttribution: markdorison at Chromatic commented
I was able to install audiofield libraries via composer.json at the top level of my repo by specifying the repository to composer and adding an requirement for the library in question:
That said, I was still hopeful to try and do this at the contrib module level so additional configuration is not necessary. Sadly composer does not recognize repositories added recursively. To absolve us from having to specify the repository, we would need to get the libraries in question to incorporate their own composer.json and submit to packagist. However, even with that they would not be specified as type 'drupal-library' so I believe site builders using composer would still need to specify it as such at their top-level composer.json file as described in the "dropzone" package example on the "Using Composer to manage Drupal site dependencies" documentation.
Which libraries were you able to install this way? I successfully got mediaelement and jPlayer installed this way, but audio.js, Projekktor, SoundManager, and Wavesurfer all seem to have additional levels of nesting that result in the library not being findable.
Comments
Comment #2
markdorisonI was able to install audiofield libraries via
composer.json
at the top level of my repo by specifying the repository to composer and adding an requirement for the library in question:That said, I was still hopeful to try and do this at the contrib module level so additional configuration is not necessary. Sadly composer does not recognize repositories added recursively. To absolve us from having to specify the repository, we would need to get the libraries in question to incorporate their own composer.json and submit to packagist. However, even with that they would not be specified as type 'drupal-library' so I believe site builders using composer would still need to specify it as such at their top-level composer.json file as described in the "dropzone" package example on the "Using Composer to manage Drupal site dependencies" documentation.
It seems other contrib projects are struggling with this as well: #2673910: Add the require jquery cycle library in composer json file.
Comment #3
wrd CreditAttribution: wrd commentedWhich libraries were you able to install this way? I successfully got mediaelement and jPlayer installed this way, but audio.js, Projekktor, SoundManager, and Wavesurfer all seem to have additional levels of nesting that result in the library not being findable.
Comment #4
markdorisonI am using mediaelement in this way.
Comment #5
PratikshaD CreditAttribution: PratikshaD as a volunteer and commentedI have tried #2 code but for me its throwing error package name "mediaelement/mediaelement" not found.