Question

I'm bundling a web application through composer. In my config section, a vendor dir needed by the framework (TYPO3 Flow) is defined:

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

Now I have one custom package that doesn't come from Packagist but from Github. This package needs to be checked out to Packages/Application/Vendor.PackageName. So I tried using the target-dir:

"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"
}

Cloning from Github works fine, but the package is now checked out to

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

That means that vendor-dir and target-dir were concatenated.

How is it possible to override the vendor-dir completely for a single package? Thanks for any help.

Was it helpful?

Solution

Instead of target-dir you need to use Composer Installers and change the package type to typo3-flow-package, so your package definition can be:

"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"
        }
    }
]}

By default your package will be installed under Packages/Application/package, but if you want to prefix the package folder with vendor name and get it under Packages/Application/vendor.package just add:

"extra": {
    "installer-paths": {
        "Packages/Application/{$vendor}.{$name}/": ["type:typo3-flow-package"]
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top