[英]Install git package on different path with composer
我正在尝试使用composer在自定义路径中从git安装存储库,因为我正在将Bedrock用于WordPress。
在我的composer.json
我有以下代码块:
// ...
repositories: [{
"type": "package",
"package": {
"name": "juniorgarcia/acf-gme",
"version": "1.0.2",
"source": {
"url": "https://github.com/juniorgarcia/acf-gme",
"type": "git",
"reference": "master"
}
}
}]
// ...
"extra": {
"installer-paths": {
"web/app/plugins/{$name}/": ["type:wordpress-plugin"]
}
}
我的存储库的composer.json
具有以下内容:
{
"name": "juniorgarcia/acf-gme",
"type": "wordpress-plugin",
"description": "A extended version of ACF Google Maps plugin with some more functionality.",
"require": {
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "advanced-custom-fields-google-map-extended"
}
}
我按照作曲家的指示将其安装在自定义路径上,但没有用。 它安装在vendor
。 我究竟做错了什么?
在分析composer.lock
我意识到,对于我的自定义存储库,将其插入如下:
// ...
{
"name": "juniorgarcia/acf-gme",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/juniorgarcia/acf-gme",
"reference": "master"
},
"type": "library" // Notice here! Type is set to "library"
} // ...
Type设置为library
,所以我在composer.json
上添加了"type": "wordpress-plugin"
,如下所示:
{ // ...
"type": "package",
"package": {
"name": "juniorgarcia/acf-gme",
"version": "1.0.2",
"type": "wordpress-plugin", // Here is where I changed.
"source": {
"url": "https://github.com/juniorgarcia/acf-gme",
"type": "git",
"reference": "master"
}
}
} // ...
这工作了。 我还更改了installer-name
添加了以下信息:
// ... on my composer.json
"extra": {
"installer-name": "advanced-custom-fields-google-maps-extended" // This also worked
}
即使能够正常工作,我也不知道为什么composer不会读取我的软件包的composer.json
文件,而该文件已经具有type
和type
。 我很高兴有人可以向我解释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.