Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue installing library with their own composer.json #435

Open
jurgenhaas opened this issue Aug 13, 2019 · 1 comment
Open

Issue installing library with their own composer.json #435

jurgenhaas opened this issue Aug 13, 2019 · 1 comment

Comments

@jurgenhaas
Copy link

Used versions:

  • PHP: 7.0
  • composer: 1.8.6
  • composer/installers: 1.7.0

Context: Drupal project

Here is an extract of my composer.json:

{
   ...
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "ckeditorplugin/codesnippet",
                "type": "drupal-library",
                "version": "master",
                "dist": {
                    "type": "zip",
                    "url": "https://download.ckeditor.com/codesnippet/releases/codesnippet_4.5.11.zip",
                    "reference": "master"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "harvesthq/chosen",
                "type": "drupal-library",
                "version": "master",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/harvesthq/chosen/releases/download/v1.8.7/chosen_v1.8.7.zip",
                    "reference": "master"
                }
            }
        }
    ],
    "require": {
        "ckeditorplugin/codesnippet": "master",
        "harvesthq/chosen": "^1.6",
...
    },
    "extra": {
        "installer-paths": {
...
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
        },
    }
}

Expectation: both libraries should be installed in web/libraries but only codesnippet lands there and the chosen library goes into the vendor directory. I guess this is because that library comes with a composer.json which declares the type as library which seems to overwrite my type drupal-library.

I've then tried to add "harvesthq/chosen" to extra / installer-paths / web/libraries array but that made no difference.

My question is: how do I get the chosen library into the web/libraries path?

@jurgenhaas
Copy link
Author

Further investigation uncovered more details:

The installation work fine if the version string in repositories/package and in require are exactly the same. But only if really the same.

However, if the version string is master, it doesn't work and always stores the library in vendor directory.

Also, if the drupal-library is required by another package (not by the root project), it will always be installed in vendor and not in the installer path defined in extras.

Hope, those further aspects help to identify and fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant