我已经在我的私人仓库中创建了一个模块。我为它创建了一个composer.json
文件:
{
"name": "company/sync",
"description": "sync",
"type": "silverstripe-module",
"authors": [{
"name": "XXXX",
"email": "XXXX"
}],
"require": {
"silverstripe/framework": "~3.2",
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "sync"
},
"minimum-stability": "dev"
}
我已经完成了我的主要项目composer.json
:
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"repositories": [
{
"type": "package",
"package": {
"name": "company/sync",
"version": "master",
"source": {
"url": "git@xxx:xxx/sync.git",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "3.3.1",
"silverstripe/framework": "3.3.1",
"silverstripe/reports": "3.3.1",
"silverstripe/siteconfig": "3.3.1",
"silverstripe-themes/simple": "3.1.*",
"company/sync": "*"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7"
},
"extra": {
"branch-alias": {
"3.x-dev": "3.3.x-dev"
},
"installer-paths": {
"sync": ["company/sync"]
}
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
根据我的阅读,包被标记为silverstripe-module
它应该将它放在安装的根目录下。我还尝试通过extra
参数进行设置,但它仍然位于vendor / company / sync。我做错了什么?
答案 0 :(得分:2)
我认为您的问题是您的自定义“存储库”条目。通过定义“包”条目,您可以告诉作曲家包的属性,它不会查找存储库的composer.json
。
因此,要么通过添加“type”和其他字段来完全定义“package”条目,要么只使用“vcs”条目(将使用您的存储库中的composer.json
)。例如
"repositories": [
{
"type": "vcs",
"url": "git@xxx:xxx/sync.git"
}
]
简而言之:如果依赖于没有任何编写器元数据的源,请将“vcs”用于具有自己的composer.json
且仅使用“package”的存储库。