我尝试使用composer在自定义路径中使用git安装存储库,因为我使用了Bedrock for 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
上。我做错了什么?
答案 0 :(得分:0)
在分析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
,因此我在"type": "wordpress-plugin"
上添加了composer.json
,如下所示:
{ // ...
"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
个文件。我很感激如果有人能解释我的话。