php - Is it possible to tell Composer not to uninstall already installed dependencies when using the composer command?
问题描述
I am using https://github.com/tonix-tuft/grunt-hub-automator (a repo I have created on GitHub) which lets me set up a daemon which runs the following command whenever I change my composer.json
or composer.lock
file:
composer self-update && composer install --no-dev && composer update --lock
This way I can move across different branches and the daemon keeps the dependencies in vendor
synchronized with composer.json
.
However, if after adding new dependencies on new_branch I checkout old_branch which doesn't have those dependencies defined in composer.json
because I have added them only on new_branch, the daemon fires the command and removes the dependencies on the old branch to keep everything in sync.
The problem of this approach is that if at that point I checkout again new_branch before the composer
command has finished its work on old_branch (it's running in the background thanks to the daemon), I end up with an unsynced vendor
folder because Composer is removing the dependencies as it thinks I am still on old_branch
.
Is there a way to tell Composer not to remove already installed dependencies from vendor
when they are not defined in composer.json
?
Basically, I would like Composer to install missing dependencies or update those which are defined in composer.json
every time composer.json
changes without removing eventual dependencies which were already installed in vendor but now are not defined in composer.json
anymore.
Is it possible?
I hope I was clear.
Thank you for your attention.
解决方案
推荐阅读
- email - PHPMailer 不工作,在垃圾邮件中发送邮件
- python - 在 2D numpy 数组的子矩阵上高效运行
- javascript - 如何制作垂直菜单图标线
- regex - 正则表达式 - 显示目录,排除首页
- c# - c# 我的 Xpath 有问题吗?使用 Package.GetPart 从 DocX 文件中解析 Xml
- python-3.x - 将单个值的 PeriodIndex 应用于 pandas 数据帧的所有行
- php - Laravel 路由视图缓存
- r - 我的包函数修改版找不到包的其他内部函数
- debugging - Jenkins 未在 AWS ec2 t2 大型实例中运行
- javascript - JQuery datepicker不保存选定的日期