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

autoload_file is reset after composer reinstall #13

Open
SlavaAurim opened this issue Dec 12, 2021 · 8 comments
Open

autoload_file is reset after composer reinstall #13

SlavaAurim opened this issue Dec 12, 2021 · 8 comments

Comments

@SlavaAurim
Copy link

SlavaAurim commented Dec 12, 2021

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.

@hopeseekr
Copy link

OK I'll look into this.

@hopeseekr
Copy link

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 added a commit to hopeseekr-contribs/composer-include-files that referenced this issue Jun 18, 2022
@hopeseekr
Copy link

hopeseekr commented Jun 18, 2022

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 hopeseekr-contribs@0e77aa7

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 added a commit to hopeseekr-contribs/composer-include-files that referenced this issue Jun 18, 2022
@hopeseekr
Copy link

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.

@ivanvermeyen
Copy link

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.

@hopeseekr
Copy link

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

@ivanvermeyen
Copy link

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. 🙏

@hopeseekr
Copy link

@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.

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

No branches or pull requests

3 participants