Open sjregan opened 1 year ago
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.
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?
I've added two commits for addressing this
But I haven't written any tests against it.
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.
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.
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.
~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?
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.