Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #187, allow users to extend package data. #188

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NielsdeBlaauw
Copy link
Contributor

No description provided.

Copy link
Contributor

@tyrann0us tyrann0us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants