composer-include-files icon indicating copy to clipboard operation
composer-include-files copied to clipboard

autoload_file is reset after composer reinstall

Open SlavaAurim opened this issue 3 years ago • 8 comments

When I call command composer reinstall <some/package> the file vendor/composer/autoload_file.php is reseted to original content without my extra include files. The composer update fix problem, but I would like to avoid this extra work. Is it possible? Probably you need to add processing of some events that generates form composer reinstall.

SlavaAurim avatar Dec 12 '21 10:12 SlavaAurim

OK I'll look into this.

hopeseekr avatar Dec 27 '21 17:12 hopeseekr

I can definitely duplicate this:

Steps to duplicate:

composer require codezero/laravel-localized-routes
### Contents of vendor/composer/autoload_files.php
##    '8620ae051a66f0f3007e7d731bb67e8d' => $vendorDir . '/codezero/laravel-localized-routes/src/helpers.php',
##     '60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
##     '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',

composer reinstall psr/container
### Contents of vendor/composer/autoload_files.php
##     '60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
##     '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',

The '/codezero/laravel-localized-routes/src/helpers.php' is definitely missing...

hopeseekr avatar Jun 18 '22 06:06 hopeseekr

OK, I've confirmed that it's fixed in my fork of this package: https://packagist.org/packages/0.0.0/composer-include-files

composer require 0.0.0/composer-include-files

See https://github.com/hopeseekr-contribs/composer-include-files/commit/0e77aa7a723ac7a32a6b4f4ce4666872a642e845

composer require codezero/laravel-localized-routes
### Contents of vendor/composer/autoload_files.php
##    '8620ae051a66f0f3007e7d731bb67e8d' => $vendorDir . '/codezero/laravel-localized-routes/src/helpers.php',
##     '60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
##     '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',

composer reinstall psr/container
### Contents of vendor/composer/autoload_files.php
##    '8620ae051a66f0f3007e7d731bb67e8d' => $vendorDir . '/codezero/laravel-localized-routes/src/helpers.php',
##     '60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
##     '72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',

hopeseekr avatar Jun 18 '22 07:06 hopeseekr

Hey @SlavaAurim, I apologize for it taking me 7 months to resolve this issue.

I have applied to my own fork of this package, as mentioned above, and I have also created a PR (#14) for this package, in case this project's maintainer ever is interested in fixing this bug.

hopeseekr avatar Jun 18 '22 07:06 hopeseekr

Hey, is anyone still maintaining this package?

I took it upon myself to learn how this and composer plugins in general work. Based on what I learned from the composer source code, this package and @hopeseekr 's fork, I ended up with a working result, that fixes this bug and #7.

Because it was somewhat an educational project for me, I built it from scratch. So my code looks similar, but is structured differently...

If any maintainer is interested, I can try to translate my changes into a pull request. Or perhaps I can put my code online so you can take a look at it yourself. If not, maybe I can publish it myself.

ivanvermeyen avatar Mar 28 '23 11:03 ivanvermeyen

This project is very obviously abandoned. There are 254,597 installs of my fork of this project, 0.0.0/composer-include-files, which should be considered canon now.

https://github.com/hopeseekr-contribs/composer-include-files

hopeseekr avatar Sep 17 '23 13:09 hopeseekr

This project is very obviously abandoned. There are 254,597 installs of my fork of this project, 0.0.0/composer-include-files, which should be considered canon now.

https://github.com/hopeseekr-contribs/composer-include-files

@hopeseekr
Was using your fork for quite a while in one of my Laravel packages. Thank you for that!

But some people reported it still had some issues. Since there was no activity here, I rewrote the package myself from scratch. That way I could learn and understand how it works. I ended up using a somewhat different approach to regenerating the autoload files, letting existing composer functions do the work.

I hope you don't take offense of this. Of course, I did properly credit you and funkjedi with a link to your repo's. 🙏

ivanvermeyen avatar Sep 17 '23 16:09 ivanvermeyen

@ivanvermeyen I don’t take offense. But you really should post a PR or two to my project so we can all benefit. I’ve applied every PR submitted to this repo to mine, too.

hopeseekr avatar May 26 '24 15:05 hopeseekr