为什么 composer.json 在 "composer install" 命令之后修改?
Why composer.json is modified after "composer install" command?
我目前正在研究我刚刚从我们公司的 Gitlab 克隆的 Laravel 5.8 项目。我 运行 composer install
然后当我 运行 git status
它列出 composer.json
作为修改文件。
我认为 composer install
不会修改 composer.json
文件。
我认为如果我提交这个文件,那么远程服务器就不能将新的 composer 文件与旧的合并。
我该怎么办?
一般情况下,Composer 安装不会修改composer.json
。但是在某些情况下可以更改它,尽管我不知道如果没有用户输入会发生什么。
目前我能想到的设置是config.allow-plugins
。
如果您克隆一个使用低于 2.2.0 的 Composer 创建的项目,则配置文件中不会存在此选项。
如果您现在 运行 Composer 版本 > 2.2.0,并且如果此项目包含作曲家插件(想到的一些是 composer/package-versions-deprecated
、symfony/flex
、symfony/runtime
, 等等), 你会得到一些提示要求你授权插件。
像这样:
bamarni/composer-bin-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "bamarni/composer-bin-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]
不同的选项代表:
选择 y
es 或 n
o,最终会修改您的 composer.json
添加此配置。
I think that if I commit this file, then the remote server can not merge the new composer file with the old one.
Git 合并这种变化没有问题。
What should I do?
与贵公司的某人交谈。 运行 git diff composer.json
检查更改,并与某人确认是否应将这些更改推送到上游。如果没有,只需 运行 git restore composer.json
我目前正在研究我刚刚从我们公司的 Gitlab 克隆的 Laravel 5.8 项目。我 运行 composer install
然后当我 运行 git status
它列出 composer.json
作为修改文件。
我认为 composer install
不会修改 composer.json
文件。
我认为如果我提交这个文件,那么远程服务器就不能将新的 composer 文件与旧的合并。
我该怎么办?
一般情况下,Composer 安装不会修改composer.json
。但是在某些情况下可以更改它,尽管我不知道如果没有用户输入会发生什么。
目前我能想到的设置是config.allow-plugins
。
如果您克隆一个使用低于 2.2.0 的 Composer 创建的项目,则配置文件中不会存在此选项。
如果您现在 运行 Composer 版本 > 2.2.0,并且如果此项目包含作曲家插件(想到的一些是 composer/package-versions-deprecated
、symfony/flex
、symfony/runtime
, 等等), 你会得到一些提示要求你授权插件。
像这样:
bamarni/composer-bin-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "bamarni/composer-bin-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]
不同的选项代表:
选择 y
es 或 n
o,最终会修改您的 composer.json
添加此配置。
I think that if I commit this file, then the remote server can not merge the new composer file with the old one.
Git 合并这种变化没有问题。
What should I do?
与贵公司的某人交谈。 运行 git diff composer.json
检查更改,并与某人确认是否应将这些更改推送到上游。如果没有,只需 运行 git restore composer.json