Skip to content

Add negated dependency support #129

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

Merged
merged 1 commit into from
Jul 14, 2025
Merged

Conversation

adamj88
Copy link
Contributor

@adamj88 adamj88 commented Jun 5, 2025

Currently, you can specify a patch to apply when a specific composer package is installed using the @depends metadata in a patch file:

@depends magento/module-base:2.4.7

However, you cannot do the reverse of this, apply a patch if another package isn't present.

This PR adds support for this feature, with the following syntax:

@depends !magento/module-base # patch when magento/module-base is not installed
@depends !magento/module-base:>=2.4.7-p6 # patch when magento/module-base is not >=2.4.7-p6

A use case I have is that there is code added to a package, which depends on another that we do not want to use. Subsequently, we use a composer to remove it, however, we also need to patch the module which depends on it to remove any code referencing it.

@adamj88 adamj88 force-pushed the depends-exclusion branch from fc02cdd to 8edab02 Compare June 5, 2025 15:57
@jooname
Copy link
Contributor

jooname commented Jun 6, 2025

Thank you for the contribution! I've been checking the changes and so far it's looking good. I've been also updating the testsuite with new cases to confirm these changes specifically, these are so far in https://github.com/vaimo/composer-patches/tree/feature/pr-129-tests. Unfortunately not able to finish checking this during today and then I will be unavailable for two weeks, so there will be delay getting these changes forward. Apologies for that!

@jooname jooname merged commit 6d74b20 into vaimo:master Jul 14, 2025
10 checks passed
@jooname jooname mentioned this pull request Jul 14, 2025
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

Successfully merging this pull request may close these issues.

2 participants