Package path declaration#52
Conversation
|
I appreciate your pull request but the consensus on this feature is I've recently added a note about this to the readme as it's a commonly requested feature (and was once implemented then removed): https://github.com/composer/installers#should-we-allow-dynamic-package-types-or-paths-no Please reference these issues for precedence: #41, #22, #21, #20, and #10. |
|
What is different about extra.installer-paths? |
|
I thought that: $this->composer->getPackage()Returned the root package, and obtaining the extra from the root package would be the end user's decision to install a package at an arbitrary location. |
|
Oh I thought you we're asking to implement custom install paths from the package author end. I looked at your PR closer and realized it's an alias for |
|
The extra.package-paths changes the path location on a package type basis. I imagine in a number of scenarios if one package type needs a custom install path all of them do. This prevents necessity to update every package pulled in by composer to be listed in an array for a specific type. I have a wordpress install configured with a custom content directory outside of the wordpress directory. This keeps wordpress clean and directly from the upstream VCS, and my satis repositories have all of my plugins and themes configured to utilize composer/installers. This gives me an end result of installing them in wp-content/my_plugin which wp-content is a sibling to wordpress. This patch allows for the package-type install path to be overridden in the root composer.json to set the install location to wordpress/wp-content or in my case omni-content without listing all 100+ plugins/themes in the arrays for installer-paths. |
|
I also have a number of cake applications that can benefit from this because they have a shared plugin directory outside of the application. |
|
Oh I see, this allows a consumer to customize the path based on "installer-paths": {
"wordpress/wp-content/plugins/{$name}/": ["type!wordpress-plugin"],
}Or something. If supporting @Seldaek what is your opinion on being able to configure |
|
Or maybe it's safe to assume if the value within the array doesn't have a |
|
I think at the moment assuming that the lack of a Perhaps utilizing |
|
Regex could be interesting. In the WordPress scenario: "installer-paths": {
"wordpress/wp-content/${1}/{$name}/": ["^wordpress-(\w+)"]
}Maybe to maintain backwards compatibility, and utilize the same extra array... If |
|
All package names must have a vendor. Trying to keep it simple to avoid a bajillion support issues from opening. The regex looks too messy and problematic; let's scratch that idea. |
|
If all packages must have a vendor name, then the first solution would work assuming that items with a |
|
Oh thanks for pointing that out. I wrote that test but it might have been a mistake, #25. I'll ask around when people are back around from holiday. |
|
If you must, allowing |
|
My mistake, thank you Jordi. @slbmeh feel free to open a new PR or update this one for "installer-paths": {
"wordpress/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
} |
…ler-paths instead of separate package-paths extra.
|
I also use an alternate WordPress path and would love to see this implemented! Thanks for writing it up. |
|
Merged. Thanks Steve! Sorry it took so long. |
|
No problem, thank you. |
This may be a better approach to what I was trying to achieve in my WordPress package pull request. Certain cases may be flexible and allow names/locations to be changed. This patch in my case for WordPress allows a custom content directory to be declared, as well as allows the composer root to live outside of the wordpress directory.
{ "extra": { "package-paths": { "wordpress/wp-content/plugins/{$name}/": ["wordpress-plugin"], "wordpress/wp-content/themes/{$name}/": ["wordpress-theme"] } } }Can install all wordpress plugins and themes into the wordpress directory where the actual installation lives, opposed to maintaining an array of each of the package types in the install-paths array along side of the regular requirement declarations.
This time not limited to only wordpress.