Fixes #187, allow users to extend package data.#188
Fixes #187, allow users to extend package data.#188NielsdeBlaauw wants to merge 1 commit intocedaro:developfrom
Conversation
There was a problem hiding this comment.
Hi @bradyvercher, long time no see. 😉 We are still using SatisPress because our clients keep insisting on third-party plugins. 😆
Regarding this PR, in #187 (comment), you mentioned that the same can be achieved using the satispress_compose filter to replace the Composer repository transformer dependency in the container. This might be an option for some. However, I'd like to push for adding the filter introduced in here.
In our current case, we must add the Composer replace property to a specific package for certain reasons. So, instead of having to replace the repository transformer, we solve this with a tiny mu-plugin like the following:
add_filter(
'satispress_package_repository_item',
static function(array $composerData, \SatisPress\Package $package): array {
if ($package->get_name() !== 'satispress/foo') {
return $composerData;
}
return array_map(function($data) {
$data['replace'] = [
'bar/foo' => 'self.version'
];
return $data;
}, $composerData);
},
10,
2
);This works just fine and is much less code than the effort required to achieve this with satispress_compose, so I'd highly appreciate it if you reconsidered this PR and merged it.
Thank you very much!
No description provided.