liborm85 / composer-vendor-cleaner

Composer Vendor Cleaner removes unnecessary development files and directories from vendor directory.
MIT License
27 stars 3 forks source link

How to switch back to the dev-dependencies in your dev-workflow? #4

Closed jepster closed 2 years ago

jepster commented 3 years ago

Hi,

currently it seems, that I must always execute a "composer update" command for getting back to my dev-dependencies. Let's say you are in the dev-phase. How do you get your dev-dependencies? It get get quite annoying, if you must always update all of your dependencies. Because you can stumble into issues with new versions quite often.

It should not be necessary to run a "composer update" command to get back to your dev dependencies. Do you recommend to work with an additional composer.lock file?

liborm85 commented 3 years ago

I don't know if I fully understand your question. Plugin is only for removing unnecessary files or folders, cannot be used to rollback files/folders (because doesn't backup these items). For "recovery" must be packages reinstalled via composer. File composer.lock should not be related to this, because plugin does not remove entire packages from lock file, but only unnecessary files in packages.

jepster commented 3 years ago

For my project, which is quite large, with dozens of vendor packages, it did not worked. Also it might fail due to patches of vendor packages. I have tried all possible ways. composer install - -no-dev && rm -rf vendor && composer install. It looks like it has issues with larger projects. I have invested 17 hours in total for making it work. I am also using the prestissimo composer plugin (https://github.com/hirak/prestissimo). It might fail in coexistence with it. You can check our large deGov project by yourself, if you like: https://packagist.org/packages/degov/degov

jepster commented 3 years ago

I ended up with a simple shell script, which is deleting the folders and files. Very simple, but very efficient.

liborm85 commented 3 years ago

I try install https://packagist.org/packages/degov/degov via:

composer require degov/degov

And problem with not found drupal/address package is returned:

Using version ^9.0 for degov/degov
./composer.json has been created
Running composer update degov/degov
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - degov/degov[9.0.0, ..., 9.0.12] require drupal/address ^1.0 -> could not be found in any version, there may be a typo in the package name.
    - Root composer.json requires degov/degov ^9.0 -> satisfiable by degov/degov[9.0.0, ..., 9.0.12].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, deleting ./composer.json.

Cleaning is not depend on number of vendor packages, but number of files/folders to delete. I use this plugin to delete large number of files without any problem.

@jepster I need your composer.json file including definition for deletion via composer vendor plugin, for reproduce your issue.