2013-10-22 54 views
2

我通過composer捆綁了一個web應用程序。在我的配置部分,由框架(TYPO3流)需要供應商目錄定義:如何覆蓋composer.json中單個軟件包的vendor-dir

"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完全適用於單個包?謝謝你的幫助。

回答

4

而不是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"] 
    } 
} 
+0

對不起,延遲和非常感謝你,這有幫助! – lorenz

相關問題