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

Forward specified Composer commands #154

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cs278
Copy link

@cs278 cs278 commented Aug 11, 2023

This is a proof of concept and open to feedback or closing if not desired.

The change enables the user to configure which Composer commands are forwarded, allowing the user to customise the default behaviour of either forwarding nothing or forwarding both the install and update commands.

Personally I find the default behaviour of forwarding update annoying as generally I only intending to run the update on the root package, the current behaviour means my commands take longer and sometimes result in unintended changes to my tools lock files.

In this proof of concept I've added another configuration setting which takes a list of command names, keeping the existing boolean flag as a global on/off. However there is some overlap here, I could just use the existing property and make it accept both array and bool.

Related to #149 unfortunately it does not fix this use case as only some Composer commands actually raise a CommandEvent changing to use PreCommandRunEvent might be an option to fix this, as that runs on all commands.

@theofidry
Copy link
Collaborator

Sorry for the long overdue review.

The feature makes sense to me and I'm happy with the general idea.

Reviewing your PoC I think it makes more sense to expose a single setting to the user. For Config though, having two separate settings (forwarding enabled/disabled, and the list of forwarded commands) makes more sense IMO.

Related to #149 unfortunately it does not fix this use case as only some Composer commands actually raise a CommandEvent changing to use PreCommandRunEvent might be an option to fix this, as that runs on all commands.

Is there a way to know which commands are PreCommandRunEvent? We could experiment, but I have a premonition that this will cause problems e.g. with https://github.com/wikimedia/composer-merge-plugin.

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.

None yet

2 participants