Comments (7)
Sure. This question has come up a few times, so documenting it is probably a good idea. Thanks!
from composer-patches.
That is correct. This plugin changed what is saved on disk after downloading dependencies. You cannot change the dependency's package metadata, as that comes from Packagist. If you need different package metadata, you'll have to change the compose.json upstream or use a different package that incorporates those changes.
from composer-patches.
@arknoll Did that make sense ^ ? I'm not sure why you'd want to change a dependency's composer.json file, though. Can't you just make the changes in your root composer.json? That is, if a dependency requires version ~2.0 of vendor/package, and you need ~2.3, you can just require ~2.3 in your root package and composer will figure out that 2.3+ satisfies the requirement from the dependency too. Or maybe you're trying to do something else?
from composer-patches.
That does make sense, and I am trying to do something else. The upstream package has a bug in its composer.json file. Until a patch gets in upstream I am unable to use the package unless I fork it. (I can't just patch the composer file)
from composer-patches.
I see some limitations that are less than ideal:
- If you work around the problem by requiring your own copy of the sub-dependency in your root composer.json, you're limited by the precision declared in the dependent package's composer.json file. For example, if it specifies ~2.0, you're limited to 2.x, if it specifies ~2.0.0, you're limited to 2.0.x).
- If you work around the problem by specifying a forked upstream, you're stuck maintaining a fork until your patches/changes are merged in to the canonical.
Would it be unreasonable to incorporate some mechanism for pre/post-update application of patches?
from composer-patches.
There is no way around this. Composer calculates dependency versions and dependencies and such before the plugin is even instantiated. This plugin cannot be used to do what you want to do, and there is no plugin that will do what you want to do because what you want to do doesn't match with how composer works. You cannot patch a dependency's composer.json and expect it to work because composer install
doesn't actually parse the dependency's composer.json.
You are stuck maintaining a fork until the canonical repo is fixed if you're wanting to change that dependency's composer.json.
from composer-patches.
Makes sense, thanks for the explanation. Would you be amenable to a PR w/documentation updates reflecting as much in the README.md?
from composer-patches.
Related Issues (20)
- Should not uninstall packages when Composer is called with --no-install HOT 2
- [Bug or new feature] Add support for local patch files and external patch file in dependencies HOT 10
- Clear error-message if patch is not available HOT 7
- How to apply patches from URL to a private GitHub repo? HOT 2
- PHP 8.2 support HOT 7
- SIMPLE example HOT 1
- When installing Drupal module metatag version: '8.x-1.19' module, the sub module metatag_extended_perms gets created twice, once inside a folder named b HOT 5
- The patch is partially applied HOT 3
- [2.0.0-beta1] No available patcher was able to apply patch ( for drupal/core ) HOT 7
- Composer require hangs sometimes when a patch applies HOT 2
- Removing package for re-install and re-patch does not trigger if patches definition is empty (1.7.3) HOT 1
- I'm Confused By Some of the Directions HOT 5
- [2.*] Make lock file path configurable HOT 2
- Write copy of a patch to a project directory for code review HOT 6
- Link in the README 404s: Documentation: https://docs.cweagans.net/composer-patches HOT 2
- Add a `patches-import` subcommand as a way to support discovering patches from dependencies HOT 4
- Dependency patch resolution: use patches file from dependency instead of root composer if configured HOT 1
- Dependency patch resolution: resolve file paths to local patches stored in dependencies HOT 5
- Mention my d10up article
- Dependency patch resolution: Only allow patches from trusted dependencies HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composer-patches.