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

Add warning about using composer packages installed with symlink #64

Open
sjregan opened this issue Apr 24, 2023 · 7 comments
Open

Add warning about using composer packages installed with symlink #64

sjregan opened this issue Apr 24, 2023 · 7 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation v1.0

Comments

@sjregan
Copy link

sjregan commented Apr 24, 2023

Quite a few operations will change or delete files. When packages are installed by symlink these operations will break other projects also using the packages.

It would be great to have a warning before any dangerous operations are performed, and a warning in the docs.

@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Apr 27, 2023

I agree entirely. Until recently, there were no changes to any files (except explicit opt-in for deleting some files). The current default behavior does not edit any files – it copies and then changes the new files. Since last month, March, there is a new configuration that can result in, as you say, editing files that should not. I'll certainly add a warning. I'll think about how to add an explicit opt-in setting too.

@doekenorg
Copy link

doekenorg commented Aug 7, 2023

The "delete_vendor_packages": true option seems to be clearing out that folder, instead of removing it. When using local repositories (for development purposes) these folders get emptied out; removing the entire local package 😄

Is it possible that it removes / unlinks the folder in a way that only removes the symlink; but the linked package stays intact?

@BrianHenryIE BrianHenryIE added the documentation Improvements or additions to documentation label Nov 2, 2023
@BrianHenryIE BrianHenryIE added the bug Something isn't working label Nov 18, 2023
@BrianHenryIE
Copy link
Owner

I've added two commits for addressing this

But I haven't written any tests against it.

@BrianHenryIE
Copy link
Owner

Behaviour as of v0.16.0 is to unlink when delete_vendor_packages is true.

Still, I'll take a proper look at that PR when I can and will add something to the README if we need to.

I learned recently, you can use COMPOSER_MIRROR_PATH_REPOS=1 composer install to have Composer copy the local repos into your project rather than symlink them.

I'll output an error message informing the user of that option if they try to set target_directory to vendor and have a symlinked package.

@doekenorg
Copy link

Thanks. That is my go to solution for now, but I forget I need to do that every once in a while 😭. So then I'm testing, changing code, symlinking and bam: I loose everything, because the original folder gets cleared out. Only then I remember; and need to start over with mirroring. So the notification sounds great; but it should be a confirmation before it goes on today prevent this deleting.

@BrianHenryIE
Copy link
Owner

BrianHenryIE commented Mar 19, 2024

I think we think this is fixed – release 0.17.0.

Your test case was great. That was the intended behaviour after the commits I mentioned earlier, but my code wasn't working as intended. Then your code did work!

Edit: reopening because I think the notice would still be helpful to add.

@doekenorg
Copy link

I think we think this is fixed – release 0.17.0.

Your test case was great. That was the intended behaviour after the commits I mentioned earlier, but my code wasn't working as intended. Then your code did work!

Edit: reopening because I think the notice would still be helpful to add.

Cool! Thanks for the release; this will help greatly.

Speaking of tests. I'm more than willing to set up some tests to ensure certain behaviour when I have some extra time. Do you have any cases you wish you had tested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation v1.0
Projects
None yet
Development

No branches or pull requests

3 participants