我正在尝试使用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"
} // ...
类型设置为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.json
文件,这些文件已经具有type
和type
。Div>