composer icon indicating copy to clipboard operation
composer copied to clipboard

composer config --unset "repositories.1.exclude" does not work

Open chx opened this issue 2 years ago • 3 comments

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        },
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
              "drupal/amp"
            ]
        },

composer config --unset "repositories.1" nukes the entire section but composer config --unset "repositories.1.exclude does not remove exclude alone.

chx avatar Oct 25 '23 08:10 chx

Yeah we don't support very deep editing like this.. especially for repos. Might be doable so I'll leave this open if I (or someone else 👀) ever get to it.. but I wouldn't hold my breath, just open the file in an editor for complex operations.

Seldaek avatar Oct 25 '23 15:10 Seldaek

So I am guessing Config::removeProperty is the method to look into. As far as I can tell the code is quite universal but if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) { restricts it to extra and scripts. I am not familiar enough with composer to know why this restriction is there and what would break if were to simply remove it.

chx avatar Oct 28 '23 21:10 chx

Yeah we could perhaps do it for repos, I am not sure if it will work or not.. You can try, but the regex json modifications need to be heavily covered by tests as it's an art more than a science..

Seldaek avatar Oct 31 '23 14:10 Seldaek