3

我正在通过 Composer 捆绑一个 Web 应用程序。在我的配置部分中,定义了框架(TYPO3 Flow)所需的供应商目录:

"config": {
    "vendor-dir": "Packages/Libraries",
    "bin-dir": "bin"
},

现在我有一个不是来自 Packagist 而是来自 Github 的自定义包。这个包需要签出到 Packages/Application/Vendor.PackageName。所以我尝试使用目标目录:

"repositories": [{
    "type": "package",
    "package": {
        "version": "dev-master",
        "name": "vendor/package",
        "source": {
            "url": "https://github.com/mycompany/mypackagerepo.git",
            "type": "git",
            "reference": "master"
        },
        "target-dir": "Packages/Application/Vendor.Package",
    }
}],
"require": {
    "typo3/flow": "2.0.*",
    "vendor/package": "dev-master"
}

从 Github 克隆工作正常,但包现在已签出到

Packages/Libraries/vendor/package/Packages/Application/Vendor.Package

这意味着 vendor-dir 和 target-dir 是连接在一起的。

如何完全覆盖单个包的供应商目录?谢谢你的帮助。

4

1 回答 1

5

而不是target-dir您需要使用Composer Installers并将包类型更改为typo3-flow-package,因此您的包定义可以是:

"repositories": [{
    "type": "package",
    "package": {
        "version": "dev-master",
        "name": "vendor/package",
        "type": "typo3-flow-package",  
        "source": {
            "url": "https://github.com/mycompany/mypackagerepo.git",
            "type": "git",
            "reference": "master"
        },
        "require": {
            "composer/installers": "~1.0"
        }
    }
]}

默认情况下,您的软件包将安装在 下Packages/Application/package,但如果您想在软件包文件夹前面加上供应商名称并将其放在下面,Packages/Application/vendor.package只需添加:

"extra": {
    "installer-paths": {
        "Packages/Application/{$vendor}.{$name}/": ["type:typo3-flow-package"]
    }
}
于 2013-10-25T05:32:57.733 回答