composer-drupal-optimizations icon indicating copy to clipboard operation
composer-drupal-optimizations copied to clipboard

Does not work with npm-asset repository

Open prudloff-insite opened this issue 4 years ago • 0 comments

With the following composer.json:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],
    "extra": {
        "composer-drupal-optimizations": {
            "require": {
                "npm-asset/jquery": ">=3.4 <4"
            }
        }
    }
}

Composer still seems to load every jquery version (when running composer show -a npm-asset/jquery, for example).

I think it is because of this condition: https://github.com/zaporylie/composer-drupal-optimizations/blob/a7f409a765164fd13ac0bd00e19109165c51b369/src/Cache.php#L64

When using npm-asset, $data['packages'] only contains the requested package, so array_diff_key() returns false here.

prudloff-insite avatar Jan 27 '21 15:01 prudloff-insite