wikimedia / composer-merge-plugin

Merge one or more additional composer.json files at Composer runtime
MIT License
923 stars 160 forks source link

Default composer to --no-install on subdirs #246

Open Sophist-UK opened 1 year ago

Sophist-UK commented 1 year ago

If I use this plug-in, then I would like the --no-install option to be detailed when I do a Composer Require on a subdirectory.

It may be difficult to determine whether it is a subdirectory or not, so perhaps it could be defaulted based on whether there is an existing vendor directory or existing installs in composer.json or composer.lock?

bd808 commented 1 year ago

@Sophist-UK can you rephrase your feature request and provide a concrete example? I am currently unable to understand the exact issue and desired behavior that you are describing.

Sophist-UK commented 1 year ago

The idea of this plugin is to consolidate composer.json requirements down and include them in parent directories when you do a composer install or composer update. What you tend not to want to happen is have vendor directories in the children directories containing the same packages.

composer require by default does a composer install immediately following unless you add the --no-install flag. So if you do a composer require in a sub-directory without specifying this, by default it then creates the vendor hierarchy there as well as in the root.

So what I am requesting here is that when you install this plugin, composer require is changed so that --no-install is added by default unless --install has been added. This will prevent vendor hierarchies being created by accident in sub-directories, and would require the user to do an explicit composer install or composer update if they wish to create the vendor hierarchy there. The down-side is that the install would not be done by default for any composer require done in the root directory, but IME for users of this plugin that is an acceptable compromise.