Composer:直接在供应商包中开发
我有一个使用 composer 的 PHP 项目.
I have a PHP project where I use composer.
我自己的主库实际上是一个必需的包,因为我也在构建一个独立版本"供人们安装(不仅仅是库),因此它位于 vendor
目录中.
My own main library is actually a required package, as I'm also building a "standalone version" for people to install (not just the library), thus it lands in the vendor
directory.
我开发项目的大部分时间都发生在那个供应商包中,它已经是一个 Git 克隆,但不在任何分支上.我可以通过运行 git checkout master
快速地改变它.但是,每次我运行 composer update
时,它要么抱怨目录很脏,要么签出一个新副本,我必须从那里开始,而不再是在一个分支上.
Most of the time I spend developing the project happens in that vendor package, which is a Git clone already, however not on any branch. I can change that quickly enough by running git checkout master
. However, every time I run composer update
, it either complains about the directory being dirty, or checks out a new copy, where I have to start without being on a branch once more.
所以,我的问题是:Composer 是否有某种模式,例如只获取该仓库中的更改?或者在开发主包的同时开发(或只是贡献)供应商包的首选方式是什么?
So, my question: is there some mode for Composer to e.g. only fetch the changes in that repo? Or what would be the preferred way to develop (or just contribute to) a vendor package at the same time as developing the main package?
推荐答案
几分钟前,composer 更新现在会询问您是要还原更改还是要在包更新之前/之后进行存储/应用.这应该有助于解决此类问题,请参阅 https://github.com/composer/composer/拉/1188 了解详情.
As of a couple minutes ago composer updates will now ask you whether you want to revert the changes or do a stash/apply before/after the package update. This should help quite a bit with such problems, see https://github.com/composer/composer/pull/1188 for details.
相关文章