-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support for intermediary URLs such as EDD #49
base: dev
Are you sure you want to change the base?
Conversation
Add `strict_types` declaration to test files.
Add missing `config.allow-plugins` to `composer.json` files for Composer 2.2.0 and newer. See https://getcomposer.org/allow-plugins
Ensure platform requirement (PHP) is checked to ensure the appropriate dependencies are installed. For example, ignoring that the platform is PHP 8.0 would install a version of symfony/console that expectes PHP 8.1.
Include testing for PHP 8.1, 8.2, 8.3, and 8.4 (allow to fail).
Changed: - Rewrite the summary of the method's block comment. - Improve formatting, description, and example of `indirection` settings. - Add notice to description about feature only being supported by Composer 2.
Use a "dot" notation string instead of a multidimensional array to specify a key path. See: ffraenz#45 (comment) @ffraenz
Given the final download URL is most likely temporary and signed makes it unreliable as a cache key.
Check dist URL for URI fragment that matches a preset from the root package's extra object. Update README to document presets and which options are root-only.
Intercept bad configuration, requests, and responses, to throw contextual exceptions to identify the affected private package.
This pull request is ready for review and testing. Below are my responses to @ffraenz's comments on the previous pull request.
A possible issue with a hash suffix for the preset is that a hash suffix might already be defined or will be appended by Example: I have not tested the integrity of cache keys and the lock file with preset fragments.
Resolved.
The proposed changes expects the inline package to either:
|
@mcaskill Thank you so much for your work! I will come back to you and review it ASAP. |
I just remembered a missing requirement to make this feature reliable: validate that the intermediary's version matches the author's required version in the package. For example, EasyDigitalDownloads and Gravity Forms only ever offer the most recent version of their WordPress plugin. The proposed We did this junaidbhura/composer-wp-pro-plugins to avoid downloading a newer version and caching it under the older version's key. For that Composer plugin, we added a requirement on composer/semver. |
From `parse.key` to `parse.download_key` for forward compatibility with new keys.
Changed: - Moved logic to search for key or key path in response body to a new static protected method `findValueInResponseBody()` for forward compatibility with new keys. - Moved validation of download URL to a new static protected `sanitizeDownloadUrl()`. - Replaced `$packageName` parameter with `$package`in method `fetchIndirection()` to allow greater control of indirection handling.
The `parse.version_key` setting, if specified, will attempt to ensure that the intermediary's download matches the package's required version constraint. This is necessary for Gravity Forms and plugins that use EDD. This commit requires a dependency on composer/semver for proper version comparisons.
I've done some additional work today to add support for a |
The `parse.format` now accepts either `json` or `serialize` (used by vendors such as Gravity Forms). Improved error handling for intermediary JSON responses to exclude the intermediary URL from the message.
Changed: - Renamed and sorted methods to better describe their intent. - Refactored tests to use data providers to aggregate repetitive logic. - Moved repretitive fixtures to static methods to reduce repetitive values.
7abb40f
to
8c7e767
Compare
I've deployed the latest changes and this should be ready for review and advanced testing. The decrease in coverage reported by Coveralls is because only the report for Composer v1 is submitted. This new feature is limited to Composer v2. |
Fix #22 by allowing a package URL indirection to take place.
Continuation of #45 to implement suggested changes.
Summary of suggested changes by @ffraenz to implement:
extra.private-composer-installer
. [...] This way multiple packages (from the same vendor) could reuse the same config. I would keep aconfig
generic to allow for future additions that may be unrelated to an indirection feature."foo.bar.0.download_url
to specify [keys]."Additional features:
serialize()
-ed data.Requires dependency on composer/semver.
Example:
Note
[2024-08-09] Feature branch has been unit tested but has not been tested yet with an actual indirect package.
Important
[2024-08-06] This pull request's branch is based on
mcaskill:feature/maintenance
#50 in order to work.