Comments

markdorison created an issue.

markdorison’s picture

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:

"repositories": [
        {
            "type"    : "package",
            "package" : {
                "name"    : "mediaelement/mediaelement",
                "version" : "v4.2.7",
                "type"    : "drupal-library",
                "source"  : {
                    "url"       : "https://github.com/mediaelement/mediaelement.git",
                    "type"      : "git",
                    "reference" : "origin/master"
                }
            }
        }
    ],
"require": {
        "mediaelement/mediaelement": "4.2.7"
    },

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.

wrd’s picture

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.

markdorison’s picture

I am using mediaelement in this way.

PratikshaD’s picture

I have tried #2 code but for me its throwing error package name "mediaelement/mediaelement" not found.